X-Git-Url: https://ncurses.scripts.mit.edu/?p=ncurses.git;a=blobdiff_plain;f=progs%2Ftparm_type.c;h=3da4a0774af5164eab3f2d7655b6f491a83a5cf6;hp=da681ce90fe2e49a821798a84b20ad37e35bf4a6;hb=7f4b9f390624835ceb0849965a7f6ff2dcb39d00;hpb=47d2fb4537d9ad5bb14f4810561a327930ca4280 diff --git a/progs/tparm_type.c b/progs/tparm_type.c index da681ce9..3da4a077 100644 --- a/progs/tparm_type.c +++ b/progs/tparm_type.c @@ -33,7 +33,7 @@ #include -MODULE_ID("$Id: tparm_type.c,v 1.3 2020/02/02 23:34:34 tom Exp $") +MODULE_ID("$Id: tparm_type.c,v 1.4 2020/10/24 17:30:32 tom Exp $") /* * Lookup the type of call we should make to tparm(). This ignores the actual @@ -70,3 +70,31 @@ tparm_type(const char *name) } return result; } + +TParams +guess_tparm_type(int nparam, char **p_is_s) +{ + TParams result = Other; + switch (nparam) { + case 0: + case 1: + if (!p_is_s[0]) + result = Numbers; + break; + case 2: + if (!p_is_s[0] && !p_is_s[1]) + result = Numbers; + if (!p_is_s[0] && p_is_s[1]) + result = Num_Str; + break; + case 3: + if (!p_is_s[0] && !p_is_s[1] && !p_is_s[2]) + result = Numbers; + if (!p_is_s[0] && p_is_s[1] && p_is_s[2]) + result = Num_Str_Str; + break; + default: + break; + } + return result; +}