summaryrefslogtreecommitdiffstatshomepage
diff options
context:
space:
mode:
authorGravatar Antti K2014-07-29 23:30:49 +0200
committerGravatar Antti K2014-07-30 01:11:09 +0200
commit764dafa29fdb42e331c3edc960f5938254ca77d5 (patch)
treee77dd05c0bef29c2b627d66fceb7c026b648dab6
parent099102ef9890a754c686960bbe10f82776d77249 (diff)
downloadxkbcat-764dafa29fdb42e331c3edc960f5938254ca77d5.tar.gz
xkbcat-764dafa29fdb42e331c3edc960f5938254ca77d5.zip
Consistency: Make default display a const char *
Yep, `hostname` is a `const char *` too, even though it's potentially being assigned to. This is [unintuitive](http://stackoverflow.com/a/9834194/777586), but intentional.
-rwxr-xr-xcompile2
-rw-r--r--xkbcat.c12
2 files changed, 7 insertions, 7 deletions
diff --git a/compile b/compile
index 4b8f85e..41d4254 100755
--- a/compile
+++ b/compile
@@ -1 +1 @@
-clang --std=gnu11 -Wall -o xkbcat -lX11 xkbcat.c
+clang --std=gnu11 -pedantic -Wall -o xkbcat -lX11 xkbcat.c
diff --git a/xkbcat.c b/xkbcat.c
index 7cdb800..1fc3ff3 100644
--- a/xkbcat.c
+++ b/xkbcat.c
@@ -8,9 +8,9 @@
#include <stdbool.h>
#include <time.h>
-char * DEFAULT_DISPLAY = ":0";
-const int DEFAULT_DELAY = 10000000;
-const bool DEFAULT_PRINT_UP = false;
+const char * DEFAULT_DISPLAY = ":0";
+const int DEFAULT_DELAY = 10000000;
+const bool DEFAULT_PRINT_UP = false;
typedef char KbBuffer[32];
static inline bool keyState(KbBuffer b, int key) {
@@ -31,9 +31,9 @@ USAGE: xkbcat [-display <display>] [-delay <nanosec>] [-up]\n\
int main(int argc, char * argv[]) {
- char * hostname = DEFAULT_DISPLAY;
- int delay = DEFAULT_DELAY;
- bool printKeyUps = DEFAULT_PRINT_UP;
+ const char * hostname = DEFAULT_DISPLAY;
+ int delay = DEFAULT_DELAY;
+ bool printKeyUps = DEFAULT_PRINT_UP;
// Get args
for (int i = 1; i < argc; i++) {