home *** CD-ROM | disk | FTP | other *** search
/ The World of Computer Software / World_Of_Computer_Software-02-385-Vol-1of3.iso / f / frbts_20.zip / FROBOT.H < prev    next >
C/C++ Source or Header  |  1991-04-27  |  6KB  |  159 lines

  1. /****************************************************************************/
  2. /*                                                                          */
  3. /*    Frobot.h    Version 2.0    By Craig Derouen                           */
  4. /*                                                                          */
  5. /*                                                                          */
  6. /*                                                                          */
  7. /****************************************************************************/
  8.  
  9.  
  10.  
  11. #include <stdio.h>
  12. #include <ctype.h>
  13. #include <string.h>
  14. #include <stdlib.h>
  15. #include <dos.h>
  16. #include <direct.h>
  17. #include <errno.h>
  18. #include <malloc.h>
  19. #include <sys\types.h>
  20. #include <sys\stat.h>
  21.  
  22. #define  Version 2.00
  23. #define  TRUE  1
  24. #define  FALSE 0
  25.  
  26. #define  NOMEM    1
  27. #define  BADFILE  2
  28.  
  29. #define  MAXLINE_SIZE   128
  30.  
  31. #define bit   unsigned
  32. #define sword signed int
  33. #define word  unsigned int
  34. #define dword long int
  35. #define byte  unsigned char
  36.  
  37. struct _stamp   /* DOS-style datestamp */
  38. {
  39.   struct
  40.   {
  41.     unsigned int da : 5;
  42.     unsigned int mo : 4;
  43.     unsigned int yr : 7;
  44.   } date;
  45.  
  46.   struct
  47.   {
  48.     unsigned int ss : 5;
  49.     unsigned int mm : 6;
  50.     unsigned int hh : 5;
  51.   } time;
  52. };
  53.  
  54. /* FIdonet message format, stripped from OPU/Maximus */
  55. struct _msg
  56. {
  57.    byte from[36];
  58.    byte to[36];
  59.    byte subj[72];
  60.    byte date[20];       /* Obsolete/unused ASCII date information        */
  61.    word times;          /* FIDO<tm>: Number of times read                */
  62.    sword dest;          /* Destination node                              */
  63.    sword orig;          /* Origination node number                       */
  64.    word cost;           /* Unit cost charged to send the message         */
  65.  
  66.    sword orig_net;      /* Origination network number                    */
  67.    sword dest_net;      /* Destination network number                    */
  68.  
  69.                         /* A TIMESTAMP is a 32-bit integer in the Unix   */
  70.                         /* flavor (ie. the number of seconds since       */
  71.                         /* January 1, 1970).  Timestamps in messages are */
  72.                         /* always Greenwich Mean Time, never local time. */
  73.  
  74.    struct _stamp date_written;   /* When user wrote the msg              */
  75.    struct _stamp date_arrived;   /* When msg arrived on-line             */
  76.  
  77.    word reply;          /* Current msg is a reply to this msg number     */
  78.    word attr;           /* Attribute (behavior) of the message           */
  79.    word up;             /* Next message in the thread                    */
  80. };
  81.  
  82.  
  83. /*--------------------------------------------------------------------------*/
  84. /* Message attributes                                                       */
  85. /*--------------------------------------------------------------------------*/
  86. #define MSGPRIVATE 0x0001  /* private message         * 0000 0000 0000 0001 */
  87. #define MSGCRASH   0x0002  /* squirtmail              * 0000 0000 0000 0010 */
  88. #define MSGREAD    0x0004  /* read by addressee       * 0000 0000 0000 0100 */
  89. #define MSGSENT    0x0008  /* sent OK (remote)          0000 0000 0000 1000 */
  90. #define MSGFILE    0x0010  /* file attached to msg    * 0000 0000 0001 0000 */
  91. #define MSGFWD     0x0020  /* in transit                0000 0000 0010 0000 */
  92. #define MSGORPHAN  0x0040  /* unknown dest node         0000 0000 0100 0000 */
  93. #define MSGKILL    0x0080  /* kill after bundling     * 0000 0000 1000 0000 */
  94. #define MSGLOCAL   0x0100  /* FidoNet vs. local         0000 0001 0000 0000 */
  95. #define MSGHOLD    0x0200  /* Hold, don't send        * 0000 0010 0000 0000 */
  96. #define MSGXX2     0x0400  /* <reserved>             X? 0000 0100 0000 0000 */
  97. #define MSGFRQ     0x0800  /* file request            * 0000 1000 0000 0000 */
  98. #define MSGRRQ     0x1000  /* receipt requested      X* 0001 0000 0000 0000 */
  99. #define MSGCPT     0x2000  /* is a return receipt    X* 0010 0000 0000 0000 */
  100. #define MSGARQ     0x4000  /* audit trail requested  X* 0100 0000 0000 0000 */
  101. #define MSGURQ     0x8000  /* update request         X* 1000 0000 0000 0000 */
  102.                                                    /*-----------------------*/
  103.                                                    /* ^                     */
  104.                                                    /* |                     */
  105.                                                    /*  * = preserved by     */
  106.                                                    /*      the network      */
  107.                                                    /*  ? = stripped by the  */
  108.                                                    /*      net (FTSC spec)  */
  109.                                                    /*      but preserved    */
  110.                                                    /*      by seadog<tm>    */
  111.                                                    /*  X = not used by Opus */
  112.                                                    /*-----------------------*/
  113.  
  114. /* Prototypes */
  115.  
  116. int main(int argc,char **argv);
  117. void showvers(void);
  118.  
  119. /* File.c */
  120. int getparms(char *ctlfile);
  121. int doscript(void);
  122. void striptail(char *p);
  123. void procline(char *line);
  124. void commentline(char *line,char *str);
  125. int validate(char *p2,char *line);
  126. int filescan(FILE *infile,char *fname);
  127. void createbackup(char *input,char *output);
  128. void logit(char *strng,char flag);
  129. char *timestring(void);
  130.  
  131. /* Misc.c */
  132. void showparms(void);
  133. int parsenet(char *str,unsigned int *zone,unsigned int *net,unsigned int *node);
  134. void aborterror(int code,char *str);
  135. void warble(void);
  136. void utsound(int freq,int time);
  137. unsigned utsleep(unsigned period);
  138. int utgetclk(long *pcount);
  139. void soundon(int freq);
  140. void soundoff(void);
  141. void strinsert(char *insstr,char *dest,int position);
  142. void blanktrim(char *string);
  143. int datecheck(char *inpstr);
  144. int timecheck(char *inpstr);
  145.  
  146. /* Fidonet.c */
  147. void file_send(char *p1,char *line,char *sendfile);
  148. void file_request(char *line,char *reqfile);
  149. int setdest(char *input,char *line);
  150. int test_sfile(char *fname,FILE *flfile,int mode);
  151. int test_rfile(char *fname,FILE *reqfile,int filetries,int count);
  152. void DoFSendMsg(char *filename);
  153. void DoFReqMsg(char *filename);
  154. void DoNoteMsg(char *filename);
  155. int create_msghdr(int destnode,int destnet,char *subject,unsigned attribute);
  156. int find_fidohigh(char *msgpath);
  157.  
  158.  
  159.