static int hw3_opt_proc(void *data, const char *arg, int key, struct fuse_args *outargs) { /* The first non-option argument is the image file name. */ if (key == FUSE_OPT_KEY_NONOPT && !hw3_data.img_file) { if (strcmp(arg+strlen(arg)-4, ".img") != 0) { printf("bad image file (must end in .img): %s\n", arg); return -1; } hw3_data.img_file = strdup(arg); if ((disk = image_create(hw3_data.img_file)) == NULL) { printf("cannot open image file '%s': %s\n", arg, strerror(errno)); return -1; } return 0; } /* The second non-option argument is the mount directory. Check it * for NFS permissions issues and bail if it's not OK. */ else if (key == FUSE_OPT_KEY_NONOPT) { if (!checkdir(arg)) { printf("exiting...\n"); return -1; } } else if (key == KEY_CMDLINE) { hw3_data.cmd_mode = 1; return 0; } return 1; }
static int checkindir(long a, Dentry *d, long qpath) { Iobuf *p; int i, dmod; dmod = touch(a); p = xtag(a, Tind1, qpath); if(!p) return dmod; for(i=0; i<INDPERBUF; i++) { a = ((long*)p->iobuf)[i]; if(!a) continue; if(amark(a)) { if(flags & Cbad) { ((long*)p->iobuf)[i] = 0; p->flags |= Bmod; } continue; } if(d->mode & DDIR) dmod += checkdir(a, qpath); else if(flags & Crdall) xread(a, qpath); } putbuf(p); return dmod; }
void show_bid(char *srchbid) { FILE *fp; char buf[FILE_PATH_SIZE], *cp; if ((fp = fopen(Historyfile, "r")) == NULLFILE) { perror(Historyfile); return; } while(fgets(buf,sizeof(buf),fp) != NULLCHAR) { /* The first word on each line is all that matters */ cp=skipnonwhite(buf); *cp = '\0'; if(stricmp(srchbid,buf) == 0) { /* bid exists in some area */ break; } } if (feof(fp)) { printf ("bid %s not found in history file.\n", srchbid); fclose(fp); return; } fclose(fp); Bid2Find = srchbid; /* set flag for Index() */ if(checkdir(NULL, Index)) puts("ERROR detected, not all index files could be examined.\n"); }
void show_area_stats(void) { printf ("AREA #Msgs (KB) #Bulls (KB) #Traf (KB) #Held (KB)\n"); allsz = 0L; allmsgcnt=0; checkdir(NULL, show_area_tots); printf ("%-27s%6lu %5ldK ","==TOTALS==",allmsgcnt, (allsz+1023)/1024); printf ("\n"); }
int main(int argc, char** argv) { if (argc <= 1) { fprintf(stderr, "usage: %s dir\n", argv[0]); return 1; } checkdir(argv[1], NULL); return 0; }
static int dir_rewind(lua_State *L) { lua_apr_dir *directory; apr_status_t status; directory = checkdir(L, 1, 1); status = apr_dir_rewind(directory->handle); return push_status(L, status); }
static int dir_tostring(lua_State *L) { lua_apr_dir *directory; directory = checkdir(L, 1, 0); if (directory->handle != NULL) lua_pushfstring(L, "%s (%p)", lua_apr_dir_type.friendlyname, directory->handle); else lua_pushfstring(L, "%s (closed)", lua_apr_dir_type.friendlyname); return 1; }
static int dir_close(lua_State *L) { lua_apr_dir *directory; apr_status_t status; directory = checkdir(L, 1, 1); status = apr_dir_close(directory->handle); if (status == APR_SUCCESS) directory->handle = NULL; return push_status(L, status); }
static int dir_gc(lua_State *L) { lua_apr_dir *directory = checkdir(L, 1, 0); if (object_collectable((lua_apr_refobj*)directory)) { if (directory->handle != NULL) { apr_dir_close(directory->handle); directory->handle = NULL; } if (directory->memory_pool != NULL) { apr_pool_destroy(directory->memory_pool); directory->memory_pool = NULL; } } release_object((lua_apr_refobj*)directory); return 0; }
void checkdir(const char* path, const char* prefix) { DIR *d; struct dirent *de; struct stat st; char fullpath[FILENAME_MAX]; char fullprefix[FILENAME_MAX]; if ((d = opendir(path)) == NULL) err(1, "opendir(%s)", path); while ((de = readdir(d)) != NULL) { if (de->d_name[0] == '.') { if (de->d_name[1] == '\0') continue; else if (de->d_name[1] == '.' && de->d_name[2] == '\0') continue; } snprintf(fullpath, sizeof(fullpath), "%s/%s", path, de->d_name); if (lstat(fullpath, &st) != 0) err(1, "stat(%s)", fullpath); if (!S_ISDIR(st.st_mode)) continue; if (strcmp(de->d_name, "cur") == 0) printf("+%s ", prefix); if (strcmp(de->d_name, "cur") != 0 && strcmp(de->d_name, "new") != 0 && strcmp(de->d_name, "tmp") != 0) { if (prefix == NULL) snprintf(fullprefix, sizeof(fullprefix), "%s", de->d_name); else snprintf(fullprefix, sizeof(fullprefix), "%s/%s", prefix, de->d_name); checkdir(fullpath, fullprefix); } } if (closedir(d) != 0) errx(1, "closedir"); }
static int dir_entries(lua_State *L) { lua_apr_stat_context *context; /* Check for a valid, open directory. */ checkdir(L, 1, 1); /* Copy the stat() arguments to a userdatum. */ context = lua_newuserdata(L, sizeof(*context)); context->firstarg = 2; /* after directory handle */ context->lastarg = lua_gettop(L) - 1; /* before stat context */ check_stat_request(L, context); /* Return the iterator function and directory object. */ lua_pushcclosure(L, dir_read, 1); lua_pushvalue(L, 1); return 2; }
static int init_file_service(char *mimetypes_filename, char *doc_path) { int rc = 0; if ((rc = checkdir(doc_path))) { cp_fatal(rc, "can\'t open document root at [%s]", doc_path); exit(rc); } if ((rc = load_mime_types(mimetypes_filename))) { cp_fatal(rc, "can\'t load mime types from [%s], sorry", mimetypes_filename); exit(rc); } document_root = doc_path; return rc; }
static int dir_read(lua_State *L) { apr_status_t status; lua_apr_dir *directory; lua_apr_stat_context *context, backup_ctx; int raise_errors; directory = checkdir(L, 1, 1); if (lua_isuserdata(L, lua_upvalueindex(1))) { /* Iterator for directory:entries() */ context = lua_touserdata(L, lua_upvalueindex(1)); raise_errors = 1; } else { /* Standalone call to directory:read() */ backup_ctx.firstarg = 2; backup_ctx.lastarg = lua_gettop(L); check_stat_request(L, &backup_ctx); context = &backup_ctx; raise_errors = 0; } for (;;) { status = apr_dir_read(&context->info, context->wanted, directory->handle); if (APR_SUCCESS == status || APR_STATUS_IS_INCOMPLETE(status)) { if (!(context->info.valid & APR_FINFO_NAME \ && filename_symbolic(context->info.name))) return push_stat_results(L, context, directory->filepath); } else if (APR_STATUS_IS_ENOENT(status)) { return 0; } else if (raise_errors) { return raise_error_status(L, status); } else { return push_error_status(L, status); } } }
/* Function getnextturn(): * Checks the 7 of the 8 valid directions from the given point, * choosing those 7 based on the IP delta. Returns the "leftmost" * direction closest to "straight" that is available from the given * location. */ int getnextturn (int x, int y, int * dx, int * dy) { if (checkdir (x, y, *dx, *dy)) { return 0; } rotate (dx, dy, 45); if (checkdir (x, y, *dx, *dy)) { return 45; } rotate (dx, dy, 270); if (checkdir (x, y, *dx, *dy)) { return 315; } rotate (dx, dy, 135); if (checkdir (x, y, *dx, *dy)) { return 90; } rotate (dx, dy, 180); if (checkdir (x, y, *dx, *dy)) { return 270; } rotate (dx, dy, 225); if (checkdir (x, y, *dx, *dy)) { return 135; } rotate (dx, dy, 90); if (checkdir (x, y, *dx, *dy)) { return 225; } return 180; }
static int fsck(Dentry *d) { char *s; Rune r; Iobuf *p; int l, i, ns, dmod; long a, qpath; depth++; if(depth >= maxdepth){ maxdepth = depth; if(maxdepth >= MAXDEPTH){ cprint("max depth exceeded: %s\n", name); return 0; } } dmod = 0; if(!(d->mode & DALLOC)) return 0; nfiles++; ns = strlen(name); i = strlen(d->name); if(i >= NAMELEN){ d->name[NAMELEN-1] = 0; cprint("%s->name (%s) not terminated\n", name, d->name); return 0; } ns += i; if(ns >= sizname){ cprint("%s->name (%s) name too large\n", name, d->name); return 0; } for (s = d->name; *s; s += l){ l = chartorune(&r, s); if (r == Runeerror) for (i = 0; i < l; i++){ s[i] = '_'; cprint("%s->name (%s) bad UTF\n", name, d->name); dmod++; } } strcat(name, d->name); if(d->mode & DDIR){ if(ns > 1) strcat(name, "/"); if(flags & Cpdir) cprint("%s\n", name); } else if(flags & Cpfile) cprint("%s\n", name); qpath = d->qid.path & ~QPDIR; qmark(qpath); if(qpath > maxq) maxq = qpath; for(i=0; i<NDBLOCK; i++) { a = d->dblock[i]; if(!a) continue; if(amark(a)) { d->dblock[i] = 0; dmod++; continue; } if(d->mode & DDIR) dmod += checkdir(a, qpath); else if(flags & Crdall) xread(a, qpath); } a = d->iblock; if(a && amark(a)) { d->iblock = 0; dmod++; } else if(a) dmod += checkindir(a, d, qpath); a = d->diblock; if(a && amark(a)) { d->diblock = 0; return dmod + 1; } dmod += touch(a); if(p = xtag(a, Tind2, qpath)){ for(i=0; i<INDPERBUF; i++){ a = ((long*)p->iobuf)[i]; if(!a) continue; if(amark(a)) { if(flags & Cbad) { ((long*)p->iobuf)[i] = 0; p->flags |= Bmod; } continue; } dmod += checkindir(a, d, qpath); } putbuf(p); } return dmod; }
void TERMWINDOWMEMBER greeting(void) { MRO.Verbose = FALSE; if (loggedIn) { terminate(FALSE); } OC.Echo = BOTH; OC.setio(); setdefaultconfig(FALSE); pause(10); cls(SCROLL_SAVE); doccr(); StatusLine.Update(WC_TWp); if (modStat) { if (cfg.connectwait) { CITWINDOW *w = ScreenSaver.IsOn() ? NULL : CitWindowsMsg(NULL, getmsg(84)); pause(cfg.connectwait * 100); if (w) { destroyCitWindow(w, FALSE); } } CommPort->FlushInput(); } // make sure we want to talk to this baud rate if (modStat && (CommPort->GetModemSpeed() < cfg.minbaud)) { dispBlb(B_TOOLOW); CITWINDOW *w = ScreenSaver.IsOn() ? NULL : CitWindowsMsg(NULL, getmsg(82)); Hangup(); pause(200); if (w) { destroyCitWindow(w, FALSE); } } else { OC.User.SetCanControlD(TRUE); // set terminal autoansi(); OC.SetOutFlag(OUTOK); if (modStat || debug) { hello(); doCR(); } OC.SetOutFlag(OUTOK); mPrintfCR(getmsg(683), cfg.nodeTitle, cfg.nodeRegion, cfg.nodeCountry); mPrintfCR(getmsg(682), cfg.softverb, *cfg.softverb ? spc : ns, programName, version); mPrintf(pcts, Author); #if VERSION != RELEASE doCR(); #ifndef HARRY CRCRmPrintfCR(" 2=== 1NOTE02 ===0"); #else CRCRmPrintfCR(" 2=== NOTE ===0"); #endif #ifndef NDEBUG CRmPrintf("This BBS is running pre-release software. Because this is a test version "); mPrintf("of the software, it has extra code to assure that things are running as "); mPrintf("they should. This may cause a noticeable slow-down in the operation of "); mPrintf("the board. Also, because this is pre-release software, it may contain "); mPrintf("bugs that could cause a loss of data. This is not likely, but it is best "); mPrintfCR("to be aware of potential problems before they surprise you."); #else mPrintf("This BBS is running pre-release software. Because this is pre-release "); mPrintf("software, it may contain "); mPrintf("bugs that could cause a loss of data. This is not likely, but it is best "); mPrintfCR("to be aware of potential problems before they surprise you."); #endif #ifndef HARRY CRmPrintfCR(" 2=== 1NOTE02 ===0"); #else CRmPrintfCR(" 2=== NOTE ===0"); #endif #endif char dtstr[80]; strftime(dtstr, 79, cfg.vdatestamp, 0l); doCR(); CRmPrintf(pcts, dtstr); if (!cfg.forcelogin) { CRmPrintf(getmsg(677)); CRmPrintf(getmsg(678)); CRmPrintf(getmsg(679)); } CurrentRoom->Load(LOBBY); checkdir(); thisRoom = LOBBY; const ulong messages = Talley->MessagesInRoom(thisRoom); CRmPrintfCR(getmsg(144), ltoac(messages), (messages == 1) ? cfg.Lmsg_nym : cfg.Lmsgs_nym); CommPort->FlushInput(); } }
int main() { int choice, i, j; char name[256]; #if 0 { int error; toolfs_act_type action; char pathname[MYNAME_MAX]="/home/hsingh/tmp"; action = TOOLFS_READINODE_TABLE; error = toolfs((const char *) &pathname[0], action); printf("\n Return toolfs = %d\n",error); recover(); exit(0); } #endif do { printf("\n 1. List Folder/Directory Details"); printf("\n 2. List Current INODE Table Details"); printf("\n 3. Damage a Folder while deleting a file "); printf("\n 4. Fix/Undelete Folder/Directory"); printf("\n 5. Exit"); printf("\nEnter Your Choice : "); scanf("%d", &choice); switch (choice) { case 1: printf("***** Enter Path (relative or absolute) ***** "); do { printf("\nEnter Path Name : "); scanf("%s", name); printf("\n name=%s\n",name); //checkpathname(name); clearmystats(); myls(&name[0]); printmystats(1); } while (0); break; case 2: printf("***** Enter Path (relative or absolute) ***** "); do { printf("\nEnter Path Name : "); scanf("%s", name); //checkpathname(name); //myls(&name[0]); checkdir(name); } while (0); break; case 3: printf("***** Enter File name with Path (relative or absolute) ***** "); do { scanf("%s", name); //checkpathname(name); myls(&name[0]); } while (0); break; case 4: printf("***** Enter Path (relative or absolute) ***** "); do { printf("\nEnter Path Name : "); scanf("%s", name); //checkpathname(name); myls(&name[0]); } while (0); break; } } while (choice != 5) ; printf("\n Exiting gracefully\n"); }
/* Build a Java Home structure for a path */ static home_data *build(char *path) { home_data *data = NULL; char *cfgf = NULL; char buf[1024]; int x = 0; int k = 0; if (path == NULL) return (NULL); log_debug("Attempting to locate Java Home in %s", path); if (checkdir(path) == false) { log_debug("Path %s is not a directory", path); return (NULL); } while (location_jvm_cfg[x] != NULL) { if ((k = replace(buf, 1024, location_jvm_cfg[x], "$JAVA_HOME", path)) != 0) { log_error("Error replacing values for jvm.cfg (%d)", k); return (NULL); } log_debug("Attempting to locate VM configuration file %s", buf); if (checkfile(buf) == true) { log_debug("Found VM configuration file at %s", buf); cfgf = strdup(buf); break; } x++; } data = (home_data *)malloc(sizeof(home_data)); data->path = strdup(path); data->cfgf = cfgf; data->jvms = NULL; data->jnum = 0; /* We don't have a jvm.cfg configuration file, so all we have to do is trying to locate the "default" Java Virtual Machine library */ if (cfgf == NULL) { log_debug("VM configuration file not found"); x = 0; while (location_jvm_default[x] != NULL) { char *libr = location_jvm_default[x]; if ((k = replace(buf, 1024, libr, "$JAVA_HOME", path)) != 0) { log_error("Error replacing values for JVM library (%d)", k); return (NULL); } log_debug("Attempting to locate VM library %s", buf); if (checkfile(buf) == true) { data->jvms = (home_jvm **)malloc(2 * sizeof(home_jvm *)); data->jvms[0] = (home_jvm *)malloc(sizeof(home_jvm)); data->jvms[0]->name = NULL; data->jvms[0]->libr = strdup(buf); data->jvms[1] = NULL; data->jnum = 1; return (data); } x++; } return (data); } /* If we got here, we most definitely found a jvm.cfg file */ if (parse(data) == false) { log_error("Cannot parse VM configuration file %s", data->cfgf); } return (data); }
int ccnet_session_load_config (CcnetSession *session, const char *config_dir_r) { int ret = 0; char *config_file, *config_dir; char *id = 0, *name = 0, *port_str = 0, *lport_str, *user_name = 0; #ifdef CCNET_SERVER char *service_url; #endif int port, local_port = 0; unsigned char sha1[20]; GKeyFile *key_file; config_dir = ccnet_expand_path (config_dir_r); if (checkdir(config_dir) < 0) { ccnet_error ("Config dir %s does not exist or is not " "a directory.\n", config_dir); return -1; } config_file = g_build_filename (config_dir, SESSION_CONFIG_FILENAME, NULL); key_file = g_key_file_new (); g_key_file_set_list_separator (key_file, ','); if (!g_key_file_load_from_file (key_file, config_file, G_KEY_FILE_KEEP_COMMENTS, NULL)) { ccnet_warning ("Can't load config file %s.\n", config_file); return -1; } id = ccnet_key_file_get_string (key_file, "General", "ID"); user_name = ccnet_key_file_get_string (key_file, "General", "USER_NAME"); name = ccnet_key_file_get_string (key_file, "General", "NAME"); #ifdef CCNET_SERVER service_url = ccnet_key_file_get_string (key_file, "General", "SERVICE_URL"); #endif port_str = ccnet_key_file_get_string (key_file, "Network", "PORT"); lport_str = ccnet_key_file_get_string (key_file, "Client", "PORT"); if (port_str == NULL) port = DEFAULT_PORT; else port = atoi (port_str); if (lport_str != NULL) local_port = atoi (lport_str); if ( (id == NULL) || (strlen (id) != SESSION_ID_LENGTH) || (hex_to_sha1 (id, sha1) < 0) ) { ccnet_error ("Wrong ID\n"); ret = -1; goto onerror; } memcpy (session->base.id, id, 40); session->base.id[40] = '\0'; session->base.name = g_strdup(name); session->base.user_name = g_strdup(user_name); session->base.public_port = port; #ifdef CCNET_SERVER session->base.service_url = g_strdup(service_url); #endif session->config_file = config_file; session->config_dir = config_dir; session->local_port = local_port; session->keyf = key_file; load_rsakey(session); ret = 0; onerror: g_free (id); g_free (name); g_free (user_name); g_free (port_str); #ifdef CCNET_SERVER g_free (service_url); #endif return ret; }
bool ZIP_Wrapper::uncompress (char* zip_archive, char* path, bool verbose) { //open the zip archive unzFile uf=0; uf = unzOpen(zip_archive); if (uf==0) { DANCE_ERROR (DANCE_LOG_ERROR, (LM_DEBUG,ACE_TEXT("unzOpen failed to open the") ACE_TEXT(" zipfile\n"))); return false; } //get the name of the archive ACE_CString arch_dir (path); arch_dir += "/"; //get only the name of the archive; remove path info char* n = ACE_OS::strstr (zip_archive, "/"); char* zip_name = 0; while (n != 0) { zip_name = ++n; n = ACE_OS::strstr (n, "/"); } arch_dir += zip_name; //NOTE: Assumes .zip or cpk extension arch_dir = arch_dir.substring (0, arch_dir.length () - 4); //create directory with the name of zip archive ACE_OS::mkdir(arch_dir.c_str()); //if dir exists -1 is returned and ignored unz_global_info gi; int err = unzGetGlobalInfo(uf, &gi); if (err!=UNZ_OK) { DANCE_ERROR (DANCE_LOG_ERROR, (LM_DEBUG, ACE_TEXT("unzGetGlobalInfo failed to get global") ACE_TEXT(" information about zipfile\n"), err)); return false; } err =unzGoToFirstFile(uf); if (err!=UNZ_OK) { DANCE_ERROR (DANCE_LOG_ERROR, (LM_DEBUG,ACE_TEXT("error %d with zipfile in" ACE_TEXT(" unzGoToFirstFile\n")), err)); return false; } /* read each entry of zip file, create directory structure if it is a non existing directory whereas if it is a file, write the file at the proper path in the directory structure */ for (uLong i=0;i<gi.number_entry;i++) { char filename_inzip[256]; unz_file_info file_info; err = unzGetCurrentFileInfo(uf, &file_info, filename_inzip, sizeof(filename_inzip), 0, 0, 0, 0); if (err!=UNZ_OK) { DANCE_ERROR (DANCE_LOG_ERROR, (LM_DEBUG, ACE_TEXT("unzGetCurrentFileInfo failed") ACE_TEXT(" while trying to get information") ACE_TEXT(" about currentfile\n"), err)); break; } int direc = checkdir(filename_inzip); /* If it is a directory, we create directory structure */ if (direc==1) { makethedir(filename_inzip, arch_dir); } /* If it is a file, we read its data and write the uncompressed data to the file with proper path.*/ else if (direc==0) { handlethefile(filename_inzip, uf, file_info, verbose, arch_dir); } if ((i+1)<gi.number_entry) { err = unzGoToNextFile(uf); if (err!=UNZ_OK) { DANCE_ERROR (DANCE_LOG_ERROR, (LM_ERROR,ACE_TEXT("unzGoToNextFile failed") ACE_TEXT(" while trying to go to") ACE_TEXT(" nextfile\n"), err)); break; } } } unzClose(uf); return true; }
static Bool initCitadel(void) { if (!read_cfg_messages()) { #ifdef WINCIT char Buffer[128]; sprintf(Buffer, getmsg(188), getmsg(671)); MessageBox(NULL, Buffer, NULL, MB_ICONSTOP | MB_OK); #else printf(getmsg(188), getmsg(671)); #endif return (FALSE); } checkfiles(); initExtDrivers(); get_os(); cfg.battr = 0xff; setscreen(); logo(TRUE); // no go for debug version; td32 go crash crash init_internal_sound(); // some mouse initialization technology!!!! initMouseHandler(); hideCounter = 1; if (time(NULL) < 700000000L) { #ifdef WINCIT MessageBox(NULL, getcfgmsg(119), NULL, MB_ICONSTOP | MB_OK); #else doccr(); doccr(); cPrintf(getcfgmsg(119)); doccr(); #endif dump_cfg_messages(); return (FALSE); } static char prompt[92]; static char citadel[92]; char *envprompt; char *citprompt; envprompt = getenv(getcfgmsg(120)); citprompt = getenv(getcfgmsg(121)); if (citprompt) { sprintf(prompt, getcfgmsg(122), citprompt); } else if (envprompt) { sprintf(prompt, getcfgmsg(123), envprompt); } else { strcpy(prompt, getcfgmsg(124)); } putenv(prompt); sprintf(citadel, getcfgmsg(125), programName, version); putenv(citadel); #ifndef WINCIT OC.whichIO = CONSOLE; OC.SetOutFlag(OUTOK); OC.Echo = BOTH; OC.setio(); #endif VerifyHeap(1); // If we aren't reconfiguring, load the tables... if (!reconfig) { // Start by reading ETC.TAB getcwd(etcpath, 64); FILE *fd; if ((fd = fopen(etcTab, FO_RB)) != NULL) { if (filelength(fileno(fd)) != (long) sizeof(config) || fread(&cfg, 1, sizeof(config), fd) != (long) sizeof(config)) { memset(&cfg, 0, sizeof(cfg)); reconfig = TRUE; } fclose(fd); unlink(etcTab); // If ETC.TAB could be loaded, load the rest if (!reconfig) { changedir(cfg.homepath); allocateTables(); if (!LogTab.Load() || !MessageDat.LoadTable() || !RoomTab.Load()) { reconfig = TRUE; } Cron.ReadTable(WC_TWpn); } } else { if (!batchmode) { #ifdef WINCIT MessageBox(NULL, "No ETC.TAB.", NULL, MB_ICONSTOP | MB_OK); #else doccr(); discardable *d; if ((d = readData(6)) != NULL) { int i; for (i = 0; ((char **) d->next->aux)[i][0] != '#'; i++) { cPrintf(pcts, ((char **) d->next->aux)[i]); doccr(); } doccr(); discardData(d); } else { cOutOfMemory(28); } DeinitializeTimer(); critical(FALSE); #endif exit(1); } reconfig = TRUE; } } if (reconfig) { cfg.attr = 7; #ifndef WINCIT pause(200); cls(SCROLL_SAVE); cCPrintf(getcfgmsg(126)); doccr(); #endif if (!configcit()) { #ifdef WINCIT MessageBox(NULL, getcfgmsg(127), NULL, MB_ICONSTOP | MB_OK); #else doccr(); doccr(); cPrintf(getcfgmsg(127)); doccr(); #endif dump_cfg_messages(); return (FALSE); } #ifndef WINCIT setdefaultTerm(TT_ANSI); CurrentUser->SetWidth(80); #endif Cron.ReadCronCit(WC_TWpn); } else { #ifndef WINCIT if (!CreateScrollBackBuffer()) { cPrintf(getcfgmsg(60)); doccr(); } #endif if (readconfigcit) // forced to read in config.cit { if (!readconfig(NULL, 1)) { #ifdef WINCIT MessageBox(NULL, getcfgmsg(129), NULL, MB_ICONSTOP | MB_OK); #else doccr(); doccr(); cPrintf(getcfgmsg(129)); doccr(); #endif dump_cfg_messages(); return (FALSE); } } } VerifyHeap(1); makeBorders(); readBordersDat(); if (cmd_nobells) { cfg.noBells = 2; } if (cmd_nochat) { cfg.noChat = TRUE; } if (cmd_mdata != CERROR) { cfg.mdata = cmd_mdata; } if (*cfg.f6pass) { if (SameString(cfg.f6pass, getmsg(670))) { ConsoleLock.LockF6(); } else { ConsoleLock.Lock(); } } #ifndef WINCIT if (cfg.ovrEms) { if (_OvrInitEms(0, 0, 0)) { cPrintf(getcfgmsg(130)); doccr(); pause(200); } } if (cfg.ovrExt) { if (_OvrInitExt(0, 0)) { cPrintf(getcfgmsg(131)); doccr(); pause(200); } } CommPort->Init(); setscreen(); #endif logo(TRUE); // no go for debug version; td32 go crash crash #ifndef WINCIT StatusLine.Update(WC_TWp); #endif if (cfg.msgpath[(strlen(cfg.msgpath) - 1)] == '\\') { cfg.msgpath[(strlen(cfg.msgpath) - 1)] = '\0'; } // move to home path changedir(cfg.homepath); char FileName[128]; ReIndexFileInfo(); // keep fileinfo.dat nice and pretty // open message file if (!MessageDat.OpenMessageFile(cfg.msgpath)) { illegal(getmsg(78), MessageDat.GetFilename()); } // Then room file sprintf(FileName, sbs, cfg.homepath, roomDat); openFile(FileName, &RoomFile); citOpen(cfg.trapfile, CO_A, &TrapFile); initMenus(); dump_cfg_messages(); if(!read_tr_messages()) { errorDisp(getmsg(172)); } else { #ifdef WINCIT trap(T_SYSOP, "", gettrmsg(37)); #else trap(T_SYSOP, gettrmsg(37)); #endif dump_tr_messages(); } read_cfg_messages(); // uh-oh! if (!GroupData.Load()) { return (FALSE); } if (!HallData.Load()) { return (FALSE); } getRoomPos(); if (cfg.accounting) { ReadGrpdataCit(WC_TWpn); } ReadExternalCit(WC_TWpn); ReadProtocolCit(WC_TWpn); ReadMdmresltCit(WC_TWpn); ReadCommandsCit(WC_TWpn); #ifndef WINCIT ReadMCICit(FALSE); CurrentRoom->Load(LOBBY); thisRoom = LOBBY; checkdir(); if (!slv_door) { CITWINDOW *w = CitWindowsMsg(NULL, getmsg(19)); Initport(); Initport(); if (w) { destroyCitWindow(w, FALSE); } } else { CommPort->Enable(); } OC.whichIO = MODEM; OC.setio(); #endif // record when we put system up time(&uptimestamp); #ifndef WINCIT setdefaultconfig(FALSE); Talley->Fill(); #endif logo(FALSE); VerifyHeap(1); dump_cfg_messages(); compactMemory(1); return (TRUE); }
/* * Scan outbound, the call status is set in three counters: internet, ISDN and POTS (analogue modems). * For all systems the CM and Txx flags are checked and for official * FidoNet nodes the Zone Mail Hour wich belongs to the destination zone. * All nodes are qualified if there is a way to call them or not on this moment. * The method how to call a node is decided as well. * * On success, return 0. */ int outstat() { int rc, first = TRUE, T_window, iszmh = FALSE; struct _alist *tmp, *old; char digit[6], flstr[15], *temp, as[6], be[6], utc[6], flavor, *temp2, *fmt, *buf; time_t now; struct tm tm; int uhour, umin, thour, tmin; pp_list *tpl; faddr *fa; FILE *fp; DIR *dp = NULL; struct dirent *de; struct stat sb; unsigned int ibnmask = 0, ifcmask = 0, itnmask = 0, outsize = 0; nodelist_modem **tmpm; for (tmpm = &nl_tcpip; *tmpm; tmpm=&((*tmpm)->next)) { if (strcmp((*tmpm)->name, "IBN") == 0) ibnmask = (*tmpm)->mask; if (strcmp((*tmpm)->name, "IFC") == 0) ifcmask = (*tmpm)->mask; if (strcmp((*tmpm)->name, "ITN") == 0) itnmask = (*tmpm)->mask; } now = time(NULL); gmtime_r(&now, &tm); // UTC time uhour = tm.tm_hour; umin = tm.tm_min; snprintf(utc, 6, "%02d:%02d", uhour, umin); Syslog('+', "Scanning outbound at %s UTC.", utc); nxt_hour = 24; nxt_min = 0; inet_calls = isdn_calls = pots_calls = 0; /* * Clear current table */ for (tmp = alist; tmp; tmp = old) { old = tmp->next; free(tmp); } alist = NULL; if ((rc = scanout(each))) { Syslog('?', "Error scanning outbound, aborting"); return rc; } /* * Check private outbound box for nodes in the setup. */ temp = calloc(PATH_MAX, sizeof(char)); snprintf(temp, PATH_MAX, "%s/etc/nodes.data", getenv("FTND_ROOT")); if ((fp = fopen(temp, "r")) == NULL) { Syslog('?', "Error open %s, aborting", temp); free(temp); return 1; } fread(&nodeshdr, sizeof(nodeshdr), 1, fp); fseek(fp, 0, SEEK_SET); fread(&nodeshdr, nodeshdr.hdrsize, 1, fp); while ((fread(&nodes, nodeshdr.recsize, 1, fp)) == 1) { if (strlen(nodes.OutBox)) { if (nodes.Crash) flavor = 'c'; else if (nodes.Hold) flavor = 'h'; else flavor = 'o'; fa = (faddr *)malloc(sizeof(faddr)); fa->name = NULL; fa->domain = xstrcpy(nodes.Aka[0].domain); fa->zone = nodes.Aka[0].zone; fa->net = nodes.Aka[0].net; fa->node = nodes.Aka[0].node; fa->point = nodes.Aka[0].point; checkdir(nodes.OutBox, fa, flavor); if (fa->domain) free(fa->domain); free(fa); } fseek(fp, nodeshdr.filegrp + nodeshdr.mailgrp, SEEK_CUR); } fclose(fp); /* * Start checking T-Mail fileboxes */ if (strlen(CFG.tmailshort) && (dp = opendir(CFG.tmailshort))) { Syslog('o', "Checking T-Mail short box \"%s\"", CFG.tmailshort); while ((de = readdir(dp))) { if (strcmp(de->d_name, ".") && strcmp(de->d_name, "..")) { snprintf(temp, PATH_MAX, "%s/%s", CFG.tmailshort, de->d_name); if (stat(temp, &sb) == 0) { Syslog('o' ,"checking \"%s\"", de->d_name); if (S_ISDIR(sb.st_mode)) { int i; char b=0; for (i=0; (i<8) && (!b); ++i) { char c = tolower(de->d_name[i]); if ( (c<'0') || (c>'v') || ((c>'9') && (c<'a')) ) b=1; } if (de->d_name[8]!='.') b=1; for (i=9; (i<11) && (!b); ++i) { char c = tolower(de->d_name[i]); if ( (c<'0') || (c>'v') || ((c>'9') && (c<'a')) ) b=1; } if (b) continue; if (de->d_name[11]==0) flavor='o'; else if ((tolower(de->d_name[11])=='h') && (de->d_name[12]==0)) flavor='h'; else continue; fa = (faddr*)malloc(sizeof(faddr)); fa->name = NULL; fa->domain = NULL; memset(&digit, 0, sizeof(digit)); digit[0] = de->d_name[0]; digit[1] = de->d_name[1]; fa->zone = strtol(digit, NULL, 32); memset(&digit, 0, sizeof(digit)); digit[0] = de->d_name[2]; digit[1] = de->d_name[3]; digit[2] = de->d_name[4]; fa->net = strtol(digit, NULL, 32); memset(&digit, 0, sizeof(digit)); digit[0] = de->d_name[5]; digit[1] = de->d_name[6]; digit[2] = de->d_name[7]; fa->node = strtol(digit, NULL, 32); memset(&digit, 0, sizeof(digit)); digit[0] = de->d_name[9]; digit[1] = de->d_name[10]; fa->point = strtol(digit, NULL, 32); if (SearchFidonet(fa->zone)) { fa->domain = xstrcpy(fidonet.domain); checkdir(temp, fa, flavor); } if (fa->domain) free(fa->domain); free(fa); } } } } closedir(dp); } if (strlen(CFG.tmaillong) && (dp = opendir(CFG.tmaillong))) { temp2 = calloc(PATH_MAX, sizeof(char)); Syslog('o', "Checking T-Mail long box \"%s\"", CFG.tmaillong); while ((de = readdir(dp))) { if (strcmp(de->d_name, ".") && strcmp(de->d_name, "..")) { snprintf(temp, PATH_MAX, "%s/%s", CFG.tmaillong, de->d_name); if (stat(temp, &sb) == 0) { Syslog('o' ,"checking \"%s\"", de->d_name); if (S_ISDIR(sb.st_mode)) { char c, d; int n; snprintf(temp2, PATH_MAX, "%s", de->d_name); fa = (faddr*)malloc(sizeof(faddr)); fa->name = NULL; fa->domain = NULL; n = sscanf(temp2, "%u.%u.%u.%u.%c%c", &(fa->zone), &(fa->net), &(fa->node), &(fa->point), &c, &d); if ((n==4) || ((n==5) && (tolower(c)=='h'))) { if (SearchFidonet(fa->zone)) { fa->domain = xstrcpy(fidonet.domain); if (n==4) flavor = 'o'; else flavor = 'h'; checkdir(temp, fa, flavor); } } if (fa->domain) free(fa->domain); free(fa); } } } } closedir(dp); free(temp2); } /* * During processing the outbound list, determine when the next event will occur, * ie. the time when the callout status of a node changes because of starting a * ZMH, or changeing the time window for Txx flags. */ for (tmp = alist; tmp; tmp = tmp->next) { if (first) { Syslog('+', "Flavor Out Size Online Modem ISDN TCP/IP Calls Status Mode Address"); first = FALSE; } rc = load_node(tmp->addr); /* * Zone Mail Hours, only use Fidonet Hours. * Other nets use your default ZMH. */ T_window = iszmh = FALSE; switch (tmp->addr.zone) { case 1: if (uhour == 9) iszmh = TRUE; set_next(9, 0); set_next(10, 0); break; case 2: if (((uhour == 2) && (umin >= 30)) || ((uhour == 3) && (umin < 30))) iszmh = TRUE; set_next(2, 30); set_next(3, 30); break; case 3: if (uhour == 18) iszmh = TRUE; set_next(18, 0); set_next(19, 0); break; case 4: if (uhour == 8) iszmh = TRUE; set_next(8, 0); set_next(9, 0); break; case 5: if (uhour == 1) iszmh = TRUE; set_next(1, 0); set_next(2, 0); break; case 6: if (uhour == 20) iszmh = TRUE; set_next(20, 0); set_next(21, 0); break; default: if (get_zmh()) iszmh = TRUE; break; } if (tmp->t1 && tmp->t2) { /* * Txx flags, check callwindow */ thour = toupper(tmp->t1) - 'A'; if (isupper(tmp->t1)) tmin = 0; else tmin = 30; snprintf(as, 6, "%02d:%02d", thour, tmin); set_next(thour, tmin); thour = toupper(tmp->t2) - 'A'; if (isupper(tmp->t2)) tmin = 0; else tmin = 30; snprintf(be, 6, "%02d:%02d", thour, tmin); set_next(thour, tmin); if (strcmp(as, be) > 0) { /* * Time window is passing midnight */ if ((strcmp(utc, as) >= 0) || (strcmp(utc, be) < 0)) T_window = TRUE; } else { /* * Time window is not passing midnight */ if ((strcmp(utc, as) >= 0) && (strcmp(utc, be) < 0)) T_window = TRUE; } } memset(&flstr, 0, sizeof(flstr)); strncpy(flstr, "...... .... ..", 14); /* * If the node has internet and we have internet configured, * check if we can send immediatly. Works for CM and ICM. */ if (TCFG.max_tcp && (tmp->can_ip && tmp->is_icm) && (((tmp->flavors) & F_IMM) || ((tmp->flavors) & F_CRASH) || ((tmp->flavors) & F_NORMAL)) && ((tmp->ipflags & ibnmask) || (tmp->ipflags & ifcmask) || (tmp->ipflags & itnmask))) { tmp->flavors |= F_CALL; } /* * Immediate Mail check */ if ((tmp->flavors) & F_IMM) { flstr[0]='D'; /* * Immediate mail, send if node is CM or is in a Txx window or is in ZMH. */ if (tmp->is_cm || T_window || iszmh) { tmp->flavors |= F_CALL; } /* * Now check again for the ICM flag. */ if (tmp->is_icm && TCFG.max_tcp && ((tmp->ipflags & ibnmask) || (tmp->ipflags & ifcmask) || (tmp->ipflags & itnmask))) { tmp->flavors |= F_CALL; } } if ((tmp->flavors) & F_CRASH ) { flstr[1]='C'; /* * Crash mail, send if node is CM or is in a Txx window or is in ZMH. */ if (tmp->is_cm || T_window || iszmh) { tmp->flavors |= F_CALL; } /* * Now check again for the ICM flag. */ if (tmp->is_icm && TCFG.max_tcp && ((tmp->ipflags & ibnmask) || (tmp->ipflags & ifcmask) || (tmp->ipflags & itnmask))) { tmp->flavors |= F_CALL; } } if ((tmp->flavors) & F_NORMAL) flstr[2]='N'; if ((tmp->flavors) & F_HOLD ) flstr[3]='H'; if ((tmp->flavors) & F_FREQ ) flstr[4]='R'; if ((tmp->flavors) & F_POLL ) { flstr[5]='P'; tmp->flavors |= F_CALL; } if ((tmp->flavors) & F_ISFIL ) { flstr[7]='A'; /* * Arcmail and maybe file attaches, send during ZMH or if node has a Txx window. */ if ((iszmh || T_window) && !((tmp->flavors) & F_HOLD)) { tmp->flavors |= F_CALL; } } if ((tmp->flavors) & F_ISPKT ) { flstr[8]='M'; /* * Normal mail, send during ZMH or if node has a Txx window. */ if ((iszmh || T_window) && !((tmp->flavors) & F_HOLD)) { tmp->flavors |= F_CALL; } } if ((tmp->flavors) & F_ISFLO ) flstr[9]='F'; if (tmp->cst.tryno >= 30) { /* * Node is undialable, clear callflag */ tmp->flavors &= ~F_CALL; } if (tmp->t1) flstr[12] = tmp->t1; if (tmp->t2) flstr[13] = tmp->t2; /* * If forbidden to call from setup, clear callflag. */ if (nodes.NoCall) tmp->flavors &= ~F_CALL; /* * If we must call this node, figure out how to call this node. */ if ((tmp->flavors) & F_CALL) { tmp->callmode = CM_NONE; if (TCFG.max_tcp && ((tmp->ipflags & ibnmask) || (tmp->ipflags & ifcmask) || (tmp->ipflags & itnmask))) { inet_calls++; tmp->callmode = CM_INET; } if ((tmp->callmode == CM_NONE) && isdn_lines) { /* * If any matching port found, mark node ISDN */ for (tpl = pl; tpl; tpl = tpl->next) { if (tmp->diflags & tpl->dflags) { isdn_calls++; tmp->callmode = CM_ISDN; break; } } } if ((tmp->callmode == CM_NONE) && pots_lines) { /* * If any matching ports found, mark node POTS */ for (tpl = pl; tpl; tpl = tpl->next) { if (tmp->moflags & tpl->mflags) { pots_calls++; tmp->callmode = CM_POTS; break; } } } /* * Here we are out of options, clear callflag. */ if (tmp->callmode == CM_NONE) { buf = calloc(81, sizeof(char)); fido2str_r(tmp->addr, 0x0f, buf); Syslog('!', "No method to call %s available", buf); free(buf); tmp->flavors &= ~F_CALL; } } if ((tmp->flavors) & F_CALL) flstr[10]='C'; else /* * Safety, clear callmode. */ tmp->callmode = CM_NONE; /* * Show callresult for this node. */ outsize += (unsigned int)tmp->size; fmt = calloc(81, sizeof(char)); buf = calloc(81, sizeof(char)); size_str_r(tmp->size, fmt); fido2str_r(tmp->addr, 0x0f, buf); snprintf(temp, PATH_MAX, "%s %8s %08x %08x %08x %08x %5d %s %s %s", flstr, fmt, (unsigned int)tmp->olflags, (unsigned int)tmp->moflags, (unsigned int)tmp->diflags, (unsigned int)tmp->ipflags, tmp->cst.tryno, callstatus(tmp->cst.trystat), callmode(tmp->callmode), buf); Syslog('+', "%s", temp); free(fmt); free(buf); } /* All nodes scanned. */ if (nxt_hour == 24) { /* * 24:00 hours doesn't exist */ nxt_hour = 0; nxt_min = 0; } /* * Always set/reset semafore do_inet if internet is needed. */ if (!IsSema((char *)"do_inet") && inet_calls) { CreateSema((char *)"do_inet"); s_do_inet = TRUE; Syslog('c', "Created semafore do_inet"); } else if (IsSema((char *)"do_inet") && !inet_calls) { RemoveSema((char *)"do_inet"); s_do_inet = FALSE; Syslog('c', "Removed semafore do_inet"); } /* * Update outbound size MIB */ mib_set_outsize(outsize); /* * Log results */ snprintf(waitmsg, 81, "Next event at %02d:%02d UTC", nxt_hour, nxt_min); Syslog('+', "Systems to call: Inet=%d, ISDN=%d, POTS=%d, Next event at %02d:%02d UTC", inet_calls, isdn_calls, pots_calls, nxt_hour, nxt_min); free(temp); return 0; }
/* =========================================================================== * Function process_zipfiles() * return PK-type error code */ void process_zipfiles( struct Globals *pG ) { char *lastzipfn = (char *)NULL; int NumWinFiles, NumLoseFiles, NumWarnFiles; int NumMissDirs, NumMissFiles; int error; //, error_in_archive = 0; diag( pG, "In process_zipfiles" ); /*--------------------------------------------------------------------------- * Start by allocating buffers and (re)constructing the various PK signature * strings. *---------------------------------------------------------------------------*/ pG->inbuf = (uch *)MALLOC( INBUFSIZ + 4 ); /* 4 extra for hold[] (below) */ if ( pG->inbuf == NULL ) { UnzErr( pG, UEN_MEM03 ); return; } /* Normally realbuf and outbuf will be the same. However, if the data * are redirected to a large memory buffer, realbuf will point to the * new location while outbuf will remain pointing to the malloc'd * memory buffer. (The extra "1" is for string termination.) */ pG->realbuf = pG->outbuf = (uch *)MALLOC( OUTBUFSIZ + 1 ); if ( pG->outbuf == NULL ) { FREE( pG->inbuf ); UnzErr( pG, UEN_MEM01 ); return; } pG->hold = pG->inbuf + INBUFSIZ; /* to check for boundary-spanning sigs */ diag( pG, "two" ); pG->local_hdr_sig[0] /* = extd_local_sig[0] */ = 0x50; /* ASCII 'P', */ pG->central_hdr_sig[0] = pG->end_central_sig[0] = 0x50; /* not EBCDIC */ pG->local_hdr_sig[1] /* = extd_local_sig[1] */ = 0x4B; /* ASCII 'K', */ pG->central_hdr_sig[1] = pG->end_central_sig[1] = 0x4B; /* not EBCDIC */ /* GRR FIX: no need for these to be in global struct; OK to "overwrite" */ lstrcpy( pG->local_hdr_sig + 2, LOCAL_HDR_SIG ); lstrcpy( pG->central_hdr_sig + 2, CENTRAL_HDR_SIG ); lstrcpy( pG->end_central_sig + 2, END_CENTRAL_SIG ); /*--------------------------------------------------------------------------- * Match (possible) wildcard zipfile specification with existing files and * attempt to process each. If no hits, try again after appending ".zip" * suffix. If still no luck, give up. *---------------------------------------------------------------------------*/ NumWinFiles = NumLoseFiles = NumWarnFiles = 0; NumMissDirs = NumMissFiles = 0; diag( pG, "four in process.c - ready to dowild" ); // dowild() gives us the real name of zipfile, in case wildcard was used. while ( (pG->zipfn = do_wild( pG, pG->wildzipfn )) != NULL ) { Trace( (pG, "back from do_wild( %s ) returned %s\n", pG->wildzipfn, pG->zipfn) ); lastzipfn = pG->zipfn; if ( (error = do_seekable( pG, 0 )) == PK_WARN ) ++NumWarnFiles; else if ( error == IZ_DIR ) ++NumMissDirs; else if ( error == PK_NOZIP ) ++NumMissFiles; else if ( error ) ++NumLoseFiles; else ++NumWinFiles; Trace( (pG, "after do_seekable, warn=%d missdir=%d missfi=%d losefi=%d winfi=%d", NumWarnFiles, NumMissDirs, NumMissFiles, NumLoseFiles, NumWinFiles) ); // if ( error != IZ_DIR && error > error_in_archive ) error_in_archive = error; Trace( (pG, "do_seekable(0) returns %d (see unzpriv.h, PK_*)\n", error) ); } /* end while-loop (wildcard zipfiles) */ diag( pG, "five in process.c" ); if ( (NumWinFiles + NumWarnFiles + NumLoseFiles) == 0 && (NumMissDirs + NumMissFiles) == 1 && lastzipfn != (char *)NULL ) { NumMissDirs = NumMissFiles = 0; // if ( error_in_archive == PK_NOZIP ) error_in_archive = PK_COOL; if ( iswild( pG->wildzipfn ) ) printf( "Error: No wildcard match on zipfile: %s", pG->wildzipfn ); else { char *p = lastzipfn + lstrlen( lastzipfn ); pG->zipfn = lastzipfn; lstrcpy( p, ZSUFX ); error = do_seekable( pG, 1 ); if ( error == PK_WARN ) /* GRR: make this a switch/case stmt ... */ ++NumWarnFiles; else if ( error == IZ_DIR ) ++NumMissDirs; else if ( error == PK_NOZIP ) /* increment again => bug: "1 file had no zipfile directory." */ /* ++NumMissFiles */ ; else if ( error ) ++NumLoseFiles; else ++NumWinFiles; // if ( error > error_in_archive ) error_in_archive = error; Trace( (pG, "do_seekable(1) returns %d\n", error) ); } } diag( pG, "six" ); /*--------------------------------------------------------------------------- * Print summary of all zipfiles, assuming zipfile spec was a wildcard (no * need for a summary if just one zipfile). *---------------------------------------------------------------------------*/ if ( (NumWinFiles > 1) || (NumWinFiles == 1 && NumMissDirs + NumMissFiles + NumLoseFiles + NumWarnFiles > 0) ) printf( "files processed OK" ); if ( NumWarnFiles > 0 ) printf( "warnings were given" ); if ( NumLoseFiles > 0 || NumMissFiles > 0 ) printf( "file(s) not found" ); if ( NumMissDirs == 1 ) printf( "zip file was dir" ); else if ( NumMissDirs > 0 ) printf( "many zip file were dirs" ); if ( NumWinFiles + NumLoseFiles + NumWarnFiles == 0 ) printf( "no files found" ); diag( pG, "seven" ); /* free allocated memory */ inflate_free( pG ); checkdir( pG, (char *)NULL, END ); #ifdef DYNALLOC_CRCTAB if ( pG->extract_flag && CRC_32_TAB ) FREE( CRC_32_TAB ); #endif /* DYNALLOC_CRCTAB */ if ( pG->outbuf2 ) FREE( pG->outbuf2 ); /* malloc'd ONLY if unshrink and -a */ FREE( pG->outbuf ); FREE( pG->inbuf ); return; } /* end function process_zipfiles() */
int main(int argc, char **argv) { int i, use_stdin, use_mbox; char *configfile = NULL; char **tlang, *locale_code; int cmd_show_variables; int print_usage; int amount_old = 0; /* number of old mails */ int amount_new = 0; /* number of new mails */ #ifdef HAVE_LOCALE_H setlocale(LC_ALL, ""); #endif lockfile[0] = '\0'; use_stdin = 0; print_usage = 0; use_mbox = 0; firstdatenum = lastdatenum = 0; configfile = strsav(CONFIGFILE); cmd_show_variables = 0; opterr = 0; #define GETOPT_OPTSTRING ("a:Ab:c:d:gil:L:m:n:o:ps:tTuvVxX0:1M?") /* get pre config options here */ while ((i = getopt(argc, argv, GETOPT_OPTSTRING)) != -1) { switch ((char)i) { case 'c': configfile = strreplace(configfile, optarg); break; case 'v': cmd_show_variables = TRUE; break; case 'V': version(); /*NOTREACHED*/ case 'a': case 'A': case 'b': case 'd': case 'g': case 'i': case 'l': case 'L': case 'm': case 'n': case 'o': case 'p': case 's': case 't': case 'T': case 'u': case 'x': case 'X': case '0': case '1': case 'M': break; case '?': default: /* * Because we need to setup the language support, * printing of the usage message must be deferred * until the proper language is determined. */ print_usage = 1; break; } } /* * ...then read the configuration file. */ readconfigs(configfile, cmd_show_variables); /* reset the getopt() index variable */ optind = 1; /* now get the post-config options! */ while ((i = getopt(argc, argv, GETOPT_OPTSTRING)) != -1) { switch ((char)i) { case 'A': set_append = 1; break; case 'a': set_archives = strreplace(set_archives, optarg); break; case 'b': set_about = strreplace(set_about, optarg); break; case 'c': /* config file from pre-config options */ break; case 'd': set_dir = strreplace(set_dir, optarg); break; case 'g': set_usegdbm = 1; break; case 'i': use_stdin = TRUE; break; case 'l': set_label = strreplace(set_label, optarg); break; case 'L': set_language = strreplace(set_language, optarg); break; case 'm': set_mbox = strreplace(set_mbox, optarg); break; case 'n': set_hmail = strreplace(set_hmail, optarg); break; case 'o': ConfigAddItem(optarg); break; case 'p': set_showprogress = TRUE; break; case 's': set_htmlsuffix = strreplace(set_htmlsuffix, optarg); break; case 't': set_usetable = TRUE; break; case 'T': set_indextable = TRUE; break; case 'u': set_increment = TRUE; break; case 'v': cmd_show_variables = TRUE; break; case 'x': set_overwrite = TRUE; break; case 'X': set_writehaof = TRUE; break; case '0': set_delete_msgnum = add_list(set_delete_msgnum, optarg); break; case '1': set_readone = TRUE; break; case 'M': set_usemeta = TRUE; break; case 'N': set_nonsequential = TRUE; break; case '?': default: break; } } #ifdef DEBUG dump_config(); exit(0); #endif /* * Now override the configuration file variables with any explicitly * passed on the command line. This way you need not change the * configuration file settings for a minor change in a single run. */ /* * Check and make sure that the supplied language is a * valid language. Otherwise strange things happen quickly. */ if (strlen(set_language) > 2) { locale_code = strsav(set_language); set_language[2] = 0; /* shorten to 2-letter code */ } else locale_code = NULL; if ((tlang = valid_language(set_language, &locale_code)) == NULL) { snprintf(errmsg, sizeof(errmsg), "\"%s\" %s.", set_language, lang[MSG_LANGUAGE_NOT_SUPPORTED]); cmderr(errmsg); } #ifdef HAVE_LOCALE_H if (!setlocale(LC_ALL, locale_code)) { snprintf(errmsg, sizeof(errmsg), "WARNING: locale \"%s\", not supported.\n", locale_code); fprintf(stderr, "%s", errmsg);/* AUDIT biege: avoid format-bug warning */ } #endif lang = tlang; /* A good language, make it so. */ if (print_usage) /* Print the usage message and terminate */ usage(); #ifndef GDBM if (set_usegdbm) { fprintf(stderr, "%s: %s\n", PROGNAME, lang[MSG_OPTION_G_NOT_BUILD_IN]); usage(); } #endif #ifndef HAVE_LIBFNV if (set_nonsequential) progerr("Hypermail isn't built with the libfnv hash library.\n" "You cannot use the nonsequential option.\n"); #endif /* HAVE_LIBFNV */ if (set_mbox && !strcasecmp(set_mbox, "NONE")) { use_stdin = TRUE; } /* the list of headers that we always show and that we want to avoid showing twice when printing the body */ set_skip_headers = add_list(set_skip_headers, "from"); set_skip_headers = add_list(set_skip_headers, "date"); set_skip_headers = add_list(set_skip_headers, "subject"); /* * Did they decide to use stdin by specifying it on the command line ? * If not then check and see if that is the default they wanted from * the options.h or environment values. */ if (!use_stdin) { if (optind < argc && set_increment == -1 && !set_mbox) { set_mbox = strsav(argv[optind]); } else if (!set_mbox || !strcasecmp(set_mbox, "NONE")) use_stdin = TRUE; else use_stdin = FALSE; } else { if (set_mbox) free(set_mbox); set_mbox = NULL; } /* ** Deprecated options */ if (set_showhr) { fprintf (stderr, "The \"showhr\" option has been deprecated. Ignoring it.\n"); set_showhr = FALSE; } if (set_usetable) { fprintf (stderr, "The \"usetable\" option has been deprecated. Ignoring it.\n"); set_usetable = FALSE; } /* * Read the contents of the file into the variables to be used * in printing out the pages. */ ihtmlheaderfile = expand_contents(set_ihtmlheader); ihtmlfooterfile = expand_contents(set_ihtmlfooter); ihtmlheadfile = expand_contents(set_ihtmlhead); ihtmlhelpupfile = expand_contents(set_ihtmlhelpup); ihtmlhelplowfile = expand_contents(set_ihtmlhelplow); ihtmlnavbar2upfile = expand_contents(set_ihtmlnavbar2up); mhtmlheaderfile = expand_contents(set_mhtmlheader); mhtmlfooterfile = expand_contents(set_mhtmlfooter); if (set_dir) set_dir = strreplace(set_dir, dirpath(set_dir)); /* * Default names for directories and labels need to be figured out. */ if (use_stdin && (!set_dir || !strcasecmp(set_dir, "NONE"))) set_dir = strreplace(set_dir, DIRNAME); if (!set_dir || !strcasecmp(set_dir, "NONE")) set_dir = strreplace(set_dir, (strrchr(set_mbox, '/')) ? strrchr(set_mbox, '/') + 1 : set_mbox); if (set_dir[strlen(set_dir) - 1] != PATH_SEPARATOR) trio_asprintf(&set_dir, "%s%c", set_dir, PATH_SEPARATOR); if (!set_label || !strcasecmp(set_label, "NONE")) set_label = set_mbox ? (strreplace(set_label, (strrchr(set_mbox, '/')) ? strrchr(set_mbox, '/') + 1 : set_mbox)) : "stdin"; /* * Which index file will be called "index.html"? */ index_name[1][DATE_INDEX] = setindex(set_defaultindex, "date", set_htmlsuffix); index_name[1][THREAD_INDEX] = setindex(set_defaultindex, "thread", set_htmlsuffix); index_name[1][SUBJECT_INDEX] = setindex(set_defaultindex, "subject", set_htmlsuffix); index_name[1][AUTHOR_INDEX] = setindex(set_defaultindex, "author", set_htmlsuffix); if (set_attachmentsindex) { index_name[1][ATTACHMENT_INDEX] = setindex(set_defaultindex, "attachment", set_htmlsuffix); } if (set_folder_by_date || set_msgsperfolder) { index_name[0][DATE_INDEX] = setindex(set_default_top_index, "date", set_htmlsuffix); index_name[0][THREAD_INDEX] = setindex(set_default_top_index, "thread", set_htmlsuffix); index_name[0][SUBJECT_INDEX] = setindex(set_default_top_index, "subject", set_htmlsuffix); index_name[0][AUTHOR_INDEX] = setindex(set_default_top_index, "author", set_htmlsuffix); if (set_attachmentsindex) { index_name[0][ATTACHMENT_INDEX] = setindex(set_default_top_index, "attachment", set_htmlsuffix); } index_name[0][FOLDERS_INDEX] = setindex(set_default_top_index, "folders", set_htmlsuffix); } else { index_name[0][DATE_INDEX] = index_name[1][DATE_INDEX]; index_name[0][THREAD_INDEX] = index_name[1][THREAD_INDEX]; index_name[0][AUTHOR_INDEX] = index_name[1][AUTHOR_INDEX]; index_name[0][SUBJECT_INDEX] = index_name[1][SUBJECT_INDEX]; index_name[0][ATTACHMENT_INDEX] = index_name[1][ATTACHMENT_INDEX]; } init_index_names(); if (set_msgsperfolder && set_folder_by_date) { progerr("msgsperfolder and folder_by_date may not be used at the same time!"); } /* * General settings for mail command and rewriting. */ if (!set_domainaddr || !strcasecmp(set_domainaddr, "NONE")) use_domainaddr = 0; else use_domainaddr = 1; if (!set_mailto || !strcasecmp(set_mailto, "NONE")) use_mailto = 0; else use_mailto = 1; if (!set_mailcommand || !strcasecmp(set_mailcommand, "NONE")) use_mailcommand = 0; else use_mailcommand = 1; #ifndef HAVE_LIBFNV /* the nonsequential mode won't work unless we compiled the FNV hash library (./configure --enable-libfnv) */ if (set_nonsequential) progerr("the nonsequential mode is only available if you enabled the\n compilation" "of the fnv hash library. Try doing a\n\t./configure --enable-libfnv\n" "and recompile if you want to use this option."); #endif /* HAVE_LIBFNV */ /* * A little performance speed up. The following was being done * over and over in the write functions. This way it is done once. * A bigger win on larger archives. */ if (set_hmail && !strcasecmp(set_hmail, "NONE")) { free(set_hmail); set_hmail = NULL; } if (set_archives && !strcasecmp(set_archives, "NONE")) { free(set_archives); set_archives = NULL; } if (set_custom_archives && !strcasecmp(set_custom_archives, "NONE")) { free(set_custom_archives); set_custom_archives = NULL; } if (set_about && !strcasecmp(set_about, "NONE")) { free(set_about); set_about = NULL; } /* Simply show what the values of the variables are and exit */ if (cmd_show_variables) { if (!set_mbox) set_mbox = "NONE"; MakeConfig(TRUE); free(configfile); return (0); } /* Injecting a little sanity... */ if (use_mbox && use_stdin) { cmderr(lang[MSG_CANNOT_READ_FROM_BOTH_FILE_AND_STDIN]); } if (set_append && use_mbox) { cmderr(lang[MSG_CANNOT_BOTH_READ_AND_WRITE_TO_MBOX]); } gettimezone(); getthisyear(); /* * MIME processing requires the files be created as they * are read in loadheaders() so assure the directories are * there first... */ checkdir(set_dir); /* * Let's do it. */ if (set_uselock) lock_archive(set_dir); if (set_increment == -1) { int save_append = set_append; set_append = 0; if (set_mbox_shortened) progerr("can not use increment = -1 option with mbox_shortened option\n"); amount_new = parsemail(set_mbox, use_stdin, 1, -1, set_dir, set_inlinehtml, 0); set_increment = !matches_existing(set_startmsgnum); if (set_increment && set_folder_by_date && !set_usegdbm) progerr("folder_by_date with incremental update requires usegdbm option"); reinit_structs(); set_append = save_append; } if (set_increment) { int num_displayable; if (set_linkquotes) replylist = NULL; /* we have to start with the msgnum - 1 so that the rest of the code works ok when there are no old headers. */ max_msgnum = set_startmsgnum - 1; num_displayable = loadoldheaders(set_dir); amount_old = max_msgnum + 1; /* counts gaps as messages */ /* start numbering at this number */ amount_new = num_displayable + parsemail(set_mbox, use_stdin, set_readone, set_increment, set_dir, set_inlinehtml, amount_old); if (set_linkquotes) analyze_headers(max_msgnum + 1); /* write the index of msgno/msgid_hash filenames */ if (set_nonsequential) write_messageindex(0, max_msgnum + 1); writearticles(amount_old, max_msgnum + 1); /* JK: in function of other hypermail configuration options, delete_incremental will continuous escape and add more markup to non-deleted messages that are replies to deleted messages. Thus, a setup option to disable it */ if (set_delete_incremental && deletedlist) update_deletions(amount_old); if (set_show_msg_links) { fixnextheader(set_dir, amount_old, -1); for (i = amount_old; i <= max_msgnum; ++i) { if (set_showreplies) fixreplyheader(set_dir, i, 0, amount_old); fixthreadheader(set_dir, i, amount_old); } } } else { if (set_mbox_shortened) { if (!set_usegdbm) progerr("mbox_shortened option requires that the usegdbm option be on"); max_msgnum = set_startmsgnum - 1; loadoldheaders(set_dir); } amount_new = parsemail(set_mbox, use_stdin, set_readone, set_increment, set_dir, set_inlinehtml, set_startmsgnum); /* number from 0 */ if (!set_mbox_shortened && !matches_existing(0)) { progerr("First message in mailbox does not " "match first message in archive\n" "or obsolete gdbm file present.\n" "Maybe you want to enable the mbox_shortened option?\n"); } if (set_linkquotes) analyze_headers(max_msgnum + 1); /* write the index of msgno/msgid_hash filenames */ if (set_nonsequential) write_messageindex(0, max_msgnum + 1); writearticles(0, max_msgnum + 1); } if (amount_new) { /* Always write the index files */ if (set_linkquotes) { threadlist = NULL; threadlist_end = NULL; printedthreadlist = NULL; for (i = 0; i <= max_msgnum; ++i) { struct emailinfo *ep; if (hashnumlookup(i, &ep)) { ep->flags &= ~USED_THREAD; #ifdef FASTREPLYCODE ep->isreply = 0; #endif } threadlist_by_msgnum[i] = NULL; } /* redo threading with more complete info than in 1st pass */ crossindexthread1(datelist); for (i = 0; i <= max_msgnum; ++i) { struct emailinfo *ep, *etmp; hashnumlookup(i, &ep); etmp = nextinthread(i); if (etmp && ep->initial_next_in_thread != etmp->msgnum) fixthreadheader(set_dir, etmp->msgnum, amount_new); /* if (ep->flags & THREADING_ALTERED) */ } } count_deleted(max_msgnum + 1); if (show_index[0][DATE_INDEX]) writedates(amount_new, NULL); if (show_index[0][THREAD_INDEX]) writethreads(amount_new, NULL); if (show_index[0][SUBJECT_INDEX]) writesubjects(amount_new, NULL); if (show_index[0][AUTHOR_INDEX]) writeauthors(amount_new, NULL); if (set_attachmentsindex) { writeattachments(amount_new, NULL); } if (set_writehaof) writehaof(amount_new, NULL); if (set_folder_by_date || set_msgsperfolder) write_toplevel_indices(amount_new); if (set_monthly_index || set_yearly_index) write_summary_indices(amount_new); if (set_latest_folder) symlink_latest(); } else { printf("No mails to output!\n"); } if (set_uselock) unlock_archive(); if (configfile) free(configfile); if (ihtmlheaderfile) free(ihtmlheaderfile); if (ihtmlfooterfile) free(ihtmlfooterfile); if (ihtmlheadfile) free(ihtmlheadfile); if (ihtmlhelpupfile) free(ihtmlhelpupfile); if (ihtmlhelplowfile) free(ihtmlhelplowfile); if (ihtmlnavbar2upfile) free(ihtmlnavbar2upfile); if (mhtmlheaderfile) free(mhtmlheaderfile); if (mhtmlfooterfile) free(mhtmlfooterfile); return (0); }
void TERMWINDOWMEMBER terminate(Bool discon) { char dtstr[80]; Bool initport = FALSE; if (!altF3Timeout && (cfg.chatmail == 2 && chatReq) || (cfg.chatmail == 3) || (cfg.chatmail == 4)) { if (cfg.chatmail == 2) { dispBlb(B_CHATTED); } Message *Msg = new Message; if (Msg) { msgtosysop(Msg); delete Msg; } else { OutOfMemory(41); } } if (loggedIn && onConsole) { last_console_login_callno = cfg.callno; } chatReq = FALSE; const Bool doStore = HaveConnectionToUser(); if (discon || !doStore) { sysopNew = FALSE; } const long balance = CurrentUser->GetCredits(); OC.SetOutFlag(OUTOK); if ((doStore && (MRO.Verbose == 2)) || CurrentUser->IsAutoVerbose() || CurrentUser->IsVerboseLogOut() || CurrentUser->IsNode()) { if (CurrentUser->IsNode()) { OC.SetOutFlag(IMPERVIOUS); // no carrier } CRmPrintfCR(getmsg(119), ltoac(cfg.callno)); if (loggedIn) { mPrintfCR(getmsg(118), diffstamp(logtimestamp)); } label Entered, L; CopyStringToBuffer(Entered, ltoac(MS.Entered)); mPrintfCR(getmsg(117), Entered, MS.Entered == 1 ? cfg.Lmsg_nym : cfg.Lmsgs_nym, ltoac(MS.Read)); if (cfg.accounting && CurrentUser->IsAccounting()) { long C = (CurrentUserAccount->GetBalanceAtLogin() - balance) / 60; mPrintfCR(getmsg(116), ltoac(C), (C == 1) ? cfg.Lcredit_nym : cfg.Lcredits_nym, L); C = balance / 60; mPrintfCR(getmsg(115), ltoac(C), (C == 1) ? cfg.Lcredit_nym : cfg.Lcredits_nym); } char Buffer[64]; strftime(dtstr, 79, (loggedIn) ? CurrentUser->GetVerboseDateStamp(Buffer, sizeof(Buffer)) : cfg.vdatestamp, 0l); } if (doStore && MRO.Verbose) { goodbye(); } OC.SetOutFlag(IMPERVIOUS); label Buffer; if (loggedIn) { if ((MRO.Verbose == 2) || CurrentUser->IsAutoVerbose() || CurrentUser->IsVerboseLogOut() || CurrentUser->IsNode()) { CRmPrintfCR(getmsg(614), CurrentUser->GetName(Buffer, sizeof(Buffer)), dtstr); } else { CRmPrintfCR(getmsg(114), CurrentUser->GetName(Buffer, sizeof(Buffer))); } } // Go back to the default hall thisHall = HallData.GetDefault(); if (discon) { #ifdef WINCIT switch(CommPort->GetType()) { case CT_SERIAL: { initport = TRUE; break; } case CT_TELNET: { initport = FALSE; break; } default: { initport = FALSE; break; } } #endif if (CommPort->HaveConnection()) { CITWINDOW *w = ScreenSaver.IsOn() ? NULL : CitWindowsMsg(NULL, getmsg(82)); Hangup(); if (w) { destroyCitWindow(w, FALSE); } } //OC.whichIO = MODEM; // I really don't know //OC.setio(); } if (!slv_door && !CommPort->HaveConnection()) { CITWINDOW *w = ScreenSaver.IsOn() ? NULL : CitWindowsMsg(NULL, getmsg(19)); #ifdef WINCIT if(initport) #endif { Initport(); } if (w) { destroyCitWindow(w, FALSE); } } CurrentUser->SetInRoom(thisRoom, TRUE); if (!doStore) // if carrier dropped { if(!read_tr_messages()) { errorDisp(getmsg(172)); } #ifdef WINCIT trap(T_CARRIER, WindowCaption, gettrmsg(19), WindowCaption); #else trap(T_CARRIER, gettrmsg(19)); #endif dump_tr_messages(); } // update new pointer only if carrier not dropped if (loggedIn && doStore) { CurrentUser->SetRoomNewPointer(thisRoom, MessageDat.NewestMessage()); } if (loggedIn) { CurrentUser->SetCallNumber(cfg.callno); CurrentUser->SetCallTime(logtimestamp); // for the Minibin() function to calculate #new messages CurrentUser->SetLastMessage(MessageDat.NewestMessage()); CurrentUser->SetTotalTime(CurrentUser->GetTotalTime() + (time(NULL) - logtimestamp)); CurrentUser->SetLogins(CurrentUser->GetLogins() + 1); CurrentUser->SetPosted(CurrentUser->GetPosted() + MS.Entered); CurrentUser->SetRead(CurrentUser->GetRead() + MS.Read); CurrentUser->Save(ThisLog, thisRoom); // this stuff puts the current room at the end of jumpback, // so J will take you back here. jumpback jb; jb.hall = thisHall; jb.room = thisRoom; jb.newpointer = CurrentUser->GetRoomNewPointer(thisRoom); jb.bypass = Talley->Bypassed(thisRoom); jb.newMsgs = Talley->NewInRoom(thisRoom); CurrentUser->JumpbackPush(jb); #ifdef MULTI char LogoffEvent[256]; label NameBuffer; sprintf(LogoffEvent, doStore ? getmsg(665) : getmsg(29), CurrentUser->GetName(NameBuffer, sizeof(NameBuffer))); TermWindowCollection.SystemEvent(SE_LOGONOFF, FALSE, NULL, FALSE, LogoffEvent); #endif loggedIn = FALSE; if (CurrentUser->IsPrintFile() && OC.Printing) { OC.Printing = OC.WasPrinting; if (!OC.Printing) { fclose(OC.PrintFile); } } // trap it if (CurrentUser->IsNode()) { if (netError) { Bool OldTrapit = cfg.trapit[T_NETWORK]; if (node->GetNetFail() > 0) { cfg.trapit[T_NETWORK] = TRUE; } else if (node->GetNetFail() < 0) { cfg.trapit[T_NETWORK] = FALSE; } #ifdef WINCIT trap(T_NETWORK, WindowCaption, getmsg(606), CurrentUser->GetName(Buffer, sizeof(Buffer))); #else trap(T_NETWORK, getmsg(606), CurrentUser->GetName(Buffer, sizeof(Buffer))); #endif cfg.trapit[T_NETWORK] = OldTrapit; } else { #ifdef WINCIT trap(T_NETWORK, WindowCaption, getmsg(22), CurrentUser->GetName(Buffer, sizeof(Buffer))); #else trap(T_NETWORK, getmsg(22), CurrentUser->GetName(Buffer, sizeof(Buffer))); #endif } } else { doEvent(EVT_LOGOUT); if(!read_tr_messages()) { errorDisp(getmsg(172)); } #ifdef WINCIT trap(T_LOGIN, WindowCaption, gettrmsg(24), CurrentUser->GetName(Buffer, sizeof(Buffer))); #else trap(T_LOGIN, gettrmsg(24), CurrentUser->GetName(Buffer, sizeof(Buffer))); #endif dump_tr_messages(); } const TrapKeywords TrapType = CurrentUser->IsNode() ? T_NETWORK : T_ACCOUNT; if(!read_tr_messages()) { errorDisp(getmsg(172)); } #ifndef WINCIT trap(TrapType, gettrmsg(25), MS.Entered); trap(TrapType, gettrmsg(26), MS.Read); #else trap(TrapType, WindowCaption, gettrmsg(25), MS.Entered); trap(TrapType, WindowCaption, gettrmsg(26), MS.Read); #endif dump_tr_messages(); if (CurrentUser->IsNode()) { if(!read_tr_messages()) { errorDisp(getmsg(172)); } #ifndef WINCIT trap(T_NETWORK, gettrmsg(20), MS.Expired); trap(T_NETWORK, gettrmsg(21), MS.Duplicate); #else trap(T_NETWORK, WindowCaption, gettrmsg(20), MS.Expired); trap(T_NETWORK, WindowCaption, gettrmsg(21), MS.Duplicate); #endif dump_tr_messages(); } else if (cfg.accounting) // There's just no accounting for nodes { if(!read_tr_messages()) { errorDisp(getmsg(172)); } #ifdef WINCIT trap(T_ACCOUNT, WindowCaption, gettrmsg(27), CurrentUserAccount->GetBalanceAtLogin() - balance); #else trap(T_ACCOUNT, gettrmsg(27), CurrentUserAccount->GetBalanceAtLogin() - balance); #endif dump_tr_messages(); } delete MS.AbortedMessage; MS.AbortedMessage = NULL; #ifdef MULTI LoginList.Remove(ThisLog); #endif } setdefaultconfig(FALSE); if (discon) { setdefaultTerm(TT_ANSI); } else { setdefaultTerm(TT_DUMB); } CurrentUser->SetCredits(discon ? 0L : cfg.unlogtimeout * 60L); StatusLine.Update(WC_TWp); Talley->Fill(); CurrentRoom->Load(LOBBY); checkdir(); thisRoom = LOBBY; AideQueueClear(); clearFileQueue(); MS.AutoMKC = AM_NONE; MS.MarkedID = 0L; freeNode(&node); netError = FALSE; // just in case Cron.ResetTimer(); }