Lines 315-321
opts_init(SCR *sp, int *oargs)
Link Here
|
315 |
|
315 |
|
316 |
/* Set numeric and string default values. */ |
316 |
/* Set numeric and string default values. */ |
317 |
#define OI(indx, str) { \ |
317 |
#define OI(indx, str) { \ |
318 |
a.len = STRLEN(str); \ |
318 |
a.len = NVI_STRLEN(str); \ |
319 |
if ((CHAR_T*)str != b2) /* GCC puts strings in text-space. */ \ |
319 |
if ((CHAR_T*)str != b2) /* GCC puts strings in text-space. */ \ |
320 |
(void)MEMCPY(b2, str, a.len+1); \ |
320 |
(void)MEMCPY(b2, str, a.len+1); \ |
321 |
if (opts_set(sp, argv, NULL)) { \ |
321 |
if (opts_set(sp, argv, NULL)) { \ |
Lines 620-629
opts_set(SCR *sp, ARGS **argv, char *usa
Link Here
|
620 |
goto badnum; |
620 |
goto badnum; |
621 |
if ((nret = |
621 |
if ((nret = |
622 |
nget_uslong(sp, &value, sep, &endp, 10)) != NUM_OK) { |
622 |
nget_uslong(sp, &value, sep, &endp, 10)) != NUM_OK) { |
623 |
INT2CHAR(sp, name, STRLEN(name) + 1, |
623 |
INT2CHAR(sp, name, NVI_STRLEN(name) + 1, |
624 |
np, nlen); |
624 |
np, nlen); |
625 |
p2 = msg_print(sp, np, &nf); |
625 |
p2 = msg_print(sp, np, &nf); |
626 |
INT2CHAR(sp, sep, STRLEN(sep) + 1, |
626 |
INT2CHAR(sp, sep, NVI_STRLEN(sep) + 1, |
627 |
np, nlen); |
627 |
np, nlen); |
628 |
t2 = msg_print(sp, np, &nf2); |
628 |
t2 = msg_print(sp, np, &nf2); |
629 |
switch (nret) { |
629 |
switch (nret) { |
Lines 647-656
opts_set(SCR *sp, ARGS **argv, char *usa
Link Here
|
647 |
break; |
647 |
break; |
648 |
} |
648 |
} |
649 |
if (*endp && !ISBLANK(*endp)) { |
649 |
if (*endp && !ISBLANK(*endp)) { |
650 |
badnum: INT2CHAR(sp, name, STRLEN(name) + 1, |
650 |
badnum: INT2CHAR(sp, name, NVI_STRLEN(name) + 1, |
651 |
np, nlen); |
651 |
np, nlen); |
652 |
p2 = msg_print(sp, np, &nf); |
652 |
p2 = msg_print(sp, np, &nf); |
653 |
INT2CHAR(sp, sep, STRLEN(sep) + 1, |
653 |
INT2CHAR(sp, sep, NVI_STRLEN(sep) + 1, |
654 |
np, nlen); |
654 |
np, nlen); |
655 |
t2 = msg_print(sp, np, &nf2); |
655 |
t2 = msg_print(sp, np, &nf2); |
656 |
msgq(sp, M_ERR, |
656 |
msgq(sp, M_ERR, |
Lines 680-686
badnum: INT2CHAR(sp, name, STRLEN(nam
Link Here
|
680 |
break; |
680 |
break; |
681 |
|
681 |
|
682 |
/* Report to subsystems. */ |
682 |
/* Report to subsystems. */ |
683 |
INT2CHAR(sp, sep, STRLEN(sep) + 1, np, nlen); |
683 |
INT2CHAR(sp, sep, NVI_STRLEN(sep) + 1, np, nlen); |
684 |
if (op->func != NULL && |
684 |
if (op->func != NULL && |
685 |
op->func(sp, spo, np, &value) || |
685 |
op->func(sp, spo, np, &value) || |
686 |
ex_optchange(sp, offset, np, &value) || |
686 |
ex_optchange(sp, offset, np, &value) || |
Lines 712-718
badnum: INT2CHAR(sp, name, STRLEN(nam
Link Here
|
712 |
* Do nothing if the value is unchanged, the underlying |
712 |
* Do nothing if the value is unchanged, the underlying |
713 |
* functions can be expensive. |
713 |
* functions can be expensive. |
714 |
*/ |
714 |
*/ |
715 |
INT2CHAR(sp, sep, STRLEN(sep) + 1, np, nlen); |
715 |
INT2CHAR(sp, sep, NVI_STRLEN(sep) + 1, np, nlen); |
716 |
if (!F_ISSET(op, OPT_ALWAYS) && |
716 |
if (!F_ISSET(op, OPT_ALWAYS) && |
717 |
O_STR(sp, offset) != NULL && |
717 |
O_STR(sp, offset) != NULL && |
718 |
!strcmp(O_STR(sp, offset), np)) |
718 |
!strcmp(O_STR(sp, offset), np)) |
Lines 879-885
opts_dump(SCR *sp, enum optdisp type)
Link Here
|
879 |
} |
879 |
} |
880 |
F_CLR(&sp->opts[cnt], OPT_SELECTED); |
880 |
F_CLR(&sp->opts[cnt], OPT_SELECTED); |
881 |
|
881 |
|
882 |
curlen = STRLEN(op->name); |
882 |
curlen = NVI_STRLEN(op->name); |
883 |
switch (op->type) { |
883 |
switch (op->type) { |
884 |
case OPT_0BOOL: |
884 |
case OPT_0BOOL: |
885 |
case OPT_1BOOL: |
885 |
case OPT_1BOOL: |
Lines 1049-1055
opts_search(CHAR_T *name)
Link Here
|
1049 |
* Check to see if the name is the prefix of one (and only one) |
1049 |
* Check to see if the name is the prefix of one (and only one) |
1050 |
* option. If so, return the option. |
1050 |
* option. If so, return the option. |
1051 |
*/ |
1051 |
*/ |
1052 |
len = STRLEN(name); |
1052 |
len = NVI_STRLEN(name); |
1053 |
for (found = NULL, op = optlist; op->name != NULL; ++op) { |
1053 |
for (found = NULL, op = optlist; op->name != NULL; ++op) { |
1054 |
if (op->name[0] < name[0]) |
1054 |
if (op->name[0] < name[0]) |
1055 |
continue; |
1055 |
continue; |