fix --rcfile and --no_readline options not working due to a refactoring mistake

This commit is contained in:
Stefan Frederik 2022-02-09 17:09:35 +01:00
parent a0e7a9ed78
commit 164ea94743
3 changed files with 33 additions and 6 deletions

View File

@ -46,7 +46,7 @@ void check_opt(char *opt, char *optval, int type)
dbg(1, "process_options(): set flat netlist\n");
cli_opt_flat_netlist=1;
} else if( (type == SHORT && *opt == 'r') || (type == LONG && !strcmp("cli_opt_no_readline", opt)) ) {
} else if( (type == SHORT && *opt == 'r') || (type == LONG && !strcmp("no_readline", opt)) ) {
cli_opt_no_readline=1;
} else if( (type == SHORT && *opt == 'p') || (type == LONG && !strcmp("postscript", opt)) ) {
@ -61,8 +61,8 @@ void check_opt(char *opt, char *optval, int type)
dbg(1, "process_options(): user plotfile specified: %s\n", optval ? optval : "NULL");
if(optval) my_strncpy(cli_opt_plotfile, optval, S(cli_opt_plotfile));
} else if( (type == LONG && !strcmp("cli_opt_rcfile", opt)) ) {
dbg(1, "process_options(): user cli_opt_rcfile specified: %s\n", optval ? optval : "NULL");
} else if( (type == LONG && !strcmp("rcfile", opt)) ) {
dbg(1, "process_options(): user rcfile specified: %s\n", optval ? optval : "NULL");
if(optval) my_strncpy(cli_opt_rcfile, optval, S(cli_opt_rcfile));
} else if( (type == LONG && !strcmp("png", opt)) ) {
@ -191,7 +191,7 @@ int process_options(int argc, char *argv[])
else if(!strcmp("netlist_path", opt)) {
optval = argv[++i];
}
else if(!strcmp("cli_opt_rcfile", opt)) {
else if(!strcmp("rcfile", opt)) {
optval = argv[++i];
}
else if(!strcmp("plotfile", opt)) {

View File

@ -946,6 +946,32 @@ const char *get_cell_w_ext(const char *str, int no_of_dir)
* count number of tokens. Multiple separators and leading/trailing
* separators are allowed. */
int count_items(const char *s, const char *sep)
{
const char *ptr;
int items = 0;
int state = 0; /* 1 if item is being processed */
int c;
int j, nsep = strlen(sep);
ptr = s;
while( (c = *(unsigned char *)ptr++) ) {
for(j = 0; j < nsep; j++) {
if(c == sep[j]) break;
}
if(j >= nsep) { /* not a separator */
if(!state) items++;
state = 1;
} else {
state = 0;
}
}
return items;
}
/* in a string with tokens separated by characters in 'sep'
* count number of tokens. Multiple separators and leading/trailing
* separators are allowed. */
int xcount_items(const char *s, const char *sep)
{
const char *ptr;
char table[1 << 8 * sizeof(unsigned char)];

View File

@ -41,8 +41,9 @@ unitx=n
divx=5
subdivx=4
node="plus
minus"
color="4 5"}
minus
\\"plus minus -\\""
color="4 5 8"}
T {CAL} 140 -180 0 1 0.4 0.4 {}
T {EN} 140 -130 0 1 0.4 0.4 {}
T {CALIBRATION