X-Git-Url: http://git.marmaro.de/?a=blobdiff_plain;ds=sidebyside;f=uip%2Frcvtty.c;h=8166dc91bab228b049930da66ed64f39afa76b42;hb=70294f36748ac18c98cb5c3941baf72a9cba88d3;hp=20274e76b4e10e406c85fb88efbefc76f479fb97;hpb=240013872c392fe644bd4f79382d9f5314b4ea60;p=mmh diff --git a/uip/rcvtty.c b/uip/rcvtty.c index 20274e7..8166dc9 100644 --- a/uip/rcvtty.c +++ b/uip/rcvtty.c @@ -16,7 +16,6 @@ #include #include #include -#include #include #include @@ -33,30 +32,28 @@ #endif #define SCANFMT \ -"%2(hour{dtimenow}):%02(min{dtimenow}): %<(size)%5(size) %>%<{encrypted}E%>\ +"=%2(hour{dtimenow}):%02(min{dtimenow}): %<(size)%5(size) %>%<{encrypted}E%>\ %<(mymbox{from})%<{to}To:%14(friendly{to})%>%>%<(zero)%17(friendly{from})%> \ -%{subject}%<{body}<<%{body}>>%>" +%{subject}" static struct swit switches[] = { #define BIFFSW 0 { "biff", 0 }, #define FORMSW 1 { "form formatfile", 0 }, -#define FMTSW 2 - { "format string", 5 }, -#define WIDTHSW 3 +#define WIDTHSW 2 { "width columns", 0 }, -#define NLSW 4 +#define NLSW 3 { "newline", 0 }, -#define NNLSW 5 +#define NNLSW 4 { "nonewline", 0 }, -#define BELSW 6 +#define BELSW 5 { "bell", 0 }, -#define NBELSW 7 +#define NBELSW 6 { "nobell", 0 }, -#define VERSIONSW 8 +#define VERSIONSW 7 { "version", 0 }, -#define HELPSW 9 +#define HELPSW 8 { "help", 0 }, { NULL, 0 } }; @@ -67,12 +64,6 @@ static int newline = 1; static int biff = 0; static int width = 0; static char *form = NULL; -static char *format = NULL; - -/* -** external prototypes -*/ -char *getusername(void); /* ** static prototypes @@ -104,62 +95,56 @@ main(int argc, char **argv) /* read user profile/context */ context_read(); - mts_init(invo_name); arguments = getarguments(invo_name, argc, argv, 1); argp = arguments; while ((cp = *argp++)) { if (*cp == '-') { switch (smatch(++cp, switches)) { - case AMBIGSW: - ambigsw(cp, switches); - done(1); - case UNKWNSW: - vec[vecp++] = --cp; - continue; - - case HELPSW: - snprintf(buf, sizeof(buf), - "%s [command ...]", - invo_name); - print_help(buf, switches, 1); - done(1); - case VERSIONSW: - print_version(invo_name); - done(1); - - case BIFFSW: - biff = 1; - continue; - - case FORMSW: - if (!(form = *argp++) || *form == '-') - adios(NULL, "missing argument to %s", argp[-2]); - format = NULL; - continue; - case FMTSW: - if (!(format = *argp++) || *format == '-') - adios(NULL, "missing argument to %s", argp[-2]); - form = NULL; - continue; - - case WIDTHSW: - if (!(cp = *argp++) || *cp == '-') - adios(NULL, "missing argument to %s", argp[-2]); - width = atoi(cp); - continue; - case NLSW: - newline = 1; - continue; - case NNLSW: - newline = 0; - continue; - case BELSW: - bell = 1; - continue; - case NBELSW: - bell = 0; - continue; + case AMBIGSW: + ambigsw(cp, switches); + done(1); + case UNKWNSW: + vec[vecp++] = --cp; + continue; + + case HELPSW: + snprintf(buf, sizeof(buf), "%s [command ...]", + invo_name); + print_help(buf, switches, 1); + done(1); + case VERSIONSW: + print_version(invo_name); + done(1); + + case BIFFSW: + biff = 1; + continue; + + case FORMSW: + if (!(form = *argp++) || *form == '-') + adios(NULL, "missing argument to %s", + argp[-2]); + continue; + + case WIDTHSW: + if (!(cp = *argp++) || *cp == '-') + adios(NULL, "missing argument to %s", + argp[-2]); + width = atoi(cp); + continue; + case NLSW: + newline = 1; + continue; + case NNLSW: + newline = 0; + continue; + case BELSW: + bell = 1; + continue; + case NBELSW: + bell = 0; + continue; } } @@ -233,7 +218,7 @@ message_fd(char **vec) #endif unlink(tmpfil); - if ((child_id = vfork()) == NOTOK) { + if ((child_id = fork()) == NOTOK) { /* fork error */ close(fd); return header_fd(); @@ -297,7 +282,7 @@ header_fd(void) rewind(stdin); /* get new format string */ - nfs = new_fs(form, format, SCANFMT); + nfs = new_fs(form, SCANFMT); scan(stdin, 0, 0, nfs, width, 0, 0, NULL, 0L, 0); if (newline) write(fd, "\n\r", 2);