Mac OS X doesn't have /bin/grep, only /usr/bin/grep. Grr.
Don't try to parse PANICTRACE_GLIBC if the field doesn't exist.
#ifdef PANICTRACE
/* panic options */
char *gdbpath;
+ char *greppath;
int panictrace_gdb;
# ifdef PANICTRACE_GLIBC
int panictrace_glibc;
}
# ifdef PANICTRACE_GDB
-/* I'm going to assume /bin/grep is the right path for grep. */
# ifdef SYSCF
# define GDBPATH sysopt.gdbpath
+# define GREPPATH sysopt.greppath
# else
# ifndef GDBPATH
# define GDBPATH "/usr/bin/gdb"
# endif
+# ifndef GREPPATH
+# define GREPPATH "/bin/grep"
+# endif
# endif /* !SYSCF */
# endif /* PANICTRACE_GDB */
/* A (more) generic method to get a stack trace - invoke
* gdb on ourself. */
char *gdbpath = GDBPATH;
+ char *greppath = GREPPATH;
char buf[BUFSZ];
if(gdbpath == NULL || gdbpath[0] == 0) return FALSE;
+ if(greppath == NULL || greppath[0] == 0) return FALSE;
- sprintf(buf, "%s -n -q %s %d 2>&1 | /bin/grep '^#'",
- GDBPATH, ARGV0, getpid());
+ sprintf(buf, "%s -n -q %s %d 2>&1 | %s '^#'",
+ gdbpath, ARGV0, getpid(), greppath);
FILE *gdb = popen(buf, "w");
if(gdb){
raw_print("Generating more information you may report:\n");
return 0;
}
sysopt.pointsmin = temp;
+#ifdef PANICTRACE_GLIBC
} else if ( (src==SET_IN_SYS) && match_varname(buf, "PANICTRACE_GLIBC", 16)) {
int temp = atoi(bufp);
if(temp < 1 || temp > 2){
return 0;
}
sysopt.panictrace_glibc = temp;
+#endif
} else if ( (src==SET_IN_SYS) && match_varname(buf, "PANICTRACE_GDB", 14)) {
int temp = atoi(bufp);
if(temp < 1 || temp > 2){
if(sysopt.gdbpath) free(sysopt.gdbpath);
sysopt.gdbpath = (char*)alloc(strlen(bufp)+1);
Strcpy(sysopt.gdbpath, bufp);
+ } else if ( (src==SET_IN_SYS) && match_varname(buf, "GREPPATH", 7)) {
+ if(sysopt.greppath) free(sysopt.greppath);
+ sysopt.greppath = (char*)alloc(strlen(bufp)+1);
+ Strcpy(sysopt.greppath, bufp);
#endif
} else if (match_varname(buf, "BOULDER", 3)) {
(void) get_uchars(fp, buf, bufp, &iflags.bouldersym, TRUE,
#ifdef PANICTRACE
/* panic options */
sysopt.gdbpath = NULL;
+ sysopt.greppath = NULL;
# ifdef BETA
sysopt.panictrace_gdb = 1;
# ifdef PANICTRACE_GLIBC
CFLAGS+=-DNOCLIPPING -DNOMAIL -DNOTPARMDECL -DHACKDIR=\"$(HACKDIR)\"
CFLAGS+= -DDEFAULT_WINDOW_SYS=\"$(WANT_DEFAULT)\" -DDLB
+CFLAGS+= -DGREPPATH=\"/usr/bin/grep\"
+
ifdef WANT_WIN_TTY
WINSRC = $(WINTTYSRC)
WINOBJ = $(WINTTYOBJ)
# certain compilation options. See src/end.c and sys/unix/hints/* for
# more information.
GDBPATH=/usr/bin/gdb
+GREPPATH=/bin/grep
# Values are priorities: 0 - do not use this method, 1 - low priority,
# 2 - high priority. Non-zero priority methods are tried in order.
PANICTRACE_GDB=1