From 6ef03dcaee546215c8e5fc15fdeac43689b63f7b Mon Sep 17 00:00:00 2001 From: Mattias Andrée Date: Tue, 23 Feb 2021 15:23:30 +0100 Subject: Change license, add man pages, misc MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Signed-off-by: Mattias Andrée --- getpgrp.c | 34 ++++++++++++++++++++++++++++++++++ 1 file changed, 34 insertions(+) create mode 100644 getpgrp.c (limited to 'getpgrp.c') 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 +#include +#include +#include +#include + +#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; +} -- cgit v1.2.3-70-g09d2