/*-------------------------------------------------------------------*/ static char *rcname = NULL; /* hercules.rc name pointer */ static void* process_rc_file (void* dummy) { int is_default_rc = 0; /* 1 == default name used */ char pathname[MAX_PATH]; /* (work) */ UNREFERENCED(dummy); /* Obtain the name of the hercules.rc file or default */ if (!rcname) { if (!(rcname = getenv("HERCULES_RC"))) { rcname = "hercules.rc"; is_default_rc = 1; } } if(!strcasecmp(rcname,"None")) return NULL; hostpath(pathname, rcname, sizeof(pathname)); /* Wait for panel thread to engage */ // ZZ FIXME:THIS NEED TO GO while (!sysblk.panel_init) usleep( 10 * 1000 ); /* Run the script processor for this file */ if (process_script_file(pathname,1) != 0) if (ENOENT == errno) if (!is_default_rc) WRMSG(HHC01405, "E", pathname); // (else error message already issued) return NULL; }
void* process_rc_file (void* dummy) { char *rcname; /* hercules.rc name pointer */ int is_default_rc = 0; /* 1 == default name used */ int numcpu = 0; /* #of ONLINE & STOPPED CPUs */ int i; /* (work) */ UNREFERENCED(dummy); /* Wait for all installed/configured CPUs to come ONLINE and enter the STOPPED state */ OBTAIN_INTLOCK(NULL); for (;;) { numcpu = 0; for (i = 0; i < MAX_CPU_ENGINES; i++) if (IS_CPU_ONLINE(i) && CPUSTATE_STOPPED == sysblk.regs[i]->cpustate) numcpu++; if (numcpu == sysblk.numcpu) break; RELEASE_INTLOCK(NULL); usleep( 10 * 1000 ); OBTAIN_INTLOCK(NULL); } RELEASE_INTLOCK(NULL); /* Wait for panel thread to engage */ while (!sysblk.panel_init) usleep( 10 * 1000 ); /* Obtain the name of the hercules.rc file or default */ if (!(rcname = getenv("HERCULES_RC"))) { rcname = "hercules.rc"; is_default_rc = 1; } #if defined(OPTION_HAO) /* Initialize the Hercules Automatic Operator */ if ( !hao_initialize() ) logmsg(_("HHCIN004S Cannot create HAO thread: %s\n"), strerror(errno)); #endif /* defined(OPTION_HAO) */ /* Run the script processor for this file */ if (process_script_file(rcname,1) != 0) if (ENOENT == errno) if (!is_default_rc) logmsg(_("HHCPN995E .RC file \"%s\" not found.\n"), rcname); // (else error message already issued) return NULL; }
/*++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++*/ int parse_cmd_line (int argc, char ** argv, struct subcmd **cmdsp, int *numscp) { int i, rc, num_es, num_fs; char *p; myerror_pgm_name = "sed"; suppress_output = NO; *cmdsp = NULL; num_es = num_fs = 0; num_files = 0; /* first, do the switches */ for (i = 1; i < argc && *argv[i] == '-'; i++) { p = argv[i]; /* there are 3 valid flags: e, f and n */ if (*++p == 'n') suppress_output = YES; else if (*p == 'e') /* an edit script specified on the cmd line */ { num_es++; if (*++p != '\0') rc = add_subcmd(p, cmds, numscp); else if (i < argc) //@4a rc = add_subcmd(argv[++i], cmds, numscp); else //@4a rc = BAIL_OUT; //@4a if (rc == BAIL_OUT) return(BAIL_OUT); else *numscp += 1; } else if (*p == 'f') /* a script file is specified on the cmd line */ { num_fs++; if (*++p != '\0') rc = process_script_file(p, cmds, numscp); else if (i < argc) //@4a rc = process_script_file(argv[++i], cmds, numscp); else //@4a rc = BAIL_OUT; //@4a if (rc == BAIL_OUT) return(BAIL_OUT); } else /* who knows what that thing is? */ fprintf(stderr,"Unknown flag: %s\n", p); } /* end FOR */ /* Now we're done with the switches. One of three things has occured: */ /* 1. no more command line arguments */ /* 2. an arg was found that didn't start with '-' */ /* 3. an unknown switch was found. */ if (i == argc) /* if it's the first condition */ return(OK); /* we done */ if ((num_es + num_fs) == 0) /* if no -e and no -f, first non-switch */ /* must be the edit script */ if ( (rc = add_subcmd(argv[i++], cmds, numscp)) == BAIL_OUT) return(BAIL_OUT); else *numscp++; /* everything else on the command line must be an input file spec */ num_files = argc - i; firstfile = i; return(OK); }