OpenCoverage

alias.def

Absolute File Name:/home/opencoverage/opencoverage/guest-scripts/bash/src/builtins/alias.def
Switch to Source codePreprocessed file
LineSourceCount
1-
2-
3-
4-
5-
6-
7-
8-
9-
10-
11-
12-
13-
14-
15-
16static void print_alias (alias_t *, int);-
17-
18-
19int-
20alias_builtin (list)-
21 WORD_LIST *list;-
22{-
23 int any_failed, offset, pflag, dflags;-
24 alias_t **alias_list, *t;-
25 char *name, *value;-
26-
27 dflags = posixly_correct
posixly_correctDescription
TRUEevaluated 2 times by 1 test
Evaluated by:
  • Self test
FALSEevaluated 115 times by 1 test
Evaluated by:
  • Self test
? 0 : 0x01;
2-115
28 pflag = 0;-
29 reset_internal_getopt ();-
30 while ((
(offset = inte...t, "p")) != -1Description
TRUEevaluated 10 times by 1 test
Evaluated by:
  • Self test
FALSEevaluated 112 times by 1 test
Evaluated by:
  • Self test
offset = internal_getopt (list, "p")) != -1
(offset = inte...t, "p")) != -1Description
TRUEevaluated 10 times by 1 test
Evaluated by:
  • Self test
