]> ncurses.scripts.mit.edu Git - ncurses.git/blobdiff - progs/tparm_type.c
ncurses 6.2 - patch 20210220
[ncurses.git] / progs / tparm_type.c
index 125e43c26179640b411bc84d9e38e634f1145193..3da4a0774af5164eab3f2d7655b6f491a83a5cf6 100644 (file)
@@ -1,5 +1,6 @@
 /****************************************************************************
 /****************************************************************************
- * Copyright (c) 1998-2013,2015 Free Software Foundation, Inc.              *
+ * Copyright 2020 Thomas E. Dickey                                          *
+ * Copyright 2014,2015 Free Software Foundation, Inc.                       *
  *                                                                          *
  * Permission is hereby granted, free of charge, to any person obtaining a  *
  * copy of this software and associated documentation files (the            *
  *                                                                          *
  * Permission is hereby granted, free of charge, to any person obtaining a  *
  * copy of this software and associated documentation files (the            *
@@ -32,7 +33,7 @@
 
 #include <tparm_type.h>
 
 
 #include <tparm_type.h>
 
-MODULE_ID("$Id: tparm_type.c,v 1.2 2015/04/04 15:01:13 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
 
 /*
  * Lookup the type of call we should make to tparm().  This ignores the actual
@@ -69,3 +70,31 @@ tparm_type(const char *name)
     }
     return result;
 }
     }
     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;
+}