home *** CD-ROM | disk | FTP | other *** search
- /*
- * $Filename: faq.c $
- * $Revision: 2.1 $
- * $Date: 1994/01/17 12:02:03 $
- *
- * Copyright (C) 1993 by Peter Simons <simons@peti.GUN.de>
- *
- * This program is free software; you can redistribute it and/or
- * modify it under the terms of the GNU General Public License as
- * published by the Free Software Foundation; either version 2 of
- * the License, or (at your option) any later version.
- *
- * This program is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
- * General Public License for more details.
- *
- * You should have received a copy of the GNU General Public License
- * along with this program; if not, write to the Free Software
- * Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
- *
- * $Id: faq.c,v 2.1 1994/01/17 12:02:03 simons Exp simons $
- *
- */
-
-
- /************************************* includes ***********/
- #include "listserv.h"
- #include "protos.h"
-
- /************************************* global variables ***/
- static char rcsid[] = "$Id: faq.c,v 2.1 1994/01/17 12:02:03 simons Exp simons $";
-
- /************************************* program ************/
- void sendfaq(char *from, char *command)
- {
- int i;
- char grp[256], tmp[512];
-
- printf("called sendfaq with %s %s\n", from, command);
- i = sscanf(command, "%s%s", tmp, grp);
- if(i != 2)
- {
- sendhelp(from, command);
- return;
- }
-
- sprintf(tmp, "%s%s/FAQ", LISTDIR, grp);
- callmailer("", from, command);
- LockFile(tmp);
- if(access(tmp,R_OK) == 0) {
- UnLockFile(tmp);
- mailcat(tmp, "");
- pclose(mailer);
- return;
- }
- else {
- UnLockFile(tmp);
- fprintf(mailer, "There is no FAQ available for");
- fprintf(mailer, " mailing list \"%s\".\n", grp);
- pclose(mailer);
- return;
- }
- }
-
-
- void faqindex(char *from,
- char *request)
- {
- DIR *listdir;
- struct dirent *entry;
- char tmp[128];
- printf("called faqindex with %s %s\n", from, request);
-
- if (!(listdir = opendir(LISTDIR))) {
- perror(LISTDIR);
- exit(1);
- }
-
- callmailer("", from, request);
- fprintf(mailer, "------------------------ Index of available FAQs ---------------------\n");
-
- while (entry = readdir(listdir)) {
- sprintf(tmp, "%s%s/FAQ", LISTDIR, entry->d_name);
- LockFile(tmp);
- if (!access(tmp, R_OK))
- fprintf(mailer, "%s\n", entry->d_name);
- UnLockFile(tmp);
- }
- closedir(listdir);
-
- fprintf(mailer, "----------------------------------------------------------------------\n");
- pclose(mailer);
- return;
- }
-
-