FALSEevaluated 112 times by 1 test
Evaluated by:
  • Self test
)
10-112
31 {-
32 switch (offset)-
33 {-
34 case
executed 5 times by 1 test: case 'p':
Executed by:
  • Self test
'p':
executed 5 times by 1 test: case 'p':
Executed by:
  • Self test
5
35 pflag = 1;-
36 dflags |= 0x01;-
37 break;
executed 5 times by 1 test: break;
Executed by:
  • Self test
5
38 case
never executed: case -99:
-99:
never executed: case -99:
builtin_help (); return
never executed: return (258);
(258);
never executed: return (258);
0
39 default
executed 5 times by 1 test: default:
Executed by:
  • Self test
:
executed 5 times by 1 test: default:
Executed by:
  • Self test
5
40 builtin_usage ();-
41 return
executed 5 times by 1 test: return (258);
Executed by:
  • Self test
(258);
executed 5 times by 1 test: return (258);
Executed by:
  • Self test
5
42 }-
43 }-
44-
45 list = loptend;-
46-
47 if (list == 0
list == 0Description
TRUEevaluated 10 times by 1 test
Evaluated by:
  • Self test
FALSEevaluated 102 times by 1 test
Evaluated by:
  • Self test
|| pflag
pflagDescription
TRUEnever evaluated
FALSEevaluated 102 times by 1 test
Evaluated by:
  • Self test
)
0-102
48 {-
49 if (aliases == 0
aliases == 0Description
TRUEevaluated 3 times by 1 test
Evaluated by:
  • Self test
FALSEevaluated 7 times by 1 test
Evaluated by:
  • Self test
)
3-7
50 return
executed 3 times by 1 test: return (0);
Executed by:
  • Self test
(0);
executed 3 times by 1 test: return (0);
Executed by:
  • Self test
3
51-
52 alias_list = all_aliases ();-
53-
54 if (alias_list == 0
alias_list == 0Description
TRUEevaluated 2 times by 1 test
Evaluated by:
  • Self test
FALSEevaluated 5 times by 1 test
Evaluated by:
  • Self test
)
2-5
55 return
executed 2 times by 1 test: return (0);
Executed by:
  • Self test
(0);
executed 2 times by 1 test: return (0);
Executed by:
  • Self test
2
56-
57 for (offset = 0; alias_list[offset]
alias_list[offset]Description
TRUEevaluated 8 times by 1 test
Evaluated by:
  • Self test
FALSEevaluated 5 times by 1 test
Evaluated by:
  • Self test
; offset++)
5-8
58 print_alias (alias_list[offset], dflags);
executed 8 times by 1 test: print_alias (alias_list[offset], dflags);
Executed by:
  • Self test
8
59-
60 sh_xfree((alias_list), "./alias.def", 110);-
61-
62 if (list == 0
list == 0Description
TRUEevaluated 5 times by 1 test
Evaluated by:
  • Self test
FALSEnever evaluated
)
0-5
63 return
executed 5 times by 1 test: return (sh_chkwrite (0));
Executed by:
  • Self test
(sh_chkwrite (0));
executed 5 times by 1 test: return (sh_chkwrite (0));
Executed by:
  • Self test
5
64 }
never executed: end of block
0
65-
66 any_failed = 0;-
67 while (list
listDescription
TRUEevaluated 102 times by 1 test
Evaluated by:
  • Self test
FALSEevaluated 102 times by 1 test
Evaluated by:
  • Self test
)
102
68 {-
69 name = list->word->word;-
70-
71 for (offset = 0; name[offset]
name[offset]Description
TRUEevaluated 470 times by 1 test
Evaluated by:
  • Self test
FALSEevaluated 9 times by 1 test
Evaluated by:
  • Self test
&& name[offset] != '='
name[offset] != '='Description
TRUEevaluated 377 times by 1 test
Evaluated by:
  • Self test
FALSEevaluated 93 times by 1 test
Evaluated by:
  • Self test
; offset++)
9-470
72 ;
executed 377 times by 1 test: ;
Executed by:
  • Self test
377
73-
74 if (offset
offsetDescription
TRUEevaluated 102 times by 1 test
Evaluated by:
  • Self test
FALSEnever evaluated
&& name[offset] == '='
name[offset] == '='Description
TRUEevaluated 93 times by 1 test
Evaluated by:
  • Self test
FALSEevaluated 9 times by 1 test
Evaluated by:
  • Self test
)
0-102
75 {-
76 name[offset] = '\0';-
77 value = name + offset + 1;-
78-
79 if (legal_alias_name (name, 0) == 0
legal_alias_na...(name, 0) == 0Description
TRUEnever evaluated
FALSEevaluated 93 times by 1 test
Evaluated by:
  • Self test
)
0-93
80 {-
81 builtin_error (-
82 dcgettext (((void *)0), -
83 "`%s': invalid alias name"-
84 , 5)-
85 , name);-
86 any_failed++;-
87 }
never executed: end of block
0
88 else-
89 add_alias (name, value);
executed 93 times by 1 test: add_alias (name, value);
Executed by:
  • Self test
93
90 }-
91 else-
92 {-
93 t = find_alias (name);-
94 if (t
tDescription
TRUEevaluated 4 times by 1 test
Evaluated by:
  • Self test
FALSEevaluated 5 times by 1 test
Evaluated by:
  • Self test
)
4-5
95 print_alias (t, dflags);
executed 4 times by 1 test: print_alias (t, dflags);
Executed by:
  • Self test
4
96 else-
97 {-
98 sh_notfound (name);-
99 any_failed++;-
100 }
executed 5 times by 1 test: end of block
Executed by:
  • Self test
5
101 }-
102 list = list->next;-
103 }
executed 102 times by 1 test: end of block
Executed by:
  • Self test
102
104-
105 return
executed 102 times by 1 test: return (any_failed ? 1 : 0);
Executed by:
  • Self test
(any_failed ? 1 : 0);
executed 102 times by 1 test: return (any_failed ? 1 : 0);
Executed by:
  • Self test
102
106}-
107-
108-
109-
110int-
111unalias_builtin (list)-
112 register WORD_LIST *list;-
113{-
114 register alias_t *alias;-
115 int opt, aflag;-
116-
117 aflag = 0;-
118 reset_internal_getopt ();-
119 while ((
(opt = interna...t, "a")) != -1Description
TRUEevaluated 23 times by 1 test
Evaluated by:
  • Self test
FALSEevaluated 36 times by 1 test
Evaluated by:
  • Self test
opt = internal_getopt (list, "a")) != -1
(opt = interna...t, "a")) != -1Description
TRUEevaluated 23 times by 1 test
Evaluated by:
  • Self test
