home *** CD-ROM | disk | FTP | other *** search
/ Usenet 1994 October / usenetsourcesnewsgroupsinfomagicoctober1994disk2.iso / misc / volume3 / pcmail / part07 / smail.c < prev    next >
C/C++ Source or Header  |  1989-02-03  |  3KB  |  84 lines

  1. /*++
  2. /* NAME
  3. /*      smail 1
  4. /* SUMMARY
  5. /*      mail spooler
  6. /* PROJECT
  7. /*      pc-mail
  8. /* PACKAGE
  9. /*      smail
  10. /* SYNOPSIS
  11. /*      smail file destinations
  12. /* DESCRIPTION
  13. /*      smail makes preparations to send a copy of a text file
  14. /*    across the network.
  15. /*
  16. /*    The contents of the original file are filtered in order to
  17. /*    get rid of control characters, high most-significant bits,
  18. /*    or non-standard carriage-control conventions. The filter
  19. /*    has no effect on ordinary flat text files, such as program 
  20. /*    sources.
  21. /*
  22. /*    Aliases in the list of destinations are expanded, and multiple
  23. /*    occurrances of the same recipient are eliminated. The algorithms
  24. /*    that manipulate the list of destinations are case-insensitive.
  25. /* FILES
  26. /*    In the spool directory. Files that belong together have the
  27. /*    same sequence number in their name.
  28. /*      D<seqno>    message body (data file)
  29. /*    X<seqno>    destinations (meta file)
  30. /* SEE ALSO
  31. /*    ascf(3)        ASCII filter
  32. /*    spoolfile(3)    create data-file/meta-file pair
  33. /*      path(5)         system-dependent path names
  34. /*    unalias(3)    alias expansion and cleanup
  35. /* DIAGNOSTICS
  36. /*      Error messages if invoked with insufficient arguments.
  37. /*      The program terminates with a nonzero exit status if 
  38. /*      problems were detected (out of memory, file access problems,
  39. /*    loops in the alias data base). The exit status indicates the
  40. /*    nature of the problem.
  41. /* AUTHOR(S)
  42. /*      W.Z. Venema
  43. /*      Eindhoven University of Technology
  44. /*      Department of Mathematics and Computer Science
  45. /*      Den Dolech 2, P.O. Box 513, 5600 MB Eindhoven, The Netherlands
  46. /* CREATION DATE
  47. /*      Mon Apr  6 16:58:42 GMT+1:00 1987
  48. /* LAST MODIFICATION
  49. /*    Wed Apr  6 00:22:39 MET 1988
  50. /* VERSION/RELEASE
  51. /*    1.4
  52. /*--*/
  53.  
  54. #include "defs.h"
  55. #include "path.h"
  56. #include "status.h"
  57.  
  58. extern char **unalias();
  59.  
  60. main(argc,argv)
  61. int argc;
  62. char **argv;
  63. {
  64.     int stat = 0;                /* pathinit() status code */
  65.     char **vec;                    /* final destinations vector */
  66.     char *str;                    /* final destinations string */
  67.  
  68.     if (argc <= 2) {
  69.     fprintf(stderr,"usage: smail filename destination(s)\n");
  70.     exit(1);
  71.     } else if (stat = pathinit()) {        /* check environment vars */
  72.     exit(stat);
  73.     } else if ((vec = unalias(argv+2)) == 0) {    /* process destinations list */
  74.     exit(E_SYSFAIL);
  75.     } else if (vec[BUFSIZ-1]) {            /* destination list overflow */
  76.     exit(E_OVALIAS);
  77.     } else if ((str = vecstr(vec," ")) == 0) {    /* list -> string conversion */
  78.     exit(E_SYSFAIL);
  79.     } else {
  80.     exit(sendmail(argv[1],str));        /* make spool files */
  81.     }
  82.     /* NOTREACHED */
  83. }
  84.