int rc_read() { const char *fn = rc_file(); if(!access(fn, F_OK)) return rc_source(fn); return 1; }
void xrc(void) { int i; if ( rc_file_cnt() > 0 ) { for( i = 0; i < rc_file_cnt(); i++ ) { sprintf( args, "/r \"/i%s\" ", get_inc_path() ); strcat( args, rc_file(i) ); exec( "orc", args ); } } }
/* start a cli with <name> as a prompt, and optionally run the <initscript> file */ void enter_cli(const char *name, const char *initscript) { global_logfp = NULL; //progname = name; //we use the supplied *name instead. readline_init(); set_init(); if (initscript != NULL) { int rv=command_file(initscript); switch (rv) { case CMD_OK: /* script was succesful, start a normal CLI afterwards */ break; case CMD_FAILED: printf("Problem with file %s\n", initscript); // fallthrough, yes default: case CMD_EXIT: set_close(); return; } } else { /* print banner only if running without an initscript */ printf("%s: %s version %s\n", name, projname, PACKAGE_VERSION); printf("%s: Type HELP for a list of commands\n", name); printf("%s: Type SCAN to start ODBII Scan\n", name); printf("%s: Then use MONITOR to monitor real-time data\n", name); printf("%s: **** IMPORTANT : this is beta software ! Use at your own risk.\n", name); printf("%s: **** Remember, \"debug all -1\" displays all debugging info.\n", name); } if (rc_file() != CMD_EXIT) { printf("\n"); /* And go start CLI */ instream = stdin; (void)do_cli(root_cmd_table, name, 0, NULL); } set_close(); }