home *** CD-ROM | disk | FTP | other *** search
/ back2roots/padua / padua.7z / padua / uucp / ListSERV1_4.lha / ListSERV / source / RCS / faq.c,v < prev    next >
Encoding:
Text File  |  1993-12-28  |  8.2 KB  |  396 lines

  1. head    1.1;
  2. branch    1.1.1;
  3. access;
  4. symbols;
  5. locks
  6.     simons:1.1.1.8
  7.     andy:1.1; strict;
  8. comment    @ * @;
  9.  
  10.  
  11. 1.1
  12. date    92.09.14.11.03.46;    author andy;    state Exp;
  13. branches
  14.     1.1.1.1;
  15. next    ;
  16.  
  17. 1.1.1.1
  18. date    93.12.26.00.41.06;    author simons;    state Exp;
  19. branches;
  20. next    1.1.1.2;
  21.  
  22. 1.1.1.2
  23. date    93.12.26.19.35.55;    author simons;    state Exp;
  24. branches;
  25. next    1.1.1.3;
  26.  
  27. 1.1.1.3
  28. date    93.12.27.17.53.45;    author simons;    state Exp;
  29. branches;
  30. next    1.1.1.4;
  31.  
  32. 1.1.1.4
  33. date    93.12.27.18.22.01;    author simons;    state Exp;
  34. branches;
  35. next    1.1.1.5;
  36.  
  37. 1.1.1.5
  38. date    93.12.27.18.23.46;    author simons;    state Exp;
  39. branches;
  40. next    1.1.1.6;
  41.  
  42. 1.1.1.6
  43. date    93.12.28.00.19.54;    author simons;    state Exp;
  44. branches;
  45. next    1.1.1.7;
  46.  
  47. 1.1.1.7
  48. date    93.12.28.16.59.48;    author simons;    state Exp;
  49. branches;
  50. next    1.1.1.8;
  51.  
  52. 1.1.1.8
  53. date    93.12.28.22.16.34;    author simons;    state Exp;
  54. branches;
  55. next    ;
  56.  
  57.  
  58. desc
  59. @Original Unix-Listserv distribution.
  60. @
  61.  
  62.  
  63. 1.1
  64. log
  65. @checked in with -k by simons at 1993/12/26 00:08:53
  66. @
  67. text
  68. @#include "listserv.h"
  69.  
  70. static char rcsid[] = "$Header: /usr/local/src/mail/listserv/RCS/faq.c,v 1.1 92/09/14 11:03:46 andy Exp Locker: andy $";
  71.  
  72. extern FILE *mailer;
  73.  
  74. sendfaq(from, command, outsider)
  75. char *from, *command;
  76. int outsider;
  77.         {
  78.         int i;
  79.         char grp[256], tmp[512];
  80.  
  81.         printf("called sendfaq with %s %s %s\n", from, command, outsider);
  82.         i = sscanf(command, "%s%s", tmp, grp);
  83.         if(i != 2)
  84.                 {
  85.                 callmailer("", from, command);
  86.                 sprintf(tmp, "%s/FAQHELP", SERVDIR);
  87.                 mailcat(tmp, "\t");
  88.                 fflush(mailer);
  89.                 pclose(mailer);
  90.                 return;
  91.                 }
  92.  
  93.         sprintf(tmp, "%s/%s.pub", SERVDIR, grp);
  94.         callmailer("", from, command);
  95.         if(access(tmp,R_OK) == 0)
  96.                 {
  97.                 sprintf(tmp, "%s/%s.faq", SERVDIR, grp);
  98.                 if(access(tmp, R_OK) == 0)
  99.                         {
  100.                         mailcat(tmp, "\t");
  101.                         fflush(mailer);
  102.                         pclose(mailer);
  103.                         return;
  104.                         }
  105.                 else
  106.                         {
  107.                         fprintf(mailer, "There is no FAQ available for");
  108.                         fprintf(mailer, " mailing list \"%s\".\n", grp);
  109.                         fflush(mailer);
  110.                         pclose(mailer);
  111.                         return;
  112.                         }
  113.                 }
  114.         else if(outsider)
  115.                 {
  116.                 fprintf(mailer,"The mailing list \"%s\" could not be found.\n",
  117.                         grp);
  118.                 fprintf(mailer,"You may use the INDEX command to get a listing\n");
  119.                 fprintf(mailer,"of available mailing lists.\n");
  120.                 fflush(mailer);
  121.                 pclose(mailer);
  122.                 return;
  123.                 }
  124.         else    {
  125.                 sprintf(tmp, "%s/%s.faq", SERVDIR, grp);
  126.                 if(access(tmp, R_OK) == 0)
  127.                         {
  128.                         mailcat(tmp, "\t");
  129.                         fflush(mailer);
  130.                         pclose(mailer);
  131.                         return;
  132.                         }
  133.                 else
  134.                         {
  135.                         fprintf(mailer, "There is no FAQ available for");
  136.                         fprintf(mailer, " mailing list \"%s\".\n", grp);
  137.                         fflush(mailer);
  138.                         pclose(mailer);
  139.                         return;
  140.                         }
  141.                 }
  142.  
  143.         }
  144.  
  145.  
  146. faqindex(from,request)
  147. char *from,*request;
  148.         {
  149.         FILE *ls;
  150.         char tmp[128];
  151.         char buf[128];
  152.         int i;
  153.         printf("called faqindex with %s %s\n", from,request);
  154.  
  155.         sprintf(tmp,"cd %s; ls *.faq | sed -e 's/.faq//", SERVDIR);
  156.         ls = popen(tmp,"r");
  157.         if (ls == NULL)
  158.                 {
  159.                 perror(tmp);
  160.                 exit(1);
  161.                 }
  162.         callmailer("", from, request);
  163.         fprintf(mailer,"Index of Frequently Asked Questions\n");
  164.  
  165.         /* read the result of the ls */
  166.         while (fgets(tmp, sizeof(tmp), ls))
  167.                 {
  168.                 while (tmp[(i=strlen(tmp)-1)] == '\n')
  169.                         tmp[i] = '\0';
  170.                 fprintf(mailer, "%s\n", tmp);
  171.                 }
  172.         pclose(ls);
  173.         pclose(mailer);
  174.         return;
  175.         }
  176.  
  177.  
  178.  
  179.  
  180. @
  181.  
  182.  
  183. 1.1.1.1
  184. log
  185. @Changed source code to compiler under SAS/C 6.50.
  186. @
  187. text
  188. @a1 1
  189. #include "protos.h"
  190. d3 1
  191. a3 1
  192. static char rcsid[] = "$Id$";
  193. d5 3
  194. a7 1
  195. void sendfaq(from, command, outsider)
  196. d79 1
  197. a79 1
  198. void faqindex(from,request)
  199. @
  200.  
  201.  
  202. 1.1.1.2
  203. log
  204. @Removed the complete local/non-local user determination, including
  205. all >outsider< parameters and the cleanup() routine.
  206. Changed UNIX-paths to conform with AmigaDOS.
  207. @
  208. text
  209. @d4 1
  210. a4 1
  211. static char rcsid[] = "$Id: faq.c,v 1.1.1.1 1993/12/26 00:41:06 simons Exp simons $";
  212. d6 1
  213. a6 1
  214. void sendfaq(from, command)
  215. d8 1
  216. d13 1
  217. a13 1
  218.         printf("called sendfaq with %s %s %s\n", from, command);
  219. d18 1
  220. a18 1
  221.                 sprintf(tmp, "%sFAQHELP", SERVDIR);
  222. d25 1
  223. a25 1
  224.         sprintf(tmp, "%s%s.pub", SERVDIR, grp);
  225. d29 1
  226. a29 1
  227.                 sprintf(tmp, "%s%s.faq", SERVDIR, grp);
  228. d46 1
  229. a46 2
  230.         sprintf(tmp, "%s%s.faq", SERVDIR, grp);
  231.         if(access(tmp, R_OK) == 0)
  232. d48 4
  233. a51 1
  234.                 mailcat(tmp, "\t");
  235. d56 17
  236. a72 7
  237.         else
  238.                 {
  239.                 fprintf(mailer, "There is no FAQ available for");
  240.                 fprintf(mailer, " mailing list \"%s\".\n", grp);
  241.                 fflush(mailer);
  242.                 pclose(mailer);
  243.                 return;
  244. d74 1
  245. @
  246.  
  247.  
  248. 1.1.1.3
  249. log
  250. @Fixed 'FAQ <listname>'-commamnd.
  251. @
  252. text
  253. @d4 1
  254. a4 1
  255. static char rcsid[] = "$Id: faq.c,v 1.1.1.2 1993/12/26 19:35:55 simons Exp simons $";
  256. d12 1
  257. a12 1
  258.         printf("called sendfaq with %s %s\n", from, command);
  259. d16 5
  260. a20 1
  261.                 sendhelp(from, command);
  262. d24 1
  263. a24 1
  264.         sprintf(tmp, "%s%s/FAQ", LISTDIR, grp);
  265. d26 23
  266. a48 2
  267.         if(access(tmp,R_OK) == 0) {
  268.                 mailcat(tmp, "");
  269. d52 3
  270. a54 2
  271.         }
  272.         else {
  273. @
  274.  
  275.  
  276. 1.1.1.4
  277. log
  278. @Fixed the faqindex() function.
  279. @
  280. text
  281. @d4 1
  282. a4 1
  283. static char rcsid[] = "$Id: faq.c,v 1.1.1.3 1993/12/27 17:53:45 simons Exp simons $";
  284. d38 1
  285. a38 1
  286. void faqindex(from, request)
  287. d40 2
  288. a41 3
  289. {
  290.         DIR *listdir;
  291.         struct dirent *entry;
  292. d43 3
  293. a45 1
  294.         printf("called faqindex with %s %s\n", from, request);
  295. d47 5
  296. a51 2
  297.         if (!(listdir = opendir(LISTDIR))) {
  298.                 perror(LISTDIR);
  299. d53 3
  300. a55 1
  301.         }
  302. d57 6
  303. a62 7
  304.         callmailer(LISTSERVMANAGER, from, request);
  305.         fprintf(mailer, "------------------------ Index of available FAQs ---------------------\n");
  306.  
  307.         while (entry = readdir(listdir)) {
  308.                 sprintf(tmp, "%s%s/FAQ", LISTDIR, entry->d_name);
  309.                 if (!access(tmp,R_OK))
  310.                         fprintf(mailer, "%s\n", entry->d_name);
  311. d64 1
  312. a64 2
  313.         closedir(listdir);
  314.         fprintf(mailer, "----------------------------------------------------------------------\n");
  315. d67 4
  316. a70 1
  317. }
  318. @
  319.  
  320.  
  321. 1.1.1.5
  322. log
  323. @Added file-locking.
  324. @
  325. text
  326. @d4 1
  327. a4 1
  328. static char rcsid[] = "$Id: faq.c,v 1.1.1.4 1993/12/27 18:22:01 simons Exp simons $";
  329. a21 1
  330.         LockFile(tmp);
  331. a22 1
  332.                 UnLockFile(tmp);
  333. a28 1
  334.                 UnLockFile(tmp);
  335. d56 1
  336. a56 2
  337.                 LockFile(tmp);
  338.                 if (!access(tmp, R_OK))
  339. d58 1
  340. a58 2
  341.                 UnLockFile(tmp);
  342.         }
  343. a59 1
  344.  
  345. @
  346.  
  347.  
  348. 1.1.1.6
  349. log
  350. @Changed the username used in From-line to LISTSERVADDR instead of
  351. LISTSERVMANAGER, so people can simply reply to the mails they get.
  352. @
  353. text
  354. @d4 1
  355. a4 1
  356. static char rcsid[] = "$Id: faq.c,v 1.1.1.5 1993/12/27 18:23:46 simons Exp simons $";
  357. d54 1
  358. a54 1
  359.         callmailer(LISTSERVADDR, from, request);
  360. @
  361.  
  362.  
  363. 1.1.1.7
  364. log
  365. @Changed a callmail() call to redirect parameter '""'. I'll probably use
  366. the redirect parameter for another purpose now.
  367. @
  368. text
  369. @d4 1
  370. a4 1
  371. static char rcsid[] = "$Id: faq.c,v 1.1.1.6 1993/12/28 00:19:54 simons Exp simons $";
  372. d54 1
  373. a54 1
  374.         callmailer("", from, request);
  375. @
  376.  
  377.  
  378. 1.1.1.8
  379. log
  380. @Changed function declarations to ANSI-compliant style.
  381. @
  382. text
  383. @d4 1
  384. a4 1
  385. static char rcsid[] = "$Id: faq.c,v 1.1.1.7 1993/12/28 16:59:48 simons Exp simons $";
  386. d6 3
  387. a8 3
  388. void sendfaq(char *from,
  389.              char *command)
  390. {
  391. d41 2
  392. a42 2
  393. void faqindex(char *from,
  394.               char *request)
  395. @
  396.