mirror of https://github.com/postgres/postgres
removed pg_id fixed a few bugs in the scriptsREL7_0_PATCHES
parent
ea1f6e00e6
commit
65e0051843
@ -1,46 +0,0 @@ |
||||
#-------------------------------------------------------------------------
|
||||
#
|
||||
# Makefile.inc--
|
||||
# Makefile for bin/pg_id
|
||||
#
|
||||
# Copyright (c) 1994, Regents of the University of California
|
||||
#
|
||||
#
|
||||
# IDENTIFICATION
|
||||
# $Header: /cvsroot/pgsql/src/bin/pg_id/Attic/Makefile,v 1.12 1999/01/17 06:19:10 momjian Exp $
|
||||
#
|
||||
#-------------------------------------------------------------------------
|
||||
|
||||
SRCDIR= ../..
|
||||
include ../../Makefile.global |
||||
|
||||
OBJS= pg_id.o
|
||||
|
||||
#
|
||||
# And where libpq goes, so goes the authentication stuff...
|
||||
#
|
||||
ifdef KRBVERS |
||||
LDFLAGS+= $(KRBLIBS)
|
||||
CFLAGS+= $(KRBFLAGS)
|
||||
endif |
||||
|
||||
all: pg_id |
||||
|
||||
pg_id: $(OBJS) $(LIBPQDIR)/libpq.a |
||||
$(CC) -o pg_id -L$(LIBPQDIR) $(OBJS) -lpq $(LDFLAGS)
|
||||
|
||||
$(LIBPQDIR)/libpq.a: |
||||
$(MAKE) -C $(LIBPQDIR) libpq.a
|
||||
|
||||
install: pg_id |
||||
$(INSTALL) $(INSTL_EXE_OPTS) pg_id$(X) $(BINDIR)/pg_id$(X)
|
||||
|
||||
depend dep: |
||||
$(CC) -MM $(CFLAGS) *.c >depend
|
||||
|
||||
clean: |
||||
rm -f pg_id$(X) $(OBJS)
|
||||
|
||||
ifeq (depend,$(wildcard depend)) |
||||
include depend |
||||
endif |
||||
@ -1,63 +0,0 @@ |
||||
/*-------------------------------------------------------------------------
|
||||
* |
||||
* pg_id.c |
||||
* Print the user ID for the login name passed as argument, |
||||
* or the real user ID of the caller if no argument. If the |
||||
* login name doesn't exist, print "NOUSER" and exit 1. |
||||
* |
||||
* Copyright (c) 1994, Regents of the University of California |
||||
* |
||||
* |
||||
* IDENTIFICATION |
||||
* $Header: /cvsroot/pgsql/src/bin/pg_id/Attic/pg_id.c,v 1.9 1999/07/19 02:27:09 momjian Exp $ |
||||
* |
||||
*------------------------------------------------------------------------- |
||||
*/ |
||||
#include <stdio.h> |
||||
#include <stdlib.h> |
||||
#include <unistd.h> |
||||
#include <sys/types.h> |
||||
#include <pwd.h> |
||||
|
||||
#include "postgres.h" |
||||
#ifdef HAVE_GETOPT_H |
||||
#include <getopt.h> |
||||
#endif |
||||
|
||||
int |
||||
main(int argc, char **argv) |
||||
{ |
||||
struct passwd *pw; |
||||
int ch; |
||||
extern int optind; |
||||
|
||||
while ((ch = getopt(argc, argv, "")) != EOF) |
||||
switch (ch) |
||||
{ |
||||
case '?': |
||||
default: |
||||
fprintf(stderr, "usage: pg_id [login]\n"); |
||||
exit(1); |
||||
} |
||||
argc -= optind; |
||||
argv += optind; |
||||
|
||||
if (argc > 0) |
||||
{ |
||||
if (argc > 1) |
||||
{ |
||||
fprintf(stderr, "usage: pg_id [login]\n"); |
||||
exit(1); |
||||
} |
||||
if ((pw = getpwnam(argv[0])) == NULL) |
||||
{ |
||||
printf("NOUSER\n"); |
||||
exit(1); |
||||
} |
||||
printf("%ld\n", (long) pw->pw_uid); |
||||
} |
||||
else |
||||
printf("%ld\n", (long) getuid()); |
||||
|
||||
exit(0); |
||||
} |
||||
Loading…
Reference in new issue