ripasso-cursive: cosmetic changes (#361736)
[NixPkgs.git] / pkgs / by-name / pb / pbzx / stdin.patch
blobf4fa23474387b7406d818489a87da677a4a26744
1 C standard defines `stdin` as a macro so we can’t use it as an
2 identifier. See also
3 https://lists.llvm.org/pipermail/llvm-commits/Week-of-Mon-20130506/173524.html
5 --- a/pbzx.c
6 +++ b/pbzx.c
7 @@ -34,7 +34,7 @@
9 /* Structure to hold the command-line options. */
10 struct options {
11 - bool stdin; /* True if data should be read from stdin. */
12 + bool usestdin; /* True if data should be read from stdin. */
13 bool noxar; /* The input data is not a XAR archive but the pbzx Payload. */
14 bool help; /* Print usage with details and exit. */
15 bool version; /* Print version and exit. */
16 @@ -74,7 +74,7 @@
17 /* Skip arguments that are not flags. */
18 if (argv[i][0] != '-') continue;
19 /* Match available arguments. */
20 - if (strcmp(argv[i], "-") == 0) opts->stdin = true;
21 + if (strcmp(argv[i], "-") == 0) opts->usestdin = true;
22 else if (strcmp(argv[i], "-n") == 0) opts->noxar = true;
23 else if (strcmp(argv[i], "-h") == 0) opts->help = true;
24 else if (strcmp(argv[i], "-v") == 0) opts->version = true;
25 @@ -204,9 +204,9 @@
26 parse_args(&argc, argv, &opts);
27 if (opts.version) version();
28 if (opts.help) usage(NULL);
29 - if (!opts.stdin && argc < 2)
30 + if (!opts.usestdin && argc < 2)
31 usage("missing filename argument");
32 - else if ((!opts.stdin && argc > 2) || (opts.stdin && argc > 1))
33 + else if ((!opts.usestdin && argc > 2) || (opts.usestdin && argc > 1))
34 usage("unhandled positional argument(s)");
36 char const* filename = NULL;
37 @@ -216,7 +216,7 @@
38 struct stream stream;
39 stream_init(&stream);
40 bool success = false;
41 - if (opts.stdin) {
42 + if (opts.usestdin) {
43 stream.type = STREAM_FP;
44 stream.fp = stdin;
45 success = true;
46 @@ -291,6 +291,6 @@
48 free(zbuf);
49 lzma_end(&zs);
50 - if (!opts.stdin) stream_close(&stream);
51 + if (!opts.usestdin) stream_close(&stream);
52 return 0;