]> git.sur5r.net Git - ngadmin/blobdiff - cli/common.h
Let commands handle themselves absence of arguments
[ngadmin] / cli / common.h
index ee845aff9e41bf48b9d8ff96ddc135c200eb9e56..e50ae1e6e57a557a04a38a6175868155456b6983 100644 (file)
@@ -5,43 +5,33 @@
 
 #include <stdio.h>
 #include <stdlib.h>
+#include <string.h>
+#include <termios.h>
+#include <unistd.h>
 
 #include <ngadmin.h>
 
 
-#define UNUSED                         __attribute__((unused))
-#define COM(nam, func, args, ...)      {.name=nam, .comfunc=func, .hasArgs=args, .sub={__VA_ARGS__}}
+#define UNUSED                 __attribute__((unused))
+#define NORET                  __attribute__((noreturn))
 
 
+extern int main_loop_continue;
+extern struct termios current_term;
 
-struct TreeNode {
- const char *name;
- bool (* const comfunc)(const struct TreeNode*, int, const char**, struct ngadmin*);
- bool hasArgs;
- const struct TreeNode *sub[];
-};
-
-
-
-extern int cont;
-
-
-
-extern const struct TreeNode com_quit;
-extern const struct TreeNode com_login;
-extern const struct TreeNode com_scan;
-extern const struct TreeNode com_ports;
-extern const struct TreeNode com_password;
-extern const struct TreeNode com_list;
-extern const struct TreeNode com_list;
-extern const struct TreeNode com_firmware;
-extern const struct TreeNode com_name;
 
+extern const char * const bitrates[], * const prio[];
 
 
 void displaySwitchTab (const struct swi_attr *sa, int nb);
 void printErrCode (int err);
+int parseBitrate (const char *s);
+char parsePrio (const char *s);
+
+
+int trim (char *txt, int start);
 
+int explode (const char *commande, char** tab, int maximum);
 
 
 #endif