home *** CD-ROM | disk | FTP | other *** search
/ InfoMagic Internet Tools 1993 July / Internet Tools.iso / RockRidge / mail / pp / pp-6.0 / doc / manual / volume2 / outbound.tex < prev    next >
Encoding:
Text File  |  1990-09-20  |  4.1 KB  |  113 lines

  1. \File{outbound.c},{11:14},{Aug 24 1990}
  2. \L{\LB{\Proc{main}main (argc, argv)}}
  3. \L{\LB{int     argc;}}
  4. \L{\LB{char    **argv;}}
  5. \L{\LB{\{}}
  6. \L{\LB{}\Tab{8}{sys\_init (argv[0]);   \C{}\/* init the channel \- and find out who we are *\/\CE{}}}
  7. \L{\LB{}}
  8. \L{\LB{}\Tab{8}{dirinit();              \C{}\/* get to the right directory *\/\CE{}}}
  9. \L{\LB{\#ifdef PP\_DEBUG}}
  10. \L{\LB{}\Tab{8}{if (argc \> 1 \&\& strcmp (argv[1], \S{}\"debug\"\SE{}) == 0)}}
  11. \L{\LB{}\Tab{16}{debug\_channel\_control (argc, argv, chaninit, process, endproc);}}
  12. \L{\LB{}\Tab{8}{else}}
  13. \L{\LB{\#endif}}
  14. \L{\LB{}\Tab{16}{channel\_control (argc, argv, chaninit, process, endproc);}}
  15. \L{\LB{}\Tab{8}{exit (0);}}
  16. \L{\LB{\}}}
  17. \L{\LB{}}
  18. \L{\LB{static int chaninit (arg)}}
  19. \L{\LB{struct type\_Qmgr\_Channel *arg;}}
  20. \L{\LB{\{}}
  21. \L{\LB{}\Tab{8}{char    *p = qb2str (arg);}}
  22. \L{\LB{}}
  23. \L{\LB{}\Tab{8}{if ((mychan = ch\_nm2struct (p)) == (CHAN *)0)}}
  24. \L{\LB{}\Tab{16}{err\_abrt (RP\_PARM, \S{}\"Channel \'\%s\' not known\"\SE{}, p);}}
  25. \L{\LB{}\Tab{8}{exam\_init (mychan);}}
  26. \L{\LB{}\Tab{8}{free (p);}}
  27. \L{\LB{}\Tab{8}{return OK;}}
  28. \L{\LB{\}}}
  29. \L{\LB{}}
  30. \L{\LB{static int endproc ()}}
  31. \L{\LB{\{}}
  32. \L{\LB{}\Tab{8}{if (cur\_host)}}
  33. \L{\LB{}\Tab{16}{exam\_close (OK);}}
  34. \L{\LB{\}}}
  35. \L{\LB{}}
  36. \L{\LB{static struct type\_Qmgr\_DeliveryStatus *process (arg)}}
  37. \L{\LB{struct type\_Qmgr\_ProcMsg *arg;}}
  38. \L{\LB{\{}}
  39. \L{\LB{}\Tab{8}{struct prm\_vars prm;}}
  40. \L{\LB{}\Tab{8}{struct type\_Qmgr\_UserList *up;}}
  41. \L{\LB{}\Tab{8}{Q\_struct        Qstruct, *qp = \&Qstruct;}}
  42. \L{\LB{}\Tab{8}{int     retval;}}
  43. \L{\LB{}\Tab{8}{ADDR    *ap,}}
  44. \L{\LB{}\Tab{16}{*ad\_sendr = NULLADDR,}}
  45. \L{\LB{}\Tab{16}{*ad\_recip = NULLADDR,}}
  46. \L{\LB{}\Tab{16}{*alp,}}
  47. \L{\LB{}\Tab{16}{*ad\_list = NULLADDR;}}
  48. \L{\LB{}\Tab{8}{int     ad\_count;}}
  49. \L{\LB{}}
  50. \L{\LB{}\Tab{8}{if (this\_msg) free (this\_msg);}}
  51. \L{\LB{}}
  52. \L{\LB{}\Tab{8}{this\_msg = qb2str (arg \-\> qid);}}
  53. \L{\LB{}}
  54. \L{\LB{}\Tab{8}{PP\_TRACE ((\S{}\"process msg \%s\"\SE{}, this\_msg));}}
  55. \L{\LB{}}
  56. \L{\LB{}\Tab{8}{bzero ((char *)\&prm, sizeof prm);}}
  57. \L{\LB{}\Tab{8}{bzero ((char *)qp, sizeof *qp);}}
  58. \L{\LB{}}
  59. \L{\LB{}\Tab{8}{(void) delivery\_init (arg \-\> users);}}
  60. \L{\LB{}}
  61. \L{\LB{}\Tab{8}{retval = rd\_msg (this\_msg, \&prm, qp, \&ad\_sendr, \&ad\_recip, \&ad\_count);}}
  62. \L{\LB{}}
  63. \L{\LB{}\Tab{8}{if (rp\_isbad (retval)) \{}}
  64. \L{\LB{}\Tab{16}{PP\_LOG (LLOG\_EXCEPTIONS, (\S{}\"rd\_msg err: \%s\"\SE{}, this\_msg));}}
  65. \L{\LB{}\Tab{16}{return delivery\_setall (int\_Qmgr\_status\_messageFailure);}}
  66. \L{\LB{}\Tab{8}{\}}}
  67. \L{\LB{}}
  68. \L{\LB{}\Tab{8}{sender = ad\_sendr \-\> ad\_r822adr;}}
  69. \L{\LB{}}
  70. \L{\LB{}}
  71. \L{\LB{}\Tab{8}{for (ap = ad\_recip; ap; ap = ap \-\> ad\_next) \{}}
  72. \L{\LB{}\Tab{16}{for (up = arg \-\>users; up; up = up \-\> next) \{}}
  73. \L{\LB{}\Tab{24}{if (up \-\> RecipientId \-\> parm != ap \-\> ad\_no)}}
  74. \L{\LB{}\Tab{32}{continue;}}
  75. \L{\LB{}}
  76. \L{\LB{}\Tab{24}{if (chan\_acheck (ap, mychan,}}
  77. \L{\LB{}\Tab{40}{ ad\_list == NULL, \&cur\_mta) == NOTOK)}}
  78. \L{\LB{}\Tab{32}{continue;}}
  79. \L{\LB{}\Tab{16}{\}}}
  80. \L{\LB{}\Tab{16}{if (up == NULL)}}
  81. \L{\LB{}\Tab{24}{continue;}}
  82. \L{\LB{}}
  83. \L{\LB{}\Tab{16}{if (ad\_list == NULLADDR)}}
  84. \L{\LB{}\Tab{24}{ad\_list = alp = (ADDR *) calloc (1, sizeof *alp);}}
  85. \L{\LB{}\Tab{16}{else \{}}
  86. \L{\LB{}\Tab{24}{alp \-\> ad\_next = (ADDR *) calloc (1, sizeof *alp);}}
  87. \L{\LB{}\Tab{24}{alp = alp \-\> ad\_next;}}
  88. \L{\LB{}\Tab{16}{\}}}
  89. \L{\LB{}\Tab{16}{*alp = *ap;}}
  90. \L{\LB{}\Tab{16}{alp \-\> ad\_next = NULLADDR;}}
  91. \L{\LB{}\Tab{8}{\}}}
  92. \L{\LB{}}
  93. \L{\LB{}\Tab{8}{if (ad\_list == NULLADDR) \{}}
  94. \L{\LB{}\Tab{16}{PP\_LOG (LLOG\_EXCEPTIONS, (\S{}\"No recipients in user list\"\SE{}));}}
  95. \L{\LB{}\Tab{16}{rd\_end ();}}
  96. \L{\LB{}\Tab{16}{return deliverystate;}}
  97. \L{\LB{}\Tab{8}{\}}}
  98. \L{\LB{}}
  99. \L{\LB{}\Tab{8}{deliver (ad\_list, qp); \C{}\/* do what is required *\/\CE{}}}
  100. \L{\LB{}}
  101. \L{\LB{}\Tab{8}{rd\_end();}}
  102. \L{\LB{}}
  103. \L{\LB{}\Tab{8}{return deliverystate;}}
  104. \L{\LB{\}}}
  105. \L{\LB{}}
  106. \L{\LB{}}
  107. \L{\LB{static void dirinit()       \C{}\/* Change into pp queue space *\/\CE{}}}
  108. \L{\LB{\{}}
  109. \L{\LB{}\Tab{8}{if (chdir (quedfldir) \< 0)}}
  110. \L{\LB{}\Tab{16}{err\_abrt (RP\_LIO, \S{}\"Unable to change directory to \'\%s\'\"\SE{},}}
  111. \L{\LB{}\Tab{48}{quedfldir);}}
  112. \L{\LB{\}}}
  113.