X-Git-Url: http://git.marmaro.de/?a=blobdiff_plain;f=uip%2Frcvtty.c;h=99ae680602871039123f49574cd56cf45b789fa0;hb=84c6039eb7226c0ba0a8f708205e33d10950d2ae;hp=1e2a3efcc0ffc33d44a601428b913aff07fbdf8d;hpb=714b5c530ece27ea2835a313013f5b770163403c;p=mmh diff --git a/uip/rcvtty.c b/uip/rcvtty.c index 1e2a3ef..99ae680 100644 --- a/uip/rcvtty.c +++ b/uip/rcvtty.c @@ -16,7 +16,6 @@ #include #include #include -#include #include #include @@ -35,7 +34,7 @@ #define SCANFMT \ "%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 @@ -70,11 +69,6 @@ static char *form = NULL; static char *format = NULL; /* -** external prototypes -*/ -char *getusername(void); - -/* ** static prototypes */ static RETSIGTYPE alrmser(int); @@ -99,67 +93,68 @@ main(int argc, char **argv) #ifdef LOCALE setlocale(LC_ALL, ""); #endif - invo_name = r1bindex(argv[0], '/'); + invo_name = mhbasename(argv[0]); /* 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]); + 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; } } @@ -233,7 +228,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 +292,7 @@ header_fd(void) rewind(stdin); /* get new format string */ - nfs = new_fs(form, format, SCANFMT); + nfs = new_fs(form, format, NULL, SCANFMT); scan(stdin, 0, 0, nfs, width, 0, 0, NULL, 0L, 0); if (newline) write(fd, "\n\r", 2);