summaryrefslogtreecommitdiff
path: root/src/common/console.c
diff options
context:
space:
mode:
authorHaru <haru@dotalux.com>2015-08-07 03:22:00 +0200
committerHaru <haru@dotalux.com>2015-08-15 00:51:40 +0200
commitef207268ed7e5faa399a9af8c694639c9ff1d09f (patch)
tree89c60ddc500620e001d18e1bdd3290ac2bb715b1 /src/common/console.c
parent1f4d2c86b3d9ef894d77f7f47e0c2337fb17738b (diff)
downloadhercules-ef207268ed7e5faa399a9af8c694639c9ff1d09f.tar.gz
hercules-ef207268ed7e5faa399a9af8c694639c9ff1d09f.tar.bz2
hercules-ef207268ed7e5faa399a9af8c694639c9ff1d09f.tar.xz
hercules-ef207268ed7e5faa399a9af8c694639c9ff1d09f.zip
Minor symbols cleanup to avoid conflicts
Signed-off-by: Haru <haru@dotalux.com>
Diffstat (limited to 'src/common/console.c')
-rw-r--r--src/common/console.c72
1 files changed, 36 insertions, 36 deletions
diff --git a/src/common/console.c b/src/common/console.c
index 95d1e69fe..3b49204f6 100644
--- a/src/common/console.c
+++ b/src/common/console.c
@@ -74,12 +74,11 @@ void display_title(void) {
ShowInfo("Compile Flags: %s\n", sysinfo->cflags());
}
#ifdef CONSOLE_INPUT
-#if defined(WIN32)
-int console_parse_key_pressed(void) {
+int console_parse_key_pressed(void)
+{
+#ifdef WIN32
return _kbhit();
-}
-#else /* WIN32 */
-int console_parse_key_pressed(void) {
+#else // ! WIN32
struct timeval tv;
fd_set fds;
tv.tv_sec = 0;
@@ -91,8 +90,8 @@ int console_parse_key_pressed(void) {
select(STDIN_FILENO+1, &fds, NULL, NULL, &tv);
return FD_ISSET(STDIN_FILENO, &fds);
+#endif // WIN32
}
-#endif /* _WIN32 */
/*======================================
* CORE: Console commands
@@ -158,41 +157,41 @@ CPCMD_C(skip,update) {
}
/**
- * Defines a main category.
- *
- * Categories can't be used as commands!
- * E.G.
- * - sql update skip
- * 'sql' is the main category
- * CP_DEF_C(category)
+ * Loads console commands list
**/
+void console_load_defaults(void)
+{
+ /**
+ * Defines a main category.
+ *
+ * Categories can't be used as commands!
+ * E.G.
+ * - sql update skip
+ * 'sql' is the main category
+ * CP_DEF_C(category)
+ **/
#define CP_DEF_C(x) { #x , NULL , NULL, NULL }
-/**
- * Defines a sub-category.
- *
- * Sub-categories can't be used as commands!
- * E.G.
- * - sql update skip
- * 'update' is a sub-category
- * CP_DEF_C2(command, category)
- **/
+ /**
+ * Defines a sub-category.
+ *
+ * Sub-categories can't be used as commands!
+ * E.G.
+ * - sql update skip
+ * 'update' is a sub-category
+ * CP_DEF_C2(command, category)
+ **/
#define CP_DEF_C2(x,y) { #x , NULL , #y, NULL }
-/**
- * Defines a command that is inside a category or sub-category
- * CP_DEF_S(command, category/sub-category)
- **/
+ /**
+ * Defines a command that is inside a category or sub-category
+ * CP_DEF_S(command, category/sub-category)
+ **/
#define CP_DEF_S(x,y) { #x, CPCMD_C_A(x,y), #y, NULL }
-/**
- * Defines a command that is _not_ inside any category
- * CP_DEF_S(command)
- **/
+ /**
+ * Defines a command that is _not_ inside any category
+ * CP_DEF_S(command)
+ **/
#define CP_DEF(x) { #x , CPCMD_A(x), NULL, NULL }
-/**
- * Loads console commands list
- * See CP_DEF_C, CP_DEF_C2, CP_DEF_S, CP_DEF
- **/
-void console_load_defaults(void) {
struct {
char *name;
CParseFunc func;
@@ -254,11 +253,12 @@ void console_load_defaults(void) {
}
}
}
-}
#undef CP_DEF_C
#undef CP_DEF_C2
#undef CP_DEF_S
#undef CP_DEF
+}
+
void console_parse_create(char *name, CParseFunc func) {
unsigned int i;
char *tok;