Deleted Added
full compact
modpipe.c (302408) modpipe.c (323129)
1/*
2 * Copyright (c) 2012 Damien Miller <djm@mindrot.org>
3 *
4 * Permission to use, copy, modify, and distribute this software for any
5 * purpose with or without fee is hereby granted, provided that the above
6 * copyright notice and this permission notice appear in all copies.
7 *
8 * THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL WARRANTIES

--- 11 unchanged lines hidden (view full) ---

20
21#include <sys/types.h>
22#include <unistd.h>
23#include <stdio.h>
24#include <string.h>
25#include <stdarg.h>
26#include <stdlib.h>
27#include <errno.h>
1/*
2 * Copyright (c) 2012 Damien Miller <djm@mindrot.org>
3 *
4 * Permission to use, copy, modify, and distribute this software for any
5 * purpose with or without fee is hereby granted, provided that the above
6 * copyright notice and this permission notice appear in all copies.
7 *
8 * THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL WARRANTIES

--- 11 unchanged lines hidden (view full) ---

20
21#include <sys/types.h>
22#include <unistd.h>
23#include <stdio.h>
24#include <string.h>
25#include <stdarg.h>
26#include <stdlib.h>
27#include <errno.h>
28#ifdef HAVE_ERR_H
29# include <err.h>
30#endif
28#include "openbsd-compat/getopt_long.c"
29
31#include "openbsd-compat/getopt_long.c"
32
30static void err(int, const char *, ...) __attribute__((format(printf, 2, 3)));
31static void errx(int, const char *, ...) __attribute__((format(printf, 2, 3)));
32
33static void
33static void
34err(int r, const char *fmt, ...)
35{
36 va_list args;
37
38 va_start(args, fmt);
39 fprintf(stderr, "%s: ", strerror(errno));
40 vfprintf(stderr, fmt, args);
41 fputc('\n', stderr);
42 va_end(args);
43 exit(r);
44}
45
46static void
47errx(int r, const char *fmt, ...)
48{
49 va_list args;
50
51 va_start(args, fmt);
52 vfprintf(stderr, fmt, args);
53 fputc('\n', stderr);
54 va_end(args);
55 exit(r);
56}
57
58static void
59usage(void)
60{
61 fprintf(stderr, "Usage: modpipe -w [-m modspec ...] < in > out\n");
62 fprintf(stderr, "modspec is one of:\n");
63 fprintf(stderr, " xor:offset:value - XOR \"value\" at \"offset\"\n");
64 fprintf(stderr, " andor:offset:val1:val2 - AND \"val1\" then OR \"val2\" at \"offset\"\n");
65 exit(1);
66}

--- 109 unchanged lines hidden ---
34usage(void)
35{
36 fprintf(stderr, "Usage: modpipe -w [-m modspec ...] < in > out\n");
37 fprintf(stderr, "modspec is one of:\n");
38 fprintf(stderr, " xor:offset:value - XOR \"value\" at \"offset\"\n");
39 fprintf(stderr, " andor:offset:val1:val2 - AND \"val1\" then OR \"val2\" at \"offset\"\n");
40 exit(1);
41}

--- 109 unchanged lines hidden ---