FALSEevaluated 36 times by 1 test
Evaluated by:
  • Self test
)
23-36
120 {-
121 switch (opt)-
122 {-
123 case
executed 18 times by 1 test: case 'a':
Executed by:
  • Self test
'a':
executed 18 times by 1 test: case 'a':
Executed by:
  • Self test
18
124 aflag = 1;-
125 break;
executed 18 times by 1 test: break;
Executed by:
  • Self test
18
126 case
never executed: case -99:
-99:
never executed: case -99:
builtin_help (); return
never executed: return (258);
(258);
never executed: return (258);
0
127 default
executed 5 times by 1 test: default:
Executed by:
  • Self test
:
executed 5 times by 1 test: default:
Executed by:
  • Self test
5
128 builtin_usage ();-
129 return
executed 5 times by 1 test: return (258);
Executed by:
  • Self test
(258);
executed 5 times by 1 test: return (258);
Executed by:
  • Self test
5
130 }-
131 }-
132-
133 list = loptend;-
134-
135 if (aflag
aflagDescription
TRUEevaluated 18 times by 1 test
Evaluated by:
  • Self test
FALSEevaluated 18 times by 1 test
Evaluated by:
  • Self test
)
18
136 {-
137 delete_all_aliases ();-
138 return
executed 18 times by 1 test: return (0);
Executed by:
  • Self test
(0);
executed 18 times by 1 test: return (0);
Executed by:
  • Self test
18
139 }-
140-
141 if (list == 0
list == 0Description
TRUEnever evaluated
FALSEevaluated 18 times by 1 test
Evaluated by:
  • Self test
)
0-18
142 {-
143 builtin_usage ();-
144 return
never executed: return (258);
(258);
never executed: return (258);
0
145 }-
146-
147 aflag = 0;-
148 while (list
listDescription
TRUEevaluated 29 times by 1 test
Evaluated by:
  • Self test
FALSEevaluated 18 times by 1 test
Evaluated by:
  • Self test
)
18-29
149 {-
150 alias = find_alias (list->word->word);-
151-
152 if (alias
aliasDescription
TRUEevaluated 15 times by 1 test
Evaluated by:
  • Self test
FALSEevaluated 14 times by 1 test
Evaluated by:
  • Self test
)
14-15
153 remove_alias (alias->name);
executed 15 times by 1 test: remove_alias (alias->name);
Executed by:
  • Self test
15
154 else-
155 {-
156 sh_notfound (list->word->word);-
157 aflag++;-
158 }
executed 14 times by 1 test: end of block
Executed by:
  • Self test
14
159-
160 list = list->next;-
161 }
executed 29 times by 1 test: end of block
Executed by:
  • Self test
29
162-
163 return
executed 18 times by 1 test: return (aflag ? 1 : 0);
Executed by:
  • Self test
(aflag ? 1 : 0);
executed 18 times by 1 test: return (aflag ? 1 : 0);
Executed by:
  • Self test
18
164}-
165-
166-
167static void-
168print_alias (alias, flags)-
169 alias_t *alias;-
170 int flags;-
171{-
172 char *value;-
173-
174 value = sh_single_quote (alias->value);-
175 if (flags & 0x01
flags & 0x01Description
TRUEevaluated 12 times by 1 test
Evaluated by:
  • Self test
FALSEnever evaluated
)
0-12
176 printf ("alias %s", (alias->name && alias->name[0] == '-') ? "-- " : "");
executed 12 times by 1 test: printf ("alias %s", (alias->name && alias->name[0] == '-') ? "-- " : "");
Executed by:
  • Self test
12
177 printf ("%s=%s\n", alias->name, value);-
178 sh_xfree((value), "./alias.def", 237);-
179-
180 fflush (-
181 stdout-
182 );-
183}
executed 12 times by 1 test: end of block
Executed by:
  • Self test
12
Switch to Source codePreprocessed file

Generated by Squish Coco 4.1.2