| Line | Source | Count |
| 1 | | - |
| 2 | | - |
| 3 | | - |
| 4 | | - |
| 5 | | - |
| 6 | | - |
| 7 | | - |
| 8 | | - |
| 9 | | - |
| 10 | | - |
| 11 | | - |
| 12 | | - |
| 13 | | - |
| 14 | | - |
| 15 | | - |
| 16 | | - |
| 17 | static char **pushd_directory_list = (char **) | - |
| 18 | ((void *)0) | - |
| 19 | ; | - |
| 20 | | - |
| 21 | | - |
| 22 | static int directory_list_size; | - |
| 23 | | - |
| 24 | | - |
| 25 | static int directory_list_offset; | - |
| 26 | | - |
| 27 | static void pushd_error (int, char *); | - |
| 28 | static void clear_directory_stack (void); | - |
| 29 | static int cd_to_string (char *); | - |
| 30 | static int change_to_temp (char *); | - |
| 31 | static void add_dirstack_element (char *); | - |
| 32 | static int get_dirstack_index (intmax_t, int, int *); | - |
| 33 | | - |
| 34 | | - |
| 35 | | - |
| 36 | | - |
| 37 | | - |
| 38 | | - |
| 39 | int | - |
| 40 | pushd_builtin (list) | - |
| 41 | WORD_LIST *list; | - |
| 42 | { | - |
| 43 | WORD_LIST *orig_list; | - |
| 44 | char *temp, *current_directory, *top; | - |
| 45 | int j, flags, skipopt; | - |
| 46 | intmax_t num; | - |
| 47 | char direction; | - |
| 48 | | - |
| 49 | orig_list = list; | - |
| 50 | | - |
| 51 | do { if ((| TRUE | evaluated 13 times by 1 test | | FALSE | evaluated 3 times by 1 test |
list)| TRUE | evaluated 13 times by 1 test | | FALSE | evaluated 3 times by 1 test |
&& (| TRUE | evaluated 13 times by 1 test | | FALSE | never evaluated |
list)->word| TRUE | evaluated 13 times by 1 test | | FALSE | never evaluated |
&& (((((| TRUE | evaluated 5 times by 1 test | | FALSE | evaluated 8 times by 1 test |
list)->word->word))[0] == ("--help")[0]| TRUE | evaluated 5 times by 1 test | | FALSE | evaluated 8 times by 1 test |
&& | 0-13 |
| 52 | __extension__ ({ size_t __s1_len, __s2_len; (__builtin_constant_p (| TRUE | never evaluated | | FALSE | evaluated 5 times by 1 test |
| 0-5 |
| 53 | ((list)->word->word)| TRUE | never evaluated | | FALSE | evaluated 5 times by 1 test |
| 0-5 |
| 54 | ) && __builtin_constant_p (| TRUE | never evaluated | | FALSE | evaluated 5 times by 1 test |
| 0-5 |
| 55 | "--help"| TRUE | never evaluated | | FALSE | evaluated 5 times by 1 test |
| 0-5 |
| 56 | ) && (__s1_len = __builtin_strlen (| TRUE | never evaluated | | FALSE | evaluated 5 times by 1 test |
| 0-5 |
| 57 | ((list)->word->word)| TRUE | never evaluated | | FALSE | evaluated 5 times by 1 test |
| 0-5 |
| 58 | ), __s2_len = __builtin_strlen (| TRUE | never evaluated | | FALSE | evaluated 5 times by 1 test |
| 0-5 |
| 59 | "--help"| TRUE | never evaluated | | FALSE | evaluated 5 times by 1 test |
| 0-5 |
| 60 | ), (!((size_t)(const void *)((| TRUE | never evaluated | | FALSE | evaluated 5 times by 1 test |
| 0-5 |
| 61 | ((list)->word->word)| TRUE | never evaluated | | FALSE | evaluated 5 times by 1 test |
| 0-5 |
| 62 | ) + 1) - (size_t)(const void *)(| TRUE | never evaluated | | FALSE | evaluated 5 times by 1 test |
| 0-5 |
| 63 | ((list)->word->word)| TRUE | never evaluated | | FALSE | evaluated 5 times by 1 test |
| 0-5 |
| 64 | ) == 1) || __s1_len >= 4) && (!((size_t)(const void *)((| TRUE | never evaluated | | FALSE | evaluated 5 times by 1 test |
| 0-5 |
| 65 | "--help"| TRUE | never evaluated | | FALSE | evaluated 5 times by 1 test |
| 0-5 |
| 66 | ) + 1) - (size_t)(const void *)(| TRUE | never evaluated | | FALSE | evaluated 5 times by 1 test |
| 0-5 |
| 67 | "--help"| TRUE | never evaluated | | FALSE | evaluated 5 times by 1 test |
| 0-5 |
| 68 | ) == 1) || __s2_len >= 4)) ? __builtin_strcmp (| TRUE | never evaluated | | FALSE | evaluated 5 times by 1 test |
| 0-5 |
| 69 | ((list)->word->word)| TRUE | never evaluated | | FALSE | evaluated 5 times by 1 test |
| 0-5 |
| 70 | , | TRUE | never evaluated | | FALSE | evaluated 5 times by 1 test |
| 0-5 |
| 71 | "--help"| TRUE | never evaluated | | FALSE | evaluated 5 times by 1 test |
| 0-5 |
| 72 | ) : (__builtin_constant_p (| TRUE | never evaluated | | FALSE | evaluated 5 times by 1 test |
| 0-5 |
| 73 | ((list)->word->word)| TRUE | never evaluated | | FALSE | evaluated 5 times by 1 test |
| 0-5 |
| 74 | ) && ((size_t)(const void *)((| TRUE | never evaluated | | FALSE | evaluated 5 times by 1 test |
| 0-5 |
| 75 | ((list)->word->word)| TRUE | never evaluated | | FALSE | evaluated 5 times by 1 test |
| 0-5 |
| 76 | ) + 1) - (size_t)(const void *)(| TRUE | never evaluated | | FALSE | evaluated 5 times by 1 test |
| 0-5 |
| 77 | ((list)->word->word)| TRUE | never evaluated | | FALSE | evaluated 5 times by 1 test |
| 0-5 |
| 78 | ) == 1) && (__s1_len = __builtin_strlen (| TRUE | never evaluated | | FALSE | evaluated 5 times by 1 test |
| 0-5 |
| 79 | ((list)->word->word)| TRUE | never evaluated | | FALSE | evaluated 5 times by 1 test |
| 0-5 |
| 80 | ), __s1_len < 4) ? (__builtin_constant_p (| TRUE | never evaluated | | FALSE | evaluated 5 times by 1 test |
| 0-5 |
| 81 | "--help"| TRUE | never evaluated | | FALSE | evaluated 5 times by 1 test |
| 0-5 |
| 82 | ) && ((size_t)(const void *)((| TRUE | never evaluated | | FALSE | evaluated 5 times by 1 test |
| 0-5 |
| 83 | "--help"| TRUE | never evaluated | | FALSE | evaluated 5 times by 1 test |
| 0-5 |
| 84 | ) + 1) - (size_t)(const void *)(| TRUE | never evaluated | | FALSE | evaluated 5 times by 1 test |
| 0-5 |
| 85 | "--help"| TRUE | never evaluated | | FALSE | evaluated 5 times by 1 test |
| 0-5 |
| 86 | ) == 1) ? __builtin_strcmp (| TRUE | never evaluated | | FALSE | evaluated 5 times by 1 test |
| 0-5 |
| 87 | ((list)->word->word)| TRUE | never evaluated | | FALSE | evaluated 5 times by 1 test |
| 0-5 |
| 88 | , | TRUE | never evaluated | | FALSE | evaluated 5 times by 1 test |
| 0-5 |
| 89 | "--help"| TRUE | never evaluated | | FALSE | evaluated 5 times by 1 test |
| 0-5 |
| 90 | ) : (__extension__ ({ const unsigned char *__s2 = (const unsigned char *) (const char *) (| TRUE | never evaluated | | FALSE | evaluated 5 times by 1 test |
| 0-5 |
| 91 | "--help"| TRUE | never evaluated | | FALSE | evaluated 5 times by 1 test |
| 0-5 |
| 92 | ); int __result = (((const unsigned char *) (const char *) (| TRUE | never evaluated | | FALSE | evaluated 5 times by 1 test |
| 0-5 |
| 93 | ((list)->word->word)| TRUE | never evaluated | | FALSE | evaluated 5 times by 1 test |
| 0-5 |
| 94 | ))[0] - __s2[0]); if (__s1_len > 0| TRUE | never evaluated | | FALSE | never evaluated |
&& __result == 0| TRUE | never evaluated | | FALSE | never evaluated |
) { __result = (((const unsigned char *) (const char *) (| TRUE | never evaluated | | FALSE | evaluated 5 times by 1 test |
| 0-5 |
| 95 | ((list)->word->word)| TRUE | never evaluated | | FALSE | evaluated 5 times by 1 test |
| 0-5 |
| 96 | ))[1] - __s2[1]); if (__s1_len > 1| TRUE | never evaluated | | FALSE | never evaluated |
&& __result == 0| TRUE | never evaluated | | FALSE | never evaluated |
) { __result = (((const unsigned char *) (const char *) (| TRUE | never evaluated | | FALSE | evaluated 5 times by 1 test |
| 0-5 |
| 97 | ((list)->word->word)| TRUE | never evaluated | | FALSE | evaluated 5 times by 1 test |
| 0-5 |
| 98 | ))[2] - __s2[2]); if (__s1_len > 2| TRUE | never evaluated | | FALSE | never evaluated |
&& __result == 0| TRUE | never evaluated | | FALSE | never evaluated |
) __result = (((const unsigned char *) (const char *) (never executed: __result = (((const unsigned char *) (const char *) ( ((list)->word->word) ))[3] - __s2[3]); | TRUE | never evaluated | | FALSE | evaluated 5 times by 1 test |
| 0-5 |
| 99 | ((list)->word->word)| TRUE | never evaluated | | FALSE | evaluated 5 times by 1 test |
never executed: __result = (((const unsigned char *) (const char *) ( ((list)->word->word) ))[3] - __s2[3]); | 0-5 |
| 100 | ))[3] - __s2[3]);| TRUE | never evaluated | | FALSE | evaluated 5 times by 1 test |
never executed: __result = (((const unsigned char *) (const char *) ( ((list)->word->word) ))[3] - __s2[3]); }never executed: end of block }never executed: end of block __result; }))) : (__builtin_constant_p (| TRUE | never evaluated | | FALSE | evaluated 5 times by 1 test |
| 0-5 |
| 101 | "--help"| TRUE | never evaluated | | FALSE | evaluated 5 times by 1 test |
| 0-5 |
| 102 | ) && ((size_t)(const void *)((| TRUE | never evaluated | | FALSE | evaluated 5 times by 1 test |
| 0-5 |
| 103 | "--help"| TRUE | never evaluated | | FALSE | evaluated 5 times by 1 test |
| 0-5 |
| 104 | ) + 1) - (size_t)(const void *)(| TRUE | never evaluated | | FALSE | evaluated 5 times by 1 test |
| 0-5 |
| 105 | "--help"| TRUE | never evaluated | | FALSE | evaluated 5 times by 1 test |
| 0-5 |
| 106 | ) == 1) && (__s2_len = __builtin_strlen (| TRUE | never evaluated | | FALSE | evaluated 5 times by 1 test |
| 0-5 |
| 107 | "--help"| TRUE | never evaluated | | FALSE | evaluated 5 times by 1 test |
| 0-5 |
| 108 | ), __s2_len < 4) ? (__builtin_constant_p (| TRUE | never evaluated | | FALSE | evaluated 5 times by 1 test |
| 0-5 |
| 109 | ((list)->word->word)| TRUE | never evaluated | | FALSE | evaluated 5 times by 1 test |
| 0-5 |
| 110 | ) && ((size_t)(const void *)((| TRUE | never evaluated | | FALSE | evaluated 5 times by 1 test |
| 0-5 |
| 111 | ((list)->word->word)| TRUE | never evaluated | | FALSE | evaluated 5 times by 1 test |
| 0-5 |
| 112 | ) + 1) - (size_t)(const void *)(| TRUE | never evaluated | | FALSE | evaluated 5 times by 1 test |
| 0-5 |
| 113 | ((list)->word->word)| TRUE | never evaluated | | FALSE | evaluated 5 times by 1 test |
| 0-5 |
| 114 | ) == 1) ? __builtin_strcmp (| TRUE | never evaluated | | FALSE | evaluated 5 times by 1 test |
| 0-5 |
| 115 | ((list)->word->word)| TRUE | never evaluated | | FALSE | evaluated 5 times by 1 test |
| 0-5 |
| 116 | , | TRUE | never evaluated | | FALSE | evaluated 5 times by 1 test |
| 0-5 |
| 117 | "--help"| TRUE | never evaluated | | FALSE | evaluated 5 times by 1 test |
| 0-5 |
| 118 | ) : -(__extension__ ({ const unsigned char *__s2 = (const unsigned char *) (const char *) (| TRUE | never evaluated | | FALSE | evaluated 5 times by 1 test |
| 0-5 |
| 119 | ((list)->word->word)| TRUE | never evaluated | | FALSE | evaluated 5 times by 1 test |
| 0-5 |
| 120 | ); int __result = (((const unsigned char *) (const char *) (| TRUE | never evaluated | | FALSE | evaluated 5 times by 1 test |
| 0-5 |
| 121 | "--help"| TRUE | never evaluated | | FALSE | evaluated 5 times by 1 test |
| 0-5 |
| 122 | ))[0] - __s2[0]); if (__s2_len > 0| TRUE | never evaluated | | FALSE | never evaluated |
&& __result == 0| TRUE | never evaluated | | FALSE | never evaluated |
) { __result = (((const unsigned char *) (const char *) (| TRUE | never evaluated | | FALSE | evaluated 5 times by 1 test |
| 0-5 |
| 123 | "--help"| TRUE | never evaluated | | FALSE | evaluated 5 times by 1 test |
| 0-5 |
| 124 | ))[1] - __s2[1]); if (__s2_len > 1| TRUE | never evaluated | | FALSE | never evaluated |
&& __result == 0| TRUE | never evaluated | | FALSE | never evaluated |
) { __result = (((const unsigned char *) (const char *) (| TRUE | never evaluated | | FALSE | evaluated 5 times by 1 test |
| 0-5 |
| 125 | "--help"| TRUE | never evaluated | | FALSE | evaluated 5 times by 1 test |
| 0-5 |
| 126 | ))[2] - __s2[2]); if (__s2_len > 2| TRUE | never evaluated | | FALSE | never evaluated |
&& __result == 0| TRUE | never evaluated | | FALSE | never evaluated |
) __result = (((const unsigned char *) (const char *) (never executed: __result = (((const unsigned char *) (const char *) ( "--help" ))[3] - __s2[3]); | TRUE | never evaluated | | FALSE | evaluated 5 times by 1 test |
| 0-5 |
| 127 | "--help"| TRUE | never evaluated | | FALSE | evaluated 5 times by 1 test |
never executed: __result = (((const unsigned char *) (const char *) ( "--help" ))[3] - __s2[3]); | 0-5 |
| 128 | ))[3] - __s2[3]);| TRUE | never evaluated | | FALSE | evaluated 5 times by 1 test |
never executed: __result = (((const unsigned char *) (const char *) ( "--help" ))[3] - __s2[3]); }never executed: end of block }never executed: end of block __result; }))) : __builtin_strcmp (| TRUE | never evaluated | | FALSE | evaluated 5 times by 1 test |
| 0-5 |
| 129 | ((list)->word->word)| TRUE | never evaluated | | FALSE | evaluated 5 times by 1 test |
| 0-5 |
| 130 | , | TRUE | never evaluated | | FALSE | evaluated 5 times by 1 test |
| 0-5 |
| 131 | "--help"| TRUE | never evaluated | | FALSE | evaluated 5 times by 1 test |
| 0-5 |
| 132 | )))); }) | TRUE | never evaluated | | FALSE | evaluated 5 times by 1 test |
| 0-5 |
| 133 | == 0| TRUE | never evaluated | | FALSE | evaluated 5 times by 1 test |
))) { builtin_help (); returnnever executed: return (258); (258);never executed: return (258); } } while (0); | 0-5 |
| 134 | if (list| TRUE | evaluated 13 times by 1 test | | FALSE | evaluated 3 times by 1 test |
&& list->word| TRUE | evaluated 13 times by 1 test | | FALSE | never evaluated |
&& (list->word->word[0] == '-'| TRUE | evaluated 5 times by 1 test | | FALSE | evaluated 8 times by 1 test |
&& list->word->word[1] == '-'| TRUE | never evaluated | | FALSE | evaluated 5 times by 1 test |
&& !list->word->word[2]| TRUE | never evaluated | | FALSE | never evaluated |
)) | 0-13 |
| 135 | { | - |
| 136 | list = list->next; | - |
| 137 | skipopt = 1; | - |
| 138 | } never executed: end of block | 0 |
| 139 | else | - |
| 140 | skipopt = 0;executed 16 times by 1 test: skipopt = 0; | 16 |
| 141 | | - |
| 142 | | - |
| 143 | | - |
| 144 | if (list == 0| TRUE | evaluated 3 times by 1 test | | FALSE | evaluated 13 times by 1 test |
) | 3-13 |
| 145 | { | - |
| 146 | if (directory_list_offset == 0| TRUE | evaluated 1 time by 1 test | | FALSE | evaluated 2 times by 1 test |
) | 1-2 |
| 147 | { | - |
| 148 | builtin_error ( | - |
| 149 | dcgettext (((void *)0), | - |
| 150 | "no other directory" | - |
| 151 | , 5) | - |
| 152 | ); | - |
| 153 | returnexecuted 1 time by 1 test: return (1); (1);executed 1 time by 1 test: return (1); | 1 |
| 154 | } | - |
| 155 | | - |
| 156 | current_directory = get_working_directory ("pushd"); | - |
| 157 | if (current_directory == 0| TRUE | never evaluated | | FALSE | evaluated 2 times by 1 test |
) | 0-2 |
| 158 | return never executed: return (1); (1);never executed: return (1); | 0 |
| 159 | | - |
| 160 | j = directory_list_offset - 1; | - |
| 161 | temp = pushd_directory_list[j]; | - |
| 162 | pushd_directory_list[j] = current_directory; | - |
| 163 | j = change_to_temp (temp); | - |
| 164 | sh_xfree((temp), "./pushd.def", 211); | - |
| 165 | returnexecuted 2 times by 1 test: return j; j;executed 2 times by 1 test: return j; | 2 |
| 166 | } | - |
| 167 | | - |
| 168 | for (flags = 0; skipopt == 0| TRUE | evaluated 17 times by 1 test | | FALSE | never evaluated |
&& list| TRUE | evaluated 15 times by 1 test | | FALSE | evaluated 2 times by 1 test |
; list = list->next) | 0-17 |
| 169 | { | - |
| 170 | if ((list->word->word[0] == '-'| TRUE | evaluated 5 times by 1 test | | FALSE | evaluated 10 times by 1 test |
&& list->word->word[1] == 'n'| TRUE | evaluated 2 times by 1 test | | FALSE | evaluated 3 times by 1 test |
&& !list->word->word[2]| TRUE | evaluated 2 times by 1 test | | FALSE | never evaluated |
)) | 0-10 |
| 171 | { | - |
| 172 | flags |= 0x01; | - |
| 173 | }executed 2 times by 1 test: end of block | 2 |
| 174 | else if ((list->word->word[0] == '-'| TRUE | evaluated 3 times by 1 test | | FALSE | evaluated 10 times by 1 test |
&& list->word->word[1] == '-'| TRUE | never evaluated | | FALSE | evaluated 3 times by 1 test |
&& !list->word->word[2]| TRUE | never evaluated | | FALSE | never evaluated |
)) | 0-10 |
| 175 | { | - |
| 176 | list = list->next; | - |
| 177 | break; never executed: break; | 0 |
| 178 | } | - |
| 179 | else if (list->word->word[0] == '-'| TRUE | evaluated 3 times by 1 test | | FALSE | evaluated 10 times by 1 test |
&& list->word->word[1] == '\0'| TRUE | never evaluated | | FALSE | evaluated 3 times by 1 test |
) | 0-10 |
| 180 | | - |
| 181 | break; never executed: break; | 0 |
| 182 | else if (((| TRUE | evaluated 2 times by 1 test | | FALSE | evaluated 11 times by 1 test |
direction = list->word->word[0]) == '+')| TRUE | evaluated 2 times by 1 test | | FALSE | evaluated 11 times by 1 test |
|| direction == '-'| TRUE | evaluated 3 times by 1 test | | FALSE | evaluated 8 times by 1 test |
) | 2-11 |
| 183 | { | - |
| 184 | if (legal_number (list->word->word + 1, &num) == 0| TRUE | evaluated 1 time by 1 test | | FALSE | evaluated 4 times by 1 test |
) | 1-4 |
| 185 | { | - |
| 186 | sh_invalidnum (list->word->word); | - |
| 187 | builtin_usage (); | - |
| 188 | returnexecuted 1 time by 1 test: return (258); (258);executed 1 time by 1 test: return (258); | 1 |
| 189 | } | - |
| 190 | | - |
| 191 | if (direction == '-'| TRUE | evaluated 2 times by 1 test | | FALSE | evaluated 2 times by 1 test |
) | 2 |
| 192 | num = directory_list_offset - num;executed 2 times by 1 test: num = directory_list_offset - num; | 2 |
| 193 | | - |
| 194 | if (num > directory_list_offset| TRUE | evaluated 1 time by 1 test | | FALSE | evaluated 3 times by 1 test |
|| num < 0| TRUE | evaluated 1 time by 1 test | | FALSE | evaluated 2 times by 1 test |
) | 1-3 |
| 195 | { | - |
| 196 | pushd_error (directory_list_offset, list->word->word); | - |
| 197 | returnexecuted 2 times by 1 test: return (1); (1);executed 2 times by 1 test: return (1); | 2 |
| 198 | } | - |
| 199 | flags |= 0x02; | - |
| 200 | }executed 2 times by 1 test: end of block | 2 |
| 201 | else if (*| TRUE | never evaluated | | FALSE | evaluated 8 times by 1 test |
list->word->word == '-'| TRUE | never evaluated | | FALSE | evaluated 8 times by 1 test |
) | 0-8 |
| 202 | { | - |
| 203 | sh_invalidopt (list->word->word); | - |
| 204 | builtin_usage (); | - |
| 205 | return never executed: return (258); (258);never executed: return (258); | 0 |
| 206 | } | - |
| 207 | else | - |
| 208 | break;executed 8 times by 1 test: break; | 8 |
| 209 | } | - |
| 210 | | - |
| 211 | if (flags & 0x02| TRUE | evaluated 2 times by 1 test | | FALSE | evaluated 8 times by 1 test |
) | 2-8 |
| 212 | { | - |
| 213 | | - |
| 214 | | - |
| 215 | temp = get_working_directory ("pushd"); | - |
| 216 | | - |
| 217 | if (num == 0| TRUE | evaluated 1 time by 1 test | | FALSE | evaluated 1 time by 1 test |
) | 1 |
| 218 | { | - |
| 219 | j = ((| TRUE | never evaluated | | FALSE | evaluated 1 time by 1 test |
flags & 0x01) == 0)| TRUE | never evaluated | | FALSE | evaluated 1 time by 1 test |
? change_to_temp (temp) : 0; | 0-1 |
| 220 | sh_xfree((temp), "./pushd.def", 267); | - |
| 221 | returnexecuted 1 time by 1 test: return j; j;executed 1 time by 1 test: return j; | 1 |
| 222 | } | - |
| 223 | | - |
| 224 | do | - |
| 225 | { | - |
| 226 | top = pushd_directory_list[directory_list_offset - 1]; | - |
| 227 | | - |
| 228 | for (j = directory_list_offset - 2; j > -1| TRUE | evaluated 1 time by 1 test | | FALSE | evaluated 1 time by 1 test |
; j--) | 1 |
| 229 | pushd_directory_list[j + 1] = pushd_directory_list[j];executed 1 time by 1 test: pushd_directory_list[j + 1] = pushd_directory_list[j]; | 1 |
| 230 | | - |
| 231 | pushd_directory_list[j + 1] = temp; | - |
| 232 | | - |
| 233 | temp = top; | - |
| 234 | num--; | - |
| 235 | }executed 1 time by 1 test: end of block | 1 |
| 236 | while (num| TRUE | never evaluated | | FALSE | evaluated 1 time by 1 test |
); | 0-1 |
| 237 | | - |
| 238 | j = ((| TRUE | evaluated 1 time by 1 test | | FALSE | never evaluated |
flags & 0x01) == 0)| TRUE | evaluated 1 time by 1 test | | FALSE | never evaluated |
? change_to_temp (temp) : 0; | 0-1 |
| 239 | sh_xfree((temp), "./pushd.def", 286); | - |
| 240 | returnexecuted 1 time by 1 test: return j; j;executed 1 time by 1 test: return j; | 1 |
| 241 | } | - |
| 242 | | - |
| 243 | if (list == 0| TRUE | never evaluated | | FALSE | evaluated 8 times by 1 test |
) | 0-8 |
| 244 | return never executed: return (0); (0);never executed: return (0); | 0 |
| 245 | | - |
| 246 | | - |
| 247 | | - |
| 248 | current_directory = get_working_directory ("pushd"); | - |
| 249 | if (current_directory == 0| TRUE | never evaluated | | FALSE | evaluated 8 times by 1 test |
) | 0-8 |
| 250 | return never executed: return (1); (1);never executed: return (1); | 0 |
| 251 | | - |
| 252 | j = ((| TRUE | evaluated 7 times by 1 test | | FALSE | evaluated 1 time by 1 test |
flags & 0x01) == 0)| TRUE | evaluated 7 times by 1 test | | FALSE | evaluated 1 time by 1 test |
? cd_builtin (skipopt ? orig_list : list) : 0; | 1-7 |
| 253 | if (j == 0| TRUE | evaluated 7 times by 1 test | | FALSE | evaluated 1 time by 1 test |
) | 1-7 |
| 254 | { | - |
| 255 | add_dirstack_element ((flags & 0x01) ? (char *)strcpy (sh_xmalloc((1 + strlen (list->word->word)), "./pushd.def", 302), (list->word->word)) : current_directory); | - |
| 256 | dirs_builtin ((WORD_LIST *) | - |
| 257 | ((void *)0) | - |
| 258 | ); | - |
| 259 | if (flags & 0x01| TRUE | evaluated 1 time by 1 test | | FALSE | evaluated 6 times by 1 test |
) | 1-6 |
| 260 | sh_xfree((current_directory), "./pushd.def", 305);executed 1 time by 1 test: sh_xfree((current_directory), "./pushd.def", 305); | 1 |
| 261 | returnexecuted 7 times by 1 test: return (0); (0);executed 7 times by 1 test: return (0); | 7 |
| 262 | } | - |
| 263 | else | - |
| 264 | { | - |
| 265 | sh_xfree((current_directory), "./pushd.def", 310); | - |
| 266 | returnexecuted 1 time by 1 test: return (1); (1);executed 1 time by 1 test: return (1); | 1 |
| 267 | } | - |
| 268 | } | - |
| 269 | | - |
| 270 | | - |
| 271 | | - |
| 272 | | - |
| 273 | int | - |
| 274 | popd_builtin (list) | - |
| 275 | WORD_LIST *list; | - |
| 276 | { | - |
| 277 | register int i; | - |
| 278 | intmax_t which; | - |
| 279 | int flags; | - |
| 280 | char direction; | - |
| 281 | char *which_word; | - |
| 282 | | - |
| 283 | do { if ((| TRUE | evaluated 5 times by 1 test | | FALSE | evaluated 2 times by 1 test |
list)| TRUE | evaluated 5 times by 1 test | | FALSE | evaluated 2 times by 1 test |
&& (| TRUE | evaluated 5 times by 1 test | | FALSE | never evaluated |
list)->word| TRUE | evaluated 5 times by 1 test | | FALSE | never evaluated |
&& (((((| TRUE | evaluated 3 times by 1 test | | FALSE | evaluated 2 times by 1 test |
list)->word->word))[0] == ("--help")[0]| TRUE | evaluated 3 times by 1 test | | FALSE | evaluated 2 times by 1 test |
&& | 0-5 |
| 284 | __extension__ ({ size_t __s1_len, __s2_len; (__builtin_constant_p (| TRUE | never evaluated | | FALSE | evaluated 3 times by 1 test |
| 0-3 |
| 285 | ((list)->word->word)| TRUE | never evaluated | | FALSE | evaluated 3 times by 1 test |
| 0-3 |
| 286 | ) && __builtin_constant_p (| TRUE | never evaluated | | FALSE | evaluated 3 times by 1 test |
| 0-3 |
| 287 | "--help"| TRUE | never evaluated | | FALSE | evaluated 3 times by 1 test |
| 0-3 |
| 288 | ) && (__s1_len = __builtin_strlen (| TRUE | never evaluated | | FALSE | evaluated 3 times by 1 test |
| 0-3 |
| 289 | ((list)->word->word)| TRUE | never evaluated | | FALSE | evaluated 3 times by 1 test |
| 0-3 |
| 290 | ), __s2_len = __builtin_strlen (| TRUE | never evaluated | | FALSE | evaluated 3 times by 1 test |
| 0-3 |
| 291 | "--help"| TRUE | never evaluated | | FALSE | evaluated 3 times by 1 test |
| 0-3 |
| 292 | ), (!((size_t)(const void *)((| TRUE | never evaluated | | FALSE | evaluated 3 times by 1 test |
| 0-3 |
| 293 | ((list)->word->word)| TRUE | never evaluated | | FALSE | evaluated 3 times by 1 test |
| 0-3 |
| 294 | ) + 1) - (size_t)(const void *)(| TRUE | never evaluated | | FALSE | evaluated 3 times by 1 test |
| 0-3 |
| 295 | ((list)->word->word)| TRUE | never evaluated | | FALSE | evaluated 3 times by 1 test |
| 0-3 |
| 296 | ) == 1) || __s1_len >= 4) && (!((size_t)(const void *)((| TRUE | never evaluated | | FALSE | evaluated 3 times by 1 test |
| 0-3 |
| 297 | "--help"| TRUE | never evaluated | | FALSE | evaluated 3 times by 1 test |
| 0-3 |
| 298 | ) + 1) - (size_t)(const void *)(| TRUE | never evaluated | | FALSE | evaluated 3 times by 1 test |
| 0-3 |
| 299 | "--help"| TRUE | never evaluated | | FALSE | evaluated 3 times by 1 test |
| 0-3 |
| 300 | ) == 1) || __s2_len >= 4)) ? __builtin_strcmp (| TRUE | never evaluated | | FALSE | evaluated 3 times by 1 test |
| 0-3 |
| 301 | ((list)->word->word)| TRUE | never evaluated | | FALSE | evaluated 3 times by 1 test |
| 0-3 |
| 302 | , | TRUE | never evaluated | | FALSE | evaluated 3 times by 1 test |
| 0-3 |
| 303 | "--help"| TRUE | never evaluated | | FALSE | evaluated 3 times by 1 test |
| 0-3 |
| 304 | ) : (__builtin_constant_p (| TRUE | never evaluated | | FALSE | evaluated 3 times by 1 test |
| 0-3 |
| 305 | ((list)->word->word)| TRUE | never evaluated | | FALSE | evaluated 3 times by 1 test |
| 0-3 |
| 306 | ) && ((size_t)(const void *)((| TRUE | never evaluated | | FALSE | evaluated 3 times by 1 test |
| 0-3 |
| 307 | ((list)->word->word)| TRUE | never evaluated | | FALSE | evaluated 3 times by 1 test |
| 0-3 |
| 308 | ) + 1) - (size_t)(const void *)(| TRUE | never evaluated | | FALSE | evaluated 3 times by 1 test |
| 0-3 |
| 309 | ((list)->word->word)| TRUE | never evaluated | | FALSE | evaluated 3 times by 1 test |
| 0-3 |
| 310 | ) == 1) && (__s1_len = __builtin_strlen (| TRUE | never evaluated | | FALSE | evaluated 3 times by 1 test |
| 0-3 |
| 311 | ((list)->word->word)| TRUE | never evaluated | | FALSE | evaluated 3 times by 1 test |
| 0-3 |
| 312 | ), __s1_len < 4) ? (__builtin_constant_p (| TRUE | never evaluated | | FALSE | evaluated 3 times by 1 test |
| 0-3 |
| 313 | "--help"| TRUE | never evaluated | | FALSE | evaluated 3 times by 1 test |
| 0-3 |
| 314 | ) && ((size_t)(const void *)((| TRUE | never evaluated | | FALSE | evaluated 3 times by 1 test |
| 0-3 |
| 315 | "--help"| TRUE | never evaluated | | FALSE | evaluated 3 times by 1 test |
| 0-3 |
| 316 | ) + 1) - (size_t)(const void *)(| TRUE | never evaluated | | FALSE | evaluated 3 times by 1 test |
| 0-3 |
| 317 | "--help"| TRUE | never evaluated | | FALSE | evaluated 3 times by 1 test |
| 0-3 |
| 318 | ) == 1) ? __builtin_strcmp (| TRUE | never evaluated | | FALSE | evaluated 3 times by 1 test |
| 0-3 |
| 319 | ((list)->word->word)| TRUE | never evaluated | | FALSE | evaluated 3 times by 1 test |
| 0-3 |
| 320 | , | TRUE | never evaluated | | FALSE | evaluated 3 times by 1 test |
| 0-3 |
| 321 | "--help"| TRUE | never evaluated | | FALSE | evaluated 3 times by 1 test |
| 0-3 |
| 322 | ) : (__extension__ ({ const unsigned char *__s2 = (const unsigned char *) (const char *) (| TRUE | never evaluated | | FALSE | evaluated 3 times by 1 test |
| 0-3 |
| 323 | "--help"| TRUE | never evaluated | | FALSE | evaluated 3 times by 1 test |
| 0-3 |
| 324 | ); int __result = (((const unsigned char *) (const char *) (| TRUE | never evaluated | | FALSE | evaluated 3 times by 1 test |
| 0-3 |
| 325 | ((list)->word->word)| TRUE | never evaluated | | FALSE | evaluated 3 times by 1 test |
| 0-3 |
| 326 | ))[0] - __s2[0]); if (__s1_len > 0| TRUE | never evaluated | | FALSE | never evaluated |
&& __result == 0| TRUE | never evaluated | | FALSE | never evaluated |
) { __result = (((const unsigned char *) (const char *) (| TRUE | never evaluated | | FALSE | evaluated 3 times by 1 test |
| 0-3 |
| 327 | ((list)->word->word)| TRUE | never evaluated | | FALSE | evaluated 3 times by 1 test |
| 0-3 |
| 328 | ))[1] - __s2[1]); if (__s1_len > 1| TRUE | never evaluated | | FALSE | never evaluated |
&& __result == 0| TRUE | never evaluated | | FALSE | never evaluated |
) { __result = (((const unsigned char *) (const char *) (| TRUE | never evaluated | | FALSE | evaluated 3 times by 1 test |
| 0-3 |
| 329 | ((list)->word->word)| TRUE | never evaluated | | FALSE | evaluated 3 times by 1 test |
| 0-3 |
| 330 | ))[2] - __s2[2]); if (__s1_len > 2| TRUE | never evaluated | | FALSE | never evaluated |
&& __result == 0| TRUE | never evaluated | | FALSE | never evaluated |
) __result = (((const unsigned char *) (const char *) (never executed: __result = (((const unsigned char *) (const char *) ( ((list)->word->word) ))[3] - __s2[3]); | TRUE | never evaluated | | FALSE | evaluated 3 times by 1 test |
| 0-3 |
| 331 | ((list)->word->word)| TRUE | never evaluated | | FALSE | evaluated 3 times by 1 test |
never executed: __result = (((const unsigned char *) (const char *) ( ((list)->word->word) ))[3] - __s2[3]); | 0-3 |
| 332 | ))[3] - __s2[3]);| TRUE | never evaluated | | FALSE | evaluated 3 times by 1 test |
never executed: __result = (((const unsigned char *) (const char *) ( ((list)->word->word) ))[3] - __s2[3]); }never executed: end of block }never executed: end of block __result; }))) : (__builtin_constant_p (| TRUE | never evaluated | | FALSE | evaluated 3 times by 1 test |
| 0-3 |
| 333 | "--help"| TRUE | never evaluated | | FALSE | evaluated 3 times by 1 test |
| 0-3 |
| 334 | ) && ((size_t)(const void *)((| TRUE | never evaluated | | FALSE | evaluated 3 times by 1 test |
| 0-3 |
| 335 | "--help"| TRUE | never evaluated | | FALSE | evaluated 3 times by 1 test |
| 0-3 |
| 336 | ) + 1) - (size_t)(const void *)(| TRUE | never evaluated | | FALSE | evaluated 3 times by 1 test |
| 0-3 |
| 337 | "--help"| TRUE | never evaluated | | FALSE | evaluated 3 times by 1 test |
| 0-3 |
| 338 | ) == 1) && (__s2_len = __builtin_strlen (| TRUE | never evaluated | | FALSE | evaluated 3 times by 1 test |
| 0-3 |
| 339 | "--help"| TRUE | never evaluated | | FALSE | evaluated 3 times by 1 test |
| 0-3 |
| 340 | ), __s2_len < 4) ? (__builtin_constant_p (| TRUE | never evaluated | | FALSE | evaluated 3 times by 1 test |
| 0-3 |
| 341 | ((list)->word->word)| TRUE | never evaluated | | FALSE | evaluated 3 times by 1 test |
| 0-3 |
| 342 | ) && ((size_t)(const void *)((| TRUE | never evaluated | | FALSE | evaluated 3 times by 1 test |
| 0-3 |
| 343 | ((list)->word->word)| TRUE | never evaluated | | FALSE | evaluated 3 times by 1 test |
| 0-3 |
| 344 | ) + 1) - (size_t)(const void *)(| TRUE | never evaluated | | FALSE | evaluated 3 times by 1 test |
| 0-3 |
| 345 | ((list)->word->word)| TRUE | never evaluated | | FALSE | evaluated 3 times by 1 test |
| 0-3 |
| 346 | ) == 1) ? __builtin_strcmp (| TRUE | never evaluated | | FALSE | evaluated 3 times by 1 test |
| 0-3 |
| 347 | ((list)->word->word)| TRUE | never evaluated | | FALSE | evaluated 3 times by 1 test |
| 0-3 |
| 348 | , | TRUE | never evaluated | | FALSE | evaluated 3 times by 1 test |
| 0-3 |
| 349 | "--help"| TRUE | never evaluated | | FALSE | evaluated 3 times by 1 test |
| 0-3 |
| 350 | ) : -(__extension__ ({ const unsigned char *__s2 = (const unsigned char *) (const char *) (| TRUE | never evaluated | | FALSE | evaluated 3 times by 1 test |
| 0-3 |
| 351 | ((list)->word->word)| TRUE | never evaluated | | FALSE | evaluated 3 times by 1 test |
| 0-3 |
| 352 | ); int __result = (((const unsigned char *) (const char *) (| TRUE | never evaluated | | FALSE | evaluated 3 times by 1 test |
| 0-3 |
| 353 | "--help"| TRUE | never evaluated | | FALSE | evaluated 3 times by 1 test |
| 0-3 |
| 354 | ))[0] - __s2[0]); if (__s2_len > 0| TRUE | never evaluated | | FALSE | never evaluated |
&& __result == 0| TRUE | never evaluated | | FALSE | never evaluated |
) { __result = (((const unsigned char *) (const char *) (| TRUE | never evaluated | | FALSE | evaluated 3 times by 1 test |
| 0-3 |
| 355 | "--help"| TRUE | never evaluated | | FALSE | evaluated 3 times by 1 test |
| 0-3 |
| 356 | ))[1] - __s2[1]); if (__s2_len > 1| TRUE | never evaluated | | FALSE | never evaluated |
&& __result == 0| TRUE | never evaluated | | FALSE | never evaluated |
) { __result = (((const unsigned char *) (const char *) (| TRUE | never evaluated | | FALSE | evaluated 3 times by 1 test |
| 0-3 |
| 357 | "--help"| TRUE | never evaluated | | FALSE | evaluated 3 times by 1 test |
| 0-3 |
| 358 | ))[2] - __s2[2]); if (__s2_len > 2| TRUE | never evaluated | | FALSE | never evaluated |
&& __result == 0| TRUE | never evaluated | | FALSE | never evaluated |
) __result = (((const unsigned char *) (const char *) (never executed: __result = (((const unsigned char *) (const char *) ( "--help" ))[3] - __s2[3]); | TRUE | never evaluated | | FALSE | evaluated 3 times by 1 test |
| 0-3 |
| 359 | "--help"| TRUE | never evaluated | | FALSE | evaluated 3 times by 1 test |
never executed: __result = (((const unsigned char *) (const char *) ( "--help" ))[3] - __s2[3]); | 0-3 |
| 360 | ))[3] - __s2[3]);| TRUE | never evaluated | | FALSE | evaluated 3 times by 1 test |
never executed: __result = (((const unsigned char *) (const char *) ( "--help" ))[3] - __s2[3]); }never executed: end of block }never executed: end of block __result; }))) : __builtin_strcmp (| TRUE | never evaluated | | FALSE | evaluated 3 times by 1 test |
| 0-3 |
| 361 | ((list)->word->word)| TRUE | never evaluated | | FALSE | evaluated 3 times by 1 test |
| 0-3 |
| 362 | , | TRUE | never evaluated | | FALSE | evaluated 3 times by 1 test |
| 0-3 |
| 363 | "--help"| TRUE | never evaluated | | FALSE | evaluated 3 times by 1 test |
| 0-3 |
| 364 | )))); }) | TRUE | never evaluated | | FALSE | evaluated 3 times by 1 test |
| 0-3 |
| 365 | == 0| TRUE | never evaluated | | FALSE | evaluated 3 times by 1 test |
))) { builtin_help (); returnnever executed: return (258); (258);never executed: return (258); } } while (0); | 0-3 |
| 366 | | - |
| 367 | which_word = (char *) | - |
| 368 | ((void *)0) | - |
| 369 | ; | - |
| 370 | for (flags = 0, which = 0, direction = '+'; list| TRUE | evaluated 6 times by 1 test | | FALSE | evaluated 6 times by 1 test |
; list = list->next) | 6 |
| 371 | { | - |
| 372 | if ((list->word->word[0] == '-'| TRUE | evaluated 3 times by 1 test | | FALSE | evaluated 3 times by 1 test |
&& list->word->word[1] == 'n'| TRUE | evaluated 1 time by 1 test | | FALSE | evaluated 2 times by 1 test |
&& !list->word->word[2]| TRUE | evaluated 1 time by 1 test | | FALSE | never evaluated |
)) | 0-3 |
| 373 | { | - |
| 374 | flags |= 0x01; | - |
| 375 | }executed 1 time by 1 test: end of block | 1 |
| 376 | else if ((list->word->word[0] == '-'| TRUE | evaluated 2 times by 1 test | | FALSE | evaluated 3 times by 1 test |
&& list->word->word[1] == '-'| TRUE | never evaluated | | FALSE | evaluated 2 times by 1 test |
&& !list->word->word[2]| TRUE | never evaluated | | FALSE | never evaluated |
)) | 0-3 |
| 377 | { | - |
| 378 | list = list->next; | - |
| 379 | break; never executed: break; | 0 |
| 380 | } | - |
| 381 | else if (((| TRUE | evaluated 3 times by 1 test | | FALSE | evaluated 2 times by 1 test |
direction = list->word->word[0]) == '+')| TRUE | evaluated 3 times by 1 test | | FALSE | evaluated 2 times by 1 test |
|| direction == '-'| TRUE | evaluated 2 times by 1 test | | FALSE | never evaluated |
) | 0-3 |
| 382 | { | - |
| 383 | if (legal_number (list->word->word + 1, &which) == 0| TRUE | evaluated 1 time by 1 test | | FALSE | evaluated 4 times by 1 test |
) | 1-4 |
| 384 | { | - |
| 385 | sh_invalidnum (list->word->word); | - |
| 386 | builtin_usage (); | - |
| 387 | returnexecuted 1 time by 1 test: return (258); (258);executed 1 time by 1 test: return (258); | 1 |
| 388 | } | - |
| 389 | which_word = list->word->word; | - |
| 390 | }executed 4 times by 1 test: end of block | 4 |
| 391 | else if (*| TRUE | never evaluated | | FALSE | never evaluated |
list->word->word == '-'| TRUE | never evaluated | | FALSE | never evaluated |
) | 0 |
| 392 | { | - |
| 393 | sh_invalidopt (list->word->word); | - |
| 394 | builtin_usage (); | - |
| 395 | return never executed: return (258); (258);never executed: return (258); | 0 |
| 396 | } | - |
| 397 | else if (*| TRUE | never evaluated | | FALSE | never evaluated |
list->word->word| TRUE | never evaluated | | FALSE | never evaluated |
) | 0 |
| 398 | { | - |
| 399 | builtin_error ( | - |
| 400 | dcgettext (((void *)0), | - |
| 401 | "%s: invalid argument" | - |
| 402 | , 5) | - |
| 403 | , list->word->word); | - |
| 404 | builtin_usage (); | - |
| 405 | return never executed: return (258); (258);never executed: return (258); | 0 |
| 406 | } | - |
| 407 | else | - |
| 408 | break; never executed: break; | 0 |
| 409 | } | - |
| 410 | | - |
| 411 | if (which > directory_list_offset| TRUE | evaluated 2 times by 1 test | | FALSE | evaluated 4 times by 1 test |
|| (| TRUE | never evaluated | | FALSE | evaluated 4 times by 1 test |
which < -directory_list_offset)| TRUE | never evaluated | | FALSE | evaluated 4 times by 1 test |
|| (directory_list_offset == 0| TRUE | evaluated 1 time by 1 test | | FALSE | evaluated 3 times by 1 test |
&& which == 0| TRUE | evaluated 1 time by 1 test | | FALSE | never evaluated |
)) | 0-4 |
| 412 | { | - |
| 413 | pushd_error (directory_list_offset, which_word ? which_word : ""); | - |
| 414 | returnexecuted 3 times by 1 test: return (1); (1);executed 3 times by 1 test: return (1); | 3 |
| 415 | } | - |
| 416 | | - |
| 417 | | - |
| 418 | if ((direction == '+'| TRUE | evaluated 3 times by 1 test | | FALSE | never evaluated |
&& which == 0| TRUE | evaluated 1 time by 1 test | | FALSE | evaluated 2 times by 1 test |
) || | 0-3 |
| 419 | (direction == '-'| TRUE | never evaluated | | FALSE | evaluated 2 times by 1 test |
&& which == directory_list_offset| TRUE | never evaluated | | FALSE | never evaluated |
)) | 0-2 |
| 420 | { | - |
| 421 | i = ((| TRUE | evaluated 1 time by 1 test | | FALSE | never evaluated |
flags & 0x01) == 0)| TRUE | evaluated 1 time by 1 test | | FALSE | never evaluated |
? cd_to_string (pushd_directory_list[directory_list_offset - 1]) | 0-1 |
| 422 | : 0; | - |
| 423 | if (i != 0| TRUE | never evaluated | | FALSE | evaluated 1 time by 1 test |
) | 0-1 |
| 424 | return never executed: return (i); (i);never executed: return (i); | 0 |
| 425 | sh_xfree((pushd_directory_list[--directory_list_offset]), "./pushd.def", 382); | - |
| 426 | }executed 1 time by 1 test: end of block | 1 |
| 427 | else | - |
| 428 | { | - |
| 429 | | - |
| 430 | | - |
| 431 | | - |
| 432 | i = (| TRUE | evaluated 2 times by 1 test | | FALSE | never evaluated |
direction == '+')| TRUE | evaluated 2 times by 1 test | | FALSE | never evaluated |
? directory_list_offset - which : which; | 0-2 |
| 433 | if (i < 0| TRUE | never evaluated | | FALSE | evaluated 2 times by 1 test |
|| i > directory_list_offset| TRUE | never evaluated | | FALSE | evaluated 2 times by 1 test |
) | 0-2 |
| 434 | { | - |
| 435 | pushd_error (directory_list_offset, which_word ? which_word : ""); | - |
| 436 | return never executed: return (1); (1);never executed: return (1); | 0 |
| 437 | } | - |
| 438 | sh_xfree((pushd_directory_list[i]), "./pushd.def", 395); | - |
| 439 | directory_list_offset--; | - |
| 440 | | - |
| 441 | | - |
| 442 | for (; i < directory_list_offset| TRUE | evaluated 2 times by 1 test | | FALSE | evaluated 2 times by 1 test |
; i++) | 2 |
| 443 | pushd_directory_list[i] = pushd_directory_list[i + 1];executed 2 times by 1 test: pushd_directory_list[i] = pushd_directory_list[i + 1]; | 2 |
| 444 | }executed 2 times by 1 test: end of block | 2 |
| 445 | | - |
| 446 | dirs_builtin ((WORD_LIST *) | - |
| 447 | ((void *)0) | - |
| 448 | ); | - |
| 449 | returnexecuted 3 times by 1 test: return (0); (0);executed 3 times by 1 test: return (0); | 3 |
| 450 | } | - |
| 451 | | - |
| 452 | | - |
| 453 | int | - |
| 454 | dirs_builtin (list) | - |
| 455 | WORD_LIST *list; | - |
| 456 | { | - |
| 457 | int flags, desired_index, index_flag, vflag; | - |
| 458 | intmax_t i; | - |
| 459 | char *temp, *w; | - |
| 460 | | - |
| 461 | do { if ((| TRUE | evaluated 17 times by 1 test | | FALSE | evaluated 22 times by 1 test |
list)| TRUE | evaluated 17 times by 1 test | | FALSE | evaluated 22 times by 1 test |
&& (| TRUE | evaluated 17 times by 1 test | | FALSE | never evaluated |
list)->word| TRUE | evaluated 17 times by 1 test | | FALSE | never evaluated |
&& (((((| TRUE | evaluated 10 times by 1 test | | FALSE | evaluated 7 times by 1 test |
list)->word->word))[0] == ("--help")[0]| TRUE | evaluated 10 times by 1 test | | FALSE | evaluated 7 times by 1 test |
&& | 0-22 |
| 462 | __extension__ ({ size_t __s1_len, __s2_len; (__builtin_constant_p (| TRUE | never evaluated | | FALSE | evaluated 10 times by 1 test |
| 0-10 |
| 463 | ((list)->word->word)| TRUE | never evaluated | | FALSE | evaluated 10 times by 1 test |
| 0-10 |
| 464 | ) && __builtin_constant_p (| TRUE | never evaluated | | FALSE | evaluated 10 times by 1 test |
| 0-10 |
| 465 | "--help"| TRUE | never evaluated | | FALSE | evaluated 10 times by 1 test |
| 0-10 |
| 466 | ) && (__s1_len = __builtin_strlen (| TRUE | never evaluated | | FALSE | evaluated 10 times by 1 test |
| 0-10 |
| 467 | ((list)->word->word)| TRUE | never evaluated | | FALSE | evaluated 10 times by 1 test |
| 0-10 |
| 468 | ), __s2_len = __builtin_strlen (| TRUE | never evaluated | | FALSE | evaluated 10 times by 1 test |
| 0-10 |
| 469 | "--help"| TRUE | never evaluated | | FALSE | evaluated 10 times by 1 test |
| 0-10 |
| 470 | ), (!((size_t)(const void *)((| TRUE | never evaluated | | FALSE | evaluated 10 times by 1 test |
| 0-10 |
| 471 | ((list)->word->word)| TRUE | never evaluated | | FALSE | evaluated 10 times by 1 test |
| 0-10 |
| 472 | ) + 1) - (size_t)(const void *)(| TRUE | never evaluated | | FALSE | evaluated 10 times by 1 test |
| 0-10 |
| 473 | ((list)->word->word)| TRUE | never evaluated | | FALSE | evaluated 10 times by 1 test |
| 0-10 |
| 474 | ) == 1) || __s1_len >= 4) && (!((size_t)(const void *)((| TRUE | never evaluated | | FALSE | evaluated 10 times by 1 test |
| 0-10 |
| 475 | "--help"| TRUE | never evaluated | | FALSE | evaluated 10 times by 1 test |
| 0-10 |
| 476 | ) + 1) - (size_t)(const void *)(| TRUE | never evaluated | | FALSE | evaluated 10 times by 1 test |
| 0-10 |
| 477 | "--help"| TRUE | never evaluated | | FALSE | evaluated 10 times by 1 test |
| 0-10 |
| 478 | ) == 1) || __s2_len >= 4)) ? __builtin_strcmp (| TRUE | never evaluated | | FALSE | evaluated 10 times by 1 test |
| 0-10 |
| 479 | ((list)->word->word)| TRUE | never evaluated | | FALSE | evaluated 10 times by 1 test |
| 0-10 |
| 480 | , | TRUE | never evaluated | | FALSE | evaluated 10 times by 1 test |
| 0-10 |
| 481 | "--help"| TRUE | never evaluated | | FALSE | evaluated 10 times by 1 test |
| 0-10 |
| 482 | ) : (__builtin_constant_p (| TRUE | never evaluated | | FALSE | evaluated 10 times by 1 test |
| 0-10 |
| 483 | ((list)->word->word)| TRUE | never evaluated | | FALSE | evaluated 10 times by 1 test |
| 0-10 |
| 484 | ) && ((size_t)(const void *)((| TRUE | never evaluated | | FALSE | evaluated 10 times by 1 test |
| 0-10 |
| 485 | ((list)->word->word)| TRUE | never evaluated | | FALSE | evaluated 10 times by 1 test |
| 0-10 |
| 486 | ) + 1) - (size_t)(const void *)(| TRUE | never evaluated | | FALSE | evaluated 10 times by 1 test |
| 0-10 |
| 487 | ((list)->word->word)| TRUE | never evaluated | | FALSE | evaluated 10 times by 1 test |
| 0-10 |
| 488 | ) == 1) && (__s1_len = __builtin_strlen (| TRUE | never evaluated | | FALSE | evaluated 10 times by 1 test |
| 0-10 |
| 489 | ((list)->word->word)| TRUE | never evaluated | | FALSE | evaluated 10 times by 1 test |
| 0-10 |
| 490 | ), __s1_len < 4) ? (__builtin_constant_p (| TRUE | never evaluated | | FALSE | evaluated 10 times by 1 test |
| 0-10 |
| 491 | "--help"| TRUE | never evaluated | | FALSE | evaluated 10 times by 1 test |
| 0-10 |
| 492 | ) && ((size_t)(const void *)((| TRUE | never evaluated | | FALSE | evaluated 10 times by 1 test |
| 0-10 |
| 493 | "--help"| TRUE | never evaluated | | FALSE | evaluated 10 times by 1 test |
| 0-10 |
| 494 | ) + 1) - (size_t)(const void *)(| TRUE | never evaluated | | FALSE | evaluated 10 times by 1 test |
| 0-10 |
| 495 | "--help"| TRUE | never evaluated | | FALSE | evaluated 10 times by 1 test |
| 0-10 |
| 496 | ) == 1) ? __builtin_strcmp (| TRUE | never evaluated | | FALSE | evaluated 10 times by 1 test |
| 0-10 |
| 497 | ((list)->word->word)| TRUE | never evaluated | | FALSE | evaluated 10 times by 1 test |
| 0-10 |
| 498 | , | TRUE | never evaluated | | FALSE | evaluated 10 times by 1 test |
| 0-10 |
| 499 | "--help"| TRUE | never evaluated | | FALSE | evaluated 10 times by 1 test |
| 0-10 |
| 500 | ) : (__extension__ ({ const unsigned char *__s2 = (const unsigned char *) (const char *) (| TRUE | never evaluated | | FALSE | evaluated 10 times by 1 test |
| 0-10 |
| 501 | "--help"| TRUE | never evaluated | | FALSE | evaluated 10 times by 1 test |
| 0-10 |
| 502 | ); int __result = (((const unsigned char *) (const char *) (| TRUE | never evaluated | | FALSE | evaluated 10 times by 1 test |
| 0-10 |
| 503 | ((list)->word->word)| TRUE | never evaluated | | FALSE | evaluated 10 times by 1 test |
| 0-10 |
| 504 | ))[0] - __s2[0]); if (__s1_len > 0| TRUE | never evaluated | | FALSE | never evaluated |
&& __result == 0| TRUE | never evaluated | | FALSE | never evaluated |
) { __result = (((const unsigned char *) (const char *) (| TRUE | never evaluated | | FALSE | evaluated 10 times by 1 test |
| 0-10 |
| 505 | ((list)->word->word)| TRUE | never evaluated | | FALSE | evaluated 10 times by 1 test |
| 0-10 |
| 506 | ))[1] - __s2[1]); if (__s1_len > 1| TRUE | never evaluated | | FALSE | never evaluated |
&& __result == 0| TRUE | never evaluated | | FALSE | never evaluated |
) { __result = (((const unsigned char *) (const char *) (| TRUE | never evaluated | | FALSE | evaluated 10 times by 1 test |
| 0-10 |
| 507 | ((list)->word->word)| TRUE | never evaluated | | FALSE | evaluated 10 times by 1 test |
| 0-10 |
| 508 | ))[2] - __s2[2]); if (__s1_len > 2| TRUE | never evaluated | | FALSE | never evaluated |
&& __result == 0| TRUE | never evaluated | | FALSE | never evaluated |
) __result = (((const unsigned char *) (const char *) (never executed: __result = (((const unsigned char *) (const char *) ( ((list)->word->word) ))[3] - __s2[3]); | TRUE | never evaluated | | FALSE | evaluated 10 times by 1 test |
| 0-10 |
| 509 | ((list)->word->word)| TRUE | never evaluated | | FALSE | evaluated 10 times by 1 test |
never executed: __result = (((const unsigned char *) (const char *) ( ((list)->word->word) ))[3] - __s2[3]); | 0-10 |
| 510 | ))[3] - __s2[3]);| TRUE | never evaluated | | FALSE | evaluated 10 times by 1 test |
never executed: __result = (((const unsigned char *) (const char *) ( ((list)->word->word) ))[3] - __s2[3]); }never executed: end of block }never executed: end of block __result; }))) : (__builtin_constant_p (| TRUE | never evaluated | | FALSE | evaluated 10 times by 1 test |
| 0-10 |
| 511 | "--help"| TRUE | never evaluated | | FALSE | evaluated 10 times by 1 test |
| 0-10 |
| 512 | ) && ((size_t)(const void *)((| TRUE | never evaluated | | FALSE | evaluated 10 times by 1 test |
| 0-10 |
| 513 | "--help"| TRUE | never evaluated | | FALSE | evaluated 10 times by 1 test |
| 0-10 |
| 514 | ) + 1) - (size_t)(const void *)(| TRUE | never evaluated | | FALSE | evaluated 10 times by 1 test |
| 0-10 |
| 515 | "--help"| TRUE | never evaluated | | FALSE | evaluated 10 times by 1 test |
| 0-10 |
| 516 | ) == 1) && (__s2_len = __builtin_strlen (| TRUE | never evaluated | | FALSE | evaluated 10 times by 1 test |
| 0-10 |
| 517 | "--help"| TRUE | never evaluated | | FALSE | evaluated 10 times by 1 test |
| 0-10 |
| 518 | ), __s2_len < 4) ? (__builtin_constant_p (| TRUE | never evaluated | | FALSE | evaluated 10 times by 1 test |
| 0-10 |
| 519 | ((list)->word->word)| TRUE | never evaluated | | FALSE | evaluated 10 times by 1 test |
| 0-10 |
| 520 | ) && ((size_t)(const void *)((| TRUE | never evaluated | | FALSE | evaluated 10 times by 1 test |
| 0-10 |
| 521 | ((list)->word->word)| TRUE | never evaluated | | FALSE | evaluated 10 times by 1 test |
| 0-10 |
| 522 | ) + 1) - (size_t)(const void *)(| TRUE | never evaluated | | FALSE | evaluated 10 times by 1 test |
| 0-10 |
| 523 | ((list)->word->word)| TRUE | never evaluated | | FALSE | evaluated 10 times by 1 test |
| 0-10 |
| 524 | ) == 1) ? __builtin_strcmp (| TRUE | never evaluated | | FALSE | evaluated 10 times by 1 test |
| 0-10 |
| 525 | ((list)->word->word)| TRUE | never evaluated | | FALSE | evaluated 10 times by 1 test |
| 0-10 |
| 526 | , | TRUE | never evaluated | | FALSE | evaluated 10 times by 1 test |
| 0-10 |
| 527 | "--help"| TRUE | never evaluated | | FALSE | evaluated 10 times by 1 test |
| 0-10 |
| 528 | ) : -(__extension__ ({ const unsigned char *__s2 = (const unsigned char *) (const char *) (| TRUE | never evaluated | | FALSE | evaluated 10 times by 1 test |
| 0-10 |
| 529 | ((list)->word->word)| TRUE | never evaluated | | FALSE | evaluated 10 times by 1 test |
| 0-10 |
| 530 | ); int __result = (((const unsigned char *) (const char *) (| TRUE | never evaluated | | FALSE | evaluated 10 times by 1 test |
| 0-10 |
| 531 | "--help"| TRUE | never evaluated | | FALSE | evaluated 10 times by 1 test |
| 0-10 |
| 532 | ))[0] - __s2[0]); if (__s2_len > 0| TRUE | never evaluated | | FALSE | never evaluated |
&& __result == 0| TRUE | never evaluated | | FALSE | never evaluated |
) { __result = (((const unsigned char *) (const char *) (| TRUE | never evaluated | | FALSE | evaluated 10 times by 1 test |
| 0-10 |
| 533 | "--help"| TRUE | never evaluated | | FALSE | evaluated 10 times by 1 test |
| 0-10 |
| 534 | ))[1] - __s2[1]); if (__s2_len > 1| TRUE | never evaluated | | FALSE | never evaluated |
&& __result == 0| TRUE | never evaluated | | FALSE | never evaluated |
) { __result = (((const unsigned char *) (const char *) (| TRUE | never evaluated | | FALSE | evaluated 10 times by 1 test |
| 0-10 |
| 535 | "--help"| TRUE | never evaluated | | FALSE | evaluated 10 times by 1 test |
| 0-10 |
| 536 | ))[2] - __s2[2]); if (__s2_len > 2| TRUE | never evaluated | | FALSE | never evaluated |
&& __result == 0| TRUE | never evaluated | | FALSE | never evaluated |
) __result = (((const unsigned char *) (const char *) (never executed: __result = (((const unsigned char *) (const char *) ( "--help" ))[3] - __s2[3]); | TRUE | never evaluated | | FALSE | evaluated 10 times by 1 test |
| 0-10 |
| 537 | "--help"| TRUE | never evaluated | | FALSE | evaluated 10 times by 1 test |
never executed: __result = (((const unsigned char *) (const char *) ( "--help" ))[3] - __s2[3]); | 0-10 |
| 538 | ))[3] - __s2[3]);| TRUE | never evaluated | | FALSE | evaluated 10 times by 1 test |
never executed: __result = (((const unsigned char *) (const char *) ( "--help" ))[3] - __s2[3]); }never executed: end of block }never executed: end of block __result; }))) : __builtin_strcmp (| TRUE | never evaluated | | FALSE | evaluated 10 times by 1 test |
| 0-10 |
| 539 | ((list)->word->word)| TRUE | never evaluated | | FALSE | evaluated 10 times by 1 test |
| 0-10 |
| 540 | , | TRUE | never evaluated | | FALSE | evaluated 10 times by 1 test |
| 0-10 |
| 541 | "--help"| TRUE | never evaluated | | FALSE | evaluated 10 times by 1 test |
| 0-10 |
| 542 | )))); }) | TRUE | never evaluated | | FALSE | evaluated 10 times by 1 test |
| 0-10 |
| 543 | == 0| TRUE | never evaluated | | FALSE | evaluated 10 times by 1 test |
))) { builtin_help (); returnnever executed: return (258); (258);never executed: return (258); } } while (0); | 0-10 |
| 544 | for (flags = vflag = index_flag = 0, desired_index = -1, w = ""; list| TRUE | evaluated 18 times by 1 test | | FALSE | evaluated 37 times by 1 test |
; list = list->next) | 18-37 |
| 545 | { | - |
| 546 | if ((list->word->word[0] == '-'| TRUE | evaluated 11 times by 1 test | | FALSE | evaluated 7 times by 1 test |
&& list->word->word[1] == 'l'| TRUE | evaluated 1 time by 1 test | | FALSE | evaluated 10 times by 1 test |
&& !list->word->word[2]| TRUE | evaluated 1 time by 1 test | | FALSE | never evaluated |
)) | 0-11 |
| 547 | { | - |
| 548 | flags |= 0x04; | - |
| 549 | }executed 1 time by 1 test: end of block | 1 |
| 550 | else if ((list->word->word[0] == '-'| TRUE | evaluated 10 times by 1 test | | FALSE | evaluated 7 times by 1 test |
&& list->word->word[1] == 'c'| TRUE | evaluated 2 times by 1 test | | FALSE | evaluated 8 times by 1 test |
&& !list->word->word[2]| TRUE | evaluated 2 times by 1 test | | FALSE | never evaluated |
)) | 0-10 |
| 551 | { | - |
| 552 | flags |= 0x08; | - |
| 553 | }executed 2 times by 1 test: end of block | 2 |
| 554 | else if ((list->word->word[0] == '-'| TRUE | evaluated 8 times by 1 test | | FALSE | evaluated 7 times by 1 test |
&& list->word->word[1] == 'v'| TRUE | evaluated 2 times by 1 test | | FALSE | evaluated 6 times by 1 test |
&& !list->word->word[2]| TRUE | evaluated 2 times by 1 test | | FALSE | never evaluated |
)) | 0-8 |
| 555 | { | - |
| 556 | vflag |= 2; | - |
| 557 | }executed 2 times by 1 test: end of block | 2 |
| 558 | else if ((list->word->word[0] == '-'| TRUE | evaluated 6 times by 1 test | | FALSE | evaluated 7 times by 1 test |
&& list->word->word[1] == 'p'| TRUE | never evaluated | | FALSE | evaluated 6 times by 1 test |
&& !list->word->word[2]| TRUE | never evaluated | | FALSE | never evaluated |
)) | 0-7 |
| 559 | { | - |
| 560 | vflag |= 1; | - |
| 561 | } never executed: end of block | 0 |
| 562 | else if ((list->word->word[0] == '-'| TRUE | evaluated 6 times by 1 test | | FALSE | evaluated 7 times by 1 test |
&& list->word->word[1] == '-'| TRUE | never evaluated | | FALSE | evaluated 6 times by 1 test |
&& !list->word->word[2]| TRUE | never evaluated | | FALSE | never evaluated |
)) | 0-7 |
| 563 | { | - |
| 564 | list = list->next; | - |
| 565 | break; never executed: break; | 0 |
| 566 | } | - |
| 567 | else if (*| TRUE | evaluated 6 times by 1 test | | FALSE | evaluated 7 times by 1 test |
list->word->word == '+'| TRUE | evaluated 6 times by 1 test | | FALSE | evaluated 7 times by 1 test |
|| *| TRUE | evaluated 6 times by 1 test | | FALSE | evaluated 1 time by 1 test |
list->word->word == '-'| TRUE | evaluated 6 times by 1 test | | FALSE | evaluated 1 time by 1 test |
) | 1-7 |
| 568 | { | - |
| 569 | int sign; | - |
| 570 | if (legal_number (w = list->word->word + 1, &i) == 0| TRUE | evaluated 1 time by 1 test | | FALSE | evaluated 11 times by 1 test |
) | 1-11 |
| 571 | { | - |
| 572 | sh_invalidnum (list->word->word); | - |
| 573 | builtin_usage (); | - |
| 574 | returnexecuted 1 time by 1 test: return (258); (258);executed 1 time by 1 test: return (258); | 1 |
| 575 | } | - |
| 576 | sign = (*| TRUE | evaluated 6 times by 1 test | | FALSE | evaluated 5 times by 1 test |
list->word->word == '+')| TRUE | evaluated 6 times by 1 test | | FALSE | evaluated 5 times by 1 test |
? 1 : -1; | 5-6 |
| 577 | desired_index = get_dirstack_index (i, sign, &index_flag); | - |
| 578 | }executed 11 times by 1 test: end of block | 11 |
| 579 | else | - |
| 580 | { | - |
| 581 | sh_invalidopt (list->word->word); | - |
| 582 | builtin_usage (); | - |
| 583 | returnexecuted 1 time by 1 test: return (258); (258);executed 1 time by 1 test: return (258); | 1 |
| 584 | } | - |
| 585 | } | - |
| 586 | | - |
| 587 | if (flags & 0x08| TRUE | evaluated 2 times by 1 test | | FALSE | evaluated 35 times by 1 test |
) | 2-35 |
| 588 | { | - |
| 589 | clear_directory_stack (); | - |
| 590 | returnexecuted 2 times by 1 test: return (0); (0);executed 2 times by 1 test: return (0); | 2 |
| 591 | } | - |
| 592 | | - |
| 593 | if (index_flag| TRUE | evaluated 11 times by 1 test | | FALSE | evaluated 24 times by 1 test |
&& (desired_index < 0| TRUE | evaluated 2 times by 1 test | | FALSE | evaluated 9 times by 1 test |
|| desired_index > directory_list_offset| TRUE | never evaluated | | FALSE | evaluated 9 times by 1 test |
)) | 0-24 |
| 594 | { | - |
| 595 | pushd_error (directory_list_offset, w); | - |
| 596 | returnexecuted 2 times by 1 test: return (1); (1);executed 2 times by 1 test: return (1); | 2 |
| 597 | } | - |
| 598 | | - |
| 599 | | - |
| 600 | | - |
| 601 | | - |
| 602 | | - |
| 603 | if (index_flag == 0| TRUE | evaluated 24 times by 1 test | | FALSE | evaluated 9 times by 1 test |
|| (index_flag == 1| TRUE | evaluated 5 times by 1 test | | FALSE | evaluated 4 times by 1 test |
&& desired_index == 0| TRUE | evaluated 3 times by 1 test | | FALSE | evaluated 2 times by 1 test |
)) | 2-24 |
| 604 | { | - |
| 605 | temp = get_working_directory ("dirs"); | - |
| 606 | if (temp == 0| TRUE | never evaluated | | FALSE | evaluated 27 times by 1 test |
) | 0-27 |
| 607 | temp = (char *)strcpy (sh_xmalloc((1 + strlen ( never executed: temp = (char *)strcpy (sh_xmalloc((1 + strlen ( dcgettext (((void *)0), "<no current directory>" , 5) )), "./pushd.def", 480), ( dcgettext (((void *)0), "<no current directory>" , 5) )); | 0 |
| 608 | dcgettext (((void *)0), never executed: temp = (char *)strcpy (sh_xmalloc((1 + strlen ( dcgettext (((void *)0), "<no current directory>" , 5) )), "./pushd.def", 480), ( dcgettext (((void *)0), "<no current directory>" , 5) )); | 0 |
| 609 | "<no current directory>" never executed: temp = (char *)strcpy (sh_xmalloc((1 + strlen ( dcgettext (((void *)0), "<no current directory>" , 5) )), "./pushd.def", 480), ( dcgettext (((void *)0), "<no current directory>" , 5) )); | 0 |
| 610 | , 5) never executed: temp = (char *)strcpy (sh_xmalloc((1 + strlen ( dcgettext (((void *)0), "<no current directory>" , 5) )), "./pushd.def", 480), ( dcgettext (((void *)0), "<no current directory>" , 5) )); | 0 |
| 611 | )), "./pushd.def", 480), ( never executed: temp = (char *)strcpy (sh_xmalloc((1 + strlen ( dcgettext (((void *)0), "<no current directory>" , 5) )), "./pushd.def", 480), ( dcgettext (((void *)0), "<no current directory>" , 5) )); | 0 |
| 612 | dcgettext (((void *)0), never executed: temp = (char *)strcpy (sh_xmalloc((1 + strlen ( dcgettext (((void *)0), "<no current directory>" , 5) )), "./pushd.def", 480), ( dcgettext (((void *)0), "<no current directory>" , 5) )); | 0 |
| 613 | "<no current directory>" never executed: temp = (char *)strcpy (sh_xmalloc((1 + strlen ( dcgettext (((void *)0), "<no current directory>" , 5) )), "./pushd.def", 480), ( dcgettext (((void *)0), "<no current directory>" , 5) )); | 0 |
| 614 | , 5) never executed: temp = (char *)strcpy (sh_xmalloc((1 + strlen ( dcgettext (((void *)0), "<no current directory>" , 5) )), "./pushd.def", 480), ( dcgettext (((void *)0), "<no current directory>" , 5) )); | 0 |
| 615 | )); never executed: temp = (char *)strcpy (sh_xmalloc((1 + strlen ( dcgettext (((void *)0), "<no current directory>" , 5) )), "./pushd.def", 480), ( dcgettext (((void *)0), "<no current directory>" , 5) )); | 0 |
| 616 | if (vflag & 2| TRUE | evaluated 1 time by 1 test | | FALSE | evaluated 26 times by 1 test |
) | 1-26 |
| 617 | printf ("%2d %s", 0, (flags & 0x04) ? temp : polite_directory_format (temp));executed 1 time by 1 test: printf ("%2d %s", 0, (flags & 0x04) ? temp : polite_directory_format (temp)); | 1 |
| 618 | else | - |
| 619 | printf ("%s", (flags & 0x04) ? temp : polite_directory_format (temp));executed 26 times by 1 test: printf ("%s", (flags & 0x04) ? temp : polite_directory_format (temp)); | 26 |
| 620 | sh_xfree((temp), "./pushd.def", 485); | - |
| 621 | if (index_flag| TRUE | evaluated 3 times by 1 test | | FALSE | evaluated 24 times by 1 test |
) | 3-24 |
| 622 | { | - |
| 623 | putchar ('\n'); | - |
| 624 | returnexecuted 3 times by 1 test: return (sh_chkwrite (0)); (sh_chkwrite (0));executed 3 times by 1 test: return (sh_chkwrite (0)); | 3 |
| 625 | } | - |
| 626 | }executed 24 times by 1 test: end of block | 24 |
| 627 | | - |
| 628 | | - |
| 629 | | - |
| 630 | | - |
| 631 | | - |
| 632 | | - |
| 633 | if (index_flag| TRUE | evaluated 6 times by 1 test | | FALSE | evaluated 24 times by 1 test |
) | 6-24 |
| 634 | { | - |
| 635 | if (vflag & 2| TRUE | evaluated 1 time by 1 test | | FALSE | evaluated 5 times by 1 test |
) | 1-5 |
| 636 | printf ("%2d %s", directory_list_offset - desired_index,executed 1 time by 1 test: printf ("%2d %s", directory_list_offset - desired_index, (flags & 0x04) ? pushd_directory_list[desired_index] : polite_directory_format (pushd_directory_list[desired_index])); | 1 |
| 637 | (flags & 0x04) ? pushd_directory_list[desired_index] : polite_directory_format (pushd_directory_list[desired_index]));executed 1 time by 1 test: printf ("%2d %s", directory_list_offset - desired_index, (flags & 0x04) ? pushd_directory_list[desired_index] : polite_directory_format (pushd_directory_list[desired_index])); | 1 |
| 638 | else | - |
| 639 | printf ("%s", (flags & 0x04) ? pushd_directory_list[desired_index] : polite_directory_format (pushd_directory_list[desired_index]));executed 5 times by 1 test: printf ("%s", (flags & 0x04) ? pushd_directory_list[desired_index] : polite_directory_format (pushd_directory_list[desired_index])); | 5 |
| 640 | } | - |
| 641 | else | - |
| 642 | for (i = directory_list_offset - 1; i >= 0| TRUE | evaluated 43 times by 1 test | | FALSE | evaluated 24 times by 1 test |
; i--) | 24-43 |
| 643 | if (vflag >= 2| TRUE | evaluated 2 times by 1 test | | FALSE | evaluated 41 times by 1 test |
) | 2-41 |
| 644 | printf ("\n%2d %s", directory_list_offset - (int)i, (flags & 0x04) ? pushd_directory_list[i] : polite_directory_format (pushd_directory_list[i]));executed 2 times by 1 test: printf ("\n%2d %s", directory_list_offset - (int)i, (flags & 0x04) ? pushd_directory_list[i] : polite_directory_format (pushd_directory_list[i])); | 2 |
| 645 | else | - |
| 646 | printf ("%s%s", (vflag & 1) ? "\n" : " ", (flags & 0x04) ? pushd_directory_list[i] : polite_directory_format (pushd_directory_list[i]));executed 41 times by 1 test: printf ("%s%s", (vflag & 1) ? "\n" : " ", (flags & 0x04) ? pushd_directory_list[i] : polite_directory_format (pushd_directory_list[i])); | 41 |
| 647 | | - |
| 648 | putchar ('\n'); | - |
| 649 | | - |
| 650 | returnexecuted 30 times by 1 test: return (sh_chkwrite (0)); (sh_chkwrite (0));executed 30 times by 1 test: return (sh_chkwrite (0)); | 30 |
| 651 | } | - |
| 652 | | - |
| 653 | static void | - |
| 654 | pushd_error (offset, arg) | - |
| 655 | int offset; | - |
| 656 | char *arg; | - |
| 657 | { | - |
| 658 | if (offset == 0| TRUE | evaluated 1 time by 1 test | | FALSE | evaluated 6 times by 1 test |
) | 1-6 |
| 659 | builtin_error (executed 1 time by 1 test: builtin_error ( dcgettext (((void *)0), "directory stack empty" , 5) ); | 1 |
| 660 | dcgettext (((void *)0), executed 1 time by 1 test: builtin_error ( dcgettext (((void *)0), "directory stack empty" , 5) ); | 1 |
| 661 | "directory stack empty"executed 1 time by 1 test: builtin_error ( dcgettext (((void *)0), "directory stack empty" , 5) ); | 1 |
| 662 | , 5)executed 1 time by 1 test: builtin_error ( dcgettext (((void *)0), "directory stack empty" , 5) ); | 1 |
| 663 | );executed 1 time by 1 test: builtin_error ( dcgettext (((void *)0), "directory stack empty" , 5) ); | 1 |
| 664 | else | - |
| 665 | sh_erange (arg, executed 6 times by 1 test: sh_erange (arg, dcgettext (((void *)0), "directory stack index" , 5) ); | 6 |
| 666 | dcgettext (((void *)0), executed 6 times by 1 test: sh_erange (arg, dcgettext (((void *)0), "directory stack index" , 5) ); | 6 |
| 667 | "directory stack index"executed 6 times by 1 test: sh_erange (arg, dcgettext (((void *)0), "directory stack index" , 5) ); | 6 |
| 668 | , 5)executed 6 times by 1 test: sh_erange (arg, dcgettext (((void *)0), "directory stack index" , 5) ); | 6 |
| 669 | );executed 6 times by 1 test: sh_erange (arg, dcgettext (((void *)0), "directory stack index" , 5) ); | 6 |
| 670 | } | - |
| 671 | | - |
| 672 | static void | - |
| 673 | clear_directory_stack () | - |
| 674 | { | - |
| 675 | register int i; | - |
| 676 | | - |
| 677 | for (i = 0; i < directory_list_offset| TRUE | evaluated 2 times by 1 test | | FALSE | evaluated 2 times by 1 test |
; i++) | 2 |
| 678 | sh_xfree((pushd_directory_list[i]), "./pushd.def", 535);executed 2 times by 1 test: sh_xfree((pushd_directory_list[i]), "./pushd.def", 535); | 2 |
| 679 | directory_list_offset = 0; | - |
| 680 | }executed 2 times by 1 test: end of block | 2 |
| 681 | | - |
| 682 | | - |
| 683 | | - |
| 684 | | - |
| 685 | static int | - |
| 686 | cd_to_string (name) | - |
| 687 | char *name; | - |
| 688 | { | - |
| 689 | WORD_LIST *tlist; | - |
| 690 | WORD_LIST *dir; | - |
| 691 | int result; | - |
| 692 | | - |
| 693 | dir = make_word_list (make_word (name), | - |
| 694 | ((void *)0) | - |
| 695 | ); | - |
| 696 | tlist = make_word_list (make_word ("--"), dir); | - |
| 697 | result = cd_builtin (tlist); | - |
| 698 | dispose_words (tlist); | - |
| 699 | returnexecuted 4 times by 1 test: return (result); (result);executed 4 times by 1 test: return (result); | 4 |
| 700 | } | - |
| 701 | | - |
| 702 | static int | - |
| 703 | change_to_temp (temp) | - |
| 704 | char *temp; | - |
| 705 | { | - |
| 706 | int tt; | - |
| 707 | | - |
| 708 | tt = temp| TRUE | evaluated 3 times by 1 test | | FALSE | never evaluated |
? cd_to_string (temp) : 1; | 0-3 |
| 709 | | - |
| 710 | if (tt == 0| TRUE | evaluated 3 times by 1 test | | FALSE | never evaluated |
) | 0-3 |
| 711 | dirs_builtin ((WORD_LIST *)executed 3 times by 1 test: dirs_builtin ((WORD_LIST *) ((void *)0) ); | 3 |
| 712 | ((void *)0)executed 3 times by 1 test: dirs_builtin ((WORD_LIST *) ((void *)0) ); | 3 |
| 713 | );executed 3 times by 1 test: dirs_builtin ((WORD_LIST *) ((void *)0) ); | 3 |
| 714 | | - |
| 715 | returnexecuted 3 times by 1 test: return (tt); (tt);executed 3 times by 1 test: return (tt); | 3 |
| 716 | } | - |
| 717 | | - |
| 718 | static void | - |
| 719 | add_dirstack_element (dir) | - |
| 720 | char *dir; | - |
| 721 | { | - |
| 722 | if (directory_list_offset == directory_list_size| TRUE | evaluated 2 times by 1 test | | FALSE | evaluated 5 times by 1 test |
) | 2-5 |
| 723 | pushd_directory_list = strvec_resize (pushd_directory_list, directory_list_size += 10);executed 2 times by 1 test: pushd_directory_list = strvec_resize (pushd_directory_list, directory_list_size += 10); | 2 |
| 724 | pushd_directory_list[directory_list_offset++] = dir; | - |
| 725 | }executed 7 times by 1 test: end of block | 7 |
| 726 | | - |
| 727 | static int | - |
| 728 | get_dirstack_index (ind, sign, indexp) | - |
| 729 | intmax_t ind; | - |
| 730 | int sign, *indexp; | - |
| 731 | { | - |
| 732 | if (indexp| TRUE | evaluated 18 times by 1 test | | FALSE | evaluated 1 time by 1 test |
) | 1-18 |
| 733 | *executed 18 times by 1 test: *indexp = sign > 0 ? 1 : 2; indexp = sign > 0| TRUE | evaluated 10 times by 1 test | | FALSE | evaluated 8 times by 1 test |
? 1 : 2;executed 18 times by 1 test: *indexp = sign > 0 ? 1 : 2; | 8-18 |
| 734 | | - |
| 735 | | - |
| 736 | | - |
| 737 | if (ind == 0| TRUE | evaluated 5 times by 1 test | | FALSE | evaluated 14 times by 1 test |
&& sign > 0| TRUE | evaluated 3 times by 1 test | | FALSE | evaluated 2 times by 1 test |
) | 2-14 |
| 738 | returnexecuted 3 times by 1 test: return 0; 0;executed 3 times by 1 test: return 0; | 3 |
| 739 | else if (ind == directory_list_offset| TRUE | evaluated 4 times by 1 test | | FALSE | evaluated 12 times by 1 test |
) | 4-12 |
| 740 | { | - |
| 741 | if (indexp| TRUE | evaluated 4 times by 1 test | | FALSE | never evaluated |
) | 0-4 |
| 742 | *executed 4 times by 1 test: *indexp = sign > 0 ? 2 : 1; indexp = sign > 0| TRUE | evaluated 2 times by 1 test | | FALSE | evaluated 2 times by 1 test |
? 2 : 1;executed 4 times by 1 test: *indexp = sign > 0 ? 2 : 1; | 2-4 |
| 743 | returnexecuted 4 times by 1 test: return 0; 0;executed 4 times by 1 test: return 0; | 4 |
| 744 | } | - |
| 745 | else if (ind >= 0| TRUE | evaluated 12 times by 1 test | | FALSE | never evaluated |
&& ind <= directory_list_offset| TRUE | evaluated 9 times by 1 test | | FALSE | evaluated 3 times by 1 test |
) | 0-12 |
| 746 | returnexecuted 9 times by 1 test: return (sign > 0 ? directory_list_offset - ind : ind); (sign > 0 ? directory_list_offset - ind : ind);executed 9 times by 1 test: return (sign > 0 ? directory_list_offset - ind : ind); | 9 |
| 747 | else | - |
| 748 | returnexecuted 3 times by 1 test: return -1; -1;executed 3 times by 1 test: return -1; | 3 |
| 749 | } | - |
| 750 | | - |
| 751 | | - |
| 752 | char * | - |
| 753 | get_dirstack_from_string (string) | - |
| 754 | char *string; | - |
| 755 | { | - |
| 756 | int ind, sign, index_flag; | - |
| 757 | intmax_t i; | - |
| 758 | | - |
| 759 | sign = 1; | - |
| 760 | if (*| TRUE | evaluated 3 times by 1 test | | FALSE | evaluated 4 times by 1 test |
string == '-'| TRUE | evaluated 3 times by 1 test | | FALSE | evaluated 4 times by 1 test |
|| *| TRUE | never evaluated | | FALSE | evaluated 4 times by 1 test |
string == '+'| TRUE | never evaluated | | FALSE | evaluated 4 times by 1 test |
) | 0-4 |
| 761 | { | - |
| 762 | sign = (*| TRUE | evaluated 3 times by 1 test | | FALSE | never evaluated |
string == '-')| TRUE | evaluated 3 times by 1 test | | FALSE | never evaluated |
? -1 : 1; | 0-3 |
| 763 | string++; | - |
| 764 | }executed 3 times by 1 test: end of block | 3 |
| 765 | if (legal_number (string, &i) == 0| TRUE | never evaluated | | FALSE | evaluated 7 times by 1 test |
) | 0-7 |
| 766 | return never executed: return ((char *) ((void *)0) ); ((char *)never executed: return ((char *) ((void *)0) ); | 0 |
| 767 | ((void *)0) never executed: return ((char *) ((void *)0) ); | 0 |
| 768 | ); never executed: return ((char *) ((void *)0) ); | 0 |
| 769 | | - |
| 770 | index_flag = 0; | - |
| 771 | ind = get_dirstack_index (i, sign, &index_flag); | - |
| 772 | if (index_flag| TRUE | evaluated 7 times by 1 test | | FALSE | never evaluated |
&& (ind < 0| TRUE | evaluated 1 time by 1 test | | FALSE | evaluated 6 times by 1 test |
|| ind > directory_list_offset| TRUE | never evaluated | | FALSE | evaluated 6 times by 1 test |
)) | 0-7 |
| 773 | returnexecuted 1 time by 1 test: return ((char *) ((void *)0) ); ((char *)executed 1 time by 1 test: return ((char *) ((void *)0) ); | 1 |
| 774 | ((void *)0)executed 1 time by 1 test: return ((char *) ((void *)0) ); | 1 |
| 775 | );executed 1 time by 1 test: return ((char *) ((void *)0) ); | 1 |
| 776 | if (index_flag == 0| TRUE | never evaluated | | FALSE | evaluated 6 times by 1 test |
|| (index_flag == 1| TRUE | evaluated 3 times by 1 test | | FALSE | evaluated 3 times by 1 test |
&& ind == 0| TRUE | evaluated 2 times by 1 test | | FALSE | evaluated 1 time by 1 test |
)) | 0-6 |
| 777 | returnexecuted 2 times by 1 test: return (get_string_value ("PWD")); (get_string_value ("PWD"));executed 2 times by 1 test: return (get_string_value ("PWD")); | 2 |
| 778 | else | - |
| 779 | returnexecuted 4 times by 1 test: return (pushd_directory_list[ind]); (pushd_directory_list[ind]);executed 4 times by 1 test: return (pushd_directory_list[ind]); | 4 |
| 780 | } | - |
| 781 | void | - |
| 782 | set_dirstack_element (ind, sign, value) | - |
| 783 | intmax_t ind; | - |
| 784 | int sign; | - |
| 785 | char *value; | - |
| 786 | { | - |
| 787 | int i; | - |
| 788 | | - |
| 789 | i = get_dirstack_index (ind, sign, (int *) | - |
| 790 | ((void *)0) | - |
| 791 | ); | - |
| 792 | if (ind == 0| TRUE | never evaluated | | FALSE | evaluated 1 time by 1 test |
|| i < 0| TRUE | never evaluated | | FALSE | evaluated 1 time by 1 test |
|| i > directory_list_offset| TRUE | never evaluated | | FALSE | evaluated 1 time by 1 test |
) | 0-1 |
| 793 | return; never executed: return; | 0 |
| 794 | sh_xfree((pushd_directory_list[i]), "./pushd.def", 656); | - |
| 795 | pushd_directory_list[i] = (char *)strcpy (sh_xmalloc((1 + strlen (value)), "./pushd.def", 657), (value)); | - |
| 796 | }executed 1 time by 1 test: end of block | 1 |
| 797 | | - |
| 798 | WORD_LIST * | - |
| 799 | get_directory_stack (flags) | - |
| 800 | int flags; | - |
| 801 | { | - |
| 802 | register int i; | - |
| 803 | WORD_LIST *ret; | - |
| 804 | char *d, *t; | - |
| 805 | | - |
| 806 | for (ret = (WORD_LIST *) | - |
| 807 | ((void *)0) | - |
| 808 | , i = 0; i < directory_list_offset| TRUE | evaluated 60 times by 1 test | | FALSE | evaluated 27 times by 1 test |
; i++) | 27-60 |
| 809 | { | - |
| 810 | d = (| TRUE | never evaluated | | FALSE | evaluated 60 times by 1 test |
flags&1)| TRUE | never evaluated | | FALSE | evaluated 60 times by 1 test |
? polite_directory_format (pushd_directory_list[i]) | 0-60 |
| 811 | : pushd_directory_list[i]; | - |
| 812 | ret = make_word_list (make_word (d), ret); | - |
| 813 | }executed 60 times by 1 test: end of block | 60 |
| 814 | | - |
| 815 | d = get_working_directory ("dirstack"); | - |
| 816 | i = 0; | - |
| 817 | if (d == 0| TRUE | never evaluated | | FALSE | evaluated 27 times by 1 test |
) | 0-27 |
| 818 | d = "."; never executed: d = "."; | 0 |
| 819 | else | - |
| 820 | { | - |
| 821 | t = (| TRUE | never evaluated | | FALSE | evaluated 27 times by 1 test |
flags&1)| TRUE | never evaluated | | FALSE | evaluated 27 times by 1 test |
? polite_directory_format (d) : d; | 0-27 |
| 822 | | - |
| 823 | | - |
| 824 | | - |
| 825 | if (t != d| TRUE | never evaluated | | FALSE | evaluated 27 times by 1 test |
) | 0-27 |
| 826 | { | - |
| 827 | sh_xfree((d), "./pushd.def", 687); | - |
| 828 | d = t; | - |
| 829 | } never executed: end of block | 0 |
| 830 | else | - |
| 831 | i = 1;executed 27 times by 1 test: i = 1; | 27 |
| 832 | } | - |
| 833 | ret = make_word_list (make_word (d), ret); | - |
| 834 | if (i| TRUE | evaluated 27 times by 1 test | | FALSE | never evaluated |
) | 0-27 |
| 835 | sh_xfree((d), "./pushd.def", 695);executed 27 times by 1 test: sh_xfree((d), "./pushd.def", 695); | 27 |
| 836 | returnexecuted 27 times by 1 test: return ret; ret;executed 27 times by 1 test: return ret; | 27 |
| 837 | } | - |
| | |