Line | Source | Count |
1 | | - |
2 | | - |
3 | | - |
4 | | - |
5 | | - |
6 | | - |
7 | | - |
8 | | - |
9 | | - |
10 | | - |
11 | | - |
12 | | - |
13 | | - |
14 | | - |
15 | | - |
16 | | - |
17 | | - |
18 | | - |
19 | | - |
20 | extern int unlink (const char *); | - |
21 | | - |
22 | extern FILE *sh_mktmpfp (char *, int, char **); | - |
23 | typedef struct repl { | - |
24 | struct repl *next; | - |
25 | char *pat; | - |
26 | char *rep; | - |
27 | } REPL; | - |
28 | static char *fc_dosubs (char *, REPL *); | - |
29 | static char *fc_gethist (char *, HIST_ENTRY **); | - |
30 | static int fc_gethnum (char *, HIST_ENTRY **); | - |
31 | static int fc_number (WORD_LIST *); | - |
32 | static void fc_replhist (char *); | - |
33 | | - |
34 | | - |
35 | | - |
36 | | - |
37 | | - |
38 | static void | - |
39 | set_verbose_flag () | - |
40 | { | - |
41 | echo_input_at_read = verbose_flag; | - |
42 | }executed 2 times by 1 test: end of block | 2 |
43 | int | - |
44 | fc_builtin (list) | - |
45 | WORD_LIST *list; | - |
46 | { | - |
47 | register int i; | - |
48 | register char *sep; | - |
49 | int numbering, reverse, listing, execute; | - |
50 | int histbeg, histend, last_hist, retval, opt, rh, real_last; | - |
51 | FILE *stream; | - |
52 | REPL *rlist, *rl; | - |
53 | char *ename, *command, *newcom, *fcedit; | - |
54 | HIST_ENTRY **hlist; | - |
55 | char *fn; | - |
56 | | - |
57 | numbering = 1; | - |
58 | reverse = listing = execute = 0; | - |
59 | ename = (char *) | - |
60 | ((void *)0) | - |
61 | ; | - |
62 | | - |
63 | | - |
64 | reset_internal_getopt (); | - |
65 | lcurrent = list; | - |
66 | while (fc_number (loptend = lcurrent) == 0TRUE | evaluated 35 times by 1 test | FALSE | evaluated 5 times by 1 test |
&& | 5-35 |
67 | (TRUE | evaluated 24 times by 1 test | FALSE | evaluated 11 times by 1 test |
opt = internal_getopt (list, ":e:lnrs")) != -1TRUE | evaluated 24 times by 1 test | FALSE | evaluated 11 times by 1 test |
) | 11-24 |
68 | { | - |
69 | switch (opt) | - |
70 | { | - |
71 | caseexecuted 5 times by 1 test: case 'n': 'n':executed 5 times by 1 test: case 'n': | 5 |
72 | numbering = 0; | - |
73 | break;executed 5 times by 1 test: break; | 5 |
74 | | - |
75 | caseexecuted 10 times by 1 test: case 'l': 'l':executed 10 times by 1 test: case 'l': | 10 |
76 | listing = 1; | - |
77 | break;executed 10 times by 1 test: break; | 10 |
78 | | - |
79 | caseexecuted 2 times by 1 test: case 'r': 'r':executed 2 times by 1 test: case 'r': | 2 |
80 | reverse = 1; | - |
81 | break;executed 2 times by 1 test: break; | 2 |
82 | | - |
83 | caseexecuted 4 times by 1 test: case 's': 's':executed 4 times by 1 test: case 's': | 4 |
84 | execute = 1; | - |
85 | break;executed 4 times by 1 test: break; | 4 |
86 | | - |
87 | caseexecuted 2 times by 1 test: case 'e': 'e':executed 2 times by 1 test: case 'e': | 2 |
88 | ename = list_optarg; | - |
89 | break;executed 2 times by 1 test: break; | 2 |
90 | | - |
91 | case never executed: case -99: -99:never executed: case -99: builtin_help (); returnnever executed: return (258); (258);never executed: return (258); | 0 |
92 | defaultexecuted 1 time by 1 test: default: :executed 1 time by 1 test: default: | 1 |
93 | builtin_usage (); | - |
94 | returnexecuted 1 time by 1 test: return (258); (258);executed 1 time by 1 test: return (258); | 1 |
95 | } | - |
96 | } | - |
97 | | - |
98 | list = loptend; | - |
99 | | - |
100 | if (enameTRUE | evaluated 2 times by 1 test | FALSE | evaluated 14 times by 1 test |
&& (*TRUE | never evaluated | FALSE | evaluated 2 times by 1 test |
ename == '-')TRUE | never evaluated | FALSE | evaluated 2 times by 1 test |
&& (TRUE | never evaluated | FALSE | never evaluated |
ename[1] == '\0')TRUE | never evaluated | FALSE | never evaluated |
) | 0-14 |
101 | execute = 1; never executed: execute = 1; | 0 |
102 | | - |
103 | | - |
104 | | - |
105 | if (executeTRUE | evaluated 4 times by 1 test | FALSE | evaluated 12 times by 1 test |
) | 4-12 |
106 | { | - |
107 | rlist = (REPL *) | - |
108 | ((void *)0) | - |
109 | ; | - |
110 | while (listTRUE | evaluated 5 times by 1 test | FALSE | evaluated 2 times by 1 test |
&& ((TRUE | evaluated 3 times by 1 test | FALSE | evaluated 2 times by 1 test |
sep = (char *)TRUE | evaluated 3 times by 1 test | FALSE | evaluated 2 times by 1 test |
| 2-5 |
111 | (__extension__ (__builtin_constant_p (TRUE | evaluated 3 times by 1 test | FALSE | evaluated 2 times by 1 test |
| 2-3 |
112 | '='TRUE | evaluated 3 times by 1 test | FALSE | evaluated 2 times by 1 test |
| 2-3 |
113 | ) && !__builtin_constant_p (TRUE | evaluated 3 times by 1 test | FALSE | evaluated 2 times by 1 test |
| 2-3 |
114 | list->word->wordTRUE | evaluated 3 times by 1 test | FALSE | evaluated 2 times by 1 test |
| 2-3 |
115 | ) && (TRUE | evaluated 3 times by 1 test | FALSE | evaluated 2 times by 1 test |
| 2-3 |
116 | '='TRUE | evaluated 3 times by 1 test | FALSE | evaluated 2 times by 1 test |
| 2-3 |
117 | ) == '\0' ? (char *) __rawmemchr (TRUE | evaluated 3 times by 1 test | FALSE | evaluated 2 times by 1 test |
| 2-3 |
118 | list->word->wordTRUE | evaluated 3 times by 1 test | FALSE | evaluated 2 times by 1 test |
| 2-3 |
119 | , TRUE | evaluated 3 times by 1 test | FALSE | evaluated 2 times by 1 test |
| 2-3 |
120 | '='TRUE | evaluated 3 times by 1 test | FALSE | evaluated 2 times by 1 test |
| 2-3 |
121 | ) : __builtin_strchr (TRUE | evaluated 3 times by 1 test | FALSE | evaluated 2 times by 1 test |
| 2-3 |
122 | list->word->wordTRUE | evaluated 3 times by 1 test | FALSE | evaluated 2 times by 1 test |
| 2-3 |
123 | , TRUE | evaluated 3 times by 1 test | FALSE | evaluated 2 times by 1 test |
| 2-3 |
124 | '='TRUE | evaluated 3 times by 1 test | FALSE | evaluated 2 times by 1 test |
| 2-3 |
125 | )))TRUE | evaluated 3 times by 1 test | FALSE | evaluated 2 times by 1 test |
| 2-3 |
126 | ) != TRUE | evaluated 3 times by 1 test | FALSE | evaluated 2 times by 1 test |
| 2-3 |
127 | ((void *)0)TRUE | evaluated 3 times by 1 test | FALSE | evaluated 2 times by 1 test |
| 2-3 |
128 | )TRUE | evaluated 3 times by 1 test | FALSE | evaluated 2 times by 1 test |
) | 2-3 |
129 | { | - |
130 | *sep++ = '\0'; | - |
131 | rl = (REPL *)sh_xmalloc((sizeof (REPL)), "./fc.def", 237); | - |
132 | rl->next = (REPL *) | - |
133 | ((void *)0) | - |
134 | ; | - |
135 | rl->pat = (char *)strcpy (sh_xmalloc((1 + strlen (list->word->word)), "./fc.def", 239), (list->word->word)); | - |
136 | rl->rep = (char *)strcpy (sh_xmalloc((1 + strlen (sep)), "./fc.def", 240), (sep)); | - |
137 | | - |
138 | if (rlist == TRUE | evaluated 2 times by 1 test | FALSE | evaluated 1 time by 1 test |
| 1-2 |
139 | ((void *)0)TRUE | evaluated 2 times by 1 test | FALSE | evaluated 1 time by 1 test |
| 1-2 |
140 | ) | - |
141 | rlist = rl;executed 2 times by 1 test: rlist = rl; | 2 |
142 | else | - |
143 | { | - |
144 | rl->next = rlist; | - |
145 | rlist = rl; | - |
146 | }executed 1 time by 1 test: end of block | 1 |
147 | list = list->next; | - |
148 | }executed 3 times by 1 test: end of block | 3 |
149 | | - |
150 | | - |
151 | | - |
152 | | - |
153 | rlist = ((rlistTRUE | evaluated 2 times by 1 test | FALSE | evaluated 2 times by 1 test |
&& rlist->nextTRUE | evaluated 1 time by 1 test | FALSE | evaluated 1 time by 1 test |
) ? (REPL *)list_reverse ((GENERIC_LIST *)rlist) : (REPL *)(rlist)); | 1-2 |
154 | | - |
155 | hlist = history_list (); | - |
156 | | - |
157 | | - |
158 | | - |
159 | command = fc_gethist (list ? list->word->word : (char *) | - |
160 | ((void *)0) | - |
161 | , hlist); | - |
162 | | - |
163 | if (command == TRUE | evaluated 1 time by 1 test | FALSE | evaluated 3 times by 1 test |
| 1-3 |
164 | ((void *)0)TRUE | evaluated 1 time by 1 test | FALSE | evaluated 3 times by 1 test |
| 1-3 |
165 | ) | - |
166 | { | - |
167 | builtin_error ( | - |
168 | dcgettext (((void *)0), | - |
169 | "no command found" | - |
170 | , 5) | - |
171 | ); | - |
172 | if (rlistTRUE | never evaluated | FALSE | evaluated 1 time by 1 test |
) | 0-1 |
173 | do { for (rl = rlist; rlTRUE | never evaluated | FALSE | never evaluated |
; ) { REPL *r; r = rl->next; if (rl->patTRUE | never evaluated | FALSE | never evaluated |
) sh_xfree((rl->pat), "./fc.def", 267);never executed: sh_xfree((rl->pat), "./fc.def", 267); if (rl->repTRUE | never evaluated | FALSE | never evaluated |
) sh_xfree((rl->rep), "./fc.def", 267);never executed: sh_xfree((rl->rep), "./fc.def", 267); sh_xfree((rl), "./fc.def", 267); rl = r; }never executed: end of block }never executed: end of block while (0); | 0 |
174 | | - |
175 | returnexecuted 1 time by 1 test: return (1); (1);executed 1 time by 1 test: return (1); | 1 |
176 | } | - |
177 | | - |
178 | if (rlistTRUE | evaluated 2 times by 1 test | FALSE | evaluated 1 time by 1 test |
) | 1-2 |
179 | { | - |
180 | newcom = fc_dosubs (command, rlist); | - |
181 | sh_xfree((command), "./fc.def", 275); | - |
182 | do { for (rl = rlist; rlTRUE | evaluated 3 times by 1 test | FALSE | evaluated 2 times by 1 test |
; ) { REPL *r; r = rl->next; if (rl->patTRUE | evaluated 3 times by 1 test | FALSE | never evaluated |
) sh_xfree((rl->pat), "./fc.def", 276);executed 3 times by 1 test: sh_xfree((rl->pat), "./fc.def", 276); if (rl->repTRUE | evaluated 3 times by 1 test | FALSE | never evaluated |
) sh_xfree((rl->rep), "./fc.def", 276);executed 3 times by 1 test: sh_xfree((rl->rep), "./fc.def", 276); sh_xfree((rl), "./fc.def", 276); rl = r; }executed 3 times by 1 test: end of block } while (0); | 0-3 |
183 | command = newcom; | - |
184 | }executed 2 times by 1 test: end of block | 2 |
185 | | - |
186 | fprintf ( | - |
187 | stderr | - |
188 | , "%s\n", command); | - |
189 | fc_replhist (command); | - |
190 | | - |
191 | | - |
192 | returnexecuted 3 times by 1 test: return (parse_and_execute (command, "fc", 0x004)); (parse_and_execute (command, "fc", 0x004));executed 3 times by 1 test: return (parse_and_execute (command, "fc", 0x004)); | 3 |
193 | } | - |
194 | | - |
195 | | - |
196 | | - |
197 | hlist = history_list (); | - |
198 | if (hlist == 0TRUE | never evaluated | FALSE | evaluated 12 times by 1 test |
) | 0-12 |
199 | return never executed: return (0); (0);never executed: return (0); | 0 |
200 | for (i = 0; hlist[i]TRUE | evaluated 149 times by 1 test | FALSE | evaluated 12 times by 1 test |
; i++);executed 149 times by 1 test: ; | 12-149 |
201 | rh = remember_on_historyTRUE | evaluated 11 times by 1 test | FALSE | evaluated 1 time by 1 test |
|| ((TRUE | evaluated 1 time by 1 test | FALSE | never evaluated |
subshell_environment & 0x04)TRUE | evaluated 1 time by 1 test | FALSE | never evaluated |
&& enable_history_listTRUE | evaluated 1 time by 1 test | FALSE | never evaluated |
); | 0-11 |
202 | last_hist = i - rh - hist_last_line_added; | - |
203 | | - |
204 | | - |
205 | | - |
206 | | - |
207 | real_last = i; | - |
208 | | - |
209 | while (hlist[real_last] == 0TRUE | evaluated 12 times by 1 test | FALSE | evaluated 12 times by 1 test |
&& real_last > 0TRUE | evaluated 12 times by 1 test | FALSE | never evaluated |
) | 0-12 |
210 | real_last--;executed 12 times by 1 test: real_last--; | 12 |
211 | | - |
212 | | - |
213 | if (i == last_histTRUE | never evaluated | FALSE | evaluated 12 times by 1 test |
&& hlist[last_hist] == 0TRUE | never evaluated | FALSE | never evaluated |
) | 0-12 |
214 | while (last_hist >= 0TRUE | never evaluated | FALSE | never evaluated |
&& hlist[last_hist] == 0TRUE | never evaluated | FALSE | never evaluated |
) | 0 |
215 | last_hist--; never executed: last_hist--; | 0 |
216 | if (last_hist < 0TRUE | never evaluated | FALSE | evaluated 12 times by 1 test |
) | 0-12 |
217 | { | - |
218 | sh_erange ((char *) | - |
219 | ((void *)0) | - |
220 | , | - |
221 | dcgettext (((void *)0), | - |
222 | "history specification" | - |
223 | , 5) | - |
224 | ); | - |
225 | return never executed: return (1); (1);never executed: return (1); | 0 |
226 | } | - |
227 | | - |
228 | if (listTRUE | evaluated 6 times by 1 test | FALSE | evaluated 6 times by 1 test |
) | 6 |
229 | { | - |
230 | histbeg = fc_gethnum (list->word->word, hlist); | - |
231 | list = list->next; | - |
232 | | - |
233 | if (listTRUE | evaluated 2 times by 1 test | FALSE | evaluated 4 times by 1 test |
) | 2-4 |
234 | histend = fc_gethnum (list->word->word, hlist);executed 2 times by 1 test: histend = fc_gethnum (list->word->word, hlist); | 2 |
235 | else if (histbeg == real_lastTRUE | evaluated 1 time by 1 test | FALSE | evaluated 3 times by 1 test |
) | 1-3 |
236 | histend = listingTRUE | never evaluated | FALSE | evaluated 1 time by 1 test |
? real_last : histbeg;executed 1 time by 1 test: histend = listing ? real_last : histbeg; | 0-1 |
237 | else | - |
238 | histend = listingTRUE | evaluated 3 times by 1 test | FALSE | never evaluated |
? last_hist : histbeg;executed 3 times by 1 test: histend = listing ? last_hist : histbeg; | 0-3 |
239 | } | - |
240 | else | - |
241 | { | - |
242 | | - |
243 | if (listingTRUE | evaluated 5 times by 1 test | FALSE | evaluated 1 time by 1 test |
) | 1-5 |
244 | { | - |
245 | histend = last_hist; | - |
246 | histbeg = histend - 16 + 1; | - |
247 | if (histbeg < 0TRUE | evaluated 5 times by 1 test | FALSE | never evaluated |
) | 0-5 |
248 | histbeg = 0;executed 5 times by 1 test: histbeg = 0; | 5 |
249 | }executed 5 times by 1 test: end of block | 5 |
250 | else | - |
251 | | - |
252 | histbeg = histend = last_hist;executed 1 time by 1 test: histbeg = histend = last_hist; | 1 |
253 | } | - |
254 | | - |
255 | | - |
256 | | - |
257 | if (listing == 0TRUE | evaluated 2 times by 1 test | FALSE | evaluated 10 times by 1 test |
&& hist_last_line_addedTRUE | never evaluated | FALSE | evaluated 2 times by 1 test |
) | 0-10 |
258 | { | - |
259 | bash_delete_last_history (); | - |
260 | | - |
261 | | - |
262 | | - |
263 | | - |
264 | | - |
265 | | - |
266 | if (histbeg == histendTRUE | never evaluated | FALSE | never evaluated |
&& histend == last_histTRUE | never evaluated | FALSE | never evaluated |
&& hlist[last_hist] == 0TRUE | never evaluated | FALSE | never evaluated |
) | 0 |
267 | last_hist = histbeg = --histend; never executed: last_hist = histbeg = --histend; | 0 |
268 | } never executed: end of block | 0 |
269 | | - |
270 | | - |
271 | if ((TRUE | evaluated 1 time by 1 test | FALSE | evaluated 11 times by 1 test |
histbeg < 0)TRUE | evaluated 1 time by 1 test | FALSE | evaluated 11 times by 1 test |
|| (TRUE | never evaluated | FALSE | evaluated 11 times by 1 test |
histend < 0)TRUE | never evaluated | FALSE | evaluated 11 times by 1 test |
) | 0-11 |
272 | { | - |
273 | sh_erange ((char *) | - |
274 | ((void *)0) | - |
275 | , | - |
276 | dcgettext (((void *)0), | - |
277 | "history specification" | - |
278 | , 5) | - |
279 | ); | - |
280 | returnexecuted 1 time by 1 test: return (1); (1);executed 1 time by 1 test: return (1); | 1 |
281 | } | - |
282 | | - |
283 | if (histend < histbegTRUE | never evaluated | FALSE | evaluated 11 times by 1 test |
) | 0-11 |
284 | { | - |
285 | i = histend; | - |
286 | histend = histbeg; | - |
287 | histbeg = i; | - |
288 | | - |
289 | reverse = 1; | - |
290 | } never executed: end of block | 0 |
291 | | - |
292 | if (listingTRUE | evaluated 9 times by 1 test | FALSE | evaluated 2 times by 1 test |
) | 2-9 |
293 | stream = executed 9 times by 1 test: stream = stdout ; | 9 |
294 | stdoutexecuted 9 times by 1 test: stream = stdout ; | 9 |
295 | ;executed 9 times by 1 test: stream = stdout ; | 9 |
296 | else | - |
297 | { | - |
298 | numbering = 0; | - |
299 | stream = sh_mktmpfp ("bash-fc", 0x0004|0x0001, &fn); | - |
300 | if (stream == 0TRUE | never evaluated | FALSE | evaluated 2 times by 1 test |
) | 0-2 |
301 | { | - |
302 | builtin_error ( | - |
303 | dcgettext (((void *)0), | - |
304 | "%s: cannot open temp file: %s" | - |
305 | , 5) | - |
306 | , fn ? fn : "", strerror ( | - |
307 | (*__errno_location ()) | - |
308 | )); | - |
309 | do { if (fnTRUE | never evaluated | FALSE | never evaluated |
) sh_xfree((fn), "./fc.def", 394);never executed: sh_xfree((fn), "./fc.def", 394); } while (0); | 0 |
310 | return never executed: return (1); (1);never executed: return (1); | 0 |
311 | } | - |
312 | }executed 2 times by 1 test: end of block | 2 |
313 | | - |
314 | for (i = reverse ? histend : histbeg; reverseTRUE | never evaluated | FALSE | never evaluated |
? i >= histbeg : i <= histendTRUE | evaluated 44 times by 1 test | FALSE | evaluated 11 times by 1 test |
; reverse ? i-- : i++) | 0-44 |
315 | { | - |
316 | do { if (terminating_signalTRUE | never evaluated | FALSE | evaluated 44 times by 1 test |
) termsig_handler (terminating_signal);never executed: termsig_handler (terminating_signal); if (interrupt_stateTRUE | never evaluated | FALSE | evaluated 44 times by 1 test |
) throw_to_top_level ();never executed: throw_to_top_level (); } while (0); | 0-44 |
317 | if (numberingTRUE | evaluated 27 times by 1 test | FALSE | evaluated 17 times by 1 test |
) | 17-27 |
318 | fprintf (stream, "%d", i + history_base);executed 27 times by 1 test: fprintf (stream, "%d", i + history_base); | 27 |
319 | if (listingTRUE | evaluated 42 times by 1 test | FALSE | evaluated 2 times by 1 test |
) | 2-42 |
320 | { | - |
321 | if (posixly_correctTRUE | never evaluated | FALSE | evaluated 42 times by 1 test |
) | 0-42 |
322 | fputs ("\t", stream); never executed: fputs ("\t", stream); | 0 |
323 | else | - |
324 | fprintf (stream, "\t%c", (hlist[(i)]->data) ? '*' : ' ');executed 42 times by 1 test: fprintf (stream, "\t%c", (hlist[(i)]->data) ? '*' : ' '); | 42 |
325 | } | - |
326 | fprintf (stream, "%s\n", (hlist[(i)]->line)); | - |
327 | }executed 44 times by 1 test: end of block | 44 |
328 | | - |
329 | if (listingTRUE | evaluated 9 times by 1 test | FALSE | evaluated 2 times by 1 test |
) | 2-9 |
330 | returnexecuted 9 times by 1 test: return (sh_chkwrite (0)); (sh_chkwrite (0));executed 9 times by 1 test: return (sh_chkwrite (0)); | 9 |
331 | | - |
332 | fflush (stream); | - |
333 | if (ferror (stream)TRUE | never evaluated | FALSE | evaluated 2 times by 1 test |
) | 0-2 |
334 | { | - |
335 | sh_wrerror (); | - |
336 | fclose (stream); | - |
337 | return never executed: return (1); (1);never executed: return (1); | 0 |
338 | } | - |
339 | fclose (stream); | - |
340 | | - |
341 | | - |
342 | if (enameTRUE | evaluated 2 times by 1 test | FALSE | never evaluated |
) | 0-2 |
343 | { | - |
344 | command = (char *)sh_xmalloc((strlen (ename) + strlen (fn) + 2), "./fc.def", 429); | - |
345 | sprintf (command, "%s %s", ename, fn); | - |
346 | }executed 2 times by 1 test: end of block | 2 |
347 | else | - |
348 | { | - |
349 | fcedit = posixly_correctTRUE | never evaluated | FALSE | never evaluated |
? "${FCEDIT:-${EDITOR:-ed}}" : "${FCEDIT:-${EDITOR:-vi}}"; | 0 |
350 | command = (char *)sh_xmalloc((3 + strlen (fcedit) + strlen (fn)), "./fc.def", 435); | - |
351 | sprintf (command, "%s %s", fcedit, fn); | - |
352 | } never executed: end of block | 0 |
353 | retval = parse_and_execute (command, "fc", 0x004); | - |
354 | if (retval != 0TRUE | never evaluated | FALSE | evaluated 2 times by 1 test |
) | 0-2 |
355 | { | - |
356 | unlink (fn); | - |
357 | sh_xfree((fn), "./fc.def", 442); | - |
358 | return never executed: return (1); (1);never executed: return (1); | 0 |
359 | } | - |
360 | remember_on_history = 1; | - |
361 | | - |
362 | | - |
363 | | - |
364 | begin_unwind_frame ("fc builtin"); | - |
365 | add_unwind_protect (xfree, fn); | - |
366 | add_unwind_protect (unlink, fn); | - |
367 | add_unwind_protect (set_verbose_flag, (char *) | - |
368 | ((void *)0) | - |
369 | ); | - |
370 | echo_input_at_read = 1; | - |
371 | | - |
372 | retval = fc_execute_file (fn); | - |
373 | run_unwind_frame ("fc builtin"); | - |
374 | | - |
375 | returnexecuted 2 times by 1 test: return (retval); (retval);executed 2 times by 1 test: return (retval); | 2 |
376 | } | - |
377 | | - |
378 | | - |
379 | static int | - |
380 | fc_number (list) | - |
381 | WORD_LIST *list; | - |
382 | { | - |
383 | char *s; | - |
384 | | - |
385 | if (list == 0TRUE | evaluated 6 times by 1 test | FALSE | evaluated 34 times by 1 test |
) | 6-34 |
386 | returnexecuted 6 times by 1 test: return 0; 0;executed 6 times by 1 test: return 0; | 6 |
387 | s = list->word->word; | - |
388 | if (*TRUE | evaluated 27 times by 1 test | FALSE | evaluated 7 times by 1 test |
s == '-'TRUE | evaluated 27 times by 1 test | FALSE | evaluated 7 times by 1 test |
) | 7-27 |
389 | s++;executed 27 times by 1 test: s++; | 27 |
390 | returnexecuted 34 times by 1 test: return (legal_number (s, (intmax_t *) ((void *)0) )); (legal_number (s, (intmax_t *)executed 34 times by 1 test: return (legal_number (s, (intmax_t *) ((void *)0) )); | 34 |
391 | ((void *)0)executed 34 times by 1 test: return (legal_number (s, (intmax_t *) ((void *)0) )); | 34 |
392 | ));executed 34 times by 1 test: return (legal_number (s, (intmax_t *) ((void *)0) )); | 34 |
393 | } | - |
394 | | - |
395 | | - |
396 | | - |
397 | | - |
398 | static int | - |
399 | fc_gethnum (command, hlist) | - |
400 | char *command; | - |
401 | HIST_ENTRY **hlist; | - |
402 | { | - |
403 | int sign, n, clen, rh; | - |
404 | register int i, j, last_hist, real_last; | - |
405 | register char *s; | - |
406 | | - |
407 | sign = 1; | - |
408 | | - |
409 | for (i = 0; hlist[i]TRUE | evaluated 204 times by 1 test | FALSE | evaluated 12 times by 1 test |
; i++);executed 204 times by 1 test: ; | 12-204 |
410 | rh = remember_on_historyTRUE | evaluated 11 times by 1 test | FALSE | evaluated 1 time by 1 test |
|| ((TRUE | evaluated 1 time by 1 test | FALSE | never evaluated |
subshell_environment & 0x04)TRUE | evaluated 1 time by 1 test | FALSE | never evaluated |
&& enable_history_listTRUE | evaluated 1 time by 1 test | FALSE | never evaluated |
); | 0-11 |
411 | last_hist = i - rh - hist_last_line_added; | - |
412 | | - |
413 | if (i == last_histTRUE | never evaluated | FALSE | evaluated 12 times by 1 test |
&& hlist[last_hist] == 0TRUE | never evaluated | FALSE | never evaluated |
) | 0-12 |
414 | while (last_hist >= 0TRUE | never evaluated | FALSE | never evaluated |
&& hlist[last_hist] == 0TRUE | never evaluated | FALSE | never evaluated |
) | 0 |
415 | last_hist--; never executed: last_hist--; | 0 |
416 | if (last_hist < 0TRUE | never evaluated | FALSE | evaluated 12 times by 1 test |
) | 0-12 |
417 | return never executed: return (-1); (-1);never executed: return (-1); | 0 |
418 | | - |
419 | real_last = i; | - |
420 | i = last_hist; | - |
421 | | - |
422 | | - |
423 | if (command == TRUE | evaluated 2 times by 1 test | FALSE | evaluated 10 times by 1 test |
| 2-10 |
424 | ((void *)0)TRUE | evaluated 2 times by 1 test | FALSE | evaluated 10 times by 1 test |
| 2-10 |
425 | ) | - |
426 | returnexecuted 2 times by 1 test: return (i); (i);executed 2 times by 1 test: return (i); | 2 |
427 | | - |
428 | | - |
429 | while (hlist[real_last] == 0TRUE | evaluated 10 times by 1 test | FALSE | evaluated 10 times by 1 test |
&& real_last > 0TRUE | evaluated 10 times by 1 test | FALSE | never evaluated |
) | 0-10 |
430 | real_last--;executed 10 times by 1 test: real_last--; | 10 |
431 | | - |
432 | | - |
433 | | - |
434 | s = command; | - |
435 | | - |
436 | | - |
437 | if (sTRUE | evaluated 10 times by 1 test | FALSE | never evaluated |
&& (*TRUE | evaluated 3 times by 1 test | FALSE | evaluated 7 times by 1 test |
s == '-')TRUE | evaluated 3 times by 1 test | FALSE | evaluated 7 times by 1 test |
) | 0-10 |
438 | { | - |
439 | sign = -1; | - |
440 | s++; | - |
441 | }executed 3 times by 1 test: end of block | 3 |
442 | | - |
443 | if (sTRUE | evaluated 10 times by 1 test | FALSE | never evaluated |
&& ((*TRUE | evaluated 10 times by 1 test | FALSE | never evaluated |
s) >= '0'TRUE | evaluated 10 times by 1 test | FALSE | never evaluated |
&& (*TRUE | evaluated 6 times by 1 test | FALSE | evaluated 4 times by 1 test |
s) <= '9'TRUE | evaluated 6 times by 1 test | FALSE | evaluated 4 times by 1 test |
)) | 0-10 |
444 | { | - |
445 | n = atoi (s); | - |
446 | n *= sign; | - |
447 | | - |
448 | | - |
449 | | - |
450 | if (n < 0TRUE | evaluated 3 times by 1 test | FALSE | evaluated 3 times by 1 test |
) | 3 |
451 | { | - |
452 | n += i + 1; | - |
453 | returnexecuted 3 times by 1 test: return (n < 0 ? 0 : n); (n < 0 ? 0 : n);executed 3 times by 1 test: return (n < 0 ? 0 : n); | 3 |
454 | } | - |
455 | else if (n == 0TRUE | never evaluated | FALSE | evaluated 3 times by 1 test |
) | 0-3 |
456 | return never executed: return ((sign == -1) ? real_last : i); ((sign == -1) ? real_last : i);never executed: return ((sign == -1) ? real_last : i); | 0 |
457 | else | - |
458 | { | - |
459 | n -= history_base; | - |
460 | returnexecuted 3 times by 1 test: return (i < n ? i : n); (i < n ? i : n);executed 3 times by 1 test: return (i < n ? i : n); | 3 |
461 | } | - |
462 | } | - |
463 | | - |
464 | clen = strlen (command); | - |
465 | for (j = i; j >= 0TRUE | evaluated 60 times by 1 test | FALSE | evaluated 3 times by 1 test |
; j--) | 3-60 |
466 | { | - |
467 | if (((TRUE | never evaluated | FALSE | evaluated 60 times by 1 test |
TRUE | evaluated 1 time by 1 test | FALSE | evaluated 59 times by 1 test |
TRUE | never evaluated | FALSE | evaluated 60 times by 1 test |
clen == 0)TRUE | evaluated 1 time by 1 test | FALSE | evaluated 59 times by 1 test |
TRUE | never evaluated | FALSE | evaluated 60 times by 1 test |
? (1) : ((TRUE | evaluated 2 times by 1 test | FALSE | evaluated 58 times by 1 test |
command)[0] == ((hlist[(j)]->line))[0]TRUE | evaluated 2 times by 1 test | FALSE | evaluated 58 times by 1 test |
&& TRUE | evaluated 1 time by 1 test | FALSE | evaluated 59 times by 1 test |
| 0-60 |
468 | (TRUE | evaluated 1 time by 1 test | FALSE | evaluated 1 time by 1 test |
__extension__ (__builtin_constant_p (TRUE | never evaluated | FALSE | evaluated 2 times by 1 test |
TRUE | evaluated 1 time by 1 test | FALSE | evaluated 1 time by 1 test |
TRUE | evaluated 1 time by 1 test | FALSE | evaluated 59 times by 1 test |
| 0-59 |
469 | clenTRUE | never evaluated | FALSE | evaluated 2 times by 1 test |
TRUE | evaluated 1 time by 1 test | FALSE | evaluated 1 time by 1 test |
TRUE | evaluated 1 time by 1 test | FALSE | evaluated 59 times by 1 test |
| 0-59 |
470 | )TRUE | never evaluated | FALSE | evaluated 2 times by 1 test |
&& ((__builtin_constant_p (TRUE | never evaluated | FALSE | never evaluated |
TRUE | evaluated 1 time by 1 test | FALSE | evaluated 1 time by 1 test |
TRUE | evaluated 1 time by 1 test | FALSE | evaluated 59 times by 1 test |
| 0-59 |
471 | commandTRUE | never evaluated | FALSE | never evaluated |
TRUE | evaluated 1 time by 1 test | FALSE | evaluated 1 time by 1 test |
TRUE | evaluated 1 time by 1 test | FALSE | evaluated 59 times by 1 test |
| 0-59 |
472 | )TRUE | never evaluated | FALSE | never evaluated |
&& strlen (TRUE | never evaluated | FALSE | never evaluated |
TRUE | evaluated 1 time by 1 test | FALSE | evaluated 1 time by 1 test |
TRUE | evaluated 1 time by 1 test | FALSE | evaluated 59 times by 1 test |
| 0-59 |
473 | commandTRUE | never evaluated | FALSE | never evaluated |
TRUE | evaluated 1 time by 1 test | FALSE | evaluated 1 time by 1 test |
TRUE | evaluated 1 time by 1 test | FALSE | evaluated 59 times by 1 test |
| 0-59 |
474 | ) < ((size_t) (TRUE | never evaluated | FALSE | never evaluated |
TRUE | evaluated 1 time by 1 test | FALSE | evaluated 1 time by 1 test |
TRUE | evaluated 1 time by 1 test | FALSE | evaluated 59 times by 1 test |
| 0-59 |
475 | clenTRUE | never evaluated | FALSE | never evaluated |
TRUE | evaluated 1 time by 1 test | FALSE | evaluated 1 time by 1 test |
TRUE | evaluated 1 time by 1 test | FALSE | evaluated 59 times by 1 test |
| 0-59 |
476 | ))TRUE | never evaluated | FALSE | never evaluated |
) || (__builtin_constant_p (TRUE | never evaluated | FALSE | never evaluated |
TRUE | evaluated 1 time by 1 test | FALSE | evaluated 1 time by 1 test |
TRUE | evaluated 1 time by 1 test | FALSE | evaluated 59 times by 1 test |
| 0-59 |
477 | (hlist[(j)]->line)TRUE | never evaluated | FALSE | never evaluated |
TRUE | evaluated 1 time by 1 test | FALSE | evaluated 1 time by 1 test |
TRUE | evaluated 1 time by 1 test | FALSE | evaluated 59 times by 1 test |
| 0-59 |
478 | )TRUE | never evaluated | FALSE | never evaluated |
&& strlen (TRUE | never evaluated | FALSE | never evaluated |
TRUE | evaluated 1 time by 1 test | FALSE | evaluated 1 time by 1 test |
TRUE | evaluated 1 time by 1 test | FALSE | evaluated 59 times by 1 test |
| 0-59 |
479 | (hlist[(j)]->line)TRUE | never evaluated | FALSE | never evaluated |
TRUE | evaluated 1 time by 1 test | FALSE | evaluated 1 time by 1 test |
TRUE | evaluated 1 time by 1 test | FALSE | evaluated 59 times by 1 test |
| 0-59 |
480 | ) < ((size_t) (TRUE | never evaluated | FALSE | never evaluated |
TRUE | evaluated 1 time by 1 test | FALSE | evaluated 1 time by 1 test |
TRUE | evaluated 1 time by 1 test | FALSE | evaluated 59 times by 1 test |
| 0-59 |
481 | clenTRUE | never evaluated | FALSE | never evaluated |
TRUE | evaluated 1 time by 1 test | FALSE | evaluated 1 time by 1 test |
TRUE | evaluated 1 time by 1 test | FALSE | evaluated 59 times by 1 test |
| 0-59 |
482 | ))TRUE | never evaluated | FALSE | never evaluated |
)) ? __extension__ ({ size_t __s1_len, __s2_len; (__builtin_constant_p (TRUE | evaluated 1 time by 1 test | FALSE | evaluated 1 time by 1 test |
TRUE | evaluated 1 time by 1 test | FALSE | evaluated 59 times by 1 test |
| 0-59 |
483 | commandTRUE | evaluated 1 time by 1 test | FALSE | evaluated 1 time by 1 test |
TRUE | evaluated 1 time by 1 test | FALSE | evaluated 59 times by 1 test |
| 1-59 |
484 | ) && __builtin_constant_p (TRUE | evaluated 1 time by 1 test | FALSE | evaluated 1 time by 1 test |
TRUE | evaluated 1 time by 1 test | FALSE | evaluated 59 times by 1 test |
| 1-59 |
485 | (hlist[(j)]->line)TRUE | evaluated 1 time by 1 test | FALSE | evaluated 1 time by 1 test |
TRUE | evaluated 1 time by 1 test | FALSE | evaluated 59 times by 1 test |
| 1-59 |
486 | ) && (__s1_len = __builtin_strlen (TRUE | evaluated 1 time by 1 test | FALSE | evaluated 1 time by 1 test |
TRUE | evaluated 1 time by 1 test | FALSE | evaluated 59 times by 1 test |
| 1-59 |
487 | commandTRUE | evaluated 1 time by 1 test | FALSE | evaluated 1 time by 1 test |
TRUE | evaluated 1 time by 1 test | FALSE | evaluated 59 times by 1 test |
| 1-59 |
488 | ), __s2_len = __builtin_strlen (TRUE | evaluated 1 time by 1 test | FALSE | evaluated 1 time by 1 test |
TRUE | evaluated 1 time by 1 test | FALSE | evaluated 59 times by 1 test |
| 1-59 |
489 | (hlist[(j)]->line)TRUE | evaluated 1 time by 1 test | FALSE | evaluated 1 time by 1 test |
TRUE | evaluated 1 time by 1 test | FALSE | evaluated 59 times by 1 test |
| 1-59 |
490 | ), (!((size_t)(const void *)((TRUE | evaluated 1 time by 1 test | FALSE | evaluated 1 time by 1 test |
TRUE | evaluated 1 time by 1 test | FALSE | evaluated 59 times by 1 test |
| 1-59 |
491 | commandTRUE | evaluated 1 time by 1 test | FALSE | evaluated 1 time by 1 test |
TRUE | evaluated 1 time by 1 test | FALSE | evaluated 59 times by 1 test |
| 1-59 |
492 | ) + 1) - (size_t)(const void *)(TRUE | evaluated 1 time by 1 test | FALSE | evaluated 1 time by 1 test |
TRUE | evaluated 1 time by 1 test | FALSE | evaluated 59 times by 1 test |
| 1-59 |
493 | commandTRUE | evaluated 1 time by 1 test | FALSE | evaluated 1 time by 1 test |
TRUE | evaluated 1 time by 1 test | FALSE | evaluated 59 times by 1 test |
| 1-59 |
494 | ) == 1) || __s1_len >= 4) && (!((size_t)(const void *)((TRUE | evaluated 1 time by 1 test | FALSE | evaluated 1 time by 1 test |
TRUE | evaluated 1 time by 1 test | FALSE | evaluated 59 times by 1 test |
| 1-59 |
495 | (hlist[(j)]->line)TRUE | evaluated 1 time by 1 test | FALSE | evaluated 1 time by 1 test |
TRUE | evaluated 1 time by 1 test | FALSE | evaluated 59 times by 1 test |
| 1-59 |
496 | ) + 1) - (size_t)(const void *)(TRUE | evaluated 1 time by 1 test | FALSE | evaluated 1 time by 1 test |
TRUE | evaluated 1 time by 1 test | FALSE | evaluated 59 times by 1 test |
| 1-59 |
497 | (hlist[(j)]->line)TRUE | evaluated 1 time by 1 test | FALSE | evaluated 1 time by 1 test |
TRUE | evaluated 1 time by 1 test | FALSE | evaluated 59 times by 1 test |
| 1-59 |
498 | ) == 1) || __s2_len >= 4)) ? __builtin_strcmp (TRUE | evaluated 1 time by 1 test | FALSE | evaluated 1 time by 1 test |
TRUE | evaluated 1 time by 1 test | FALSE | evaluated 59 times by 1 test |
| 1-59 |
499 | commandTRUE | evaluated 1 time by 1 test | FALSE | evaluated 1 time by 1 test |
TRUE | evaluated 1 time by 1 test | FALSE | evaluated 59 times by 1 test |
| 1-59 |
500 | , TRUE | evaluated 1 time by 1 test | FALSE | evaluated 1 time by 1 test |
TRUE | evaluated 1 time by 1 test | FALSE | evaluated 59 times by 1 test |
| 1-59 |
501 | (hlist[(j)]->line)TRUE | evaluated 1 time by 1 test | FALSE | evaluated 1 time by 1 test |
TRUE | evaluated 1 time by 1 test | FALSE | evaluated 59 times by 1 test |
| 1-59 |
502 | ) : (__builtin_constant_p (TRUE | evaluated 1 time by 1 test | FALSE | evaluated 1 time by 1 test |
TRUE | evaluated 1 time by 1 test | FALSE | evaluated 59 times by 1 test |
| 1-59 |
503 | commandTRUE | evaluated 1 time by 1 test | FALSE | evaluated 1 time by 1 test |
TRUE | evaluated 1 time by 1 test | FALSE | evaluated 59 times by 1 test |
| 1-59 |
504 | ) && ((size_t)(const void *)((TRUE | evaluated 1 time by 1 test | FALSE | evaluated 1 time by 1 test |
TRUE | evaluated 1 time by 1 test | FALSE | evaluated 59 times by 1 test |
| 1-59 |
505 | commandTRUE | evaluated 1 time by 1 test | FALSE | evaluated 1 time by 1 test |
TRUE | evaluated 1 time by 1 test | FALSE | evaluated 59 times by 1 test |
| 1-59 |
506 | ) + 1) - (size_t)(const void *)(TRUE | evaluated 1 time by 1 test | FALSE | evaluated 1 time by 1 test |
TRUE | evaluated 1 time by 1 test | FALSE | evaluated 59 times by 1 test |
| 1-59 |
507 | commandTRUE | evaluated 1 time by 1 test | FALSE | evaluated 1 time by 1 test |
TRUE | evaluated 1 time by 1 test | FALSE | evaluated 59 times by 1 test |
| 1-59 |
508 | ) == 1) && (__s1_len = __builtin_strlen (TRUE | evaluated 1 time by 1 test | FALSE | evaluated 1 time by 1 test |
TRUE | evaluated 1 time by 1 test | FALSE | evaluated 59 times by 1 test |
| 1-59 |
509 | commandTRUE | evaluated 1 time by 1 test | FALSE | evaluated 1 time by 1 test |
TRUE | evaluated 1 time by 1 test | FALSE | evaluated 59 times by 1 test |
| 1-59 |
510 | ), __s1_len < 4) ? (__builtin_constant_p (TRUE | evaluated 1 time by 1 test | FALSE | evaluated 1 time by 1 test |
TRUE | evaluated 1 time by 1 test | FALSE | evaluated 59 times by 1 test |
| 1-59 |
511 | (hlist[(j)]->line)TRUE | evaluated 1 time by 1 test | FALSE | evaluated 1 time by 1 test |
TRUE | evaluated 1 time by 1 test | FALSE | evaluated 59 times by 1 test |
| 1-59 |
512 | ) && ((size_t)(const void *)((TRUE | evaluated 1 time by 1 test | FALSE | evaluated 1 time by 1 test |
TRUE | evaluated 1 time by 1 test | FALSE | evaluated 59 times by 1 test |
| 1-59 |
513 | (hlist[(j)]->line)TRUE | evaluated 1 time by 1 test | FALSE | evaluated 1 time by 1 test |
TRUE | evaluated 1 time by 1 test | FALSE | evaluated 59 times by 1 test |
| 1-59 |
514 | ) + 1) - (size_t)(const void *)(TRUE | evaluated 1 time by 1 test | FALSE | evaluated 1 time by 1 test |
TRUE | evaluated 1 time by 1 test | FALSE | evaluated 59 times by 1 test |
| 1-59 |
515 | (hlist[(j)]->line)TRUE | evaluated 1 time by 1 test | FALSE | evaluated 1 time by 1 test |
TRUE | evaluated 1 time by 1 test | FALSE | evaluated 59 times by 1 test |
| 1-59 |
516 | ) == 1) ? __builtin_strcmp (TRUE | evaluated 1 time by 1 test | FALSE | evaluated 1 time by 1 test |
TRUE | evaluated 1 time by 1 test | FALSE | evaluated 59 times by 1 test |
| 1-59 |
517 | commandTRUE | evaluated 1 time by 1 test | FALSE | evaluated 1 time by 1 test |
TRUE | evaluated 1 time by 1 test | FALSE | evaluated 59 times by 1 test |
| 1-59 |
518 | , TRUE | evaluated 1 time by 1 test | FALSE | evaluated 1 time by 1 test |
TRUE | evaluated 1 time by 1 test | FALSE | evaluated 59 times by 1 test |
| 1-59 |
519 | (hlist[(j)]->line)TRUE | evaluated 1 time by 1 test | FALSE | evaluated 1 time by 1 test |
TRUE | evaluated 1 time by 1 test | FALSE | evaluated 59 times by 1 test |
| 1-59 |
520 | ) : (__extension__ ({ const unsigned char *__s2 = (const unsigned char *) (const char *) (TRUE | evaluated 1 time by 1 test | FALSE | evaluated 1 time by 1 test |
TRUE | evaluated 1 time by 1 test | FALSE | evaluated 59 times by 1 test |
| 1-59 |
521 | (hlist[(j)]->line)TRUE | evaluated 1 time by 1 test | FALSE | evaluated 1 time by 1 test |
TRUE | evaluated 1 time by 1 test | FALSE | evaluated 59 times by 1 test |
| 1-59 |
522 | ); int __result = (((const unsigned char *) (const char *) (TRUE | evaluated 1 time by 1 test | FALSE | evaluated 1 time by 1 test |
TRUE | evaluated 1 time by 1 test | FALSE | evaluated 59 times by 1 test |
| 1-59 |
523 | commandTRUE | evaluated 1 time by 1 test | FALSE | evaluated 1 time by 1 test |
TRUE | evaluated 1 time by 1 test | FALSE | evaluated 59 times by 1 test |
| 1-59 |
524 | ))[0] - __s2[0]); if (__s1_len > 0TRUE | never evaluated | FALSE | never evaluated |
&& __result == 0TRUE | never evaluated | FALSE | never evaluated |
) { __result = (((const unsigned char *) (const char *) (TRUE | evaluated 1 time by 1 test | FALSE | evaluated 1 time by 1 test |
TRUE | evaluated 1 time by 1 test | FALSE | evaluated 59 times by 1 test |
| 0-59 |
525 | commandTRUE | evaluated 1 time by 1 test | FALSE | evaluated 1 time by 1 test |
TRUE | evaluated 1 time by 1 test | FALSE | evaluated 59 times by 1 test |
| 1-59 |
526 | ))[1] - __s2[1]); if (__s1_len > 1TRUE | never evaluated | FALSE | never evaluated |
&& __result == 0TRUE | never evaluated | FALSE | never evaluated |
) { __result = (((const unsigned char *) (const char *) (TRUE | evaluated 1 time by 1 test | FALSE | evaluated 1 time by 1 test |
TRUE | evaluated 1 time by 1 test | FALSE | evaluated 59 times by 1 test |
| 0-59 |
527 | commandTRUE | evaluated 1 time by 1 test | FALSE | evaluated 1 time by 1 test |
TRUE | evaluated 1 time by 1 test | FALSE | evaluated 59 times by 1 test |
| 1-59 |
528 | ))[2] - __s2[2]); if (__s1_len > 2TRUE | never evaluated | FALSE | never evaluated |
&& __result == 0TRUE | never evaluated | FALSE | never evaluated |
) __result = (((const unsigned char *) (const char *) (never executed: __result = (((const unsigned char *) (const char *) ( command ))[3] - __s2[3]); TRUE | evaluated 1 time by 1 test | FALSE | evaluated 1 time by 1 test |
TRUE | evaluated 1 time by 1 test | FALSE | evaluated 59 times by 1 test |
| 0-59 |
529 | commandTRUE | evaluated 1 time by 1 test | FALSE | evaluated 1 time by 1 test |
TRUE | evaluated 1 time by 1 test | FALSE | evaluated 59 times by 1 test |
never executed: __result = (((const unsigned char *) (const char *) ( command ))[3] - __s2[3]); | 0-59 |
530 | ))[3] - __s2[3]);TRUE | evaluated 1 time by 1 test | FALSE | evaluated 1 time by 1 test |
never executed: __result = (((const unsigned char *) (const char *) ( command ))[3] - __s2[3]); }never executed: end of block }never executed: end of block __result; }))) : (__builtin_constant_p (TRUE | evaluated 1 time by 1 test | FALSE | evaluated 1 time by 1 test |
TRUE | evaluated 1 time by 1 test | FALSE | evaluated 59 times by 1 test |
| 0-59 |
531 | (hlist[(j)]->line)TRUE | evaluated 1 time by 1 test | FALSE | evaluated 1 time by 1 test |
TRUE | evaluated 1 time by 1 test | FALSE | evaluated 59 times by 1 test |
| 1-59 |
532 | ) && ((size_t)(const void *)((TRUE | evaluated 1 time by 1 test | FALSE | evaluated 1 time by 1 test |
TRUE | evaluated 1 time by 1 test | FALSE | evaluated 59 times by 1 test |
| 1-59 |
533 | (hlist[(j)]->line)TRUE | evaluated 1 time by 1 test | FALSE | evaluated 1 time by 1 test |
TRUE | evaluated 1 time by 1 test | FALSE | evaluated 59 times by 1 test |
| 1-59 |
534 | ) + 1) - (size_t)(const void *)(TRUE | evaluated 1 time by 1 test | FALSE | evaluated 1 time by 1 test |
TRUE | evaluated 1 time by 1 test | FALSE | evaluated 59 times by 1 test |
| 1-59 |
535 | (hlist[(j)]->line)TRUE | evaluated 1 time by 1 test | FALSE | evaluated 1 time by 1 test |
TRUE | evaluated 1 time by 1 test | FALSE | evaluated 59 times by 1 test |
| 1-59 |
536 | ) == 1) && (__s2_len = __builtin_strlen (TRUE | evaluated 1 time by 1 test | FALSE | evaluated 1 time by 1 test |
TRUE | evaluated 1 time by 1 test | FALSE | evaluated 59 times by 1 test |
| 1-59 |
537 | (hlist[(j)]->line)TRUE | evaluated 1 time by 1 test | FALSE | evaluated 1 time by 1 test |
TRUE | evaluated 1 time by 1 test | FALSE | evaluated 59 times by 1 test |
| 1-59 |
538 | ), __s2_len < 4) ? (__builtin_constant_p (TRUE | evaluated 1 time by 1 test | FALSE | evaluated 1 time by 1 test |
TRUE | evaluated 1 time by 1 test | FALSE | evaluated 59 times by 1 test |
| 1-59 |
539 | commandTRUE | evaluated 1 time by 1 test | FALSE | evaluated 1 time by 1 test |
TRUE | evaluated 1 time by 1 test | FALSE | evaluated 59 times by 1 test |
| 1-59 |
540 | ) && ((size_t)(const void *)((TRUE | evaluated 1 time by 1 test | FALSE | evaluated 1 time by 1 test |
TRUE | evaluated 1 time by 1 test | FALSE | evaluated 59 times by 1 test |
| 1-59 |
541 | commandTRUE | evaluated 1 time by 1 test | FALSE | evaluated 1 time by 1 test |
TRUE | evaluated 1 time by 1 test | FALSE | evaluated 59 times by 1 test |
| 1-59 |
542 | ) + 1) - (size_t)(const void *)(TRUE | evaluated 1 time by 1 test | FALSE | evaluated 1 time by 1 test |
TRUE | evaluated 1 time by 1 test | FALSE | evaluated 59 times by 1 test |
| 1-59 |
543 | commandTRUE | evaluated 1 time by 1 test | FALSE | evaluated 1 time by 1 test |
TRUE | evaluated 1 time by 1 test | FALSE | evaluated 59 times by 1 test |
| 1-59 |
544 | ) == 1) ? __builtin_strcmp (TRUE | evaluated 1 time by 1 test | FALSE | evaluated 1 time by 1 test |
TRUE | evaluated 1 time by 1 test | FALSE | evaluated 59 times by 1 test |
| 1-59 |
545 | commandTRUE | evaluated 1 time by 1 test | FALSE | evaluated 1 time by 1 test |
TRUE | evaluated 1 time by 1 test | FALSE | evaluated 59 times by 1 test |
| 1-59 |
546 | , TRUE | evaluated 1 time by 1 test | FALSE | evaluated 1 time by 1 test |
TRUE | evaluated 1 time by 1 test | FALSE | evaluated 59 times by 1 test |
| 1-59 |
547 | (hlist[(j)]->line)TRUE | evaluated 1 time by 1 test | FALSE | evaluated 1 time by 1 test |
TRUE | evaluated 1 time by 1 test | FALSE | evaluated 59 times by 1 test |
| 1-59 |
548 | ) : -(__extension__ ({ const unsigned char *__s2 = (const unsigned char *) (const char *) (TRUE | evaluated 1 time by 1 test | FALSE | evaluated 1 time by 1 test |
TRUE | evaluated 1 time by 1 test | FALSE | evaluated 59 times by 1 test |
| 1-59 |
549 | commandTRUE | evaluated 1 time by 1 test | FALSE | evaluated 1 time by 1 test |
TRUE | evaluated 1 time by 1 test | FALSE | evaluated 59 times by 1 test |
| 1-59 |
550 | ); int __result = (((const unsigned char *) (const char *) (TRUE | evaluated 1 time by 1 test | FALSE | evaluated 1 time by 1 test |
TRUE | evaluated 1 time by 1 test | FALSE | evaluated 59 times by 1 test |
| 1-59 |
551 | (hlist[(j)]->line)TRUE | evaluated 1 time by 1 test | FALSE | evaluated 1 time by 1 test |
TRUE | evaluated 1 time by 1 test | FALSE | evaluated 59 times by 1 test |
| 1-59 |
552 | ))[0] - __s2[0]); if (__s2_len > 0TRUE | never evaluated | FALSE | never evaluated |
&& __result == 0TRUE | never evaluated | FALSE | never evaluated |
) { __result = (((const unsigned char *) (const char *) (TRUE | evaluated 1 time by 1 test | FALSE | evaluated 1 time by 1 test |
TRUE | evaluated 1 time by 1 test | FALSE | evaluated 59 times by 1 test |
| 0-59 |
553 | (hlist[(j)]->line)TRUE | evaluated 1 time by 1 test | FALSE | evaluated 1 time by 1 test |
TRUE | evaluated 1 time by 1 test | FALSE | evaluated 59 times by 1 test |
| 1-59 |
554 | ))[1] - __s2[1]); if (__s2_len > 1TRUE | never evaluated | FALSE | never evaluated |
&& __result == 0TRUE | never evaluated | FALSE | never evaluated |
) { __result = (((const unsigned char *) (const char *) (TRUE | evaluated 1 time by 1 test | FALSE | evaluated 1 time by 1 test |
TRUE | evaluated 1 time by 1 test | FALSE | evaluated 59 times by 1 test |
| 0-59 |
555 | (hlist[(j)]->line)TRUE | evaluated 1 time by 1 test | FALSE | evaluated 1 time by 1 test |
TRUE | evaluated 1 time by 1 test | FALSE | evaluated 59 times by 1 test |
| 1-59 |
556 | ))[2] - __s2[2]); if (__s2_len > 2TRUE | never evaluated | FALSE | never evaluated |
&& __result == 0TRUE | never evaluated | FALSE | never evaluated |
) __result = (((const unsigned char *) (const char *) (never executed: __result = (((const unsigned char *) (const char *) ( (hlist[(j)]->line) ))[3] - __s2[3]); TRUE | evaluated 1 time by 1 test | FALSE | evaluated 1 time by 1 test |
TRUE | evaluated 1 time by 1 test | FALSE | evaluated 59 times by 1 test |
| 0-59 |
557 | (hlist[(j)]->line)TRUE | evaluated 1 time by 1 test | FALSE | evaluated 1 time by 1 test |
TRUE | evaluated 1 time by 1 test | FALSE | evaluated 59 times by 1 test |
never executed: __result = (((const unsigned char *) (const char *) ( (hlist[(j)]->line) ))[3] - __s2[3]); | 0-59 |
558 | ))[3] - __s2[3]);TRUE | evaluated 1 time by 1 test | FALSE | evaluated 1 time by 1 test |
never executed: __result = (((const unsigned char *) (const char *) ( (hlist[(j)]->line) ))[3] - __s2[3]); }never executed: end of block }never executed: end of block __result; }))) : __builtin_strcmp (TRUE | evaluated 1 time by 1 test | FALSE | evaluated 1 time by 1 test |
TRUE | evaluated 1 time by 1 test | FALSE | evaluated 59 times by 1 test |
| 0-59 |
559 | commandTRUE | evaluated 1 time by 1 test | FALSE | evaluated 1 time by 1 test |
TRUE | evaluated 1 time by 1 test | FALSE | evaluated 59 times by 1 test |
| 1-59 |
560 | , TRUE | evaluated 1 time by 1 test | FALSE | evaluated 1 time by 1 test |
TRUE | evaluated 1 time by 1 test | FALSE | evaluated 59 times by 1 test |
| 1-59 |
561 | (hlist[(j)]->line)TRUE | evaluated 1 time by 1 test | FALSE | evaluated 1 time by 1 test |
TRUE | evaluated 1 time by 1 test | FALSE | evaluated 59 times by 1 test |
| 1-59 |
562 | )))); }) : strncmp (TRUE | evaluated 1 time by 1 test | FALSE | evaluated 1 time by 1 test |
TRUE | evaluated 1 time by 1 test | FALSE | evaluated 59 times by 1 test |
| 1-59 |
563 | commandTRUE | evaluated 1 time by 1 test | FALSE | evaluated 1 time by 1 test |
TRUE | evaluated 1 time by 1 test | FALSE | evaluated 59 times by 1 test |
| 1-59 |
564 | , TRUE | evaluated 1 time by 1 test | FALSE | evaluated 1 time by 1 test |
TRUE | evaluated 1 time by 1 test | FALSE | evaluated 59 times by 1 test |
| 1-59 |
565 | (hlist[(j)]->line)TRUE | evaluated 1 time by 1 test | FALSE | evaluated 1 time by 1 test |
TRUE | evaluated 1 time by 1 test | FALSE | evaluated 59 times by 1 test |
| 1-59 |
566 | , TRUE | evaluated 1 time by 1 test | FALSE | evaluated 1 time by 1 test |
TRUE | evaluated 1 time by 1 test | FALSE | evaluated 59 times by 1 test |
| 1-59 |
567 | clenTRUE | evaluated 1 time by 1 test | FALSE | evaluated 1 time by 1 test |
TRUE | evaluated 1 time by 1 test | FALSE | evaluated 59 times by 1 test |
| 1-59 |
568 | ))) TRUE | evaluated 1 time by 1 test | FALSE | evaluated 1 time by 1 test |
TRUE | evaluated 1 time by 1 test | FALSE | evaluated 59 times by 1 test |
| 1-59 |
569 | == 0TRUE | evaluated 1 time by 1 test | FALSE | evaluated 1 time by 1 test |
))TRUE | evaluated 1 time by 1 test | FALSE | evaluated 59 times by 1 test |
) | 1-59 |
570 | returnexecuted 1 time by 1 test: return (j); (j);executed 1 time by 1 test: return (j); | 1 |
571 | }executed 59 times by 1 test: end of block | 59 |
572 | returnexecuted 3 times by 1 test: return (-1); (-1);executed 3 times by 1 test: return (-1); | 3 |
573 | } | - |
574 | | - |
575 | | - |
576 | | - |
577 | static char * | - |
578 | fc_gethist (command, hlist) | - |
579 | char *command; | - |
580 | HIST_ENTRY **hlist; | - |
581 | { | - |
582 | int i; | - |
583 | | - |
584 | if (hlist == 0TRUE | never evaluated | FALSE | evaluated 4 times by 1 test |
) | 0-4 |
585 | return never executed: return ((char *) ((void *)0) ); ((char *)never executed: return ((char *) ((void *)0) ); | 0 |
586 | ((void *)0) never executed: return ((char *) ((void *)0) ); | 0 |
587 | ); never executed: return ((char *) ((void *)0) ); | 0 |
588 | | - |
589 | i = fc_gethnum (command, hlist); | - |
590 | | - |
591 | if (i >= 0TRUE | evaluated 3 times by 1 test | FALSE | evaluated 1 time by 1 test |
) | 1-3 |
592 | returnexecuted 3 times by 1 test: return ((char *)strcpy (sh_xmalloc((1 + strlen ((hlist[(i)]->line))), "./fc.def", 592), ((hlist[(i)]->line)))); ((char *)strcpy (sh_xmalloc((1 + strlen ((hlist[(i)]->line))), "./fc.def", 592), ((hlist[(i)]->line))));executed 3 times by 1 test: return ((char *)strcpy (sh_xmalloc((1 + strlen ((hlist[(i)]->line))), "./fc.def", 592), ((hlist[(i)]->line)))); | 3 |
593 | else | - |
594 | returnexecuted 1 time by 1 test: return ((char *) ((void *)0) ); ((char *)executed 1 time by 1 test: return ((char *) ((void *)0) ); | 1 |
595 | ((void *)0)executed 1 time by 1 test: return ((char *) ((void *)0) ); | 1 |
596 | );executed 1 time by 1 test: return ((char *) ((void *)0) ); | 1 |
597 | } | - |
598 | static char * | - |
599 | fc_dosubs (command, subs) | - |
600 | char *command; | - |
601 | REPL *subs; | - |
602 | { | - |
603 | register char *new, *t; | - |
604 | register REPL *r; | - |
605 | | - |
606 | for (new = (char *)strcpy (sh_xmalloc((1 + strlen (command)), "./fc.def", 653), (command)), r = subs; rTRUE | evaluated 3 times by 1 test | FALSE | evaluated 2 times by 1 test |
; r = r->next) | 2-3 |
607 | { | - |
608 | t = strsub (new, r->pat, r->rep, 1); | - |
609 | sh_xfree((new), "./fc.def", 656); | - |
610 | new = t; | - |
611 | }executed 3 times by 1 test: end of block | 3 |
612 | returnexecuted 2 times by 1 test: return (new); (new);executed 2 times by 1 test: return (new); | 2 |
613 | } | - |
614 | | - |
615 | | - |
616 | | - |
617 | | - |
618 | | - |
619 | static void | - |
620 | fc_replhist (command) | - |
621 | char *command; | - |
622 | { | - |
623 | int n; | - |
624 | | - |
625 | if (command == 0TRUE | never evaluated | FALSE | evaluated 3 times by 1 test |
|| *TRUE | never evaluated | FALSE | evaluated 3 times by 1 test |
command == '\0'TRUE | never evaluated | FALSE | evaluated 3 times by 1 test |
) | 0-3 |
626 | return; never executed: return; | 0 |
627 | | - |
628 | n = strlen (command); | - |
629 | if (command[n - 1] == '\n'TRUE | evaluated 1 time by 1 test | FALSE | evaluated 2 times by 1 test |
) | 1-2 |
630 | command[n - 1] = '\0';executed 1 time by 1 test: command[n - 1] = '\0'; | 1 |
631 | | - |
632 | if (commandTRUE | evaluated 3 times by 1 test | FALSE | never evaluated |
&& *TRUE | evaluated 3 times by 1 test | FALSE | never evaluated |
commandTRUE | evaluated 3 times by 1 test | FALSE | never evaluated |
) | 0-3 |
633 | { | - |
634 | bash_delete_last_history (); | - |
635 | maybe_add_history (command); | - |
636 | }executed 3 times by 1 test: end of block | 3 |
637 | }executed 3 times by 1 test: end of block | 3 |
| | |