]> git.mdlowis.com Git - projs/tide.git/commitdiff
instrumented code to make fuzzing easier
authorMichael D. Lowis <mike.lowis@gentex.com>
Tue, 26 Feb 2019 20:28:20 +0000 (15:28 -0500)
committerMichael D. Lowis <mike.lowis@gentex.com>
Tue, 26 Feb 2019 20:28:20 +0000 (15:28 -0500)
src/tide.c

index e039e3349aa881aab690c4e7aacba35a04764533..8e07013294e31b241df64193eb20587dffd0b7b7 100644 (file)
 #define INCLUDE_DEFS
 #include "config.h"
 
+/* stub some functions for test so we don't interact with the outside world too much */
+#ifdef TEST
+#define job_start(cmd, data, ndata, dest) \
+    ((void)cmd, (void)data, (void)ndata, (void)dest)
+#define job_run(char** cmd)
+    ((void)cmd, 0)
+#define x11_sel_get(x, selid, str) \
+    ((void)x, (void)selid, (void)str)
+#define x11_sel_get(x, selid, cbfn) \
+    ((void)x, (void)selid, (void)cbfn, (void)1)
+#endif
+
 /* predeclare some things */
 static void exec(char* cmd, char* arg);
 void cut(char* arg);
@@ -887,7 +899,7 @@ static void usage(void) {
     exit(1);
 }
 
-#ifndef TEST
+#if !defined(TEST)
 int main(int argc, char** argv) {
     long int line_num = 0;
     #define BOOLARG() (EOPTARG(usage()), optarg_[0] == '0' ? 0 : 1)