commit b200a6e75f4885c3e91acccdea231a2a32cbc187
parent 3fa0a358b1cd599bc699b4d338eb3df6ff69d071
Author: sin <sin@2f30.org>
Date: Sun, 16 Nov 2014 13:13:31 +0000
Set exit status accordingly in printenv(1)
Diffstat:
1 file changed, 4 insertions(+), 1 deletion(-)
diff --git a/printenv.c b/printenv.c
@@ -16,6 +16,7 @@ int
main(int argc, char *argv[])
{
char *var;
+ int ret = 0;
ARGBEGIN {
default:
@@ -29,8 +30,10 @@ main(int argc, char *argv[])
while (*argv) {
if ((var = getenv(*argv)))
printf("%s\n", var);
+ else
+ ret = 1;
argv++;
}
}
- return 0;
+ return ret;
}