#include <stdio.h>
#include <getopt.h>
+#ifdef STDC_HEADERS
+#include <stdlib.h>
+#endif
+#ifdef HAVE_UNISTD_H
+#include <unistd.h>
+#endif
char *getenv (), *getwd ();
char *getcwd ();
-int geteuid ();
/* This is defined with -D from the compilation command,
which extracts it from ../lisp/version.el. */
/* Nonzero means don't wait for a response from Emacs. --no-wait. */
int nowait = 0;
+void print_help_and_exit ();
+
struct option longopts[] =
{
{ "no-wait", no_argument, NULL, 'n' },
}
}
+void
print_help_and_exit ()
{
fprintf (stderr,
return copy;
}
+
+#ifdef C_ALLOCA
+/* Like malloc but get fatal error if memory is exhausted. */
+
+char *
+xmalloc (size)
+ unsigned int size;
+{
+ char *result = (char *) malloc (size);
+ if (result == NULL)
+ {
+ perror ("malloc");
+ exit (1);
+ }
+ return result;
+}
+#endif /* C_ALLOCA */
\f
#if !defined (HAVE_SOCKETS) && !defined (HAVE_SYSVIPC)
exit (1);
}
-#ifdef BSD
+#ifdef BSD_SYSTEM
cwd = getwd (string);
#else
cwd = getcwd (string, sizeof string);
if (cwd == 0)
{
/* getwd puts message in STRING if it fails. */
- fprintf (stderr, "%s: %s (%s)\n", argv[0], string, strerror (errno));
+ fprintf (stderr, "%s: %s (%s)\n", argv[0],
+#ifdef BSD_SYSTEM
+ string,
+#else
+ "Cannot get current working directory",
+#endif
+ strerror (errno));
exit (1);
}
#include <sys/msg.h>
#include <sys/utsname.h>
#include <stdio.h>
+#include <errno.h>
+extern int errno;
char *getwd (), *getcwd (), *getenv ();
struct utsname system_name;
}
/* Determine working dir, so we can prefix it to all the arguments. */
-#ifdef BSD
+#ifdef BSD_SYSTEM
temp = getwd (gwdirb);
#else
temp = getcwd (gwdirb, sizeof gwdirb);
}
else
{
+#ifdef BSD_SYSTEM
fprintf (stderr, "%s: %s\n", argv[0], cwd);
+#else
+ fprintf (stderr, "%s: Cannot get current working directory: %s\n",
+ argv[0], strerror (errno));
+#endif
exit (1);
}