From f07d5cdbaf5d906b145b152d549915271d355798 Mon Sep 17 00:00:00 2001 From: Bobby Bingham Date: Thu, 19 Jan 2017 19:11:54 -0600 Subject: nqasm: add command line processing --- common.h | 24 ++++++++++++++++++++++++ 1 file changed, 24 insertions(+) create mode 100644 common.h (limited to 'common.h') diff --git a/common.h b/common.h new file mode 100644 index 0000000..82a6328 --- /dev/null +++ b/common.h @@ -0,0 +1,24 @@ +#ifndef NQ_COMMON_H +#define NQ_COMMON_H + +#include +#include + +extern const char *progname; + +#define ERROR(...) \ + do { \ + fprintf(stderr, "%s: ", progname); \ + fprintf(stderr, __VA_ARGS__); \ + fprintf(stderr, "\n"); \ + } while (0) + +#define PERROR(str) \ + do { \ + int err = errno; \ + fprintf(stderr, "%s: ", progname); \ + errno = err; \ + perror(str); \ + } while (0) + +#endif -- cgit v1.2.3