Commit 4060f075 authored by Bruce Momjian's avatar Bruce Momjian

Rename variables for clarity.

parent 92aa4622
...@@ -6,7 +6,7 @@ ...@@ -6,7 +6,7 @@
* *
* Copyright (c) 2000-2003, PostgreSQL Global Development Group * Copyright (c) 2000-2003, PostgreSQL Global Development Group
* *
* $Header: /cvsroot/pgsql/src/bin/pg_id/Attic/pg_id.c,v 1.22 2003/08/09 01:25:46 momjian Exp $ * $Header: /cvsroot/pgsql/src/bin/pg_id/Attic/pg_id.c,v 1.23 2003/09/06 01:41:56 momjian Exp $
*/ */
#include "postgres_fe.h" #include "postgres_fe.h"
...@@ -24,9 +24,9 @@ int ...@@ -24,9 +24,9 @@ int
main(int argc, char *argv[]) main(int argc, char *argv[])
{ {
int c; int c;
int nameflag = 0, int name_only_flag = 0,
realflag = 0, use_real_uid_flag = 0,
userflag = 0; limit_user_info = 0;
const char *username = NULL; const char *username = NULL;
struct passwd *pw; struct passwd *pw;
...@@ -38,13 +38,13 @@ main(int argc, char *argv[]) ...@@ -38,13 +38,13 @@ main(int argc, char *argv[])
switch (c) switch (c)
{ {
case 'n': case 'n':
nameflag = 1; name_only_flag = 1;
break; break;
case 'r': case 'r':
realflag = 1; use_real_uid_flag = 1;
break; break;
case 'u': case 'u':
userflag = 1; limit_user_info = 1;
break; break;
default: default:
fprintf(stderr, "Usage: %s [-n] [-r] [-u] [username]\n", argv[0]); fprintf(stderr, "Usage: %s [-n] [-r] [-u] [username]\n", argv[0]);
...@@ -55,12 +55,12 @@ main(int argc, char *argv[]) ...@@ -55,12 +55,12 @@ main(int argc, char *argv[])
if (argc - optind >= 1) if (argc - optind >= 1)
username = argv[optind]; username = argv[optind];
if (nameflag && !userflag) if (name_only_flag && !limit_user_info)
{ {
fprintf(stderr, "%s: -n must be used together with -u\n", argv[0]); fprintf(stderr, "%s: -n must be used together with -u\n", argv[0]);
exit(1); exit(1);
} }
if (username && realflag) if (username && use_real_uid_flag)
{ {
fprintf(stderr, "%s: -r cannot be used when a user name is given\n", argv[0]); fprintf(stderr, "%s: -r cannot be used when a user name is given\n", argv[0]);
exit(1); exit(1);
...@@ -76,7 +76,7 @@ main(int argc, char *argv[]) ...@@ -76,7 +76,7 @@ main(int argc, char *argv[])
exit(1); exit(1);
} }
} }
else if (realflag) else if (use_real_uid_flag)
pw = getpwuid(getuid()); pw = getpwuid(getuid());
else else
pw = getpwuid(geteuid()); pw = getpwuid(geteuid());
...@@ -87,9 +87,9 @@ main(int argc, char *argv[]) ...@@ -87,9 +87,9 @@ main(int argc, char *argv[])
exit(1); exit(1);
} }
if (!userflag) if (!limit_user_info)
printf("uid=%d(%s)\n", (int) pw->pw_uid, pw->pw_name); printf("uid=%d(%s)\n", (int) pw->pw_uid, pw->pw_name);
else if (nameflag) else if (name_only_flag)
puts(pw->pw_name); puts(pw->pw_name);
else else
#ifdef __BEOS__ #ifdef __BEOS__
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment