X-Git-Url: http://git.marmaro.de/?p=mmh;a=blobdiff_plain;f=uip%2Frcvtty.c;h=b3c1d52a8c051c752d1356a52a760cbdffb847f6;hp=577873fa2bd265393c8f197ca8c1d2d5cf8d6fd0;hb=ced6090a330d3d83d0bce709f756aa3d7d65fea4;hpb=337338b404931f06f0db2119c9e145e8ca5a9860 diff --git a/uip/rcvtty.c b/uip/rcvtty.c index 577873f..b3c1d52 100644 --- a/uip/rcvtty.c +++ b/uip/rcvtty.c @@ -1,15 +1,15 @@ /* - * rcvtty.c -- a rcvmail program (a lot like rcvalert) handling IPC ttys - * - * This code is Copyright (c) 2002, by the authors of nmh. See the - * COPYRIGHT file in the root directory of the nmh distribution for - * complete copyright information. - */ +** rcvtty.c -- a rcvmail program (a lot like rcvalert) handling IPC ttys +** +** This code is Copyright (c) 2002, by the authors of nmh. See the +** COPYRIGHT file in the root directory of the nmh distribution for +** complete copyright information. +*/ /* Changed to use getutent() and friends. Assumes that when getutent() exists, - * a number of other things also exist. Please check. - * Ruud de Rooij Sun, 28 May 2000 17:28:55 +0200 - */ +** a number of other things also exist. Please check. +** Ruud de Rooij Sun, 28 May 2000 17:28:55 +0200 +*/ #include #include @@ -70,13 +70,13 @@ static char *form = NULL; static char *format = NULL; /* - * external prototypes - */ +** external prototypes +*/ char *getusername(void); /* - * static prototypes - */ +** static prototypes +*/ static RETSIGTYPE alrmser (int); static int message_fd (char **); static int header_fd (void); @@ -119,7 +119,9 @@ main (int argc, char **argv) continue; case HELPSW: - snprintf (buf, sizeof(buf), "%s [command ...]", invo_name); + snprintf (buf, sizeof(buf), + "%s [command ...]", + invo_name); print_help (buf, switches, 1); done (1); case VERSIONSW: @@ -175,12 +177,11 @@ main (int argc, char **argv) while ((utp = getutent()) != NULL) { if ( #ifdef HAVE_STRUCT_UTMP_UT_TYPE - utp->ut_type == USER_PROCESS - && + utp->ut_type == USER_PROCESS && #endif - utp->ut_name[0] != 0 - && utp->ut_line[0] != 0 - && strncmp (user, utp->ut_name, sizeof(utp->ut_name)) == 0) { + utp->ut_name[0] != 0 && utp->ut_line[0] != 0 + && strncmp (user, utp->ut_name, + sizeof(utp->ut_name)) == 0) { strncpy (tty, utp->ut_line, sizeof(utp->ut_line)); alert (tty, md); } @@ -191,7 +192,8 @@ main (int argc, char **argv) exit (RCV_MBX); while (fread ((char *) &ut, sizeof(ut), 1, uf) == 1) if (ut.ut_name[0] != 0 - && strncmp (user, ut.ut_name, sizeof(ut.ut_name)) == 0) { + && strncmp (user, ut.ut_name, + sizeof(ut.ut_name)) == 0) { strncpy (tty, ut.ut_line, sizeof(ut.ut_line)); alert (tty, md); } @@ -239,7 +241,8 @@ message_fd (char **vec) /* parent process */ if (!setjmp (myctx)) { SIGNAL (SIGALRM, alrmser); - bytes = fstat(fileno (stdin), &st) != NOTOK ? (int) st.st_size : 100; + bytes = fstat(fileno (stdin), &st) != NOTOK ? + (int) st.st_size : 100; /* amount of time to wait depends on message size */ if (bytes <= 100) { @@ -259,9 +262,9 @@ message_fd (char **vec) return fd; } else { /* - * Ruthlessly kill the child and anything - * else in its process group. - */ + ** Ruthlessly kill the child and anything + ** else in its process group. + */ KILLPG(child_id, SIGKILL); } close (fd); @@ -316,9 +319,9 @@ alert (char *tty, int md) snprintf (ttyspec, sizeof(ttyspec), "/dev/%s", tty); /* - * The mask depends on whether we are checking for - * write permission based on `biff' or `mesg'. - */ + ** The mask depends on whether we are checking for + ** write permission based on `biff' or `mesg'. + */ mask = biff ? S_IEXEC : (S_IWRITE >> 3); if (stat (ttyspec, &st) == NOTOK || (st.st_mode & mask) == 0) return;