]> granicus.if.org Git - postgresql/commitdiff
Move username lookup functions from /port to /common
authorBruce Momjian <bruce@momjian.us>
Fri, 10 Jan 2014 23:03:28 +0000 (18:03 -0500)
committerBruce Momjian <bruce@momjian.us>
Fri, 10 Jan 2014 23:03:28 +0000 (18:03 -0500)
Per suggestion from Peter E and Alvaro

src/backend/libpq/auth.c
src/backend/main/main.c
src/bin/initdb/initdb.c
src/bin/psql/help.c
src/bin/scripts/common.h
src/common/Makefile
src/common/username.c [moved from src/port/username.c with 96% similarity]
src/include/common/username.h [new file with mode: 0644]
src/include/port.h
src/port/Makefile
src/tools/msvc/Mkvcbuild.pm

index 72ee9cc6986b25073c696701398ae25dc805d535..858991598438a2f805a88ab6c8d3d0e14c3c4810 100644 (file)
@@ -21,6 +21,7 @@
 #include <arpa/inet.h>
 #include <unistd.h>
 
+#include "common/username.h"
 #include "libpq/auth.h"
 #include "libpq/crypt.h"
 #include "libpq/ip.h"
index a046c1cf0ffd4654b903429d546890fa179578c3..4ee8a153d93cd30cb7b28197339764a12ea0ea4a 100644 (file)
@@ -35,6 +35,7 @@
 #endif
 
 #include "bootstrap/bootstrap.h"
+#include "common/username.h"
 #include "postmaster/postmaster.h"
 #include "tcop/tcopprot.h"
 #include "utils/help_config.h"
index 3f1ce0567493cf87ddca82e6ad91a3fa131d28b9..a9aa7a487f661587d54b94b34544e72b5f97c3d5 100644 (file)
@@ -60,6 +60,7 @@
 #include "sys/mman.h"
 #endif
 
+#include "common/username.h"
 #include "mb/pg_wchar.h"
 #include "getaddrinfo.h"
 #include "getopt_long.h"
index d7c31e0b1b42af4fd22bf73b179682ba76dd033d..baa94175ea1ed20dcde44a8934f863719dfd36e1 100644 (file)
@@ -23,6 +23,7 @@
 #endif
 
 #include "common.h"
+#include "common/username.h"
 #include "help.h"
 #include "input.h"
 #include "settings.h"
index 4944c46a4b2a943e0aa686b8b507bb251793f361..691f6c6a02f43a909446e8918e2d4e7b5d071bd4 100644 (file)
@@ -9,6 +9,7 @@
 #ifndef COMMON_H
 #define COMMON_H
 
+#include "common/username.h"
 #include "libpq-fe.h"
 #include "getopt_long.h"               /* pgrminclude ignore */
 #include "pqexpbuffer.h"               /* pgrminclude ignore */
index 62ca8ab0c353986c491934aed9eb1d01429ba2b4..7edbaaa2c1a707f59cbf6b9c137838c201f28cb8 100644 (file)
@@ -23,7 +23,7 @@ include $(top_builddir)/src/Makefile.global
 override CPPFLAGS := -DFRONTEND $(CPPFLAGS)
 LIBS += $(PTHREAD_LIBS)
 
-OBJS_COMMON = exec.o pgfnames.o psprintf.o relpath.o rmtree.o wait_error.o
+OBJS_COMMON = exec.o pgfnames.o psprintf.o relpath.o rmtree.o username.o wait_error.o
 
 OBJS_FRONTEND = $(OBJS_COMMON) fe_memutils.o
 
similarity index 96%
rename from src/port/username.c
rename to src/common/username.c
index f0f0a8900dd6475c0bc38c9024c9838e87592886..c6812ddd9d17c3219f4a854fdb32b88395da8e48 100644 (file)
@@ -7,7 +7,7 @@
  * Portions Copyright (c) 1994, Regents of the University of California
  *
  * IDENTIFICATION
- *       src/port/username.c
+ *       src/common/username.c
  *
  *-------------------------------------------------------------------------
  */
@@ -23,6 +23,7 @@
 #include <unistd.h>
 #include <sys/types.h>
 
+#include "common/username.h"
 
 /*
  * Returns the current user name in a static buffer, or NULL on error and
diff --git a/src/include/common/username.h b/src/include/common/username.h
new file mode 100644 (file)
index 0000000..115d1ed
--- /dev/null
@@ -0,0 +1,15 @@
+/*
+ *     username.h
+ *             lookup effective username
+ *
+ *     Copyright (c) 2003-2014, PostgreSQL Global Development Group
+ *
+ *     src/include/common/username.h
+ */
+#ifndef USERNAME_H
+#define USERNAME_H
+
+extern const char *get_user_name(char **errstr);
+extern const char *get_user_name_or_exit(const char *progname);
+
+#endif   /* USERNAME_H */
index bc275c0c1c2d9047e050da3901fc3b8c2ac07e4e..f50fbecf0109fcca47a10be182bf5463598d6ba5 100644 (file)
@@ -473,10 +473,6 @@ extern pqsigfunc pqsignal(int signo, pqsigfunc func);
 /* port/quotes.c */
 extern char *escape_single_quotes_ascii(const char *src);
 
-/* port/username.c */
-extern const char *get_user_name(char **errstr);
-extern const char *get_user_name_or_exit(const char *progname);
-
 /* port/wait_error.c */
 extern char *wait_result_to_str(int exit_status);
 
index a50e0af2143c39e5f83815e5b3aa30e680be8f00..1be4ff57a2f5fc46dba49c247dbd68532388cfe2 100644 (file)
@@ -33,7 +33,7 @@ LIBS += $(PTHREAD_LIBS)
 OBJS = $(LIBOBJS) chklocale.o dirmod.o erand48.o fls.o inet_net_ntop.o \
        noblock.o path.o pgcheckdir.o pg_crc.o pgmkdirp.o pgsleep.o \
        pgstrcasecmp.o pqsignal.o \
-       qsort.o qsort_arg.o quotes.o sprompt.o tar.o thread.o username.o
+       qsort.o qsort_arg.o quotes.o sprompt.o tar.o thread.o
 
 # foo_srv.o and foo.o are both built from foo.c, but only foo.o has -DFRONTEND
 OBJS_SRV = $(OBJS:%.o=%_srv.o)
index d6b6eaf158438e48c407b8461ff2835d02717652..a8324ff7b20ff2f96a47c9c057e5c9d2df7401d8 100644 (file)
@@ -70,11 +70,11 @@ sub mkvcbuild
          erand48.c snprintf.c strlcat.c strlcpy.c dirmod.c noblock.c path.c
          pgcheckdir.c pg_crc.c pgmkdirp.c pgsleep.c pgstrcasecmp.c pqsignal.c
          qsort.c qsort_arg.c quotes.c
-         sprompt.c tar.c thread.c getopt.c getopt_long.c dirent.c rint.c username.c
+         sprompt.c tar.c thread.c getopt.c getopt_long.c dirent.c rint.c
          win32env.c win32error.c win32setlocale.c);
 
        our @pgcommonallfiles = qw(
-         exec.c pgfnames.c psprintf.c relpath.c rmtree.c wait_error.c);
+         exec.c pgfnames.c psprintf.c relpath.c rmtree.c username.c wait_error.c);
 
        our @pgcommonfrontendfiles = (@pgcommonallfiles, qw(fe_memutils.c));