X-Git-Url: http://lists.indexdata.dk/cgi-bin?a=blobdiff_plain;f=kernel%2Feti.c;h=6cce040620a674d3768747c4498221b700ceb0da;hb=a2f56ecd6659951c36290396241b7a7706be78a1;hp=183f0e3d34fb98dcc9804920edbe61063d198ea4;hpb=c3d25c24fb405af98c6879fa7f5f619ccc895151;p=egate.git diff --git a/kernel/eti.c b/kernel/eti.c index 183f0e3..6cce040 100644 --- a/kernel/eti.c +++ b/kernel/eti.c @@ -2,7 +2,16 @@ * Europagate, 1995 * * $Log: eti.c,v $ - * Revision 1.2 1995/03/27 12:51:05 adam + * Revision 1.5 1995/03/31 09:43:13 adam + * Removed unused variable. + * + * Revision 1.4 1995/03/28 11:42:34 adam + * First use of string-queue utility. + * + * Revision 1.3 1995/03/28 08:01:23 adam + * FIFO existence is used to test for a running kernel. + * + * Revision 1.2 1995/03/27 12:51:05 adam * New log level in use: GW_LOG_ERRNO. * * Revision 1.1 1995/03/27 08:24:00 adam @@ -18,44 +27,89 @@ #include #include #include +#include +#include #include #include #include +#include #define LINE_MAX 1024 -static char line_buf[LINE_MAX+1]; static char *module = "eti"; +static jmp_buf retry_jmp; + +static void pipe_handle (int dummy) +{ + longjmp (retry_jmp, 1); +} -static int email_header (FILE *inf, char *from_str, char *subject_str) +static int email_header (struct str_queue *sq, + char *from_str, char *subject_str) { + char *msg; + int index = 0; + *from_str = '\0'; - *subject_str = '\0'; - while (fgets (line_buf, LINE_MAX, inf)) + *subject_str = '\0'; + while ((msg = str_queue_get (sq, index++))) { - if (line_buf[0] == '\n') + if (msg[0] == '\n') return 0; - if (strncmp (line_buf, "From ", 5) == 0) - sscanf (line_buf+4, "%s", from_str); - if (strncmp (line_buf, "Subject: ", 9) == 0 && - sscanf (line_buf+9, "%s", subject_str+1) == 1) - strcpy (subject_str, line_buf+9); + if (memcmp (msg, "From ", 5) == 0) + sscanf (msg+4, "%s", from_str); + if (memcmp (msg, "Subject: ", 9) == 0 && + sscanf (msg+9, "%s", subject_str+1) == 1) + strcpy (subject_str, msg+9); } return 1; } -static int kernel_active (int id) +static void start_kernel (int argc, char **argv, int id) { - char active_name[1024]; - int fd; - - sprintf (active_name, "kernel.pid.%d", id); - fd = open (active_name, O_RDONLY); - if (fd == -1) - return 0; - close (fd); - return 1; + pid_t pid; + int i; + char **argv_p; + char userid_option[20]; + + argv_p = malloc (sizeof(*argv_p)*(argc+2)); + if (!argv_p) + { + gw_log (GW_LOG_FATAL|GW_LOG_ERRNO, module, "malloc fail"); + exit (1); + } + argv_p[0] = "kernel"; + for (i = 1; i