Absolute File Name: | /home/opencoverage/opencoverage/guest-scripts/coreutils/src/src/whoami.c |
Switch to Source code | Preprocessed file |
Line | Source | Count | ||||||||||||
---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|
1 | - | |||||||||||||
2 | - | |||||||||||||
3 | - | |||||||||||||
4 | - | |||||||||||||
5 | - | |||||||||||||
6 | - | |||||||||||||
7 | - | |||||||||||||
8 | - | |||||||||||||
9 | static struct option const long_options[] = | - | ||||||||||||
10 | { | - | ||||||||||||
11 | { | - | ||||||||||||
12 | ((void *)0) | - | ||||||||||||
13 | , 0, | - | ||||||||||||
14 | ((void *)0) | - | ||||||||||||
15 | , 0} | - | ||||||||||||
16 | }; | - | ||||||||||||
17 | - | |||||||||||||
18 | void | - | ||||||||||||
19 | usage (int status) | - | ||||||||||||
20 | { | - | ||||||||||||
21 | if (status !=
| 3 | ||||||||||||
22 | 0
| 3 | ||||||||||||
23 | ) | - | ||||||||||||
24 | do { fprintf ( | - | ||||||||||||
25 | stderr | - | ||||||||||||
26 | , | - | ||||||||||||
27 | dcgettext (((void *)0), | - | ||||||||||||
28 | "Try '%s --help' for more information.\n" | - | ||||||||||||
29 | , 5) | - | ||||||||||||
30 | , program_name); } executed 3 times by 1 test: while (0);end of block Executed by:
| 3 | ||||||||||||
31 | else | - | ||||||||||||
32 | { | - | ||||||||||||
33 | printf ( | - | ||||||||||||
34 | dcgettext (((void *)0), | - | ||||||||||||
35 | "Usage: %s [OPTION]...\n" | - | ||||||||||||
36 | , 5) | - | ||||||||||||
37 | , program_name); | - | ||||||||||||
38 | fputs_unlocked ( | - | ||||||||||||
39 | dcgettext (((void *)0), | - | ||||||||||||
40 | "Print the user name associated with the current effective user ID.\nSame as id -un.\n\n" | - | ||||||||||||
41 | , 5) | - | ||||||||||||
42 | , | - | ||||||||||||
43 | stdout | - | ||||||||||||
44 | ) | - | ||||||||||||
45 | - | |||||||||||||
46 | - | |||||||||||||
47 | - | |||||||||||||
48 | ; | - | ||||||||||||
49 | fputs_unlocked ( | - | ||||||||||||
50 | dcgettext (((void *)0), | - | ||||||||||||
51 | " --help display this help and exit\n" | - | ||||||||||||
52 | , 5) | - | ||||||||||||
53 | , | - | ||||||||||||
54 | stdout | - | ||||||||||||
55 | ); | - | ||||||||||||
56 | fputs_unlocked ( | - | ||||||||||||
57 | dcgettext (((void *)0), | - | ||||||||||||
58 | " --version output version information and exit\n" | - | ||||||||||||
59 | , 5) | - | ||||||||||||
60 | , | - | ||||||||||||
61 | stdout | - | ||||||||||||
62 | ); | - | ||||||||||||
63 | emit_ancillary_info ("whoami"); | - | ||||||||||||
64 | } executed 3 times by 1 test: end of block Executed by:
| 3 | ||||||||||||
65 | exit (status); executed 6 times by 1 test: exit (status); Executed by:
| 6 | ||||||||||||
66 | } | - | ||||||||||||
67 | - | |||||||||||||
68 | int | - | ||||||||||||
69 | main (int argc, char **argv) | - | ||||||||||||
70 | { | - | ||||||||||||
71 | struct passwd *pw; | - | ||||||||||||
72 | uid_t uid; | - | ||||||||||||
73 | uid_t NO_UID = -1; | - | ||||||||||||
74 | - | |||||||||||||
75 | ; | - | ||||||||||||
76 | set_program_name (argv[0]); | - | ||||||||||||
77 | setlocale ( | - | ||||||||||||
78 | 6 | - | ||||||||||||
79 | , ""); | - | ||||||||||||
80 | bindtextdomain ("coreutils", "/usr/local/share/locale"); | - | ||||||||||||
81 | textdomain ("coreutils"); | - | ||||||||||||
82 | - | |||||||||||||
83 | atexit (close_stdout); | - | ||||||||||||
84 | - | |||||||||||||
85 | parse_long_options (argc, argv, "whoami", "GNU coreutils", Version, | - | ||||||||||||
86 | usage, ("Richard Mlynarik"), (char const *) | - | ||||||||||||
87 | ((void *)0) | - | ||||||||||||
88 | ); | - | ||||||||||||
89 | if (getopt_long (argc, argv, "", long_options,
| 1-3 | ||||||||||||
90 | ((void *)0)
| 1-3 | ||||||||||||
91 | ) != -1
| 1-3 | ||||||||||||
92 | usage ( executed 3 times by 1 test: usage ( 1 ); Executed by:
| 3 | ||||||||||||
93 | 1 executed 3 times by 1 test: usage ( 1 ); Executed by:
| 3 | ||||||||||||
94 | ); executed 3 times by 1 test: usage ( 1 ); Executed by:
| 3 | ||||||||||||
95 | - | |||||||||||||
96 | if (optind != argc
| 0-1 | ||||||||||||
97 | { | - | ||||||||||||
98 | error (0, 0, | - | ||||||||||||
99 | dcgettext (((void *)0), | - | ||||||||||||
100 | "extra operand %s" | - | ||||||||||||
101 | , 5) | - | ||||||||||||
102 | , quote (argv[optind])); | - | ||||||||||||
103 | usage ( | - | ||||||||||||
104 | 1 | - | ||||||||||||
105 | ); | - | ||||||||||||
106 | } never executed: end of block | 0 | ||||||||||||
107 | - | |||||||||||||
108 | - | |||||||||||||
109 | (*__errno_location ()) | - | ||||||||||||
110 | = 0; | - | ||||||||||||
111 | uid = geteuid (); | - | ||||||||||||
112 | pw = (uid == NO_UID
| 0-1 | ||||||||||||
113 | (*
| 0 | ||||||||||||
114 | ? | - | ||||||||||||
115 | ((void *)0) | - | ||||||||||||
116 | : getpwuid (uid)); | - | ||||||||||||
117 | if (!pw
| 0-1 | ||||||||||||
118 | (( never executed: !!sizeof (struct { _Static_assert (((!!sizeof (struct { _Static_assert ( 1 , "verify_expr (" "1" ", " "(error (1, (*__errno_location ()), dcgettext (((void *)0), \"cannot find name for user ID %lu\", 5), (unsigned long int) uid), assume (false))" ")"); int _gl_dummy; })) ? ((error ( 1 , (*...nsigned long int) uid), (( 0 ) ? (void) 0 : __builtin_unreachable ()))) : ((error ( 1 , (*__errno_location ()) , dcgettext (((void *)0), "cannot find name for user ID %lu" , 5) , (unsigned long int) uid), (( 0 ) ? (void) 0 : __builtin_unreachable ())))) ; never executed: ((!!sizeof (struct { _Static_assert ( 1 , "verify_expr (" "1" ", " "(error (1, (*__errno_location ()), dcgettext (((void *)0), \"cannot find name for user ID %lu\", 5), (unsigned long int) uid), assume (false))" ")"); int _gl_dummy; })) ? ((error ( 1 , (*...nsigned long int) uid), (( 0 ) ? (void) 0 : __builtin_unreachable ()))) : ((error ( 1 , (*__errno_location ()) , dcgettext (((void *)0), "cannot find name for user ID %lu" , 5) , (unsigned long int) uid), (( 0 ) ? (void) 0 : __builtin_unreachable ())))) ; | 0 | ||||||||||||
119 | 1 never executed: ((!!sizeof (struct { _Static_assert ( 1 , "verify_expr (" "1" ", " "(error (1, (*__errno_location ()), dcgettext (((void *)0), \"cannot find name for user ID %lu\", 5), (unsigned long int) uid), assume (false))" ")"); int _gl_dummy; })) ? ((error ( 1 , (*...nsigned long int) uid), (( 0 ) ? (void) 0 : __builtin_unreachable ()))) : ((error ( 1 , (*__errno_location ()) , dcgettext (((void *)0), "cannot find name for user ID %lu" , 5) , (unsigned long int) uid), (( 0 ) ? (void) 0 : __builtin_unreachable ())))) ; | 0 | ||||||||||||
120 | , "verify_expr (" "1" ", " "(error (1, (*__errno_location ()), dcgettext (((void *)0), \"cannot find name for user ID %lu\", 5), (unsigned long int) uid), assume (false))" ")"); int _gl_dummy; })) ? ((error ( never executed: ((!!sizeof (struct { _Static_assert ( 1 , "verify_expr (" "1" ", " "(error (1, (*__errno_location ()), dcgettext (((void *)0), \"cannot find name for user ID %lu\", 5), (unsigned long int) uid), assume (false))" ")"); int _gl_dummy; })) ? ((error ( 1 , (*...nsigned long int) uid), (( 0 ) ? (void) 0 : __builtin_unreachable ()))) : ((error ( 1 , (*__errno_location ()) , dcgettext (((void *)0), "cannot find name for user ID %lu" , 5) , (unsigned long int) uid), (( 0 ) ? (void) 0 : __builtin_unreachable ())))) ; | 0 | ||||||||||||
121 | 1 never executed: ((!!sizeof (struct { _Static_assert ( 1 , "verify_expr (" "1" ", " "(error (1, (*__errno_location ()), dcgettext (((void *)0), \"cannot find name for user ID %lu\", 5), (unsigned long int) uid), assume (false))" ")"); int _gl_dummy; })) ? ((error ( 1 , (*...nsigned long int) uid), (( 0 ) ? (void) 0 : __builtin_unreachable ()))) : ((error ( 1 , (*__errno_location ()) , dcgettext (((void *)0), "cannot find name for user ID %lu" , 5) , (unsigned long int) uid), (( 0 ) ? (void) 0 : __builtin_unreachable ())))) ; | 0 | ||||||||||||
122 | , never executed: ((!!sizeof (struct { _Static_assert ( 1 , "verify_expr (" "1" ", " "(error (1, (*__errno_location ()), dcgettext (((void *)0), \"cannot find name for user ID %lu\", 5), (unsigned long int) uid), assume (false))" ")"); int _gl_dummy; })) ? ((error ( 1 , (*...nsigned long int) uid), (( 0 ) ? (void) 0 : __builtin_unreachable ()))) : ((error ( 1 , (*__errno_location ()) , dcgettext (((void *)0), "cannot find name for user ID %lu" , 5) , (unsigned long int) uid), (( 0 ) ? (void) 0 : __builtin_unreachable ())))) ; | 0 | ||||||||||||
123 | (*__errno_location ()) never executed: ((!!sizeof (struct { _Static_assert ( 1 , "verify_expr (" "1" ", " "(error (1, (*__errno_location ()), dcgettext (((void *)0), \"cannot find name for user ID %lu\", 5), (unsigned long int) uid), assume (false))" ")"); int _gl_dummy; })) ? ((error ( 1 , (*...nsigned long int) uid), (( 0 ) ? (void) 0 : __builtin_unreachable ()))) : ((error ( 1 , (*__errno_location ()) , dcgettext (((void *)0), "cannot find name for user ID %lu" , 5) , (unsigned long int) uid), (( 0 ) ? (void) 0 : __builtin_unreachable ())))) ; | 0 | ||||||||||||
124 | , never executed: ((!!sizeof (struct { _Static_assert ( 1 , "verify_expr (" "1" ", " "(error (1, (*__errno_location ()), dcgettext (((void *)0), \"cannot find name for user ID %lu\", 5), (unsigned long int) uid), assume (false))" ")"); int _gl_dummy; })) ? ((error ( 1 , (*...nsigned long int) uid), (( 0 ) ? (void) 0 : __builtin_unreachable ()))) : ((error ( 1 , (*__errno_location ()) , dcgettext (((void *)0), "cannot find name for user ID %lu" , 5) , (unsigned long int) uid), (( 0 ) ? (void) 0 : __builtin_unreachable ())))) ; | 0 | ||||||||||||
125 | dcgettext (((void *)0), never executed: ((!!sizeof (struct { _Static_assert ( 1 , "verify_expr (" "1" ", " "(error (1, (*__errno_location ()), dcgettext (((void *)0), \"cannot find name for user ID %lu\", 5), (unsigned long int) uid), assume (false))" ")"); int _gl_dummy; })) ? ((error ( 1 , (*...nsigned long int) uid), (( 0 ) ? (void) 0 : __builtin_unreachable ()))) : ((error ( 1 , (*__errno_location ()) , dcgettext (((void *)0), "cannot find name for user ID %lu" , 5) , (unsigned long int) uid), (( 0 ) ? (void) 0 : __builtin_unreachable ())))) ; | 0 | ||||||||||||
126 | "cannot find name for user ID %lu" never executed: ((!!sizeof (struct { _Static_assert ( 1 , "verify_expr (" "1" ", " "(error (1, (*__errno_location ()), dcgettext (((void *)0), \"cannot find name for user ID %lu\", 5), (unsigned long int) uid), assume (false))" ")"); int _gl_dummy; })) ? ((error ( 1 , (*...nsigned long int) uid), (( 0 ) ? (void) 0 : __builtin_unreachable ()))) : ((error ( 1 , (*__errno_location ()) , dcgettext (((void *)0), "cannot find name for user ID %lu" , 5) , (unsigned long int) uid), (( 0 ) ? (void) 0 : __builtin_unreachable ())))) ; | 0 | ||||||||||||
127 | , 5) never executed: ((!!sizeof (struct { _Static_assert ( 1 , "verify_expr (" "1" ", " "(error (1, (*__errno_location ()), dcgettext (((void *)0), \"cannot find name for user ID %lu\", 5), (unsigned long int) uid), assume (false))" ")"); int _gl_dummy; })) ? ((error ( 1 , (*...nsigned long int) uid), (( 0 ) ? (void) 0 : __builtin_unreachable ()))) : ((error ( 1 , (*__errno_location ()) , dcgettext (((void *)0), "cannot find name for user ID %lu" , 5) , (unsigned long int) uid), (( 0 ) ? (void) 0 : __builtin_unreachable ())))) ; | 0 | ||||||||||||
128 | , (unsigned long int) uid), (( never executed: ((!!sizeof (struct { _Static_assert ( 1 , "verify_expr (" "1" ", " "(error (1, (*__errno_location ()), dcgettext (((void *)0), \"cannot find name for user ID %lu\", 5), (unsigned long int) uid), assume (false))" ")"); int _gl_dummy; })) ? ((error ( 1 , (*...nsigned long int) uid), (( 0 ) ? (void) 0 : __builtin_unreachable ()))) : ((error ( 1 , (*__errno_location ()) , dcgettext (((void *)0), "cannot find name for user ID %lu" , 5) , (unsigned long int) uid), (( 0 ) ? (void) 0 : __builtin_unreachable ())))) ; | 0 | ||||||||||||
129 | 0 never executed: ((!!sizeof (struct { _Static_assert ( 1 , "verify_expr (" "1" ", " "(error (1, (*__errno_location ()), dcgettext (((void *)0), \"cannot find name for user ID %lu\", 5), (unsigned long int) uid), assume (false))" ")"); int _gl_dummy; })) ? ((error ( 1 , (*...nsigned long int) uid), (( 0 ) ? (void) 0 : __builtin_unreachable ()))) : ((error ( 1 , (*__errno_location ()) , dcgettext (((void *)0), "cannot find name for user ID %lu" , 5) , (unsigned long int) uid), (( 0 ) ? (void) 0 : __builtin_unreachable ())))) ; | 0 | ||||||||||||
130 | ) ? (void) 0 : __builtin_unreachable ()))) : ((error ( never executed: ((!!sizeof (struct { _Static_assert ( 1 , "verify_expr (" "1" ", " "(error (1, (*__errno_location ()), dcgettext (((void *)0), \"cannot find name for user ID %lu\", 5), (unsigned long int) uid), assume (false))" ")"); int _gl_dummy; })) ? ((error ( 1 , (*...nsigned long int) uid), (( 0 ) ? (void) 0 : __builtin_unreachable ()))) : ((error ( 1 , (*__errno_location ()) , dcgettext (((void *)0), "cannot find name for user ID %lu" , 5) , (unsigned long int) uid), (( 0 ) ? (void) 0 : __builtin_unreachable ())))) ; | 0 | ||||||||||||
131 | 1 never executed: ((!!sizeof (struct { _Static_assert ( 1 , "verify_expr (" "1" ", " "(error (1, (*__errno_location ()), dcgettext (((void *)0), \"cannot find name for user ID %lu\", 5), (unsigned long int) uid), assume (false))" ")"); int _gl_dummy; })) ? ((error ( 1 , (*...nsigned long int) uid), (( 0 ) ? (void) 0 : __builtin_unreachable ()))) : ((error ( 1 , (*__errno_location ()) , dcgettext (((void *)0), "cannot find name for user ID %lu" , 5) , (unsigned long int) uid), (( 0 ) ? (void) 0 : __builtin_unreachable ())))) ; | 0 | ||||||||||||
132 | , never executed: ((!!sizeof (struct { _Static_assert ( 1 , "verify_expr (" "1" ", " "(error (1, (*__errno_location ()), dcgettext (((void *)0), \"cannot find name for user ID %lu\", 5), (unsigned long int) uid), assume (false))" ")"); int _gl_dummy; })) ? ((error ( 1 , (*...nsigned long int) uid), (( 0 ) ? (void) 0 : __builtin_unreachable ()))) : ((error ( 1 , (*__errno_location ()) , dcgettext (((void *)0), "cannot find name for user ID %lu" , 5) , (unsigned long int) uid), (( 0 ) ? (void) 0 : __builtin_unreachable ())))) ; | 0 | ||||||||||||
133 | (*__errno_location ()) never executed: ((!!sizeof (struct { _Static_assert ( 1 , "verify_expr (" "1" ", " "(error (1, (*__errno_location ()), dcgettext (((void *)0), \"cannot find name for user ID %lu\", 5), (unsigned long int) uid), assume (false))" ")"); int _gl_dummy; })) ? ((error ( 1 , (*...nsigned long int) uid), (( 0 ) ? (void) 0 : __builtin_unreachable ()))) : ((error ( 1 , (*__errno_location ()) , dcgettext (((void *)0), "cannot find name for user ID %lu" , 5) , (unsigned long int) uid), (( 0 ) ? (void) 0 : __builtin_unreachable ())))) ; | 0 | ||||||||||||
134 | , never executed: ((!!sizeof (struct { _Static_assert ( 1 , "verify_expr (" "1" ", " "(error (1, (*__errno_location ()), dcgettext (((void *)0), \"cannot find name for user ID %lu\", 5), (unsigned long int) uid), assume (false))" ")"); int _gl_dummy; })) ? ((error ( 1 , (*...nsigned long int) uid), (( 0 ) ? (void) 0 : __builtin_unreachable ()))) : ((error ( 1 , (*__errno_location ()) , dcgettext (((void *)0), "cannot find name for user ID %lu" , 5) , (unsigned long int) uid), (( 0 ) ? (void) 0 : __builtin_unreachable ())))) ; | 0 | ||||||||||||
135 | dcgettext (((void *)0), never executed: ((!!sizeof (struct { _Static_assert ( 1 , "verify_expr (" "1" ", " "(error (1, (*__errno_location ()), dcgettext (((void *)0), \"cannot find name for user ID %lu\", 5), (unsigned long int) uid), assume (false))" ")"); int _gl_dummy; })) ? ((error ( 1 , (*...nsigned long int) uid), (( 0 ) ? (void) 0 : __builtin_unreachable ()))) : ((error ( 1 , (*__errno_location ()) , dcgettext (((void *)0), "cannot find name for user ID %lu" , 5) , (unsigned long int) uid), (( 0 ) ? (void) 0 : __builtin_unreachable ())))) ; | 0 | ||||||||||||
136 | "cannot find name for user ID %lu" never executed: ((!!sizeof (struct { _Static_assert ( 1 , "verify_expr (" "1" ", " "(error (1, (*__errno_location ()), dcgettext (((void *)0), \"cannot find name for user ID %lu\", 5), (unsigned long int) uid), assume (false))" ")"); int _gl_dummy; })) ? ((error ( 1 , (*...nsigned long int) uid), (( 0 ) ? (void) 0 : __builtin_unreachable ()))) : ((error ( 1 , (*__errno_location ()) , dcgettext (((void *)0), "cannot find name for user ID %lu" , 5) , (unsigned long int) uid), (( 0 ) ? (void) 0 : __builtin_unreachable ())))) ; | 0 | ||||||||||||
137 | , 5) never executed: ((!!sizeof (struct { _Static_assert ( 1 , "verify_expr (" "1" ", " "(error (1, (*__errno_location ()), dcgettext (((void *)0), \"cannot find name for user ID %lu\", 5), (unsigned long int) uid), assume (false))" ")"); int _gl_dummy; })) ? ((error ( 1 , (*...nsigned long int) uid), (( 0 ) ? (void) 0 : __builtin_unreachable ()))) : ((error ( 1 , (*__errno_location ()) , dcgettext (((void *)0), "cannot find name for user ID %lu" , 5) , (unsigned long int) uid), (( 0 ) ? (void) 0 : __builtin_unreachable ())))) ; | 0 | ||||||||||||
138 | , (unsigned long int) uid), (( never executed: ((!!sizeof (struct { _Static_assert ( 1 , "verify_expr (" "1" ", " "(error (1, (*__errno_location ()), dcgettext (((void *)0), \"cannot find name for user ID %lu\", 5), (unsigned long int) uid), assume (false))" ")"); int _gl_dummy; })) ? ((error ( 1 , (*...nsigned long int) uid), (( 0 ) ? (void) 0 : __builtin_unreachable ()))) : ((error ( 1 , (*__errno_location ()) , dcgettext (((void *)0), "cannot find name for user ID %lu" , 5) , (unsigned long int) uid), (( 0 ) ? (void) 0 : __builtin_unreachable ())))) ; | 0 | ||||||||||||
139 | 0 never executed: ((!!sizeof (struct { _Static_assert ( 1 , "verify_expr (" "1" ", " "(error (1, (*__errno_location ()), dcgettext (((void *)0), \"cannot find name for user ID %lu\", 5), (unsigned long int) uid), assume (false))" ")"); int _gl_dummy; })) ? ((error ( 1 , (*...nsigned long int) uid), (( 0 ) ? (void) 0 : __builtin_unreachable ()))) : ((error ( 1 , (*__errno_location ()) , dcgettext (((void *)0), "cannot find name for user ID %lu" , 5) , (unsigned long int) uid), (( 0 ) ? (void) 0 : __builtin_unreachable ())))) ; | 0 | ||||||||||||
140 | ) ? (void) 0 : __builtin_unreachable ())))) never executed: ((!!sizeof (struct { _Static_assert ( 1 , "verify_expr (" "1" ", " "(error (1, (*__errno_location ()), dcgettext (((void *)0), \"cannot find name for user ID %lu\", 5), (unsigned long int) uid), assume (false))" ")"); int _gl_dummy; })) ? ((error ( 1 , (*...nsigned long int) uid), (( 0 ) ? (void) 0 : __builtin_unreachable ()))) : ((error ( 1 , (*__errno_location ()) , dcgettext (((void *)0), "cannot find name for user ID %lu" , 5) , (unsigned long int) uid), (( 0 ) ? (void) 0 : __builtin_unreachable ())))) ; | 0 | ||||||||||||
141 | ; never executed: ((!!sizeof (struct { _Static_assert ( 1 , "verify_expr (" "1" ", " "(error (1, (*__errno_location ()), dcgettext (((void *)0), \"cannot find name for user ID %lu\", 5), (unsigned long int) uid), assume (false))" ")"); int _gl_dummy; })) ? ((error ( 1 , (*...nsigned long int) uid), (( 0 ) ? (void) 0 : __builtin_unreachable ()))) : ((error ( 1 , (*__errno_location ()) , dcgettext (((void *)0), "cannot find name for user ID %lu" , 5) , (unsigned long int) uid), (( 0 ) ? (void) 0 : __builtin_unreachable ())))) ; | 0 | ||||||||||||
142 | puts (pw->pw_name); | - | ||||||||||||
143 | return executed 1 time by 1 test: return 0 ; Executed by:
executed 1 time by 1 test: return 0 ; Executed by:
| 1 | ||||||||||||
144 | 0 executed 1 time by 1 test: return 0 ; Executed by:
| 1 | ||||||||||||
145 | ; executed 1 time by 1 test: return 0 ; Executed by:
| 1 | ||||||||||||
146 | } | - | ||||||||||||
Switch to Source code | Preprocessed file |