home *** CD-ROM | disk | FTP | other *** search
/ Usenet 1994 January / usenetsourcesnewsgroupsinfomagicjanuary1994.iso / sources / unix / volume25 / smail-deliver.pch / execm.c < prev    next >
Encoding:
C/C++ Source or Header  |  1992-01-11  |  667 b   |  42 lines

  1. /*
  2.  * execm.c
  3.  *
  4.  * This program is a substitute for Xenix's /usr/lib/mail/execmail.
  5.  * It parses arguments appropriate for execmail, then runs /usr/bin/smail.
  6.  *
  7.  * Written by Chip Salzenberg <chip@tct.uucp>.
  8.  */
  9.  
  10. #include <stdio.h>
  11.  
  12. main(argc, argv)
  13. int     argc;
  14. char    **argv;
  15. {
  16.     char *progname = argv[0];
  17.  
  18.     /*
  19.      * Drop the execmail options.
  20.      */
  21.     while (argv[1][0] == '-')
  22.     {
  23.         switch (argv[1][1])
  24.         {
  25.         case 'f':
  26.         case 'h':
  27.             argv += (argv[1][2] ? 1 : 2);
  28.             break;
  29.         default:
  30.             ++argv;
  31.             break;
  32.         }
  33.     }
  34.  
  35.     argv[0] = progname;
  36.     execv("/usr/bin/smail", argv);
  37.     execv("/bin/smail", argv);
  38.  
  39.     fprintf(stderr, "%s: can't execute smail!\n", progname);
  40.     exit(1);
  41. }
  42.