diff options
author | Mattias Andrée <maandree@kth.se> | 2021-02-23 15:23:30 +0100 |
---|---|---|
committer | Mattias Andrée <maandree@kth.se> | 2021-02-23 15:23:30 +0100 |
commit | 6ef03dcaee546215c8e5fc15fdeac43689b63f7b (patch) | |
tree | fa1dfdf2d1122446745f60f72c9b04da7acb487a /getpgrp.c | |
parent | remove dist (diff) | |
download | setpgrp-12c6f1553863aa99c0b9f1c93341886f9ac2e7f9.tar.gz setpgrp-12c6f1553863aa99c0b9f1c93341886f9ac2e7f9.tar.bz2 setpgrp-12c6f1553863aa99c0b9f1c93341886f9ac2e7f9.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.c | 34 |
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; +} |