OpenCoverage

whoami.c

Absolute File Name:/home/opencoverage/opencoverage/guest-scripts/coreutils/src/src/whoami.c
Switch to Source codePreprocessed file
LineSourceCount
1-
2-
3-
4-
5-
6-
7-
8-
9static struct option const long_options[] =-
10{-
11 {-
12 ((void *)0)-
13 , 0, -
14 ((void *)0)-
15 , 0}-
16};-
17-
18void-
19usage (int status)-
20{-
21 if (status !=
status != 0Description
TRUEevaluated 3 times by 1 test
Evaluated by:
  • whoami
FALSEevaluated 3 times by 1 test
Evaluated by:
  • whoami
3
22 0
status != 0Description
TRUEevaluated 3 times by 1 test
Evaluated by:
  • whoami
FALSEevaluated 3 times by 1 test
Evaluated by:
  • whoami
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: end of block
Executed by:
  • whoami
while (0);
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:
  • whoami
3
65 exit (status);
executed 6 times by 1 test: exit (status);
Executed by:
  • whoami
6
66}-
67-
68int-
69main (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,
getopt_long (a...d *)0) ) != -1Description
TRUEevaluated 3 times by 1 test
Evaluated by:
  • whoami
FALSEevaluated 1 time by 1 test
Evaluated by:
  • whoami
1-3
90 ((void *)0)
getopt_long (a...d *)0) ) != -1Description
TRUEevaluated 3 times by 1 test
Evaluated by:
  • whoami
FALSEevaluated 1 time by 1 test
Evaluated by:
  • whoami
1-3
91 ) != -1
getopt_long (a...d *)0) ) != -1Description
TRUEevaluated 3 times by 1 test
Evaluated by:
  • whoami
FALSEevaluated 1 time by 1 test
Evaluated by:
  • whoami
)
1-3
92 usage (
executed 3 times by 1 test: usage ( 1 );
Executed by:
  • whoami
3
93 1
executed 3 times by 1 test: usage ( 1 );
Executed by:
  • whoami
3
94 );
executed 3 times by 1 test: usage ( 1 );
Executed by:
  • whoami
3
95-
96 if (optind != argc
optind != argcDescription
TRUEnever evaluated
FALSEevaluated 1 time by 1 test
Evaluated by:
  • whoami
)
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
uid == NO_UIDDescription
TRUEnever evaluated
FALSEevaluated 1 time by 1 test
Evaluated by:
  • whoami
&&
0-1
113 (*
(*__errno_location ())Description
TRUEnever evaluated
FALSEnever evaluated
__errno_location ())
(*__errno_location ())Description
TRUEnever evaluated
FALSEnever evaluated
0
114 ? -
115 ((void *)0) -
116 : getpwuid (uid));-
117 if (!pw
!pwDescription
TRUEnever evaluated
FALSEevaluated 1 time by 1 test
Evaluated by:
  • whoami
)
0-1
118 ((
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 ())))) ;
!!sizeof (struct { _Static_assert (
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:
  • whoami
executed 1 time by 1 test: return 0 ;
Executed by:
  • whoami
1
144 0
executed 1 time by 1 test: return 0 ;
Executed by:
  • whoami
1
145 ;
executed 1 time by 1 test: return 0 ;
Executed by:
  • whoami
1
146}-
Switch to Source codePreprocessed file

Generated by Squish Coco 4.1.2