| Absolute File Name: | /home/opencoverage/opencoverage/guest-scripts/coreutils/src/src/yes.c | 
| Switch to Source code | Preprocessed file | 
| Line | Source | Count | ||||||||||||
|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|
| 1 | - | |||||||||||||
| 2 | - | |||||||||||||
| 3 | - | |||||||||||||
| 4 | - | |||||||||||||
| 5 | - | |||||||||||||
| 6 | - | |||||||||||||
| 7 | - | |||||||||||||
| 8 | - | |||||||||||||
| 9 | static struct option const long_options[] = | - | ||||||||||||
| 10 | { | - | ||||||||||||
| 11 | { | - | ||||||||||||
| 12 | ((void *)0) | - | ||||||||||||
| 13 | , 0, | - | ||||||||||||
| 14 | ((void *)0) | - | ||||||||||||
| 15 | , 0} | - | ||||||||||||
| 16 | }; | - | ||||||||||||
| 17 | - | |||||||||||||
| 18 | void | - | ||||||||||||
| 19 | usage (int status) | - | ||||||||||||
| 20 | { | - | ||||||||||||
| 21 |   if (status != 
  | 3 | ||||||||||||
| 22 |                0
  | 3 | ||||||||||||
| 23 | ) | - | ||||||||||||
| 24 | do { fprintf ( | - | ||||||||||||
| 25 | stderr | - | ||||||||||||
| 26 | , | - | ||||||||||||
| 27 | dcgettext (((void *)0), | - | ||||||||||||
| 28 | "Try '%s --help' for more information.\n" | - | ||||||||||||
| 29 | , 5) | - | ||||||||||||
| 30 |    , program_name); } executed 3 times by 1 test:   while (0);end of blockExecuted by: 
  | 3 | ||||||||||||
| 31 | else | - | ||||||||||||
| 32 | { | - | ||||||||||||
| 33 | printf ( | - | ||||||||||||
| 34 | dcgettext (((void *)0), | - | ||||||||||||
| 35 | "Usage: %s [STRING]...\n or: %s OPTION\n" | - | ||||||||||||
| 36 | , 5) | - | ||||||||||||
| 37 | - | |||||||||||||
| 38 | - | |||||||||||||
| 39 | - | |||||||||||||
| 40 | , | - | ||||||||||||
| 41 | program_name, program_name); | - | ||||||||||||
| 42 | - | |||||||||||||
| 43 | fputs_unlocked ( | - | ||||||||||||
| 44 | dcgettext (((void *)0), | - | ||||||||||||
| 45 | "Repeatedly output a line with all specified STRING(s), or 'y'.\n\n" | - | ||||||||||||
| 46 | , 5) | - | ||||||||||||
| 47 | , | - | ||||||||||||
| 48 | stdout | - | ||||||||||||
| 49 | ) | - | ||||||||||||
| 50 | - | |||||||||||||
| 51 | - | |||||||||||||
| 52 | ; | - | ||||||||||||
| 53 | fputs_unlocked ( | - | ||||||||||||
| 54 | dcgettext (((void *)0), | - | ||||||||||||
| 55 | " --help display this help and exit\n" | - | ||||||||||||
| 56 | , 5) | - | ||||||||||||
| 57 | , | - | ||||||||||||
| 58 | stdout | - | ||||||||||||
| 59 | ); | - | ||||||||||||
| 60 | fputs_unlocked ( | - | ||||||||||||
| 61 | dcgettext (((void *)0), | - | ||||||||||||
| 62 | " --version output version information and exit\n" | - | ||||||||||||
| 63 | , 5) | - | ||||||||||||
| 64 | , | - | ||||||||||||
| 65 | stdout | - | ||||||||||||
| 66 | ); | - | ||||||||||||
| 67 | emit_ancillary_info ("yes"); | - | ||||||||||||
| 68 |     } executed 3 times by 1 test:  end of blockExecuted by: 
  | 3 | ||||||||||||
| 69 |   exit (status); executed 6 times by 1 test:  exit (status);Executed by: 
  | 6 | ||||||||||||
| 70 | } | - | ||||||||||||
| 71 | - | |||||||||||||
| 72 | int | - | ||||||||||||
| 73 | main (int argc, char **argv) | - | ||||||||||||
| 74 | { | - | ||||||||||||
| 75 | ; | - | ||||||||||||
| 76 | set_program_name (argv[0]); | - | ||||||||||||
| 77 | setlocale ( | - | ||||||||||||
| 78 | 6 | - | ||||||||||||
| 79 | , ""); | - | ||||||||||||
| 80 | bindtextdomain ("coreutils", "/usr/local/share/locale"); | - | ||||||||||||
| 81 | textdomain ("coreutils"); | - | ||||||||||||
| 82 | - | |||||||||||||
| 83 | atexit (close_stdout); | - | ||||||||||||
| 84 | - | |||||||||||||
| 85 | parse_long_options (argc, argv, "yes", "GNU coreutils", Version, | - | ||||||||||||
| 86 | usage, ("David MacKenzie"), (char const *) | - | ||||||||||||
| 87 | ((void *)0) | - | ||||||||||||
| 88 | ); | - | ||||||||||||
| 89 |   if (getopt_long (argc, argv, "+", long_options, 
  | 3-47 | ||||||||||||
| 90 |                                                  ((void *)0)
  | 3-47 | ||||||||||||
| 91 |                                                      ) != -1
  | 3-47 | ||||||||||||
| 92 |     usage ( executed 3 times by 1 test:  usage ( 1 );Executed by: 
  | 3 | ||||||||||||
| 93 |           1 executed 3 times by 1 test:  usage ( 1 );Executed by: 
  | 3 | ||||||||||||
| 94 |                       ); executed 3 times by 1 test:  usage ( 1 );Executed by: 
  | 3 | ||||||||||||
| 95 | - | |||||||||||||
| 96 | char **operands = argv + optind; | - | ||||||||||||
| 97 | char **operand_lim = argv + argc; | - | ||||||||||||
| 98 |   if (optind == argc
  | 23-24 | ||||||||||||
| 99 |     * executed 23 times by 1 test:  operand_lim++ = bad_cast ("y");*operand_lim++ = bad_cast ("y");Executed by: 
 executed 23 times by 1 test:  *operand_lim++ = bad_cast ("y");Executed by: 
  | 23 | ||||||||||||
| 100 | - | |||||||||||||
| 101 | - | |||||||||||||
| 102 | - | |||||||||||||
| 103 | size_t bufalloc = 0; | - | ||||||||||||
| 104 | - | |||||||||||||
| 105 | _Bool | - | ||||||||||||
| 106 | reuse_operand_strings = | - | ||||||||||||
| 107 | 1 | - | ||||||||||||
| 108 | ; | - | ||||||||||||
| 109 |   for (char **operandp = operands; operandp < operand_lim
  | 47-4145 | ||||||||||||
| 110 | { | - | ||||||||||||
| 111 | size_t operand_len = strlen (*operandp); | - | ||||||||||||
| 112 | bufalloc += operand_len + 1; | - | ||||||||||||
| 113 |       if (operandp + 1 < operand_lim
  | 47-4098 | ||||||||||||
| 114 |           && *
 
  | 0-4098 | ||||||||||||
| 115 |         reuse_operand_strings =  never executed:  reuse_operand_strings = 0 ; | 0 | ||||||||||||
| 116 |                                0 never executed:  reuse_operand_strings = 0 ; | 0 | ||||||||||||
| 117 |                                     ; never executed:  reuse_operand_strings = 0 ; | 0 | ||||||||||||
| 118 |     } executed 4145 times by 1 test:  end of blockExecuted by: 
  | 4145 | ||||||||||||
| 119 | - | |||||||||||||
| 120 | - | |||||||||||||
| 121 |   if (bufalloc <= 
  | 7-40 | ||||||||||||
| 122 |                  8192 
  | 7-40 | ||||||||||||
| 123 |                         / 2
  | 7-40 | ||||||||||||
| 124 | { | - | ||||||||||||
| 125 | bufalloc = | - | ||||||||||||
| 126 | 8192 | - | ||||||||||||
| 127 | ; | - | ||||||||||||
| 128 | reuse_operand_strings = | - | ||||||||||||
| 129 | 0 | - | ||||||||||||
| 130 | ; | - | ||||||||||||
| 131 |     } executed 40 times by 1 test:  end of blockExecuted by: 
  | 40 | ||||||||||||
| 132 | - | |||||||||||||
| 133 | - | |||||||||||||
| 134 | - | |||||||||||||
| 135 |   char *buf = reuse_operand_strings
  | 7-40 | ||||||||||||
| 136 | size_t bufused = 0; | - | ||||||||||||
| 137 |   for (char **operandp = operands; operandp < operand_lim
  | 47-4145 | ||||||||||||
| 138 | { | - | ||||||||||||
| 139 | size_t operand_len = strlen (*operandp); | - | ||||||||||||
| 140 |       if (! reuse_operand_strings
  | 139-4006 | ||||||||||||
| 141 |         memcpy (buf + bufused, *operandp, operand_len); executed 139 times by 1 test:  memcpy (buf + bufused, *operandp, operand_len);Executed by: 
  | 139 | ||||||||||||
| 142 | bufused += operand_len; | - | ||||||||||||
| 143 | buf[bufused++] = ' '; | - | ||||||||||||
| 144 |     } executed 4145 times by 1 test:  end of blockExecuted by: 
  | 4145 | ||||||||||||
| 145 | buf[bufused - 1] = '\n'; | - | ||||||||||||
| 146 | - | |||||||||||||
| 147 | - | |||||||||||||
| 148 | - | |||||||||||||
| 149 | size_t copysize = bufused; | - | ||||||||||||
| 150 |   for (size_t copies = bufalloc / copysize; --
 
  | 47-109414 | ||||||||||||
| 151 | { | - | ||||||||||||
| 152 | memcpy (buf + bufused, buf, copysize); | - | ||||||||||||
| 153 | bufused += copysize; | - | ||||||||||||
| 154 |     } executed 109414 times by 1 test:  end of blockExecuted by: 
  | 109414 | ||||||||||||
| 155 | - | |||||||||||||
| 156 | - | |||||||||||||
| 157 |   while (full_write (
  | 45-8995 | ||||||||||||
| 158 |                     1
  | 45-8995 | ||||||||||||
| 159 |                                  , buf, bufused) == bufused
  | 45-8995 | ||||||||||||
| 160 |     continue; executed 8995 times by 1 test:  continue;Executed by: 
  | 8995 | ||||||||||||
| 161 | error (0, | - | ||||||||||||
| 162 | (*__errno_location ()) | - | ||||||||||||
| 163 | , | - | ||||||||||||
| 164 | dcgettext (((void *)0), | - | ||||||||||||
| 165 | "standard output" | - | ||||||||||||
| 166 | , 5) | - | ||||||||||||
| 167 | ); | - | ||||||||||||
| 168 |   return executed 45 times by 1 test:   return 1 ;Executed by: 
 executed 45 times by 1 test:  return 1 ;Executed by: 
  | 45 | ||||||||||||
| 169 |         1 executed 45 times by 1 test:  return 1 ;Executed by: 
  | 45 | ||||||||||||
| 170 |                     ; executed 45 times by 1 test:  return 1 ;Executed by: 
  | 45 | ||||||||||||
| 171 | } | - | ||||||||||||
| Switch to Source code | Preprocessed file |