aboutsummaryrefslogtreecommitdiffstats
path: root/getpgrp.c
diff options
context:
space:
mode:
authorMattias Andrée <maandree@kth.se>2021-02-23 15:23:30 +0100
committerMattias Andrée <maandree@kth.se>2021-02-23 15:23:30 +0100
commit6ef03dcaee546215c8e5fc15fdeac43689b63f7b (patch)
treefa1dfdf2d1122446745f60f72c9b04da7acb487a /getpgrp.c
parentremove dist (diff)
downloadsetpgrp-6ef03dcaee546215c8e5fc15fdeac43689b63f7b.tar.gz
setpgrp-6ef03dcaee546215c8e5fc15fdeac43689b63f7b.tar.bz2
setpgrp-6ef03dcaee546215c8e5fc15fdeac43689b63f7b.tar.xz
Change license, add man pages, misc2
Signed-off-by: Mattias Andrée <maandree@kth.se>
Diffstat (limited to 'getpgrp.c')
-rw-r--r--getpgrp.c34
1 files changed, 34 insertions, 0 deletions
diff --git a/getpgrp.c b/getpgrp.c
new file mode 100644
index 0000000..f3e9c81
--- /dev/null
+++ b/getpgrp.c
@@ -0,0 +1,34 @@
+/* See LICENSE file for copyright and license details. */
+#include <errno.h>
+#include <stdint.h>
+#include <stdio.h>
+#include <string.h>
+#include <unistd.h>
+
+#include "arg.h"
+
+
+char *argv0;
+
+int
+main(int argc, char *argv[])
+{
+ ARGBEGIN {
+ default:
+ goto usage;
+ } ARGEND;
+ if (argc)
+ goto usage;
+
+ printf("%ji\n", (intmax_t)getpgrp());
+ if (fflush(stdout) || ferror(stdout) || fclose(stdout)) {
+ fprintf(stderr, "%s: printf: %s\n", argv0, strerror(errno));
+ return 1;
+ }
+
+ return 0;
+
+usage:
+ fprintf(stderr, "usage: %s\n", argv0);
+ return 1;
+}