home *** CD-ROM | disk | FTP | other *** search
/ Frozen Fish 1: Amiga / FrozenFish-Apr94.iso / bbs / alib / d6xx / d656 / cybercron.lha / CyberCron / Source / CyberCron.h < prev    next >
C/C++ Source or Header  |  1992-05-15  |  4KB  |  162 lines

  1. #include <exec/types.h>
  2. #include <exec/nodes.h>
  3.  
  4. #include <exec/execbase.h>
  5. #include <exec/memory.h>
  6. #include <exec/ports.h>
  7. #include <exec/semaphores.h>
  8. #include <dos/rdargs.h>
  9. #include <dos/notify.h>
  10. #include <dos/dostags.h>
  11. #include <dos/datetime.h>
  12. #include <rexx/rxslib.h>
  13. #include <rexx/errors.h>
  14. #include <workbench/startup.h>
  15. #include <workbench/workbench.h>
  16.  
  17. #include <clib/exec_protos.h>
  18. extern struct ExecBase *SysBase;
  19. #include <pragmas/exec_lib.h>
  20.  
  21. #include <clib/dos_protos.h>
  22. extern struct DosLibrary *DOSBase;
  23. #include <pragmas/dos_lib.h>
  24.  
  25. #include <clib/rexxsyslib_protos.h>
  26. extern struct RxsLib *RexxSysBase;
  27. #include <pragmas/rexxsyslib_lib.h>
  28.  
  29. #include <clib/icon_protos.h>
  30. extern struct Library *IconBase;
  31. #include <pragmas/icon_lib.h>
  32.  
  33. #include <clib/timer_protos.h>
  34. extern struct timerequest TimerIO;
  35. #define TimerBase (TimerIO.tr_node.io_Device)
  36. #include <pragmas/timer_lib.h>
  37.  
  38. #include <clib/alib_protos.h>
  39.  
  40. #include <stdio.h>
  41. #include <string.h>
  42. #include <stdlib.h>
  43. #include <stdarg.h>
  44. #include <ctype.h>
  45. #include <dos.h>    /* for __emit() prototype */
  46.  
  47. #define SECSINDAY (86400)
  48.  
  49. /* this struct holds a system time in a way we can easily use it */
  50. typedef struct {
  51.     ULONG st_tvsecs;    /* as returned by the timer device */
  52.     UWORD st_Year;
  53.     UWORD st_Month;
  54.     UWORD st_Day;
  55.     UWORD st_Hour;
  56.     UWORD st_Min;
  57.     UWORD st_Sec;
  58.     UBYTE st_DOW;
  59. } SystemTime_t;
  60.  
  61. struct CyberNode {
  62.     struct Node    cn_Node;
  63. #define cn_Name cn_Node.ln_Name
  64.     STRPTR        cn_Command;
  65.     STRPTR        cn_ReDirIn;
  66.     STRPTR        cn_ReDirOut;
  67.     STRPTR        cn_ReDirErr;
  68.     STRPTR        cn_CustomShell;
  69.     STRPTR        cn_SendToUser;
  70.     ULONG        cn_Stack;
  71.     BYTE        cn_Priority;
  72.     UBYTE        cn_DayOfWeek;
  73.     UWORD        cn_Month;
  74.     ULONG        cn_Day;
  75.     ULONG        cn_Hour;
  76.     ULONG        cn_HiMin;
  77.     ULONG        cn_LoMin;
  78.     UBYTE        cn_ObeyQueue;
  79.     UBYTE        cn_Flags;
  80. };
  81.  
  82. /* these are the possible values for the flags in cn_Flags */
  83. #define CNB_NOLOG   0        /* don't to log when running the command */
  84. #define CNB_REXX    1        /* start command as a rexx script */
  85. #define CNB_CRONTAB 2        /* node was generated by an entry in crontab
  86.                  * file */
  87. #define CNB_SYSSH   3        /* use system shell instead of user shell */
  88. #define CNB_OUTAPP  4        /* append to output redirection instead of
  89.                    overwrite */
  90. #define CNB_ERRAPP  5        /* append to error redirection instead of
  91.                    overwrite */
  92. #define CNB_EXECONE 6        /* run job once and then delete it */
  93. #define CNB_DELAYED 7        /* queued job was delayed due to queue limits */
  94.  
  95. #define CNF_NOLOG   (1L << CNB_NOLOG)
  96. #define CNF_REXX    (1L << CNB_REXX)
  97. #define CNF_CRONTAB (1L << CNB_CRONTAB)
  98. #define CNF_SYSSH   (1L << CNB_SYSSH)
  99. #define CNF_OUTAPP  (1L << CNB_OUTAPP)
  100. #define CNF_ERRAPP  (1L << CNB_ERRAPP)
  101. #define CNF_EXECONE (1L << CNB_EXECONE)
  102. #define CNF_DELAYED (1L << CNB_DELAYED)
  103.  
  104. struct JobQueue {
  105.     ULONG    jq_Max;
  106.     ULONG    jq_Cur;
  107. };
  108.  
  109. struct SystemECdata {
  110.     UWORD    jobNo;
  111.     UBYTE    queueNo;
  112.     UBYTE    flags;
  113. };
  114.  
  115. /*
  116.  * here we have prototypes for all functions contained in or used by this
  117.  * file
  118.  */
  119. struct CyberNode *ParseEvent(STRPTR);
  120. void ParseBits(ULONG *, STRPTR);
  121. void UnParseBits(ULONG *, STRPTR, int, int);
  122. UWORD GetJobNum(void);
  123. void FreeJobNum(UWORD);
  124. void __stdargs Log(STRPTR, ...);
  125. void __stdargs MySPrintf(STRPTR, STRPTR, ...);
  126. int __regargs main(char *cmdptr, int cmdlen, struct WBStartup *WBMsg);
  127. void ReadCronTab(void);
  128. BOOL GetARexxLib(void);
  129. void FreeARexxLib(void);
  130. void __stdargs ErrorMsg(char *fmt, ...);
  131. void MyExit(int);
  132. void FreeEvents(BOOL);
  133. STRPTR WBtoCLIargs(struct WBStartup *WBMsg);
  134. void StartSystemJob(struct CyberNode *cn);
  135. void StartRexxJob(struct CyberNode *cn);
  136. int __saveds __asm EndSystemJob(register __d0 int rc, register __d1 struct SystemECData *data);
  137. void GetSystemTime(SystemTime_t *st);
  138. void ScanForJobs(void);
  139. void HandleRexxEvents(void);
  140. struct CyberNode *FindEvent(STRPTR name);
  141. BPTR SetupSendMail(STRPTR cmdName, STRPTR userName);
  142.  
  143. extern void DoMsg(struct RexxMsg *, APTR, int, int);
  144.  
  145. void   rx_Shutdown(void);
  146. STRPTR rx_Version(void);
  147. void   rx_Suspend(void);
  148. void   rx_Resume(void);
  149. int    rx_NewEventFile(STRPTR);
  150. void   rx_CloseEventFile(void);
  151. int    rx_AddEvent(STRPTR);
  152. int    rx_DeleteRexxEvent(STRPTR);
  153. int    rx_DeleteEvent(STRPTR);
  154. void   rx_PurgeRexxEvents(void);
  155. STRPTR rx_ShowEvent(STRPTR);
  156. STRPTR rx_ListEvents(void);
  157. STRPTR rx_ShowStatus(void);
  158. int    rx_NewLogFile(STRPTR);
  159. void   rx_CloseLogFile(void);
  160. int    rx_SetQueueMax(STRPTR);
  161. int    rx_GetQueueMax(STRPTR);
  162.