home *** CD-ROM | disk | FTP | other *** search
- #include <exec/types.h>
- #include <exec/nodes.h>
-
- #include <exec/execbase.h>
- #include <exec/memory.h>
- #include <exec/ports.h>
- #include <exec/semaphores.h>
- #include <dos/rdargs.h>
- #include <dos/notify.h>
- #include <dos/dostags.h>
- #include <dos/datetime.h>
- #include <rexx/rxslib.h>
- #include <rexx/errors.h>
- #include <intuition/intuitionbase.h>
- #include <workbench/startup.h>
- #include <workbench/workbench.h>
- #include <utility/date.h>
-
- #include <clib/exec_protos.h>
- extern struct ExecBase *SysBase;
- #include <pragmas/exec_libcall_lib.h>
-
- #include <clib/dos_protos.h>
- extern struct DosLibrary *DOSBase;
- #include <pragmas/dos_lib.h>
-
- #include <clib/rexxsyslib_protos.h>
- extern struct RxsLib *RexxSysBase;
- #include <pragmas/rexxsyslib_lib.h>
-
- /* hack to get the ARexx ErrorMsg() function */
- struct NexxStr *ARexxErrorMsg(int);
- #pragma libcall RexxSysBase ARexxErrorMsg 60 081
-
- #include <clib/icon_protos.h>
- extern struct Library *IconBase;
- #include <pragmas/icon_lib.h>
-
- #include <clib/timer_protos.h>
- extern struct timerequest TimerIO;
- #define TimerBase (TimerIO.tr_node.io_Device)
- #include <pragmas/timer_lib.h>
-
- #include <clib/intuition_protos.h>
- #include <pragmas/intuition_lib.h>
-
- #include <clib/utility_protos.h>
- extern struct Library *UtilityBase;
- #include <pragmas/utility_lib.h>
-
- #include <libraries/locale.h>
- #include <clib/locale_protos.h>
- extern struct LocaleBase *LocaleBase;
- #include <pragmas/locale_lib.h>
-
- #include <clib/alib_protos.h>
-
- #include <stdio.h>
- #include <string.h>
- #include <stdlib.h>
- #include <stdarg.h>
- #include <ctype.h>
- #include <dos.h> /* for __emit() prototype */
-
- #include "CyberCronStrings.h"
-
- #include "OwnDevUnit.h"
- #include "wb2cli.h"
-
- #define SECSINDAY (86400)
- #define SECSINHOUR (3600)
- #define SECSINMINUTE (60)
-
- #define JOB_TABLE_SIZE (256)
-
- #define BIG_BUF_SIZE_BASE (1024)
- #define BIG_BUF_SIZE_XTRA (16)
- #define BIG_BUF_SIZE (BIG_BUF_SIZE_BASE + BIG_BUF_SIZE_XTRA)
-
- #define LEAP(yr) (yr % 4 == 0 && yr % 100 != 0 || yr % 400 == 0)
-
- /* this struct holds a system time in a way we can easily use it */
- typedef struct {
- ULONG st_tvsecs; /* as returned by the timer device */
- UWORD st_Year;
- UWORD st_Month;
- UWORD st_Day;
- UWORD st_Hour;
- UWORD st_Min;
- UWORD st_Sec;
- UBYTE st_DOW;
- } SystemTime_t;
-
- struct CyberNode {
- struct Node cn_Node;
- #define cn_Name cn_Node.ln_Name
- STRPTR cn_Command;
- STRPTR cn_Args;
- STRPTR cn_ReDirIn;
- STRPTR cn_ReDirOut;
- STRPTR cn_ReDirErr;
- STRPTR cn_CustomShell;
- STRPTR cn_SendToUser;
- ULONG cn_Stack;
- BYTE cn_Priority;
- UBYTE cn_DayOfWeek;
- UWORD cn_Month;
- ULONG cn_Day;
- ULONG cn_Hour;
- ULONG cn_HiMin;
- ULONG cn_LoMin;
- ULONG cn_DelayedCount;
- UBYTE cn_ObeyQueue;
- UBYTE cn_Flags;
- };
-
- /* these are the possible values for the flags in cn_Flags */
- #define CNB_NOLOG 0 /* don't do log when running the command */
- #define CNB_REXX 1 /* start command as a rexx script */
- #define CNB_CRONTAB 2 /* node was generated by an entry in crontab
- * file */
- #define CNB_SYSSH 3 /* use system shell instead of user shell */
- #define CNB_OUTAPP 4 /* append to output redirection instead of
- overwrite */
- #define CNB_ERRAPP 5 /* append to error redirection instead of
- overwrite */
- #define CNB_EXECONE 6 /* run job once and then delete it */
-
- #define CNF_NOLOG (1L << CNB_NOLOG)
- #define CNF_REXX (1L << CNB_REXX)
- #define CNF_CRONTAB (1L << CNB_CRONTAB)
- #define CNF_SYSSH (1L << CNB_SYSSH)
- #define CNF_OUTAPP (1L << CNB_OUTAPP)
- #define CNF_ERRAPP (1L << CNB_ERRAPP)
- #define CNF_EXECONE (1L << CNB_EXECONE)
-
- struct JobQueue {
- ULONG jq_Max;
- ULONG jq_Cur;
- struct MinList jq_FIFOList;
- };
-
- struct QueueFIFO {
- struct MinNode qf_Node;
- struct CyberNode *qf_CyberNode;
- };
-
- struct SystemECdata {
- UWORD jobNo;
- UBYTE queueNo;
- UBYTE flags;
- };
-
- /* stuff for handling our public semaphores. */
- struct MyPublicSema {
- struct SignalSemaphore mps_Sema;
- UBYTE *mps_SemaData;
- ULONG mps_UseCount;
- UBYTE mps_SemaName[4];
- };
-
- /*
- * here we have prototypes for all functions contained in or used by this
- * file
- */
- struct CyberNode *ParseEvent(STRPTR);
- void ParseBits(ULONG *, STRPTR);
- void UnParseBits(ULONG *, STRPTR, int, int);
- UWORD GetJobNum(void);
- void FreeJobNum(UWORD);
- void __stdargs Log(ULONG fmdId, ...);
- void __stdargs MySPrintf(STRPTR, STRPTR, ...);
- int __regargs main(char *cmdptr, int cmdlen, struct WBStartup *WBMsg);
- void ReadCronTab(void);
- BOOL GetARexxLib(void);
- void FreeARexxLib(void);
- void __stdargs ErrorMsg(ULONG fmtId, ...);
- void MyExit(int);
- void FreeEvents(BOOL);
- STRPTR WBtoCLIargs(struct WBStartup *WBMsg, STRPTR ArgTemplate);
- void StartSystemJob(struct CyberNode *cn);
- void StartRexxJob(struct CyberNode *cn);
- int __saveds __asm EndSystemJob(register __d0 int rc, register __d1 struct SystemECdata * data);
- void GetSystemTime(SystemTime_t *st, BOOL stIsSet);
- void ScanForJobs(void);
- void HandleRexxEvents(void);
- struct CyberNode *FindEvent(STRPTR name);
- BPTR SetupSendMail(STRPTR cmdName, STRPTR cmdArgs, STRPTR userName);
- struct MyPublicSema *InitMyPublicSemaphore(STRPTR semaName, ULONG semaDataSize);
- void FreeMyPublicSemaphore(struct MyPublicSema *mySema);
- STRPTR GetString(ULONG id);
- ULONG EventNextExecutes(struct CyberNode *cn, SystemTime_t *st);
- BOOL ProcessQueue(struct CyberNode *cn, BOOL TimeMatch);
- void DeleteEvent(struct CyberNode *cn);
-
- extern void DoMsg(struct RexxMsg *, APTR, int, int);
-
- void rx_Shutdown(void);
- STRPTR rx_Version(void);
- void rx_Suspend(void);
- void rx_Resume(void);
- int rx_NewEventFile(STRPTR);
- void rx_CloseEventFile(void);
- int rx_AddEvent(STRPTR);
- int rx_DeleteRexxEvent(STRPTR);
- int rx_DeleteEvent(STRPTR);
- void rx_PurgeRexxEvents(void);
- STRPTR rx_ShowEvent(STRPTR);
- STRPTR rx_ListEvents(void);
- STRPTR rx_ShowStatus(void);
- int rx_NewLogFile(STRPTR);
- void rx_CloseLogFile(void);
- int rx_SetQueueMax(STRPTR);
- int rx_GetQueueMax(STRPTR);
- STRPTR rx_EventNextExec(STRPTR name);
- STRPTR rx_NextEventToExec(void);
- STRPTR rx_ExpandSSSC(int SSSC);
- STRPTR rx_SSSCtoASCII(int SSSC);
-
- void __stdargs kprintf(STRPTR fmt, ...);
-