- char *program;
-
- if (!strcasecmp(oprogram, "(default)"))
- {
- oprogram = FORTUNE_PROGRAM;
-
-#if defined(__linux__) && defined(HAVE_UNAME)
- {
- static int done_once = 0;
- if (!done_once)
- {
- struct utsname uts;
- struct stat st;
- done_once = 1;
- if (uname (&uts) == 0)
- {
- static char cmd[200];
- char *s;
- /* strip version at the first non-digit-dash-dot, to
- lose any "SMP" crap at the end. */
- for (s = uts.release; *s; s++)
- if (!isdigit(*s) && *s != '.' && *s != '-')
- *s = 0;
- sprintf (cmd, "cat /usr/src/linux-%s/README", uts.release);
- if (!stat (cmd+4, &st))
- oprogram = cmd;
- else
- {
- /* kernel source not installed? try X... */
- strcpy (cmd, "cat /usr/X11R6/lib/X11/doc/README");
- if (!stat (cmd+4, &st))
- oprogram = cmd;
- }
- }
- }
- }
-#endif /* __linux__ && HAVE_UNAME */
-
-#ifdef __APPLE__ /* MacOS X + XDarwin */
- {
- static int done_once = 0;
- if (!done_once)
- {
- struct stat st;
- static char *cmd = "cat /usr/X11R6/README";
- if (!stat (cmd+4, &st))
- oprogram = cmd;
- }
- }
-#endif /* __APPLE__ */
- }
-
- program = (char *) malloc (strlen (oprogram) + 10);