home *** CD-ROM | disk | FTP | other *** search
- /*
- $Header: fidoutil.c 3.3 87/12/12 00:42:28 Bob Exp $
-
- The Conference Mail System
-
- This module was originally written by Bob Hartman
- Sysop of FidoNet node 1:132/101
-
- Spark Software, 427-3 Amherst St, CS 2032, Suite 232, Nashua, NH 03061
-
- The Conference Mail System is a complete Echomail processing package. It
- is a superset of the original Echomail utilities created by Jeff Rush, and
- also contains ideas gleaned from the ARCmail, Renum, oMMM, MGM, and Opus
- programs that were created by various software authors.
-
- This program source code is being released with the following provisions:
-
- 1. You are free to make changes to this source code for use on your own
- machine, however, altered source files may not be distributed without the
- consent of Spark Software.
-
- 2. You may distribute "patches" or "diff" files for any changes that you
- have made, provided that the "patch" or "diff" files are also sent to Spark
- Software for inclusion in future releases of the entire package. A "diff"
- file for the source archives may also contain a compiled version, provided
- it is clearly marked as not being created from the original source code.
- No other executable versions may be distributed without the consent of
- Spark Software.
-
- 3. You are free to include portions of this source code in any program you
- develop, providing: a) Credit is given to Spark Software for any code that
- may is used, and b) The resulting program is free to anyone wanting to use
- it, including commercial and government users.
-
- 4. There is NO technical support available for dealing with this source
- code, or the accompanying executable files. This source code is provided
- as is, with no warranty expressed or implied (I hate legalease). In other
- words, if you don't know what to do with it, don't use it, and if you are
- brave enough to use it, you're on your own.
-
- Spark Software may be contacted by modem at (603) 888-8179 (node 1:132/101)
- on the public FidoNet network, or at the address given above.
-
- To use this code you will need Microsoft C version 4.0, and also Microsoft
- Macro Assembler version 4.0.
-
- */
-
- /*
- $Log: fidoutil.c $
- * Revision 3.3 87/12/12 00:42:28 Bob
- *
- * Source code release
- *
- */
-
- #include <stdlib.h>
- #include <string.h>
- #include <stdio.h>
- #include <ctype.h>
- #include <fcntl.h>
- #include <sys\types.h>
- #include <sys\stat.h>
- #include <io.h>
- #include "bbsdev.h"
-
- int get_fido_sys (s, q)
- char *s;
- int q;
- {
- char fname[64];
- int f;
- SYS fsys;
- int i;
-
- i = atoi (s);
- if ((i > 99) || (strlen (s) > 2) || (!isdigit(*s)))
- {
- if (q)
- printf ("Directory '%s' doesn't exist, ignoring this line\n", s);
- return (-1);
- }
- else if (i > 0)
- {
- sprintf (fname, "SYSTEM%d.BBS", i);
- }
- else
- {
- if ((i == 0) && (*s != '0'))
- {
- if (q)
- printf ("Directory '%s' doesn't exist, ignoring this line\n", s);
- return (-1);
- }
- else
- {
- strcpy (fname, "SYSTEM.BBS");
- }
- }
-
- if ((f = fast_open (fname, O_RDONLY|O_BINARY)) == -1)
- {
- if (q)
- printf ("Fido area %s doesn't exist\n", fname);
- return (-1);
- }
-
- if (fast_read (f, (char *) &fsys, sizeof (SYS)) != sizeof (SYS))
- {
- (void) fast_close (f);
- printf ("Can't read from %s\n", fname);
- return (-1);
- }
-
- (void) fast_close (f);
- fsys.msgpath[strlen(fsys.msgpath)-1] = '\0';
- strcpy (fname, fsys.msgpath);
- if (!(filedir (fname, 0, fname, ST_DIRECT) & ST_DIRECT))
- {
- printf ("The message path '%s' doesn't exist\n", fsys.msgpath);
- return (-1);
- }
- strcpy (s, fsys.msgpath);
- return (0);
- }
-