summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorJakob Kaivo <jkk@ung.org>2022-04-10 21:04:49 -0400
committerJakob Kaivo <jkk@ung.org>2022-04-10 21:04:49 -0400
commit780e6834cc16dcef23315f49b2db3f5e6f821aae (patch)
tree5ce7a0201982a3f4a05ddfbadf3c0dff1e1b3e12
parentef19c7338171c93cb13d08bf3860ee41ae826a95 (diff)
add setlocale() to localize potential error messages from getopt()HEADmaster
-rw-r--r--dirname.c10
1 files changed, 5 insertions, 5 deletions
diff --git a/dirname.c b/dirname.c
index a43414c..fc21fc7 100644
--- a/dirname.c
+++ b/dirname.c
@@ -1,7 +1,7 @@
/*
* UNG's Not GNU
*
- * Copyright (c) 2011-2017, Jakob Kaivo <jkk@ung.org>
+ * Copyright (c) 2011-2022, Jakob Kaivo <jkk@ung.org>
*
* Permission to use, copy, modify, and/or distribute this software for any
* purpose with or without fee is hereby granted, provided that the above
@@ -19,20 +19,20 @@
#define _XOPEN_SOURCE 700
#include <stdio.h>
+#include <locale.h>
#include <libgen.h>
#include <unistd.h>
-/*d Give the directory portion of a pathname d*/
-/*a string a*/
-
int main(int argc, char *argv[])
{
+ setlocale(LC_ALL, "");
+
while (getopt(argc, argv, "") != -1) {
return 1;
}
if (optind != argc - 1) {
- fprintf(stderr, "dirname: Requires exactly one pathname\n");
+ fprintf(stderr, "dirname: provide exactly one operand\n");
return 1;
}