From b40b3306faa36e469d52a5fa86e8cbcbd6fdbff2 Mon Sep 17 00:00:00 2001 From: Peter Eisentraut Date: Wed, 17 Dec 2003 18:44:09 +0000 Subject: [PATCH] Remove pg_id. --- src/bin/Makefile | 4 +- src/bin/initdb/initdb.c | 4 +- src/bin/pg_id/Makefile | 37 -------------- src/bin/pg_id/pg_id.c | 133 ------------------------------------------------ 4 files changed, 4 insertions(+), 174 deletions(-) delete mode 100644 src/bin/pg_id/Makefile delete mode 100644 src/bin/pg_id/pg_id.c diff --git a/src/bin/Makefile b/src/bin/Makefile index 4c6690724a..c2ebfc4903 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 0d0628a28a..0efae260d7 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 29230f5946..0000000000 --- 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 32309aa0b3..0000000000 --- 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 -#endif - -#include -#include -#include -#include -#include - -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; -} -- 2.11.0