summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorAlejandro Colomar <alx@kernel.org>2024-01-18 01:30:23 +0100
committerSerge Hallyn <serge@hallyn.com>2024-03-14 16:16:15 -0500
commitefd169e010f8c4dc7b6167e775dfae6b869150d5 (patch)
tree08ed4f46c9a666a8bac843c0ea7ed03c7b50dfca
parentda440b536ccdb2ec1b56ab7525b721073b5af61d (diff)
lib/, src/: Use int main(void) where appropriate
Remove /*ARGSUSED*/ comments. Instead, use appropriate declarators for main(). ISO C allows using int main(void) if the parameters are going to be unused. Also, do some cosmetic changes in the uses of argc and argv, to show where they are used. And use *argv[], instead of **argv. Array notation is friendlier, IMO. Signed-off-by: Alejandro Colomar <alx@kernel.org>
-rw-r--r--lib/getdate.y5
-rw-r--r--src/id.c10
-rw-r--r--src/sulogin.c14
3 files changed, 13 insertions, 16 deletions
diff --git a/lib/getdate.y b/lib/getdate.y
index 4b37fe70..8cea2cc4 100644
--- a/lib/getdate.y
+++ b/lib/getdate.y
@@ -923,11 +923,8 @@ time_t get_date (const char *p, const time_t *now)
#if defined (TEST)
-/* ARGSUSED */
int
-main (ac, av)
- int ac;
- char *av[];
+main(void)
{
char buff[MAX_BUFF_LEN + 1];
time_t d;
diff --git a/src/id.c b/src/id.c
index b4681bb1..673693e0 100644
--- a/src/id.c
+++ b/src/id.c
@@ -36,7 +36,8 @@ static void usage (void)
exit (EXIT_FAILURE);
}
- /*ARGSUSED*/ int main (int argc, char **argv)
+int
+main(int argc, char *argv[])
{
uid_t ruid, euid;
gid_t rgid, egid;
@@ -74,11 +75,10 @@ static void usage (void)
*/
if (argc > 1) {
- if ((argc > 2) || (strcmp (argv[1], "-a") != 0)) {
- usage ();
- } else {
+ if (argc > 2 || strcmp(argv[1], "-a") != 0)
+ usage();
+ else
aflg = true;
- }
}
ruid = getuid ();
diff --git a/src/sulogin.c b/src/sulogin.c
index f4e42ab8..244a2acd 100644
--- a/src/sulogin.c
+++ b/src/sulogin.c
@@ -53,8 +53,8 @@ static void catch_signals (MAYBE_UNUSED int sig)
}
-/*ARGSUSED*/ int
-main(int argc, char **argv)
+int
+main(int argc, char *argv[])
{
int err = 0;
char **envp = environ;
@@ -78,13 +78,13 @@ main(int argc, char **argv)
(void) bindtextdomain (PACKAGE, LOCALEDIR);
(void) textdomain (PACKAGE);
- initenv ();
+ initenv();
if (argc > 1) {
- close (0);
- close (1);
- close (2);
+ close(0);
+ close(1);
+ close(2);
- if (open (argv[1], O_RDWR) >= 0) {
+ if (open(argv[1], O_RDWR) >= 0) {
dup (0);
dup (0);
} else {