/*
- * 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 <ruud@ruud.org> Sun, 28 May 2000 17:28:55 +0200
- */
+** a number of other things also exist. Please check.
+** Ruud de Rooij <ruud@ruud.org> Sun, 28 May 2000 17:28:55 +0200
+*/
#include <h/mh.h>
#include <h/signals.h>
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);
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:
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);
}
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);
}
/* 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) {
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);
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;