]> andersk Git - moira.git/blobdiff - server/startmoira.c
lint
[moira.git] / server / startmoira.c
index 1fe7e7d4fe51d3b8faf4ba50b4a17d70731feb89..93561868c0c8e3c986fcd95dd48620c78ec50b94 100644 (file)
@@ -4,26 +4,19 @@
  *     $Header$
  *
  *     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 sms server in a "clean" environment.
+ *     This program starts the moira server in a "clean" environment.
  *     and then waits for it to exit.
  * 
- *     $Log$
- *     Revision 1.3  1987-08-22 17:30:58  wesommer
- *     Changed path used to start server.
- *
- * Revision 1.2  87/06/02  20:08:16  wesommer
- * Changed logging, location of daemon to run.
- * 
- * Revision 1.1  87/06/01  03:35:33  wesommer
- * Initial revision
- * 
  */
 
 #ifndef lint
-static char *rcsid_sms_starter_c = "$Header$";
+static char *rcsid_mr_starter_c = "$Header$";
 #endif lint
 
+#include <mit-copyright.h>
 #include <stdio.h>
 #include <strings.h>
 #include <sys/types.h>
@@ -31,47 +24,12 @@ static char *rcsid_sms_starter_c = "$Header$";
 #include <sys/wait.h>
 #include <sys/signal.h>
 #include <sys/ioctl.h>
+#include <moira_site.h>
 
-#define SMS_LOG_FILE "/u1/sms/sms.log"
-
-#define SMS_PROG "/u1/sms/bin/smsd"
+#define PROG   "moirad"
 
 int rdpipe[2];
-char *sigdescr[] = {
-       0,
-       "hangup",
-       "interrupt",    
-       "quit",
-       "illegal instruction",
-       "trace/BPT trap",
-       "IOT trap",
-       "EMT trap",
-       "floating exception",
-       "kill",
-       "bus error",
-       "segmentation violation",
-       "bad system call",
-       "broken pipe",
-       "alarm clock",
-       "termination",
-       "urgent I/O condition",
-       "stopped",
-       "stopped",
-       "continued",
-       "child exited",
-       "stopped (tty input)",
-       "stopped (tty output)",
-       "I/O possible",
-       "cputime limit exceeded",
-       "filesize limit exceeded",
-       "virtual timer expired",
-       "profiling timer expired",
-       "window size changed",
-       "signal 29",
-       "user defined signal 1",
-       "user defined signal 2",
-       "signal 32"
-};
+extern char *sys_siglist[];
 
 cleanup()
 {
@@ -91,7 +49,7 @@ cleanup()
                }
                if (WIFSIGNALED(stat)) {
                        sprintf(buf, "exited on %s signal%s\n",
-                               sigdescr[stat.w_termsig],
+                               sys_siglist[stat.w_termsig],
                                (stat.w_coredump?"; Core dumped":0));
                }
                write(rdpipe[1], buf, strlen(buf));
@@ -114,9 +72,10 @@ main(argc, argv)
        setreuid(0);
        signal(SIGCHLD, cleanup);
        
-       logf = open(SMS_LOG_FILE, O_CREAT|O_WRONLY|O_APPEND, 0640);
+       sprintf(buf, "%s/moira.log", SMS_DIR);
+       logf = open(buf, O_CREAT|O_WRONLY|O_APPEND, 0640);
        if (logf<0) {
-               perror(SMS_LOG_FILE);
+               perror(buf);
                exit(1);
        }
        inf = open("/dev/null", O_RDONLY , 0);
@@ -126,7 +85,7 @@ main(argc, argv)
        }
        pipe(rdpipe);
        if (fork()) {
-               exit();
+               exit(0);
        }
        chdir("/");     
        close(0);
@@ -139,6 +98,7 @@ main(argc, argv)
        tty = open("/dev/tty");
        ioctl(tty, TIOCNOTTY, 0);
        close(tty);
+       sprintf(buf, "%s/%s", BIN_DIR, PROG);
        
        if ((pid = fork()) == 0) {
                
@@ -146,12 +106,12 @@ main(argc, argv)
                dup2(rdpipe[1], 1);
                dup2(1,2);
                for (i = 3; i <nfds; i++) close(i);
-               execl(SMS_PROG, "smsd", 0);
-               perror("cannot run smsd");
+               execl(buf, PROG, 0);
+               perror("cannot run moirad");
                exit(1);
        }
        if (pid<0) {
-               perror("sms_starter");
+               perror("moira_starter");
                exit(1);
        }
 
@@ -176,7 +136,7 @@ main(argc, argv)
                time(&foo);
                time_s = ctime(&foo)+4;
                time_s[strlen(time_s)-6]='\0';
-               fprintf(log, "%s <%d> %s", time_s, pid, buf);
+               fprintf(log, "%s %s", time_s, buf);
                fflush(log);
        } while (!done);
        exit(0);
This page took 0.04915 seconds and 4 git commands to generate.