summaryrefslogtreecommitdiff
path: root/awklib/eg/lib/grcat.c
diff options
context:
space:
mode:
Diffstat (limited to 'awklib/eg/lib/grcat.c')
-rw-r--r--awklib/eg/lib/grcat.c16
1 files changed, 10 insertions, 6 deletions
diff --git a/awklib/eg/lib/grcat.c b/awklib/eg/lib/grcat.c
index 802aa639..c022dc7e 100644
--- a/awklib/eg/lib/grcat.c
+++ b/awklib/eg/lib/grcat.c
@@ -12,9 +12,13 @@
#if HAVE_CONFIG_H
#include <config.h>
#endif
+
+#if defined (STDC_HEADERS)
+#include <stdlib.h>
+#endif
-#ifndef HAVE_GETPGRENT
-int main() { exit(0); }
+#ifndef HAVE_GETGRENT
+int main() { return 0; }
#else
#include <stdio.h>
#include <grp.h>
@@ -28,8 +32,8 @@ char **argv;
int i;
while ((g = getgrent()) != NULL) {
- printf("%s:%s:%d:", g->gr_name, g->gr_passwd,
- g->gr_gid);
+ printf("%s:%s:%ld:", g->gr_name, g->gr_passwd,
+ (long) g->gr_gid);
for (i = 0; g->gr_mem[i] != NULL; i++) {
printf("%s", g->gr_mem[i]);
if (g->gr_mem[i+1] != NULL)
@@ -38,6 +42,6 @@ char **argv;
putchar('\n');
}
endgrent();
- exit(0);
+ return 0;
}
-#endif /* HAVE_GETPGRENT */
+#endif /* HAVE_GETGRENT */