void main( void) { RCONbits.NOT_POR = 1; RCONbits.NOT_RI = 1; Hardware_Initialize(); Initialize_Variables(); /* initialize BACnet Data Link Layer */ dlmstp_set_my_address(42); dlmstp_set_max_info_frames(1); dlmstp_set_max_master(127); RS485_Set_Baud_Rate(38400); dlmstp_init(); /* Handle anything that needs to be done on powerup */ /* Greet the BACnet world! */ Send_I_Am(&Handler_Transmit_Buffer[0]); /* Main loop */ while (TRUE) { RESTART_WDT(); dlmstp_task(); MainTasks(); Global_Int(INT_ENABLED); ENABLE_TIMER4_INT(); } }
int _stdc main(int argc, char *argv[]) { char *p; NW(__fd2n); #if defined(__FLAT__) && !defined(UNIX) Hello("SQUISH/386", "SquishMail Conference Processor", version, "1990, " THIS_YEAR); #elif defined(LINUX) Hello("SQUISH/LINUX", "SquishMail Conference Processor", version, "1990, " THIS_YEAR); #elif defined(UNIX) Hello("SQUISH/UNIX", "SquishMail Conference Processor", version, "1990, " THIS_YEAR); #else Hello("SQUISH", "SquishMail Conference Processor", version, "1990, " THIS_YEAR); #endif #ifdef OS_2 /* Serialize Squish's execution */ BbsSemSerialize("/sem/squish/default", "BBSSEM"); #endif #ifdef __WATCOMC__ setbuf(stdout, NULL); #endif #ifdef DMALLOC /*dmalloc_on(TRUE);*/ #endif #ifdef DJ dj=fopen("dj.log", "a"); #endif #ifdef UNIX if (!getenv("SQUISH")) putenv("SQUISH=" INSTALL_PREFIX "/etc/squish.cfg"); #endif if (!fexist(ar.cfgname) && (p=getenv("SQUISH")) != NULL) (void)strcpy(ar.cfgname, p); #if defined(__MSDOS__) && !defined(__FLAT__) install_24(); (void)atexit(uninstall_24); #endif if (argc < 2) usage(); Initialize_Variables(); /* Use the SQUISH environment variable to locate config file, if necessary */ p=getenv("SQUISH"); if (p && !fexist(ar.cfgname)) /* as long as there's no squish.cfg in cwd */ (void)strcpy(ar.cfgname, p); ParseArgs(&ar, (byte **)argv); /* Command-line arguments */ /* strcpy(ar.cfgname,"Squish.Cfg");*/ Parse_Config(ar.cfgname); /* parse squish.cfg and areas.bbs */ /* { NETADDR bill={1,249,1,0}; if (DestIsHereA(&bill)) printf("!!! This copy of Squish is registered to Bill Cassidy !!!\n"); } */ Parse_Areas(*ar.areasbbs ? ar.areasbbs : config.areasbbs); /* If a log-file override was specified on the command line */ if (*ar.logfile) { if (config.logfile) free(config.logfile); config.logfile=sstrdup(ar.logfile); } InitializeConfig(); /* Initialize configuration */ if (ar.action==ACTION_GET || ar.action==ACTION_SEND || ar.action==ACTION_UPDATE || ar.action==ACTION_POLL) { config.flag &= ~FLAG_ADDMODE; HandleAttReqPoll(ar.action, ar.toscan); } else SquishSquashCycle(); #ifdef DJ if (dj) fclose(dj); #endif CleanupConfig(); (void)printf("\n" SQNAME ": Done!\n"); return (erl_max ? ERL_MAXMSGS : erl_echo ? ERL_TOSS_ECHO : erl_net ? ERL_TOSS_NET : erl_sent ? ERL_SENT_ECHO : ERL_NONE); }