diff options
author | Bobby Bingham <koorogi@koorogi.info> | 2017-01-19 19:11:54 -0600 |
---|---|---|
committer | Bobby Bingham <koorogi@koorogi.info> | 2017-01-19 19:11:54 -0600 |
commit | f07d5cdbaf5d906b145b152d549915271d355798 (patch) | |
tree | 74ca01e5ccf06c67ac25e769f5c4a3f71aa7bbe6 /common.h | |
parent | 7561230a9dda9728b93306c0bd398c5b1cc1ce4d (diff) |
nqasm: add command line processing
Diffstat (limited to 'common.h')
-rw-r--r-- | common.h | 24 |
1 files changed, 24 insertions, 0 deletions
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 <errno.h> +#include <stdio.h> + +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 |