Fixup PROGNAME

This commit is contained in:
Pierre Pronchery 2020-12-08 14:46:02 +01:00
parent 4b26da1d86
commit 23ec5395cf

View File

@ -23,6 +23,11 @@
#include <pwd.h> #include <pwd.h>
#include <grp.h> #include <grp.h>
/* constants */
#ifndef PROGNAME
# define PROGNAME "id"
#endif
/* id */ /* id */
static int _id_error(char const * message, int ret); static int _id_error(char const * message, int ret);
@ -45,7 +50,7 @@ static int _id(char const * user, int flag, int flagn, int flagr)
/* _id_error */ /* _id_error */
static int _id_error(char const * message, int ret) static int _id_error(char const * message, int ret)
{ {
fputs("id: ", stderr); fputs(PROGNAME ": ", stderr);
perror(message); perror(message);
return ret; return ret;
} }
@ -261,7 +266,7 @@ static struct group * _print_gid(gid_t gid)
/* usage */ /* usage */
static int _usage(void) static int _usage(void)
{ {
fputs("Usage: id [-Ggu][-nr] [user]\n\ fputs("Usage: " PROGNAME " [-Ggu][-nr] [user]\n\
-G Output all different group IDs\n\ -G Output all different group IDs\n\
-g Output only the effective group ID\n\ -g Output only the effective group ID\n\
-u Output only the effective user ID\n\ -u Output only the effective user ID\n\