]> andersk Git - moira.git/blobdiff - server/startmoira.c
Command line printer manipulation client, and build goo.
[moira.git] / server / startmoira.c
index 14db9d5c3285153c87a51c8d36333ab4ff69c318..2692cac623afdca662302406990a17af7dc658e2 100644 (file)
@@ -1,41 +1,34 @@
-/*
- *     $Source$
- *     $Author$
- *     $Header$
+/* $Id$
  *
- *     Copyright (C) 1987 by the Massachusetts Institute of Technology
- *     For copying and distribution information, please see the file
- *     <mit-copyright.h>.
- *
- *     This program starts the moira server in a "clean" environment.
- *     and then waits for it to exit.
+ * This program starts the moira server in a "clean" environment.
+ * and then waits for it to exit.
  *
+ * Copyright (C) 1987-1998 by the Massachusetts Institute of Technology
+ * For copying and distribution information, please see the file
+ * <mit-copyright.h>.
  */
 
-#ifndef lint
-static char *rcsid_mr_starter_c = "$Header$";
-#endif lint
-
 #include <mit-copyright.h>
+#include <moira.h>
+#include <moira_site.h>
+
+#include <sys/resource.h>
+#include <sys/wait.h>
+
 #include <errno.h>
+#include <fcntl.h>
+#include <signal.h>
 #include <stdio.h>
 #include <string.h>
-#include <sys/types.h>
-#include <sys/file.h>
-#include <sys/wait.h>
-#include <sys/signal.h>
-#include <sys/ioctl.h>
-#include <time.h>
-#include <fcntl.h>
-#include <sys/resource.h>
-#include <moira_site.h>
+#include <unistd.h>
 
+RCSID("$Header$");
 
 #define PROG   "moirad"
 
 int rdpipe[2];
-extern int errno;
 char *whoami;
+void cleanup(void);
 
 void cleanup(void)
 {
@@ -51,7 +44,7 @@ void cleanup(void)
          if (WEXITSTATUS(stat))
            {
              sprintf(buf, "exited with code %d\n", WEXITSTATUS(stat));
-             critical_alert("startmoira", "%s", buf);
+             critical_alert(whoami, "startmoira", "%s", buf);
            }
        }
       if (WIFSIGNALED(stat))
@@ -59,7 +52,7 @@ void cleanup(void)
          sprintf(buf, "exited on signal %d%s\n", WTERMSIG(stat),
                  (WCOREDUMP(stat) ? "; Core dumped" : ""));
          if (WCOREDUMP(stat))
-           critical_alert("startmoira", "%s", buf);
+           critical_alert(whoami, "startmoira", "%s", buf);
        }
       write(rdpipe[1], buf, strlen(buf));
       close(rdpipe[1]);
@@ -71,12 +64,9 @@ int main(int argc, char *argv[])
 {
   char buf[BUFSIZ];
   FILE *log, *prog;
-  int logf, inf, i, done, pid, tty;
+  int logf, inf, i, done, pid;
   struct rlimit rl;
 
-  extern int errno;
-  extern char *sys_errlist[];
-
   struct sigaction action;
   int nfds;
 
@@ -90,7 +80,7 @@ int main(int argc, char *argv[])
   sigemptyset(&action.sa_mask);
   sigaction(SIGCHLD, &action, NULL);
 
-  sprintf(buf, "%s/moira.log", SMS_DIR);
+  sprintf(buf, "%s/moira.log", MOIRA_DIR);
   logf = open(buf, O_CREAT|O_WRONLY|O_APPEND, 0640);
   if (logf < 0)
     {
@@ -149,7 +139,7 @@ int main(int argc, char *argv[])
          if (errno && errno != EINTR)
            {
              strcpy(buf, "Unable to read from program: ");
-             strcat(buf, sys_errlist[errno]);
+             strcat(buf, strerror(errno));
              strcat(buf, "\n");
            }
          else
This page took 0.03736 seconds and 4 git commands to generate.