aboutsummaryrefslogtreecommitdiff
path: root/src/bin
diff options
context:
space:
mode:
authorPeter Eisentraut <peter_e@gmx.net>2003-12-17 18:44:09 +0000
committerPeter Eisentraut <peter_e@gmx.net>2003-12-17 18:44:09 +0000
commitb40b3306faa36e469d52a5fa86e8cbcbd6fdbff2 (patch)
treefe8571e95b62af00b8fba3aad2bcf6811ebf7ec8 /src/bin
parent99e922a01db6d9ff7f68bea67ecfed62f2bad948 (diff)
downloadpostgresql-b40b3306faa36e469d52a5fa86e8cbcbd6fdbff2.tar.gz
postgresql-b40b3306faa36e469d52a5fa86e8cbcbd6fdbff2.zip
Remove pg_id.
Diffstat (limited to 'src/bin')
-rw-r--r--src/bin/Makefile4
-rw-r--r--src/bin/initdb/initdb.c4
-rw-r--r--src/bin/pg_id/Makefile37
-rw-r--r--src/bin/pg_id/pg_id.c133
4 files changed, 4 insertions, 174 deletions
diff --git a/src/bin/Makefile b/src/bin/Makefile
index 4c6690724ae..c2ebfc49039 100644
--- a/src/bin/Makefile
+++ b/src/bin/Makefile
@@ -5,7 +5,7 @@
# Portions Copyright (c) 1996-2002, PostgreSQL Global Development Group
# Portions Copyright (c) 1994, Regents of the University of California
#
-# $PostgreSQL: pgsql/src/bin/Makefile,v 1.40 2003/11/29 19:52:04 pgsql Exp $
+# $PostgreSQL: pgsql/src/bin/Makefile,v 1.41 2003/12/17 18:44:08 petere Exp $
#
#-------------------------------------------------------------------------
@@ -13,7 +13,7 @@ subdir = src/bin
top_builddir = ../..
include $(top_builddir)/src/Makefile.global
-DIRS := initdb initlocation ipcclean pg_ctl pg_dump pg_id \
+DIRS := initdb initlocation ipcclean pg_ctl pg_dump \
psql scripts pg_config pg_controldata pg_resetxlog \
pg_encoding
diff --git a/src/bin/initdb/initdb.c b/src/bin/initdb/initdb.c
index 0d0628a28a0..0efae260d7e 100644
--- a/src/bin/initdb/initdb.c
+++ b/src/bin/initdb/initdb.c
@@ -43,7 +43,7 @@
* Portions Copyright (c) 1994, Regents of the University of California
* Portions taken from FreeBSD.
*
- * $PostgreSQL: pgsql/src/bin/initdb/initdb.c,v 1.16 2003/12/01 23:15:47 momjian Exp $
+ * $PostgreSQL: pgsql/src/bin/initdb/initdb.c,v 1.17 2003/12/17 18:44:08 petere Exp $
*
*-------------------------------------------------------------------------
*/
@@ -649,7 +649,7 @@ exit_nicely(void)
}
/*
- * find the current user using code lifted from pg_id.c
+ * find the current user
*
* on unix make sure it isn't really root
*/
diff --git a/src/bin/pg_id/Makefile b/src/bin/pg_id/Makefile
deleted file mode 100644
index 29230f59465..00000000000
--- a/src/bin/pg_id/Makefile
+++ /dev/null
@@ -1,37 +0,0 @@
-#-------------------------------------------------------------------------
-#
-# Makefile for src/bin/pg_id
-#
-# Copyright (C) 2000 by PostgreSQL Global Development Team
-#
-# $PostgreSQL: pgsql/src/bin/pg_id/Makefile,v 1.21 2003/11/29 19:52:05 pgsql Exp $
-#
-#-------------------------------------------------------------------------
-
-subdir = src/bin/pg_id
-top_builddir = ../../..
-include $(top_builddir)/src/Makefile.global
-
-all: pg_id
-
-pg_id: pg_id.o
- $(CC) $(CFLAGS) $(LDFLAGS) $^ $(LIBS) -o $@
-
-install: all installdirs
- $(INSTALL_PROGRAM) pg_id$(X) $(DESTDIR)$(bindir)/pg_id$(X)
-
-installdirs:
- $(mkinstalldirs) $(DESTDIR)$(bindir)
-
-uninstall:
- rm -f $(DESTDIR)$(bindir)/pg_id$(X)
-
-depend dep:
- $(CC) -MM $(CFLAGS) *.c >depend
-
-clean distclean maintainer-clean:
- rm -f pg_id$(X) pg_id.o
-
-ifeq (depend,$(wildcard depend))
-include depend
-endif
diff --git a/src/bin/pg_id/pg_id.c b/src/bin/pg_id/pg_id.c
deleted file mode 100644
index 32309aa0b33..00000000000
--- a/src/bin/pg_id/pg_id.c
+++ /dev/null
@@ -1,133 +0,0 @@
-/*
- * pg_id.c
- *
- * A crippled id utility for use in various shell scripts in use by PostgreSQL
- * (in particular initdb)
- *
- * Copyright (c) 2000-2003, PostgreSQL Global Development Group
- *
- * $PostgreSQL: pgsql/src/bin/pg_id/pg_id.c,v 1.26 2003/11/29 19:52:06 pgsql Exp $
- */
-#include "postgres_fe.h"
-
-#ifdef HAVE_GETOPT_H
-#include <getopt.h>
-#endif
-
-#include <pwd.h>
-#include <stdio.h>
-#include <stdlib.h>
-#include <unistd.h>
-#include <sys/types.h>
-
-int
-main(int argc, char *argv[])
-{
- int c;
- int name_only_flag = 0,
- use_real_uid_flag = 0,
- limit_user_info = 0;
- const char *username = NULL;
- extern int optind;
-#ifndef WIN32
- struct passwd *pw;
-#else
- struct passwd_win32
- {
- int pw_uid;
- char pw_name[128];
- } pass_win32;
- struct passwd_win32 *pw = &pass_win32;
- unsigned long pwname_size = sizeof(pass_win32.pw_name) - 1;
-
- pw->pw_uid = 1;
-#endif
-
- while ((c = getopt(argc, argv, "nru")) != -1)
- {
- switch (c)
- {
- case 'n':
- name_only_flag = 1;
- break;
- case 'r':
- use_real_uid_flag = 1;
- break;
- case 'u':
- limit_user_info = 1;
- break;
- default:
-#ifndef WIN32
- fprintf(stderr, "Usage: %s [-n] [-r] [-u] [username]\n", argv[0]);
-#else
- fprintf(stderr, "Usage: %s [-n] [-r] [-u]\n", argv[0]);
-#endif
- exit(1);
- }
- }
-
- if (argc - optind >= 1)
-#ifndef WIN32
- username = argv[optind];
-#else
- {
- fprintf(stderr, "%s: specifying a username is not supported on this platform\n", argv[0]);
- exit(1);
- }
-#endif
-
- if (name_only_flag && !limit_user_info)
- {
- fprintf(stderr, "%s: -n must be used together with -u\n", argv[0]);
- exit(1);
- }
- if (username && use_real_uid_flag)
- {
- fprintf(stderr, "%s: -r cannot be used when a user name is given\n", argv[0]);
- exit(1);
- }
-
-#ifndef WIN32
- if (username)
- {
- pw = getpwnam(username);
- if (!pw)
- {
- fprintf(stderr, "%s: %s: no such user\n", argv[0], username);
- exit(1);
- }
- }
- else if (use_real_uid_flag)
- pw = getpwuid(getuid());
- else
- pw = getpwuid(geteuid());
-
- if (!pw)
- {
- perror(argv[0]);
- exit(1);
- }
-#else
- if (!use_real_uid_flag)
- {
- fprintf(stderr, "%s: -r must be used on this platform\n", argv[0]);
- exit(1);
- }
-
- GetUserName(pw->pw_name, &pwname_size);
-#endif
-
- if (!limit_user_info)
- printf("uid=%d(%s)\n", (int) pw->pw_uid, pw->pw_name);
- else if (name_only_flag)
- puts(pw->pw_name);
- else
-#ifdef __BEOS__
- if (pw->pw_uid == 0)
- printf("1\n");
- else
-#endif
- printf("%d\n", (int) pw->pw_uid);
-
- return 0;
-}