home *** CD-ROM | disk | FTP | other *** search
/ Usenet 1994 January / usenetsourcesnewsgroupsinfomagicjanuary1994.iso / sources / unix / volume22 / nn6.4 / part21 / nnmail.c < prev    next >
Encoding:
C/C++ Source or Header  |  1990-06-07  |  1.4 KB  |  89 lines

  1. /*
  2.  *    (c) Copyright 1990, Kim Fabricius Storm.  All rights reserved.
  3.  *
  4.  *     nnmail - a mailer that understands @ addressing
  5.  *         when you don't have sendmail or smail
  6.  */
  7.  
  8. #include "config.h"
  9.  
  10. #include "options.h"
  11.  
  12. char * MAILER = MAILX;
  13. static int print_vers, test_mode;
  14.  
  15. Option_Description( mail_options ) {
  16.  
  17.     'v', Bool_Option( print_vers ),
  18.     'm', String_Option( MAILER ),
  19.     't', Bool_Option( test_mode ),
  20.  
  21.     '\0',
  22. };
  23.  
  24.  
  25. main(argc, argv)
  26. int argc;
  27. char **argv;
  28. {
  29.     int i, n;
  30.     char route[512];
  31.     char *getenv(), *envmail;
  32.     extern char **environ;
  33.  
  34.     if (envmail = getenv("NNMAILER"))
  35.     MAILER = envmail;
  36.  
  37.     n = parse_options(argc, argv, (char *)NULL,
  38.               mail_options, (char *)NULL, NULL_FCT);
  39.  
  40.     if (print_vers) {
  41.     printf("Release %s\n", version_id);
  42.     nn_exit(0);
  43.     }
  44.  
  45. #ifndef HAVE_ROUTING
  46.     if (test_mode) {
  47.     extern FILE *route_trace;
  48.     route_trace = stdout;
  49.     }
  50. #endif
  51.  
  52.     argv[0] = MAILER;
  53.  
  54. #ifndef HAVE_ROUTING
  55.     for (i = 1; i <= n; i++)
  56.     if (reroute(route, argv[i])) {
  57.         if (test_mode) {
  58.         printf("%s \t-->  %s\n", argv[i], route);
  59.         continue;
  60.         }
  61.         argv[i] = newstr(strlen(route)+1);
  62.         strcpy(argv[i], route);
  63.     } else
  64.         if (test_mode)
  65.         printf("%s \t***  no route found\n", argv[i]);
  66. #endif
  67.  
  68.     if (test_mode) nn_exit(0);
  69.  
  70.     execve(MAILER, argv, environ);
  71.     fprintf(stderr, "Mailer '%s' not found\n", MAILER);
  72.     nn_exit(7);
  73. }
  74.  
  75.  
  76. /*VARARGS*/
  77. user_error()
  78. {
  79. }
  80.  
  81. nn_exit(n)
  82. {
  83.     exit(n);
  84. }
  85.  
  86. suspend_nn()
  87. {
  88. }
  89.