The old version in some cases (but not always) returns -1 (255) on
error. It seems better to cleanup the code and don't return internal
return codes by exit().
Signed-off-by: Karel Zak <kzak@redhat.com>
.TP
.B "-v, \-\-version"
Print version information and exit.
+.SH "EXIT STATUS"
+Returns 0 if operation was successful, 1 if operation failed or command syntax was not valid.
.SH "SEE ALSO"
.BR finger (1),
.BR passwd (5)
uid_t uid;
struct finfo oldf, newf;
int interactive;
- int status;
sanitize_env();
setlocale(LC_ALL, ""); /* both for messages and for iscntrl() below */
printf(_("Finger information not changed.\n"));
return EXIT_SUCCESS;
}
- status = save_new_data(&oldf);
- return status;
+
+ return save_new_data(&oldf) == 0 ? EXIT_SUCCESS : EXIT_FAILURE;
}
/*
default:
usage(stderr);
}
- if (status < 0)
- exit(status);
+ if (status != 0)
+ exit(EXIT_FAILURE);
}
/* done parsing arguments. check for a username. */
if (optind < argc) {
usage(stderr);
pinfo->username = argv[optind];
}
- return (!info_given);
+ return !info_given;
}
/*