home *** CD-ROM | disk | FTP | other *** search
/ back2roots/padua / padua.7z / padua / uucp / ListSERV2_3.lha / ListSERV / source / commands.c next >
Encoding:
C/C++ Source or Header  |  1994-01-10  |  3.1 KB  |  98 lines

  1. /*
  2.  *      $Filename: commands.c $
  3.  *      $Revision: 2.0 $
  4.  *      $Date: 1994/01/09 15:26:48 $
  5.  *
  6.  *      Copyright (C) 1993 by Peter Simons <simons@peti.GUN.de>
  7.  *
  8.  *      This program is free software; you can redistribute it and/or
  9.  *      modify it under the terms of the GNU General Public License as
  10.  *      published by the Free Software Foundation; either version 2 of
  11.  *      the License, or (at your option) any later version.
  12.  *
  13.  *      This program is distributed in the hope that it will be useful,
  14.  *      but WITHOUT ANY WARRANTY; without even the implied warranty of
  15.  *      MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
  16.  *      General Public License for more details.
  17.  *
  18.  *      You should have received a copy of the GNU General Public License
  19.  *      along with this program; if not, write to the Free Software
  20.  *      Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
  21.  *
  22.  *      $Id: commands.c,v 2.0 1994/01/09 15:26:48 simons Rel simons $
  23.  *
  24.  */
  25.  
  26.  
  27. /************************************* includes ***********/
  28. #include "listserv.h"
  29. #include "protos.h"
  30.  
  31. /************************************* global variables ***/
  32. static char rcsid[] = "$Id: commands.c,v 2.0 1994/01/09 15:26:48 simons Rel simons $";
  33.  
  34. /************************************* program ************/
  35. void sendhelp(char *from, char *request)
  36. {
  37.         printf("called sendhelp with %s %s\n", from, request);
  38.         callmailer("", from, request);
  39.         mailcat(HELPFILE,"");
  40.         pclose(mailer);
  41.         return;
  42.         }
  43.  
  44. void listhelp(char *from,
  45.               char *grp,
  46.               char *request)
  47. {
  48.         char tmp[128];
  49.         printf("called listhelp with %s %s %s\n", from,grp,request);
  50.  
  51.         callmailer("", from, request);
  52.         sprintf(tmp, "%s%s/Description", LISTDIR, grp);
  53.         mailcat(tmp ,"");
  54.         pclose(mailer);
  55.         return;
  56.         }
  57.  
  58. void sendindex(char *from,
  59.                char *request,
  60.                int longi)
  61. {
  62.         DIR *listdir;
  63.         struct dirent *entry;
  64.         char tmp[128];
  65.  
  66.         printf("called sendindex with %s %s %d\n", from, request, longi);
  67.  
  68.         listdir = opendir(LISTDIR);
  69.         if (!listdir) {
  70.                 perror(LISTDIR);
  71.                 exit(1);
  72.         }
  73.  
  74.         callmailer("", from, request);
  75.         fprintf(mailer, "------------------------ Index of mailing lists ----------------------\n");
  76.  
  77.         while (entry = readdir(listdir)) {
  78.                 fprintf(mailer, "%s\n", entry->d_name);
  79.                 if (longi) {
  80.                         sprintf(tmp, "%s%s/Description", LISTDIR, entry->d_name);
  81.                         LockFile(tmp);
  82.                         if(!access(tmp,R_OK)) {
  83.                                 UnLockFile(tmp);
  84.                                 mailcat(tmp, "     ");
  85.                                 fprintf(mailer, "\n", entry->d_name);
  86.                         }
  87.                         else
  88.                                 UnLockFile(tmp);
  89.                 }
  90.         }
  91.  
  92.         closedir(listdir);
  93.         fprintf(mailer, "----------------------------------------------------------------------\n");
  94.         pclose(mailer);
  95.         return;
  96. }
  97.  
  98.