Set exit status accordingly in printenv(1)

This commit is contained in:
sin 2014-11-16 13:13:31 +00:00
parent 3fa0a358b1
commit b200a6e75f

View File

@ -16,6 +16,7 @@ int
main(int argc, char *argv[]) main(int argc, char *argv[])
{ {
char *var; char *var;
int ret = 0;
ARGBEGIN { ARGBEGIN {
default: default:
@ -29,8 +30,10 @@ main(int argc, char *argv[])
while (*argv) { while (*argv) {
if ((var = getenv(*argv))) if ((var = getenv(*argv)))
printf("%s\n", var); printf("%s\n", var);
else
ret = 1;
argv++; argv++;
} }
} }
return 0; return ret;
} }