From 800d24aad29a47942ed455cda4f79409aafd3675 Mon Sep 17 00:00:00 2001 From: Jakob Kaivo Date: Mon, 15 Jul 2019 11:35:18 -0400 Subject: strerror with error messages only --- strerror.c | 20 ++++++++++++++++++++ 1 file changed, 20 insertions(+) create mode 100644 strerror.c (limited to 'strerror.c') diff --git a/strerror.c b/strerror.c new file mode 100644 index 0000000..e7b1695 --- /dev/null +++ b/strerror.c @@ -0,0 +1,20 @@ +#include +#include +#include + +int main(int argc, char *argv[]) +{ + int n = 1; + + if (argc < 2) { + printf("Usage: %s errno...\n", argv[0]); + return 1; + } + + do { + int err = atoi(argv[n]); + printf("%d: %s\n", err, strerror(err)); + } while (argv[++n]); + + return 0; +} -- cgit v1.2.1