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

  1. head    1.4;
  2. branch    1.4.1;
  3. access;
  4. symbols;
  5. locks
  6.     simons:1.4.1.6
  7.     andy:1.4; strict;
  8. comment    @ * @;
  9.  
  10.  
  11. 1.4
  12. date    92.09.14.11.03.42;    author andy;    state Exp;
  13. branches
  14.     1.4.1.1;
  15. next    ;
  16.  
  17. 1.4.1.1
  18. date    93.12.26.00.40.30;    author simons;    state Exp;
  19. branches;
  20. next    1.4.1.2;
  21.  
  22. 1.4.1.2
  23. date    93.12.26.19.08.25;    author simons;    state Exp;
  24. branches;
  25. next    1.4.1.3;
  26.  
  27. 1.4.1.3
  28. date    93.12.26.19.35.55;    author simons;    state Exp;
  29. branches;
  30. next    1.4.1.4;
  31.  
  32. 1.4.1.4
  33. date    93.12.27.17.37.04;    author simons;    state Exp;
  34. branches;
  35. next    1.4.1.5;
  36.  
  37. 1.4.1.5
  38. date    93.12.27.17.42.19;    author simons;    state Exp;
  39. branches;
  40. next    1.4.1.6;
  41.  
  42. 1.4.1.6
  43. date    93.12.28.22.16.34;    author simons;    state Exp;
  44. branches;
  45. next    ;
  46.  
  47.  
  48. desc
  49. @Original Unix-Listserv distribution.
  50. @
  51.  
  52.  
  53. 1.4
  54. log
  55. @checked in with -k by simons at 1993/12/26 00:08:53
  56. @
  57. text
  58. @#include "listserv.h"
  59.  
  60. static char rcsid[] = "$Header: /usr/local/src/mail/listserv/RCS/commands.c,v 1.4 92/09/14 11:03:42 andy Exp Locker: andy $";
  61.  
  62. extern FILE *msg;
  63. extern FILE *mailer;
  64.  
  65. sendhelp(from,request)
  66. char *from, *request;
  67.         {
  68.         printf("called sendhelp with %s %s\n", from, request);
  69.         callmailer("", from, request);
  70.         mailcat(HELPFILE,"");
  71.         pclose(mailer);
  72.         return;
  73.         }
  74.  
  75. listhelp(from,grp,request,outsider)
  76. char *from,*grp,*request;
  77. int outsider;
  78.         {
  79.         FILE *commands;
  80.         int i;
  81.         char tmp[128], hlp[128], cmd[128];
  82.         printf("called listhelp with %s %s %s\n", from,grp,request);
  83.  
  84.         callmailer("", from, request);
  85.         strcpy(tmp, COMMANDFILE);
  86.         commands = fopen(tmp, "r");
  87.         if( commands == NULL)
  88.                 {
  89.                 perror(tmp);
  90.                 exit(1);
  91.                 }
  92.         while(i = fscanf(commands, "%s %s",cmd, hlp) > 0)
  93.                 if (!strcasecmp(cmd, grp))
  94.                         {
  95.                         sprintf(tmp, "%s/%s", SERVDIR, hlp);
  96.                         mailcat(tmp, "\t");
  97.                         fflush(mailer);
  98.                         pclose(mailer);
  99.                         fclose(commands);
  100.                         return;
  101.                         }
  102.         fclose(commands);
  103.  
  104.         if (outsider)
  105.                 sprintf(tmp,"%s/%s.pub", SERVDIR, grp);
  106.         else
  107.                 sprintf(tmp,"%s/%s.info", SERVDIR, grp);
  108.         if (access(tmp,R_OK) != 0)
  109.                 {
  110.                 fprintf(mailer,"The mailing list \"%s\" could not be found.\n",
  111.                         grp);
  112.                 fprintf(mailer,"You may use the INDEX command to get a listing\n");
  113.                 fprintf(mailer,"of available mailing lists.\n");
  114.                 fflush(mailer);
  115.                 pclose(mailer);
  116.                 return;
  117.                 }
  118.  
  119.         fprintf(mailer,"Mailing list \"%s\":\n", grp);
  120.         mailcat(tmp,"\t");
  121.         pclose(mailer);
  122.         return;
  123.         }
  124.  
  125. sendindex(from,request,l,outsider)
  126. char *from,*request;
  127. int l,outsider;
  128.         {
  129.         FILE *ls;
  130.         char tmp[128];
  131.         char buf[128];
  132.         int i;
  133.         printf("called sendindex with %s %s %d %d\n",
  134.                 from,request,l,outsider);
  135.  
  136.         if (outsider)
  137.                 sprintf(tmp,"cd %s; ls *.pub | sed -e 's/.pub//", SERVDIR);
  138.         else
  139.                 sprintf(tmp,"cd %s; ls *.info | sed -e 's/.info//", SERVDIR);
  140.         ls = popen(tmp,"r");
  141.         if (ls == NULL)
  142.                 {
  143.                 perror(tmp);
  144.                 exit(1);
  145.                 }
  146.         callmailer("", from, request);
  147.         fprintf(mailer,"Index of mailing lists\n");
  148.  
  149.         /* read the result of the ls */
  150.         while (fgets(tmp, sizeof(tmp), ls))
  151.                 {
  152.                 while (tmp[(i=strlen(tmp)-1)] == '\n')
  153.                         tmp[i] = '\0';
  154.                 fprintf(mailer, "%s\n", tmp);
  155.  
  156.                 /* if he wanted the long listing, cat the .info file */
  157.                 if (l)
  158.                         {
  159.                         if (outsider)
  160.                                 sprintf(buf, "%s/%s.pub", SERVDIR, tmp);
  161.                         else
  162.                                 sprintf(buf, "%s/%s.info", SERVDIR, tmp);
  163.                         mailcat(buf,"\t");
  164.                         fprintf(mailer, "\n");
  165.                         }
  166.                 }
  167.         pclose(ls);
  168.         pclose(mailer);
  169.         return;
  170.         }
  171.  
  172.  
  173.  
  174.  
  175. @
  176.  
  177.  
  178. 1.4.1.1
  179. log
  180. @Changed source code to compiler under SAS/C 6.50.
  181. @
  182. text
  183. @a1 1
  184. #include "protos.h"
  185. d3 1
  186. a3 1
  187. static char rcsid[] = "$Id$";
  188. d5 4
  189. a8 1
  190. void sendhelp(from,request)
  191. d18 1
  192. a18 1
  193. void listhelp(from,grp,request,outsider)
  194. d68 1
  195. a68 1
  196. void sendindex(from,request,l,outsider)
  197. @
  198.  
  199.  
  200. 1.4.1.2
  201. log
  202. @Changed UNIX directory stuff to conform with the AmigaDOS.
  203. Changed sendindex() to fire the INDEX file up.
  204. 'LONGINDEX'-command still has to be implemented.
  205. @
  206. text
  207. @d4 1
  208. a4 1
  209. static char rcsid[] = "$Id: commands.c,v 1.4.1.1 1993/12/26 00:40:30 simons Exp simons $";
  210. d36 1
  211. a36 1
  212.                         sprintf(tmp, "%s%s", SERVDIR, hlp);
  213. d46 1
  214. a46 1
  215.                 sprintf(tmp,"%s%s.pub", SERVDIR, grp);
  216. d48 1
  217. a48 1
  218.                 sprintf(tmp,"%s%s.info", SERVDIR, grp);
  219. d66 1
  220. a66 1
  221. void sendindex(from,request,longi)
  222. d68 3
  223. a70 2
  224. int longi;
  225. {
  226. d72 4
  227. a75 1
  228.         printf("called sendindex with %s %s %d\n", from, request, longi);
  229. d77 10
  230. d88 21
  231. a108 8
  232.         fprintf(mailer, "------------------------ Index of mailing lists ----------------------\n");
  233.         sprintf(tmp, "%sINDEX", SERVDIR);
  234.         mailcat(tmp, "");
  235.         fprintf(mailer, "----------------------------------------------------------------------\n");
  236.         if (longi)
  237.         {
  238.                 fprintf(mailer, "\nSorry, but the LONGINDEX command is not supported in this ListSERV\nversion!\n");
  239.         }
  240. d111 4
  241. a114 1
  242. }
  243. @
  244.  
  245.  
  246. 1.4.1.3
  247. log
  248. @Removed the complete local/non-local user determination, including
  249. all >outsider< parameters and the cleanup() routine.
  250. Changed UNIX-paths to conform with AmigaDOS.
  251. @
  252. text
  253. @d4 1
  254. a4 1
  255. static char rcsid[] = "$Id: commands.c,v 1.4.1.2 1993/12/26 19:08:25 simons Exp simons $";
  256. d16 1
  257. a16 1
  258. void listhelp(from, grp, request)
  259. d18 1
  260. d45 4
  261. a48 1
  262.         sprintf(tmp,"%s%s.pub", SERVDIR, grp);
  263. @
  264.  
  265.  
  266. 1.4.1.4
  267. log
  268. @Fixed 'HELP <listname>'-command.
  269. @
  270. text
  271. @d4 1
  272. a4 1
  273. static char rcsid[] = "$Id: commands.c,v 1.4.1.3 1993/12/26 19:35:55 simons Exp simons $";
  274. d25 33
  275. a57 2
  276.         sprintf(tmp, "%s%s/Description", LISTDIR, grp);
  277.         mailcat(tmp ,"");
  278. @
  279.  
  280.  
  281. 1.4.1.5
  282. log
  283. @Removed unecessary buffers.
  284. TODO: 'HELP <listname>' currently understands only one parameter!
  285. @
  286. text
  287. @d4 1
  288. a4 1
  289. static char rcsid[] = "$Id: commands.c,v 1.4.1.4 1993/12/27 17:37:04 simons Exp simons $";
  290. d19 3
  291. a21 1
  292.         char tmp[128];
  293. @
  294.  
  295.  
  296. 1.4.1.6
  297. log
  298. @Changed function declarations to ANSI-compliant style.
  299. @
  300. text
  301. @d4 1
  302. a4 1
  303. static char rcsid[] = "$Id: commands.c,v 1.4.1.5 1993/12/27 17:42:19 simons Exp simons $";
  304. d6 3
  305. a8 3
  306. void sendhelp(char *from,
  307.               char *request)
  308. {
  309. d16 3
  310. a18 4
  311. void listhelp(char *from,
  312.               char *grp,
  313.               char *request)
  314. {
  315. d29 3
  316. a31 3
  317. void sendindex(char *from,
  318.                char *request,
  319.                int longi)
  320. @
  321.