home *** CD-ROM | disk | FTP | other *** search
/ InfoMagic Internet Tools 1993 July / Internet Tools.iso / RockRidge / mail / mmdf / mmdf-IIb.43 / src / list / ch_list.c next >
Encoding:
C/C++ Source or Header  |  1986-02-01  |  3.2 KB  |  129 lines

  1. #include "util.h"
  2. #include "mmdf.h"
  3. /*
  4.  *     MULTI-CHANNEL MEMO DISTRIBUTION FACILITY  (MMDF)
  5.  *     
  6.  *
  7.  *     Copyright (C) 1979,1980,1981  University of Delaware
  8.  *     
  9.  *     Department of Electrical Engineering
  10.  *     University of Delaware
  11.  *     Newark, Delaware  19711
  12.  *
  13.  *     Phone:  (302) 738-1163
  14.  *     
  15.  *     
  16.  *     This program module was developed as part of the University
  17.  *     of Delaware's Multi-Channel Memo Distribution Facility (MMDF).
  18.  *     
  19.  *     Acquisition, use, and distribution of this module and its listings
  20.  *     are subject restricted to the terms of a license agreement.
  21.  *     Documents describing systems using this module must cite its source.
  22.  *
  23.  *     The above statements must be retained with all copies of this
  24.  *     program and may not be removed without the consent of the
  25.  *     University of Delaware.
  26.  *     
  27.  *
  28.  *     version  -1    David H. Crocker    March   1979
  29.  *     version   0    David H. Crocker    April   1980
  30.  *     version  v7    David H. Crocker    May     1981
  31.  *     version   1    David H. Crocker    October 1981
  32.  *
  33.  */
  34.  
  35. /*                  LIST PROCESSING CHANNEL                             */
  36.  
  37. #include <signal.h>
  38. #include "phs.h"
  39. #include "ch.h"
  40.  
  41. extern LLog *logptr;
  42.  
  43. Chan *chanptr;
  44. char obuf[BUFSIZ];        /* Buffer for status printfs */
  45.  
  46. /*      MAIN MAIN MAIN MAIN MAIN MAIN MAIN MAIN MAIN MAIN MAIN MAIN     */
  47.  
  48. main (argc, argv)
  49. int       argc;
  50. char   *argv[];
  51. {
  52.     char *dupfpath ();
  53.     short retval;
  54.  
  55.     mmdf_init (argv[0]);
  56.     setbuf( stdout, obuf );
  57.  
  58. #ifdef RUNALON
  59.     logptr -> ll_fd = 1;
  60.     ll_init (logptr);
  61. #endif
  62.  
  63.     siginit ();
  64.     signal (SIGINT, SIG_IGN);     /* always ignore interrupts             */
  65.  
  66.     if ((chanptr = ch_nm2struct (argv[0])) == (Chan *) NOTOK)
  67.     {
  68.     ll_log (logptr, LLOGTMP, "listprocessor (%s) unknown channel", argv[0]);
  69.     exit (RP_PARM);
  70.     }
  71.     retval = ch_list (argc, argv);
  72.     ll_close (logptr);
  73.     exit (retval);
  74. }
  75. /* **************  (ch_) MAILING LIST DELIVERY  ******************** */
  76.  
  77. ch_list (argc, argv)              /* send to internet                   */
  78. int       argc;
  79. char   *argv[];
  80. {
  81.     ch_llinit (chanptr);
  82. #ifdef DEBUG
  83.     ll_log (logptr, LLOGBTR, "ch_list()");
  84. #endif
  85.  
  86.     if (rp_isbad (qu_init (argc, argv)))
  87.     return (RP_NO);          /* problem setting-up for deliver     */
  88.     
  89.     phs_note (chanptr, PHS_WRSTRT);
  90.  
  91.     if (rp_isbad (qu2ls_send ()))
  92.     return (RP_NO);          /* send the batch of outgoing mail    */
  93.  
  94.     phs_note (chanptr, PHS_WREND);
  95.  
  96.     qu_end (OK);                  /* done with Deliver function         */
  97.  
  98.     return (RP_OK);          /* NORMAL RETURN                      */
  99. }
  100.  
  101. /* */
  102.  
  103. /* VARARGS2 */
  104. err_abrt (code, fmt, b, c, d)     /* terminate ourself                  */
  105. short     code;
  106. char    fmt[],
  107.         b[],
  108.         c[],
  109.         d[];
  110. {
  111. #ifdef DEBUG
  112.     char linebuf[LINESIZE];
  113. #endif
  114.  
  115.     qu_end (NOTOK);
  116.  
  117. #ifdef DEBUG
  118.     if (rp_gbval (code) == RP_BNO || logptr -> ll_level >= LLOGBTR)
  119.     {                         /* don't worry about minor stuff      */
  120.     sprintf (linebuf, "%s%s", "err [ ABEND (%s) ]\t", fmt);
  121.     ll_log (logptr, LLOGFAT, linebuf, rp_valstr (code), b, c, d);
  122.     abort ();
  123.     }
  124. #endif
  125.     ll_close (logptr);            /* in case of cycling, close neatly   */
  126.  
  127.     exit (code);
  128. }
  129.