| Line | Source | Count |
| 1 | | - |
| 2 | | - |
| 3 | | - |
| 4 | | - |
| 5 | | - |
| 6 | | - |
| 7 | | - |
| 8 | | - |
| 9 | | - |
| 10 | | - |
| 11 | | - |
| 12 | | - |
| 13 | | - |
| 14 | | - |
| 15 | | - |
| 16 | | - |
| 17 | | - |
| 18 | | - |
| 19 | | - |
| 20 | | - |
| 21 | #include <config.h> | - |
| 22 | | - |
| 23 | #include <stdio.h> | - |
| 24 | #include <getopt.h> | - |
| 25 | #include <sys/types.h> | - |
| 26 | | - |
| 27 | #include "system.h" | - |
| 28 | #include "die.h" | - |
| 29 | #include "error.h" | - |
| 30 | #include "fadvise.h" | - |
| 31 | #include "quote.h" | - |
| 32 | #include "xstrtol.h" | - |
| 33 | #include "xdectoint.h" | - |
| 34 | #include "xbinary-io.h" | - |
| 35 | | - |
| 36 | #define AUTHORS proper_name ("Simon Josefsson") | - |
| 37 | | - |
| 38 | #if BASE_TYPE == 32 | - |
| 39 | # include "base32.h" | - |
| 40 | # define PROGRAM_NAME "base32" | - |
| 41 | #else | - |
| 42 | # include "base64.h" | - |
| 43 | # define PROGRAM_NAME "base64" | - |
| 44 | #endif | - |
| 45 | | - |
| 46 | | - |
| 47 | static struct option const long_options[] = | - |
| 48 | { | - |
| 49 | {"decode", no_argument, 0, 'd'}, | - |
| 50 | {"wrap", required_argument, 0, 'w'}, | - |
| 51 | {"ignore-garbage", no_argument, 0, 'i'}, | - |
| 52 | | - |
| 53 | {GETOPT_HELP_OPTION_DECL}, | - |
| 54 | {GETOPT_VERSION_OPTION_DECL}, | - |
| 55 | {NULL, 0, NULL, 0} | - |
| 56 | }; | - |
| 57 | | - |
| 58 | void | - |
| 59 | usage (int status) | - |
| 60 | { | - |
| 61 | if (status != EXIT_SUCCESS)| TRUE | evaluated 6 times by 2 tests | | FALSE | evaluated 14 times by 2 tests |
| 6-14 |
| 62 | emit_try_help ();executed 6 times by 2 tests: end of block | 6 |
| 63 | else | - |
| 64 | { | - |
| 65 | printf (_("\ | - |
| 66 | Usage: %s [OPTION]... [FILE]\n\ | - |
| 67 | Base%d encode or decode FILE, or standard input, to standard output.\n\ | - |
| 68 | "), program_name, BASE_TYPE); | - |
| 69 | | - |
| 70 | emit_stdin_note (); | - |
| 71 | emit_mandatory_arg_note (); | - |
| 72 | | - |
| 73 | fputs (_("\ | - |
| 74 | -d, --decode decode data\n\ | - |
| 75 | -i, --ignore-garbage when decoding, ignore non-alphabet characters\n\ | - |
| 76 | -w, --wrap=COLS wrap encoded lines after COLS character (default 76).\n\ | - |
| 77 | Use 0 to disable line wrapping\n\ | - |
| 78 | \n\ | - |
| 79 | "), stdout); | - |
| 80 | fputs (HELP_OPTION_DESCRIPTION, stdout); | - |
| 81 | fputs (VERSION_OPTION_DESCRIPTION, stdout); | - |
| 82 | printf (_("\ | - |
| 83 | \n\ | - |
| 84 | The data are encoded as described for the %s alphabet in RFC 4648.\n\ | - |
| 85 | When decoding, the input may contain newlines in addition to the bytes of\n\ | - |
| 86 | the formal %s alphabet. Use --ignore-garbage to attempt to recover\n\ | - |
| 87 | from any other non-alphabet bytes in the encoded stream.\n"), | - |
| 88 | PROGRAM_NAME, PROGRAM_NAME); | - |
| 89 | emit_ancillary_info (PROGRAM_NAME); | - |
| 90 | }executed 14 times by 2 tests: end of block | 14 |
| 91 | | - |
| 92 | exit (status);executed 20 times by 2 tests: exit (status); | 20 |
| 93 | } | - |
| 94 | | - |
| 95 | #define ENC_BLOCKSIZE (1024*3*10) | - |
| 96 | | - |
| 97 | #if BASE_TYPE == 32 | - |
| 98 | # define BASE_LENGTH BASE32_LENGTH | - |
| 99 | | - |
| 100 | | - |
| 101 | # define DEC_BLOCKSIZE (1024*5) | - |
| 102 | | - |
| 103 | | - |
| 104 | verify (ENC_BLOCKSIZE % 40 == 0); | - |
| 105 | verify (DEC_BLOCKSIZE % 40 == 0); | - |
| 106 | | - |
| 107 | # define base_encode base32_encode | - |
| 108 | # define base_decode_context base32_decode_context | - |
| 109 | # define base_decode_ctx_init base32_decode_ctx_init | - |
| 110 | # define base_decode_ctx base32_decode_ctx | - |
| 111 | # define isbase isbase32 | - |
| 112 | #else | - |
| 113 | # define BASE_LENGTH BASE64_LENGTH | - |
| 114 | | - |
| 115 | | - |
| 116 | # define DEC_BLOCKSIZE (1024*3) | - |
| 117 | | - |
| 118 | | - |
| 119 | verify (ENC_BLOCKSIZE % 12 == 0); | - |
| 120 | verify (DEC_BLOCKSIZE % 12 == 0); | - |
| 121 | | - |
| 122 | # define base_encode base64_encode | - |
| 123 | # define base_decode_context base64_decode_context | - |
| 124 | # define base_decode_ctx_init base64_decode_ctx_init | - |
| 125 | # define base_decode_ctx base64_decode_ctx | - |
| 126 | # define isbase isbase64 | - |
| 127 | #endif | - |
| 128 | | - |
| 129 | static void | - |
| 130 | wrap_write (const char *buffer, size_t len, | - |
| 131 | uintmax_t wrap_column, size_t *current_column, FILE *out) | - |
| 132 | { | - |
| 133 | size_t written; | - |
| 134 | | - |
| 135 | if (wrap_column == 0)| TRUE | evaluated 2 times by 2 tests | | FALSE | evaluated 32 times by 2 tests |
| 2-32 |
| 136 | { | - |
| 137 | | - |
| 138 | if (fwrite (buffer, 1, len, stdout) < len) never executed: break; | TRUE | never evaluated | | FALSE | evaluated 2 times by 2 tests |
| TRUE | never evaluated | | FALSE | never evaluated |
| TRUE | never evaluated | | FALSE | never evaluated |
| TRUE | never evaluated | | FALSE | never evaluated |
| TRUE | evaluated 2 times by 2 tests | | FALSE | never evaluated |
| TRUE | never evaluated | | FALSE | evaluated 2 times by 2 tests |
| TRUE | never evaluated | | FALSE | never evaluated |
| TRUE | never evaluated | | FALSE | never evaluated |
| TRUE | evaluated 2 times by 2 tests | | FALSE | never evaluated |
| TRUE | never evaluated | | FALSE | evaluated 2 times by 2 tests |
| TRUE | never evaluated | | FALSE | evaluated 2 times by 2 tests |
| TRUE | never evaluated | | FALSE | never evaluated |
| 0-2 |
| 139 | die (EXIT_FAILURE, errno, _("write error")); never executed: ((!!sizeof (struct { _Static_assert ( 1 , "verify_expr (" "1" ", " "(error (1, (*__errno_location ()), dcgettext (((void *)0), \"write error\", 5)), assume (false))" ")"); int _gl_dummy; })) ? ((error ( 1 , (*__errno_location ()) , dcgettext (((void *)0), "write error" , 5) ), (( 0 ) ? (void) 0 : __builtin_unreachable ()))) : ((error ( 1 , (*__errno_location ()) , dcgettext (((void *)0), "write error" , 5) ), (( 0 ) ? (void) 0 : __builtin_unreachable ())))); | 0 |
| 140 | }executed 2 times by 2 tests: end of block | 2 |
| 141 | else | - |
| 142 | for (written = 0; written < len;)| TRUE | evaluated 426 times by 2 tests | | FALSE | evaluated 32 times by 2 tests |
| 32-426 |
| 143 | { | - |
| 144 | uintmax_t cols_remaining = wrap_column - *current_column; | - |
| 145 | size_t to_write = MIN (cols_remaining, SIZE_MAX);| TRUE | evaluated 426 times by 2 tests | | FALSE | never evaluated |
| 0-426 |
| 146 | to_write = MIN (to_write, len - written);| TRUE | evaluated 394 times by 2 tests | | FALSE | evaluated 32 times by 2 tests |
| 32-394 |
| 147 | | - |
| 148 | if (to_write == 0)| TRUE | evaluated 197 times by 2 tests | | FALSE | evaluated 229 times by 2 tests |
| 197-229 |
| 149 | { | - |
| 150 | if (fputc ('\n', out) == EOF)| TRUE | never evaluated | | FALSE | evaluated 197 times by 2 tests |
| 0-197 |
| 151 | die (EXIT_FAILURE, errno, _("write error")); never executed: ((!!sizeof (struct { _Static_assert ( 1 , "verify_expr (" "1" ", " "(error (1, (*__errno_location ()), dcgettext (((void *)0), \"write error\", 5)), assume (false))" ")"); int _gl_dummy; })) ? ((error ( 1 , (*__errno_location ()) , dcgettext (((void *)0), "write error" , 5) ), (( 0 ) ? (void) 0 : __builtin_unreachable ()))) : ((error ( 1 , (*__errno_location ()) , dcgettext (((void *)0), "write error" , 5) ), (( 0 ) ? (void) 0 : __builtin_unreachable ())))); | 0 |
| 152 | *current_column = 0; | - |
| 153 | }executed 197 times by 2 tests: end of block | 197 |
| 154 | else | - |
| 155 | { | - |
| 156 | if (fwrite (buffer + written, 1, to_write, stdout) < to_write) never executed: break; | TRUE | never evaluated | | FALSE | evaluated 229 times by 2 tests |
| TRUE | never evaluated | | FALSE | never evaluated |
| TRUE | never evaluated | | FALSE | never evaluated |
| TRUE | never evaluated | | FALSE | never evaluated |
| TRUE | evaluated 229 times by 2 tests | | FALSE | never evaluated |
| TRUE | never evaluated | | FALSE | evaluated 229 times by 2 tests |
| TRUE | never evaluated | | FALSE | never evaluated |
| TRUE | never evaluated | | FALSE | never evaluated |
| TRUE | evaluated 229 times by 2 tests | | FALSE | never evaluated |
| TRUE | never evaluated | | FALSE | evaluated 229 times by 2 tests |
| TRUE | never evaluated | | FALSE | evaluated 229 times by 2 tests |
| TRUE | never evaluated | | FALSE | never evaluated |
| 0-229 |
| 157 | die (EXIT_FAILURE, errno, _("write error")); never executed: ((!!sizeof (struct { _Static_assert ( 1 , "verify_expr (" "1" ", " "(error (1, (*__errno_location ()), dcgettext (((void *)0), \"write error\", 5)), assume (false))" ")"); int _gl_dummy; })) ? ((error ( 1 , (*__errno_location ()) , dcgettext (((void *)0), "write error" , 5) ), (( 0 ) ? (void) 0 : __builtin_unreachable ()))) : ((error ( 1 , (*__errno_location ()) , dcgettext (((void *)0), "write error" , 5) ), (( 0 ) ? (void) 0 : __builtin_unreachable ())))); | 0 |
| 158 | *current_column += to_write; | - |
| 159 | written += to_write; | - |
| 160 | }executed 229 times by 2 tests: end of block | 229 |
| 161 | } | - |
| 162 | }executed 34 times by 2 tests: end of block | 34 |
| 163 | | - |
| 164 | static void | - |
| 165 | do_encode (FILE *in, FILE *out, uintmax_t wrap_column) | - |
| 166 | { | - |
| 167 | size_t current_column = 0; | - |
| 168 | char inbuf[ENC_BLOCKSIZE]; | - |
| 169 | char outbuf[BASE_LENGTH (ENC_BLOCKSIZE)]; | - |
| 170 | size_t sum; | - |
| 171 | | - |
| 172 | do | - |
| 173 | { | - |
| 174 | size_t n; | - |
| 175 | | - |
| 176 | sum = 0; | - |
| 177 | do | - |
| 178 | { | - |
| 179 | n = fread (inbuf + sum, 1, ENC_BLOCKSIZE - sum, in); | - |
| 180 | sum += n; | - |
| 181 | }executed 36 times by 2 tests: end of block | 36 |
| 182 | while (!feof (in) && !ferror (in) && sum < ENC_BLOCKSIZE);| TRUE | never evaluated | | FALSE | evaluated 36 times by 2 tests |
| TRUE | never evaluated | | FALSE | never evaluated |
| TRUE | never evaluated | | FALSE | never evaluated |
| 0-36 |
| 183 | | - |
| 184 | if (sum > 0)| TRUE | evaluated 34 times by 2 tests | | FALSE | evaluated 2 times by 2 tests |
| 2-34 |
| 185 | { | - |
| 186 | | - |
| 187 | | - |
| 188 | base_encode (inbuf, sum, outbuf, BASE_LENGTH (sum)); | - |
| 189 | | - |
| 190 | wrap_write (outbuf, BASE_LENGTH (sum), wrap_column, | - |
| 191 | ¤t_column, out); | - |
| 192 | }executed 34 times by 2 tests: end of block | 34 |
| 193 | }executed 36 times by 2 tests: end of block | 36 |
| 194 | while (!feof (in) && !ferror (in) && sum == ENC_BLOCKSIZE);| TRUE | never evaluated | | FALSE | evaluated 36 times by 2 tests |
| TRUE | never evaluated | | FALSE | never evaluated |
| TRUE | never evaluated | | FALSE | never evaluated |
| 0-36 |
| 195 | | - |
| 196 | | - |
| 197 | if (wrap_column && current_column > 0 && fputc ('\n', out) == EOF)| TRUE | evaluated 34 times by 2 tests | | FALSE | evaluated 2 times by 2 tests |
| TRUE | evaluated 32 times by 2 tests | | FALSE | evaluated 2 times by 2 tests |
| TRUE | never evaluated | | FALSE | evaluated 32 times by 2 tests |
| 0-34 |
| 198 | die (EXIT_FAILURE, errno, _("write error")); never executed: ((!!sizeof (struct { _Static_assert ( 1 , "verify_expr (" "1" ", " "(error (1, (*__errno_location ()), dcgettext (((void *)0), \"write error\", 5)), assume (false))" ")"); int _gl_dummy; })) ? ((error ( 1 , (*__errno_location ()) , dcgettext (((void *)0), "write error" , 5) ), (( 0 ) ? (void) 0 : __builtin_unreachable ()))) : ((error ( 1 , (*__errno_location ()) , dcgettext (((void *)0), "write error" , 5) ), (( 0 ) ? (void) 0 : __builtin_unreachable ())))); | 0 |
| 199 | | - |
| 200 | if (ferror (in))| TRUE | never evaluated | | FALSE | evaluated 36 times by 2 tests |
| 0-36 |
| 201 | die (EXIT_FAILURE, errno, _("read error")); never executed: ((!!sizeof (struct { _Static_assert ( 1 , "verify_expr (" "1" ", " "(error (1, (*__errno_location ()), dcgettext (((void *)0), \"read error\", 5)), assume (false))" ")"); int _gl_dummy; })) ? ((error ( 1 , (*__errno_location ()) , dcgettext (((void *)0), "read error" , 5) ), (( 0 ) ? (void) 0 : __builtin_unreachable ()))) : ((error ( 1 , (*__errno_location ()) , dcgettext (((void *)0), "read error" , 5) ), (( 0 ) ? (void) 0 : __builtin_unreachable ())))); | 0 |
| 202 | }executed 36 times by 2 tests: end of block | 36 |
| 203 | | - |
| 204 | static void | - |
| 205 | do_decode (FILE *in, FILE *out, bool ignore_garbage) | - |
| 206 | { | - |
| 207 | char inbuf[BASE_LENGTH (DEC_BLOCKSIZE)]; | - |
| 208 | char outbuf[DEC_BLOCKSIZE]; | - |
| 209 | size_t sum; | - |
| 210 | struct base_decode_context ctx; | - |
| 211 | | - |
| 212 | base_decode_ctx_init (&ctx); | - |
| 213 | | - |
| 214 | do | - |
| 215 | { | - |
| 216 | bool ok; | - |
| 217 | size_t n; | - |
| 218 | unsigned int k; | - |
| 219 | | - |
| 220 | sum = 0; | - |
| 221 | do | - |
| 222 | { | - |
| 223 | n = fread (inbuf + sum, 1, BASE_LENGTH (DEC_BLOCKSIZE) - sum, in); | - |
| 224 | | - |
| 225 | if (ignore_garbage)| TRUE | never evaluated | | FALSE | evaluated 372 times by 2 tests |
| 0-372 |
| 226 | { | - |
| 227 | for (size_t i = 0; n > 0 && i < n;)| TRUE | never evaluated | | FALSE | never evaluated |
| TRUE | never evaluated | | FALSE | never evaluated |
| 0 |
| 228 | { | - |
| 229 | if (isbase (inbuf[sum + i]) || inbuf[sum + i] == '=')| TRUE | never evaluated | | FALSE | never evaluated |
| TRUE | never evaluated | | FALSE | never evaluated |
| 0 |
| 230 | i++; never executed: i++; | 0 |
| 231 | else | - |
| 232 | memmove (inbuf + sum + i, inbuf + sum + i + 1, --n - i); never executed: memmove (inbuf + sum + i, inbuf + sum + i + 1, --n - i); | 0 |
| 233 | } | - |
| 234 | } never executed: end of block | 0 |
| 235 | | - |
| 236 | sum += n; | - |
| 237 | | - |
| 238 | if (ferror (in))| TRUE | never evaluated | | FALSE | evaluated 372 times by 2 tests |
| 0-372 |
| 239 | die (EXIT_FAILURE, errno, _("read error")); never executed: ((!!sizeof (struct { _Static_assert ( 1 , "verify_expr (" "1" ", " "(error (1, (*__errno_location ()), dcgettext (((void *)0), \"read error\", 5)), assume (false))" ")"); int _gl_dummy; })) ? ((error ( 1 , (*__errno_location ()) , dcgettext (((void *)0), "read error" , 5) ), (( 0 ) ? (void) 0 : __builtin_unreachable ()))) : ((error ( 1 , (*__errno_location ()) , dcgettext (((void *)0), "read error" , 5) ), (( 0 ) ? (void) 0 : __builtin_unreachable ())))); | 0 |
| 240 | }executed 372 times by 2 tests: end of block | 372 |
| 241 | while (sum < BASE_LENGTH (DEC_BLOCKSIZE) && !feof (in));| TRUE | evaluated 363 times by 2 tests | | FALSE | evaluated 9 times by 1 test |
| TRUE | never evaluated | | FALSE | evaluated 363 times by 2 tests |
| 0-363 |
| 242 | | - |
| 243 | | - |
| 244 | | - |
| 245 | | - |
| 246 | | - |
| 247 | for (k = 0; k < 1 + !!feof (in); k++)| TRUE | evaluated 734 times by 2 tests | | FALSE | evaluated 238 times by 2 tests |
| 238-734 |
| 248 | { | - |
| 249 | if (k == 1 && ctx.i == 0)| TRUE | evaluated 362 times by 2 tests | | FALSE | evaluated 372 times by 2 tests |
| TRUE | evaluated 129 times by 2 tests | | FALSE | evaluated 233 times by 2 tests |
| 129-372 |
| 250 | break;executed 129 times by 2 tests: break; | 129 |
| 251 | n = DEC_BLOCKSIZE; | - |
| 252 | ok = base_decode_ctx (&ctx, inbuf, (k == 0 ? sum : 0), outbuf, &n); | - |
| 253 | | - |
| 254 | if (fwrite (outbuf, 1, n, out) < n) never executed: break; | TRUE | never evaluated | | FALSE | evaluated 605 times by 2 tests |
| TRUE | never evaluated | | FALSE | never evaluated |
| TRUE | never evaluated | | FALSE | never evaluated |
| TRUE | never evaluated | | FALSE | never evaluated |
| TRUE | evaluated 605 times by 2 tests | | FALSE | never evaluated |
| TRUE | never evaluated | | FALSE | evaluated 605 times by 2 tests |
| TRUE | never evaluated | | FALSE | never evaluated |
| TRUE | never evaluated | | FALSE | never evaluated |
| TRUE | evaluated 605 times by 2 tests | | FALSE | never evaluated |
| TRUE | never evaluated | | FALSE | evaluated 605 times by 2 tests |
| TRUE | never evaluated | | FALSE | evaluated 605 times by 2 tests |
| TRUE | never evaluated | | FALSE | never evaluated |
| 0-605 |
| 255 | die (EXIT_FAILURE, errno, _("write error")); never executed: ((!!sizeof (struct { _Static_assert ( 1 , "verify_expr (" "1" ", " "(error (1, (*__errno_location ()), dcgettext (((void *)0), \"write error\", 5)), assume (false))" ")"); int _gl_dummy; })) ? ((error ( 1 , (*__errno_location ()) , dcgettext (((void *)0), "write error" , 5) ), (( 0 ) ? (void) 0 : __builtin_unreachable ()))) : ((error ( 1 , (*__errno_location ()) , dcgettext (((void *)0), "write error" , 5) ), (( 0 ) ? (void) 0 : __builtin_unreachable ())))); | 0 |
| 256 | | - |
| 257 | if (!ok)| TRUE | evaluated 5 times by 1 test | | FALSE | evaluated 600 times by 2 tests |
| 5-600 |
| 258 | die (EXIT_FAILURE, 0, _("invalid input"));executed 5 times by 1 test: ((!!sizeof (struct { _Static_assert ( 1 , "verify_expr (" "1" ", " "(error (1, 0, dcgettext (((void *)0), \"invalid input\", 5)), assume (false))" ")"); int _gl_dummy; })) ? ((error ( 1 , 0, dcgettext (((void *)0), "invalid input" , 5) ), (( 0 ) ? (void) 0 : __builtin_unreachable ()))) : ((error ( 1 , 0, dcgettext (((void *)0), "invalid input" , 5) ), (( 0 ) ? (void) 0 : __builtin_unreachable ())))); | 5 |
| 259 | }executed 600 times by 2 tests: end of block | 600 |
| 260 | }executed 367 times by 2 tests: end of block | 367 |
| 261 | while (!feof (in));| TRUE | evaluated 9 times by 1 test | | FALSE | evaluated 358 times by 2 tests |
| 9-358 |
| 262 | }executed 358 times by 2 tests: end of block | 358 |
| 263 | | - |
| 264 | int | - |
| 265 | main (int argc, char **argv) | - |
| 266 | { | - |
| 267 | int opt; | - |
| 268 | FILE *input_fh; | - |
| 269 | const char *infile; | - |
| 270 | | - |
| 271 | | - |
| 272 | bool decode = false; | - |
| 273 | | - |
| 274 | bool ignore_garbage = false; | - |
| 275 | | - |
| 276 | uintmax_t wrap_column = 76; | - |
| 277 | | - |
| 278 | initialize_main (&argc, &argv); | - |
| 279 | set_program_name (argv[0]); | - |
| 280 | setlocale (LC_ALL, ""); | - |
| 281 | bindtextdomain (PACKAGE, LOCALEDIR); | - |
| 282 | textdomain (PACKAGE); | - |
| 283 | | - |
| 284 | atexit (close_stdout); | - |
| 285 | | - |
| 286 | while ((opt = getopt_long (argc, argv, "diw:", long_options, NULL)) != -1)| TRUE | evaluated 431 times by 2 tests | | FALSE | evaluated 399 times by 2 tests |
| 399-431 |
| 287 | switch (opt) | - |
| 288 | { | - |
| 289 | case 'd':executed 367 times by 2 tests: case 'd': | 367 |
| 290 | decode = true; | - |
| 291 | break;executed 367 times by 2 tests: break; | 367 |
| 292 | | - |
| 293 | case 'w':executed 32 times by 2 tests: case 'w': | 32 |
| 294 | wrap_column = xdectoumax (optarg, 0, UINTMAX_MAX, "", | - |
| 295 | _("invalid wrap size"), 0); | - |
| 296 | break;executed 20 times by 2 tests: break; | 20 |
| 297 | | - |
| 298 | case 'i':executed 4 times by 2 tests: case 'i': | 4 |
| 299 | ignore_garbage = true; | - |
| 300 | break;executed 4 times by 2 tests: break; | 4 |
| 301 | | - |
| 302 | case_GETOPT_HELP_CHAR; never executed: break; executed 14 times by 2 tests: case GETOPT_HELP_CHAR: | 0-14 |
| 303 | | - |
| 304 | case_GETOPT_VERSION_CHAR (PROGRAM_NAME, AUTHORS);executed 8 times by 2 tests: exit ( 0 ); never executed: break; executed 8 times by 2 tests: case GETOPT_VERSION_CHAR: | 0-8 |
| 305 | | - |
| 306 | default:executed 6 times by 2 tests: default: | 6 |
| 307 | usage (EXIT_FAILURE); | - |
| 308 | break; never executed: break; | 0 |
| 309 | } | - |
| 310 | | - |
| 311 | if (argc - optind > 1)| TRUE | never evaluated | | FALSE | evaluated 399 times by 2 tests |
| 0-399 |
| 312 | { | - |
| 313 | error (0, 0, _("extra operand %s"), quote (argv[optind])); | - |
| 314 | usage (EXIT_FAILURE); | - |
| 315 | } never executed: end of block | 0 |
| 316 | | - |
| 317 | if (optind < argc)| TRUE | evaluated 395 times by 2 tests | | FALSE | evaluated 4 times by 2 tests |
| 4-395 |
| 318 | infile = argv[optind];executed 395 times by 2 tests: infile = argv[optind]; | 395 |
| 319 | else | - |
| 320 | infile = "-";executed 4 times by 2 tests: infile = "-"; | 4 |
| 321 | | - |
| 322 | if (STREQ (infile, "-")) never executed: __result = (((const unsigned char *) (const char *) ( infile ))[3] - __s2[3]); never executed: end of block never executed: end of block never executed: __result = (((const unsigned char *) (const char *) ( "-" ))[3] - __s2[3]); never executed: end of block executed 4 times by 2 tests: end of block | TRUE | evaluated 4 times by 2 tests | | FALSE | evaluated 395 times by 2 tests |
| TRUE | never evaluated | | FALSE | never evaluated |
| TRUE | never evaluated | | FALSE | never evaluated |
| TRUE | never evaluated | | FALSE | never evaluated |
| TRUE | never evaluated | | FALSE | never evaluated |
| TRUE | never evaluated | | FALSE | never evaluated |
| TRUE | never evaluated | | FALSE | never evaluated |
| TRUE | evaluated 399 times by 2 tests | | FALSE | never evaluated |
| TRUE | evaluated 4 times by 2 tests | | FALSE | evaluated 395 times by 2 tests |
| TRUE | never evaluated | | FALSE | evaluated 4 times by 2 tests |
| TRUE | never evaluated | | FALSE | never evaluated |
| TRUE | never evaluated | | FALSE | never evaluated |
| TRUE | never evaluated | | FALSE | never evaluated |
| 0-399 |
| 323 | { | - |
| 324 | xset_binary_mode (STDIN_FILENO, O_BINARY); | - |
| 325 | input_fh = stdin; | - |
| 326 | }executed 4 times by 2 tests: end of block | 4 |
| 327 | else | - |
| 328 | { | - |
| 329 | input_fh = fopen (infile, "rb"); | - |
| 330 | if (input_fh == NULL)| TRUE | never evaluated | | FALSE | evaluated 395 times by 2 tests |
| 0-395 |
| 331 | die (EXIT_FAILURE, errno, "%s", quotef (infile)); never executed: ((!!sizeof (struct { _Static_assert ( 1 , "verify_expr (" "1" ", " "(error (1, (*__errno_location ()), \"%s\", quotearg_n_style_colon (0, shell_escape_quoting_style, infile)), assume (false))" ")"); int _gl_dummy; })) ? ((error ( 1 , (*__errno_location ()...lon (0, shell_escape_quoting_style, infile)), (( 0 ) ? (void) 0 : __builtin_unreachable ()))) : ((error ( 1 , (*__errno_location ()) , "%s", quotearg_n_style_colon (0, shell_escape_quoting_style, infile)), (( 0 ) ? (void) 0 : __builtin_unreachable ())))); | 0 |
| 332 | }executed 395 times by 2 tests: end of block | 395 |
| 333 | | - |
| 334 | fadvise (input_fh, FADVISE_SEQUENTIAL); | - |
| 335 | | - |
| 336 | if (decode)| TRUE | evaluated 363 times by 2 tests | | FALSE | evaluated 36 times by 2 tests |
| 36-363 |
| 337 | do_decode (input_fh, stdout, ignore_garbage);executed 363 times by 2 tests: do_decode (input_fh, stdout , ignore_garbage); | 363 |
| 338 | else | - |
| 339 | do_encode (input_fh, stdout, wrap_column);executed 36 times by 2 tests: do_encode (input_fh, stdout , wrap_column); | 36 |
| 340 | | - |
| 341 | if (fclose (input_fh) == EOF)| TRUE | never evaluated | | FALSE | evaluated 394 times by 2 tests |
| 0-394 |
| 342 | { | - |
| 343 | if (STREQ (infile, "-")) never executed: __result = (((const unsigned char *) (const char *) ( infile ))[3] - __s2[3]); never executed: end of block never executed: end of block never executed: __result = (((const unsigned char *) (const char *) ( "-" ))[3] - __s2[3]); never executed: end of block never executed: end of block | TRUE | never evaluated | | FALSE | never evaluated |
| TRUE | never evaluated | | FALSE | never evaluated |
| TRUE | never evaluated | | FALSE | never evaluated |
| TRUE | never evaluated | | FALSE | never evaluated |
| TRUE | never evaluated | | FALSE | never evaluated |
| TRUE | never evaluated | | FALSE | never evaluated |
| TRUE | never evaluated | | FALSE | never evaluated |
| TRUE | never evaluated | | FALSE | never evaluated |
| TRUE | never evaluated | | FALSE | never evaluated |
| TRUE | never evaluated | | FALSE | never evaluated |
| TRUE | never evaluated | | FALSE | never evaluated |
| TRUE | never evaluated | | FALSE | never evaluated |
| TRUE | never evaluated | | FALSE | never evaluated |
| 0 |
| 344 | die (EXIT_FAILURE, errno, _("closing standard input")); never executed: ((!!sizeof (struct { _Static_assert ( 1 , "verify_expr (" "1" ", " "(error (1, (*__errno_location ()), dcgettext (((void *)0), \"closing standard input\", 5)), assume (false))" ")"); int _gl_dummy; })) ? ((error ( 1 , (*__errno_location ()) , dcgettext (((void *)0), "closing standard input" , 5) ), (( 0 ) ? (void) 0 : __builtin_unreachable ()))) : ((error ( 1 , (*__errno_location ()) , dcgettext (((void *)0), "closing standard input" , 5) ), (( 0 ) ? (void) 0 : __builtin_unreachable ())))); | 0 |
| 345 | else | - |
| 346 | die (EXIT_FAILURE, errno, "%s", quotef (infile)); never executed: ((!!sizeof (struct { _Static_assert ( 1 , "verify_expr (" "1" ", " "(error (1, (*__errno_location ()), \"%s\", quotearg_n_style_colon (0, shell_escape_quoting_style, infile)), assume (false))" ")"); int _gl_dummy; })) ? ((error ( 1 , (*__errno_location ()...lon (0, shell_escape_quoting_style, infile)), (( 0 ) ? (void) 0 : __builtin_unreachable ()))) : ((error ( 1 , (*__errno_location ()) , "%s", quotearg_n_style_colon (0, shell_escape_quoting_style, infile)), (( 0 ) ? (void) 0 : __builtin_unreachable ())))); | 0 |
| 347 | } | - |
| 348 | | - |
| 349 | return EXIT_SUCCESS;executed 394 times by 2 tests: return 0 ; | 394 |
| 350 | } | - |
| | |