Line | Source | Count |
1 | | - |
2 | | - |
3 | | - |
4 | | - |
5 | | - |
6 | | - |
7 | | - |
8 | | - |
9 | | - |
10 | | - |
11 | | - |
12 | | - |
13 | | - |
14 | | - |
15 | | - |
16 | | - |
17 | | - |
18 | | - |
19 | | - |
20 | | - |
21 | | - |
22 | | - |
23 | | - |
24 | #include <config.h> | - |
25 | #include <stdio.h> | - |
26 | #include <sys/types.h> | - |
27 | #include <sys/wait.h> | - |
28 | | - |
29 | #include "system.h" | - |
30 | #include "error.h" | - |
31 | #include "quote.h" | - |
32 | #include "sig2str.h" | - |
33 | #include "operand2sig.h" | - |
34 | | - |
35 | extern int | - |
36 | operand2sig (char const *operand, char *signame) | - |
37 | { | - |
38 | int signum; | - |
39 | | - |
40 | if (ISDIGIT (*operand))TRUE | evaluated 11 times by 1 test | FALSE | evaluated 16 times by 2 tests |
| 11-16 |
41 | { | - |
42 | | - |
43 | | - |
44 | | - |
45 | | - |
46 | | - |
47 | | - |
48 | | - |
49 | | - |
50 | | - |
51 | | - |
52 | | - |
53 | char *endp; | - |
54 | long int l = (errno = 0, strtol (operand, &endp, 10)); | - |
55 | int i = l; | - |
56 | signum = (operand == endp || *endp || errno || i != l ? -1 : i);TRUE | never evaluated | FALSE | evaluated 11 times by 1 test |
TRUE | never evaluated | FALSE | evaluated 11 times by 1 test |
TRUE | never evaluated | FALSE | evaluated 11 times by 1 test |
TRUE | never evaluated | FALSE | evaluated 11 times by 1 test |
| 0-11 |
57 | | - |
58 | if (signum != -1)TRUE | evaluated 11 times by 1 test | FALSE | never evaluated |
| 0-11 |
59 | { | - |
60 | | - |
61 | | - |
62 | | - |
63 | signum &= signum >= 0xFF ? 0xFF : 0x7F;TRUE | evaluated 1 time by 1 test | FALSE | evaluated 10 times by 1 test |
| 1-10 |
64 | }executed 11 times by 1 test: end of block | 11 |
65 | }executed 11 times by 1 test: end of block | 11 |
66 | else | - |
67 | { | - |
68 | | - |
69 | | - |
70 | char *upcased = xstrdup (operand); | - |
71 | char *p; | - |
72 | for (p = upcased; *p; p++)TRUE | evaluated 67 times by 2 tests | FALSE | evaluated 16 times by 2 tests |
| 16-67 |
73 | if (strchr ("abcdefghijklmnopqrstuvwxyz", *p))TRUE | evaluated 18 times by 2 tests | FALSE | evaluated 49 times by 2 tests |
TRUE | never evaluated | FALSE | evaluated 67 times by 2 tests |
TRUE | never evaluated | FALSE | never evaluated |
TRUE | never evaluated | FALSE | never evaluated |
| 0-67 |
74 | *p += 'A' - 'a';executed 18 times by 2 tests: *p += 'A' - 'a'; | 18 |
75 | | - |
76 | | - |
77 | | - |
78 | if (!(str2sig (upcased, &signum) == 0TRUE | evaluated 10 times by 2 tests | FALSE | evaluated 6 times by 2 tests |
| 6-10 |
79 | || (upcased[0] == 'S' && upcased[1] == 'I' && upcased[2] == 'G'TRUE | never evaluated | FALSE | evaluated 6 times by 2 tests |
TRUE | never evaluated | FALSE | never evaluated |
TRUE | never evaluated | FALSE | never evaluated |
| 0-6 |
80 | && str2sig (upcased + 3, &signum) == 0)))TRUE | never evaluated | FALSE | never evaluated |
| 0 |
81 | signum = -1;executed 6 times by 2 tests: signum = -1; | 6 |
82 | | - |
83 | free (upcased); | - |
84 | }executed 16 times by 2 tests: end of block | 16 |
85 | | - |
86 | if (signum < 0 || sig2str (signum, signame) != 0)TRUE | evaluated 6 times by 2 tests | FALSE | evaluated 21 times by 2 tests |
TRUE | never evaluated | FALSE | evaluated 21 times by 2 tests |
| 0-21 |
87 | { | - |
88 | error (0, 0, _("%s: invalid signal"), quote (operand)); | - |
89 | return -1;executed 6 times by 2 tests: return -1; | 6 |
90 | } | - |
91 | | - |
92 | return signum;executed 21 times by 2 tests: return signum; | 21 |
93 | } | - |
| | |