home *** CD-ROM | disk | FTP | other *** search
/ back2roots/padua / padua.7z / padua / uucp / LharcUUCP0_22.lha / LharcUUCP / source / LharcUUCP.c < prev    next >
Encoding:
C/C++ Source or Header  |  1993-12-18  |  21.5 KB  |  640 lines

  1. /*
  2.  *      $Filename: LharcUUCP.c $
  3.  *      $Revision: 0.25 $
  4.  *      $Date: 1993/12/18 21:43:11 $
  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: LharcUUCP.c,v 0.25 1993/12/18 21:43:11 simons Exp simons $
  23.  *
  24.  * ------------------------------ log history ----------------------------
  25.  * $Log: LharcUUCP.c,v $
  26.  * Revision 0.25  1993/12/18  21:43:11  simons
  27.  * Added the myGetConfigEntry() routine to make accessing configuration
  28.  * easier.
  29.  * Added config-keywords allowing to specify a batchonlygrade per system.
  30.  * The name of the keyword is "BatchOnlyGrade_<systemname>". If this
  31.  * entry can't be found or is invalid, the global default is used.
  32.  *
  33.  * Revision 0.24  1993/12/14  22:04:24  simons
  34.  * Added check, wether the specified grade is a valid alpha-numeric
  35.  * character or not.
  36.  *
  37.  * Revision 0.23  1993/12/14  21:52:37  simons
  38.  * Added a comment describing IsPath().
  39.  *
  40.  * Revision 0.22  1993/12/14  21:25:45  simons
  41.  * Changed the main loop in LharcJob() to free the C.* file as soon as
  42.  * possible, right after the renames, so that an eventually waiting uucico
  43.  * doesn't get blocked.
  44.  *
  45.  * Revision 0.21  1993/12/14  17:59:16  simons
  46.  * Remved the tests in the routines handling with grades. Now we just need
  47.  * one central test in LharcUUCPJob(), right after the configfile is read.
  48.  * Changed the arraysize for the filenames in jobs to 256 byte.
  49.  * Changed GoNextLine() to work with a following feof().
  50.  * Added IsPath() to determine the validity of the requests.
  51.  * Changed the way, IsValidJob() recognizes 'unbatchable' UUCP requests. The
  52.  * last version just counted the number of lines (If that's no hack, what
  53.  * else? :->), while this version recognizes the paths.
  54.  * Added a missing comment in the history (for 0.18).
  55.  * Added a few comments.
  56.  *
  57.  * Revision 0.20  1993/12/14  16:42:41  simons
  58.  * Adedd a DOS version string using C='s bumprev tool.
  59.  * Changes usage-output.
  60.  *
  61.  * Revision 0.19  1993/12/14  15:21:36  simons
  62.  * Added a variable 'LharcBatchGrade' determining the batch-grade of our
  63.  * own job. This defaults to 'A'. Currently, this is only global for the
  64.  * whole system.
  65.  *
  66.  * Revision 0.18  1993/12/14  15:05:36  simons
  67.  * Added a grade-check into IsValidJob(). This required two more parameters:
  68.  * systemname and grade. Currently, the grade is only global, but I'll add
  69.  * some local way.
  70.  * Changed the order of checks in IsValidJob(). Now, the check requiring
  71.  * fileaccess is the last one.
  72.  *
  73.  * Revision 0.17  1993/12/11  14:31:46  simons
  74.  * LharcUUCP is now able to parse the UUCP main config file and determine
  75.  * the sitename from the appropiate entry there. However, HOSTNAME is tested
  76.  * before parsing the file and still has priority. Local vars aren't
  77.  * supported.
  78.  *
  79.  * Revision 0.16  1993/12/10  22:26:14  simons
  80.  * Added the command ("m") in the LHARC-define.
  81.  * LharcUUCP() now terminates, when the current C.* file is already locked,
  82.  * because this usually means, that uucico is currently working on this job
  83.  * and our batch would fail anyway, so we better process the next job.
  84.  * Then LharcUUCP() used to unlock the C.* file before deleting it. This
  85.  * has been fixed.
  86.  * Now, we're locking the full archive name (<system>.LHARCPOSTFIX), to
  87.  * avoid problems with uucico, trying to transfer our archive while we're
  88.  * working on it.
  89.  *
  90.  * Revision 0.15  1993/12/08  17:11:03  simons
  91.  * Changed the call to InitDirScan() to match the new routines.
  92.  *
  93.  * Revision 0.14  1993/12/07  02:22:48  simons
  94.  * Changed the spool directory finding routine again.
  95.  *
  96.  * Revision 0.13  1993/12/07  02:15:50  simons
  97.  * Now checking for a spooldirectory with a truncated systemname, too.
  98.  *
  99.  * Revision 0.12  1993/12/05  16:11:39  simons
  100.  * IsValidJob() didn't free the locked files.
  101.  *
  102.  * Revision 0.11  1993/12/05  15:46:13  simons
  103.  * Added IsValidJob() which determines if we should process this job.
  104.  * Currently, only mail and news are processed--UUCP commands and our
  105.  * own archive-copy is skipped. Since this check is now in a seperate
  106.  * routine, LharcJob() has become a little bit easier and more straight.
  107.  *
  108.  * Revision 0.10  1993/12/05  13:32:37  simons
  109.  * PostArchive() is now called only, when actually a job has been processed.
  110.  * Additionally, it's called after the process is finished, not every time
  111.  * the archive changed. I'm not completely sure if this is the better
  112.  * way--will need some thought.
  113.  *
  114.  * Revision 0.9  1993/12/05  13:19:28  simons
  115.  * HOMESYSTEM is not determined at startup from the related enviroment
  116.  * variable, maybe I'll add configfile parsing some day.
  117.  * Change the order of the tests in main(): Now the commandline is checked
  118.  * first.
  119.  * Added TruncName(), which makes the handling of the 7-char-maximum
  120.  * systemnames easier.
  121.  * Changed commentblock style.
  122.  *
  123.  * Revision 0.8  1993/12/05  00:35:28  simons
  124.  * The history in the sourcefile was broken.
  125.  * Also I didn't mention the seq-routines, I took from Dillon UUCP.
  126.  * Known bug: LharcUUCP packs it's self-generated Archive job. :-) It
  127.  *            doesn't really matter, but I'll find a way around this.
  128.  *
  129.  * Revision 0.7  1993/12/05  00:29:29  simons
  130.  * Added PostArchive(), a small and neat routine to create the X.* and
  131.  * the C.* file for the archive.
  132.  *
  133.  * Revision 0.6  1993/12/04  22:34:33  simons
  134.  * The outgoing-archive is now locked while the archiver runs. Actually,
  135.  * only the systemname is used to lock the archive, not the complete name,
  136.  * like "peti.lha" or something similar. So, the mechanism will work with
  137.  * different archivers than LhA on the Amiga platform.
  138.  *
  139.  * Revision 0.5  1993/12/04  22:30:44  simons
  140.  * Now actually starting the archiver, creating a file names <system>.lha,
  141.  * located in the appropiate outgoing directory.
  142.  *
  143.  * Revision 0.4  1993/12/04  20:44:35  simons
  144.  * Moved the directory scanning routine into an extra module, since this
  145.  * is the only routine that is really system-dependant.
  146.  *
  147.  * Revision 0.3  1993/12/04  18:05:00  simons
  148.  * LharcJob() now reads the C.* files and renames the D.* and X.* file to
  149.  * the names they shall have on the remote system, so they can be easily
  150.  * packed.
  151.  * Non-send-jobs are recognized.
  152.  * UUCP jobs (which are send-jobs in fact) are merely recognized, although
  153.  * the current method (UUCP-jobs have only one line!) is a hack. I'll
  154.  * change that soon.
  155.  * Also some problems with the directory scanning routine occur. I will
  156.  * have to re-write GetFileName() soon, too.
  157.  *
  158.  * Revision 0.2  1993/12/04  17:13:04 simons
  159.  * Added commandline parsing, calling PackSpoolJobs() for every provided
  160.  * system.
  161.  * Added GetFileName() which is able to scan a directory for files,
  162.  * matching a certain pattern.
  163.  * Added a basic LharcJob() call, which just locks and opens the file
  164.  * until now.
  165.  *
  166.  * Revision 0.1 1993/12/04 13:45:54 simons
  167.  * This program is released under the GNU General Public License.
  168.  */
  169.  
  170.  
  171. /************************************* includes ***********/
  172. #include <stdio.h>
  173. #include <stdlib.h>
  174. #include <string.h>
  175. #include <ctype.h>
  176. #include <dos.h>
  177. #include <proto/dos.h>
  178.  
  179. #include "LharcUUCP_rev.h"
  180.  
  181. /************************************* defines ************/
  182. #define BUFFERSIZE 128
  183. #define UUSPOOL "UUSpool:"
  184. #define SEQ "UULib:Seq"
  185. #define LHARC "LhA m"           /* archiver command, moving enabled */
  186. #define LHARCPOSTFIX ".lha"
  187.  
  188. #define USAGE VERS " -- written by Peter Simons <simons@peti.GUN.de>\n" \
  189.               "Usage: LharcUUCP system [[system] [...]]\n"
  190.  
  191. /************************************* prototypes *********/
  192. void PackSpoolJobs(char *systemname);
  193. char *GetFileName(char *pattern, int reset);
  194. void LharcJob(char *systemname, char *cfile, char grade);
  195. void PostArchive(char *systemname, char *postfix, char grade);
  196. char *TruncName(char *string);
  197. int IsValidJob(char *cfilename, char *systemname, char grade);
  198. int GoNextLine(FILE *fh);
  199. unsigned int GetSequence(unsigned int);
  200. char *SeqToName(unsigned int);
  201. int IsPath(char *filename);
  202. char *myGetConfigEntry(char *keyword, char *def);
  203.  
  204. void LockFile(char *);
  205. int FileIsLocked(char *);
  206. void UnLockFile(char *);
  207. void UnLockFiles(void);
  208.  
  209. int InitDirScan(char *);
  210. char *ScanNextFile(void);
  211. void EndDirScan(void);
  212.  
  213. char *GetConfigEntry(char *, char *, char *);
  214.  
  215. /************************************* global variables ***/
  216. static const char __RCSId[] = "$Id: LharcUUCP.c,v 0.25 1993/12/18 21:43:11 simons Exp simons $";
  217. static const char __DOSVer[] = VERSTAG;
  218. char *homesystem;
  219. int processed_flag;
  220.  
  221. /************************************* program ************/
  222.  
  223. int main(int argc, char **argv)
  224. {
  225.         char currentdir[512];
  226.  
  227.         if (argc < 2) {
  228.                 fprintf(stderr, USAGE);
  229.                 return 10;
  230.         }
  231.  
  232.         if (!(homesystem = getenv("HOSTNAME")))
  233.                 if (!(homesystem = GetConfigEntry(NULL, "NodeName", NULL))) {
  234.                         fprintf(stderr, "LharcUUCP: Can't determine the name of this machine!\n");
  235.                         return 10;
  236.                 }
  237.  
  238.         if (getcd(0, currentdir))
  239.                 return 10;
  240.  
  241.         while (--argc)
  242.                 PackSpoolJobs(argv[argc]);
  243.  
  244.         chdir(currentdir);
  245.  
  246.         return 0;
  247. }
  248.  
  249.  
  250. /************************************* subroutines ********/
  251. void PostArchive(char *systemname, char *postfix, char grade)
  252. {
  253.         FILE *cfh, *xfh;
  254.         char cfilename[64], xfilename[64], *trunc_sysname;
  255.         char dremote[64];
  256.  
  257.         trunc_sysname = TruncName(systemname);
  258.  
  259.         sprintf(cfilename, "C.%s%c0000", trunc_sysname, grade);
  260.         LockFile(cfilename);
  261.         if (!(cfh = fopen(cfilename, "r"))) {
  262.                 fclose(cfh);
  263.  
  264.                 /*
  265.                  * When the fopen() call succedes, does the file already
  266.                  * exist and we're finished.
  267.                  */
  268.  
  269.                 sprintf(xfilename, "D.%sX%s", trunc_sysname, SeqToName(GetSequence(1)));
  270.                 sprintf(dremote, "%s%s", TruncName(homesystem), SeqToName(GetSequence(1)));
  271.  
  272.                 if (cfh = fopen(cfilename, "w")) {
  273.                         fprintf(cfh, "S %s%s D.%s lharc-uucp-daemon - %s%s 0666\n",
  274.                                 systemname, postfix, dremote, systemname, postfix);
  275.                         fprintf(cfh, "S %s X.%s%s lharc-uucp-daemon - %s 0666\n",
  276.                                 xfilename, TruncName(homesystem), SeqToName(GetSequence(1)), xfilename);
  277.                         fclose(cfh);
  278.                 }
  279.  
  280.                 LockFile(xfilename);
  281.                 if (xfh = fopen(xfilename, "w")) {
  282.                         fprintf(xfh, "U lharc-uucp-daemon %s\nF D.%s\nC rlharc\n", homesystem, dremote);
  283.                         fclose(xfh);
  284.                 }
  285.                 else
  286.                         remove(cfilename);
  287.                 UnLockFile(xfilename);
  288.         }
  289.         else
  290.                 fclose(cfh);
  291.  
  292.         UnLockFile(cfilename);
  293. }
  294.  
  295.  
  296. void PackSpoolJobs(char *systemname)
  297. {
  298.         char currentdir[BUFFERSIZE], *cfile;
  299.         int success;
  300.         char owngrade, grade;
  301.  
  302.         processed_flag = 0;
  303.  
  304.         if (strlen(systemname)+strlen(UUSPOOL)+1 > BUFFERSIZE) {
  305.                 fprintf(stderr, "LharcUUCP: Directoryname is too long for internal buffer.\n");
  306.                 return;         /* Buffer overflow! */
  307.         }
  308.  
  309.         printf("Processing queued jobs for >%s<.\n", systemname);
  310.  
  311.  
  312.         /*
  313.          * Change into the appropiate directory, holding the spool jobs
  314.          * for the specified system.
  315.          */
  316.  
  317.         sprintf(currentdir, "%s%s", UUSPOOL, systemname);
  318.         if (chdir(currentdir)) {
  319.                 sprintf(currentdir, "%s%s", UUSPOOL, TruncName(systemname));
  320.                 if (chdir(currentdir)) {
  321.                         fprintf(stderr, "LharcUUCP: System >%s< has no spool directory?\n", systemname);
  322.                         strcpy(currentdir, UUSPOOL);
  323.                         if (chdir(currentdir)) {
  324.                                 fprintf(stderr, "LharcUUCP: Cd to >%s< failed.\n", UUSPOOL);
  325.                                 return;
  326.                         }
  327.                 }
  328.         }
  329.  
  330.  
  331.         /*
  332.          * Determine the configured grades for our process.
  333.          */
  334.  
  335.         {
  336.                 char *string, buf[80];
  337.  
  338.                 string = myGetConfigEntry("BatchOnlyGrade", NULL);
  339.                 grade = (string && isalnum(string[0])) ? string[0] : 'z';
  340.  
  341.                 sprintf(buf, "%s_%s", "BatchOnlyGrade", systemname);
  342.                 string = myGetConfigEntry(buf, NULL);
  343.                 grade = (string && isalnum(string[0])) ? string[0] : grade;
  344.  
  345.                 string = myGetConfigEntry("LharcBatchGrade", NULL);
  346.                 owngrade = (string && isalnum(string[0])) ? string[0] : 'A';
  347.         }
  348.  
  349.  
  350.         /*
  351.          * Build a pattern matching 'C.system*', with the systemname
  352.          * truncated to 7 characters and scan the spooldirectory for
  353.          * queued jobs we can pack.
  354.          */
  355.  
  356.         {
  357.                 char pattern[64];
  358.                 sprintf(pattern, "C.%s#?", TruncName(systemname));
  359.                 success = InitDirScan(pattern);
  360.         }
  361.  
  362.         if (success)
  363.                 while (cfile = ScanNextFile())
  364.                         LharcJob(systemname, cfile, grade);
  365.         else
  366.                 fprintf(stderr, "LharcUUCP: Directory scan for >%s< failed!\n", currentdir);
  367.  
  368.         EndDirScan();
  369.  
  370.         if (processed_flag)
  371.                 PostArchive(systemname, LHARCPOSTFIX, owngrade);
  372. }
  373.  
  374.  
  375. void LharcJob(char *systemname, char *cfilename, char grade)
  376. {
  377.         FILE *cfilehandle;
  378.         char command[2], from[256], to[256], from2[256], to2[256];
  379.         char cmdbuf[256], archivename[64];
  380.         int success = 0;
  381.  
  382.         printf("LharcUUCP: processing <%s>\n", cfilename);
  383.  
  384.         if (FileIsLocked(cfilename))
  385.                 return;         /* uucico is processing this job right now,
  386.                                  * so we better leave it alone.
  387.                                  */
  388.         LockFile(cfilename);
  389.  
  390.         if(!IsValidJob(cfilename, systemname, grade)) {
  391.                 UnLockFile(cfilename);
  392.                 return;
  393.         }
  394.  
  395.         if (cfilehandle = fopen(cfilename, "r")) {
  396.                 fscanf(cfilehandle, "%s%s%s", command, from, to);
  397.                 if (GoNextLine(cfilehandle) != EOF) {
  398.                         fscanf(cfilehandle, "%s%s%s", command, from2, to2);
  399.  
  400.                         LockFile(from);
  401.                         LockFile(to);
  402.                         LockFile(from2);
  403.                         LockFile(to2);
  404.                         if (!(rename(from, to)))
  405.                                 if (!(rename(from2, to2))) {
  406.                                         success = 1;
  407.                                         processed_flag = 1;
  408.  
  409.  
  410.                                         /* Free unused files a soon as
  411.                                          * possible.
  412.                                          */
  413.  
  414.                                         fclose(cfilehandle);
  415.                                         remove(cfilename);
  416.                                         UnLockFile(from);
  417.                                         UnLockFile(from2);
  418.                                         UnLockFile(cfilename);
  419.  
  420.  
  421.                                         /* Batch the processed files.
  422.                                          */
  423.  
  424.                                         sprintf(cmdbuf, "%s %s %s %s", LHARC, systemname, to, to2);
  425.                                         printf("%s\n", cmdbuf);
  426.                                         sprintf(archivename, "%s%s", systemname, LHARCPOSTFIX);
  427.                                         LockFile(archivename);
  428.                                         system(cmdbuf);
  429.                                         UnLockFile(archivename);
  430.                                 }
  431.                                 else
  432.                                         rename(to, from);
  433.  
  434.  
  435.                         /* When one of the 'renames' failed, we still
  436.                          * have to close and unlock the files.
  437.                          */
  438.  
  439.                         if (!success) {
  440.                                 UnLockFile(from);
  441.                                 UnLockFile(from2);
  442.                                 fclose(cfilehandle);
  443.                                 UnLockFile(cfilename);
  444.                         }
  445.  
  446.                         UnLockFile(to);         /* These must be freed */
  447.                         UnLockFile(to2);        /* in any case.        */
  448.                 }
  449.         }
  450. }
  451.  
  452.  
  453.  /*
  454.   * IsValidJob() checks the provided C.* file and tests if this job may
  455.   * may be processed by LharcUUCP. Currently, we only process mail and
  456.   * news. UUCP- and lharc-jobs are left alone.
  457.   */
  458.  
  459. int IsValidJob(char *cfilename, char *systemname, char grade)
  460. {
  461.  
  462.         /*
  463.          * Test if the grade of the commandfile is lower or the same as
  464.          * our max. grade.
  465.          */
  466.  
  467.         if (cfilename[strlen(TruncName(systemname)) + 2] > grade)
  468.                 return 0;
  469.  
  470.  
  471.         /*
  472.          * Check the number part of the filename. C.*0000 are the C.*
  473.          * files for the processed archives and won't be touched.
  474.          */
  475.  
  476.         if (!strncmp(&cfilename[strlen(cfilename) - 4], "0000", 4))
  477.                 return 0;
  478.  
  479.  
  480.         /*
  481.          * Check the contents of the file. Neither target nor source file
  482.          * may contain paths and we can't batch read-requests of course.
  483.          */
  484.  
  485.         {
  486.                 FILE *fh;
  487.                 int success = 0;
  488.                 char from[256], to[256];
  489.  
  490.                 if (fh = fopen(cfilename, "r")) {
  491.                         while (1) {
  492.                                 if (fgetc(fh) == 'S') {
  493.                                         fscanf(fh, "%s%s", from, to);
  494.                                         if (IsPath(from) || IsPath(to))
  495.                                                 break;
  496.                                         GoNextLine(fh);
  497.                                         if (feof(fh)) {
  498.                                                 success = 1;
  499.                                                 break;
  500.                                         }
  501.                                 }
  502.                                 else
  503.                                         break;
  504.                         }
  505.                         fclose(fh);
  506.                 }
  507.                 if (!success)
  508.                         return 0;
  509.         }
  510.  
  511.         return 1;
  512. }
  513.  
  514.  
  515.  
  516. unsigned int GetSequence(unsigned int bump)
  517. {
  518.         FILE *fh;
  519.         unsigned int seq = 0;
  520.  
  521.         LockFile(SEQ);
  522.         if (fh = fopen(SEQ, "r")) {
  523.                 fscanf(fh, "%u", &seq);
  524.                 fclose(fh);
  525.         }
  526.         else {
  527.                 fprintf(stderr, "LharcUUCP: Can't open seq file!\n");
  528.         }
  529.  
  530.         if (bump && seq >= 0) {
  531.                 if (bump + seq > 0xFFFFF)
  532.                         seq = 1;
  533.  
  534. endlessloop:
  535.                 if (fh = fopen(SEQ, "w")) {
  536.                         fprintf(fh, "%u", seq + bump);
  537.                         fclose(fh);
  538.                 }
  539.                 else {
  540.                         fprintf(stderr, "LharcUUCP: Can't update seq file!\n");
  541.                         Delay(5*50);
  542.                         goto endlessloop;
  543.                 }
  544.         }
  545.         UnLockFile(SEQ);
  546.         return seq;
  547. }
  548.  
  549.  
  550.  /*
  551.   * Convert a sequence number into a numeric/character combination. Names
  552.   * are unique and case-insensitive. The sequence number 0-0xFFFFF will be
  553.   * converted to a 4 character string each position containing 0-9 a-z,
  554.   * or base 36 (total of 1.6 million combinations)
  555.   */
  556.  
  557. char *SeqToName(unsigned int seqNo)
  558. {
  559.         static char Buf[5];
  560.         short i;
  561.  
  562.         seqNo &= 0xFFFFF;
  563.  
  564.         for (i = 3; i >= 0; --i) {
  565.                 short n = seqNo % 36;
  566.  
  567.                 if (n < 10)
  568.                         Buf[i] = n + '0';
  569.                 else
  570.                         Buf[i] = n - 10 + 'a';
  571.                 seqNo /= 36;
  572.         }
  573.         Buf[4] = '\0';
  574.         return (Buf);
  575. }
  576.  
  577.  
  578.  /*
  579.   * TruncName() duplicates the given string and truncates it to 7
  580.   * characters, which is required by a number of tasks in the UUCP
  581.   * enviroment.
  582.   */
  583.  
  584. char *TruncName(char *string)
  585. {
  586.         static char buffer[8];
  587.  
  588.         strncpy(buffer, string, 7);
  589.         buffer[7] = '\0';
  590.  
  591.         return buffer;
  592. }
  593.  
  594.  
  595.  /*
  596.   * GoNextLine() reads from the provided filehandle until either end-
  597.   * of-file or an end-of-line ('\n') occurs.
  598.   */
  599.  
  600. int GoNextLine(FILE *fh)
  601. {
  602.         int c;
  603.  
  604.         while ((c = fgetc(fh)) != EOF && c != '\n')
  605.                 ;
  606.  
  607.         if ((c = fgetc(fh)) != EOF)     /* Read next character to make */
  608.                 ungetc(c, fh);          /* feof() work.                */
  609.  
  610.         return c;
  611. }
  612.  
  613.  
  614.  /*
  615.   * This small routine returns a flag indicating wether the provided
  616.   * string was a filepath or just a filename! This is important, because
  617.   * filerequests containing paths can't be processed with LharcUUCP.
  618.   * This routine has to be customized for other systems.
  619.   */
  620.  
  621. int IsPath(char *filename)
  622. {
  623.         if (strchr(filename, '/') || strchr(filename, ':'))
  624.                 return 1;
  625.         else
  626.                 return 0;
  627. }
  628.  
  629.  
  630. char *myGetConfigEntry(char *keyword, char *def)
  631. {
  632.         char *string;
  633.  
  634.         if (string = getenv(keyword))
  635.                 return string;
  636.  
  637.         return GetConfigEntry(NULL, keyword, def);
  638. }
  639.  
  640.