*
*
* IDENTIFICATION
- * $PostgreSQL: pgsql/src/backend/postmaster/postmaster.c,v 1.384 2004/05/12 03:48:42 momjian Exp $
+ * $PostgreSQL: pgsql/src/backend/postmaster/postmaster.c,v 1.385 2004/05/12 13:38:39 momjian Exp $
*
* NOTES
*
int ReservedBackends;
-static char *progname = NULL;
+static const char *progname = NULL;
/* The socket(s) we're listening to. */
#define MAXLISTEN 10
*original_extraoptions = '\0';
- progname = argv[0];
+ progname = get_progname(argv[0]);
IsPostmasterEnvironment = true;
/*
* On some systems our dynloader code needs the executable's pathname.
*/
- if (find_my_binary(pg_pathname, argv[0], "postgres") < 0)
+ if (find_my_exec(pg_pathname, argv[0]) < 0)
ereport(FATAL,
(errmsg("%s: could not locate postgres executable",
progname)));
FILE *fp;
int i;
- if (find_my_binary(fullprogname, argv[0], "postmaster") < 0)
+ if (find_my_exec(fullprogname, argv[0]) < 0)
{
elog(LOG, "could not locate postmaster");
return false;
*
*
* IDENTIFICATION
- * $PostgreSQL: pgsql/src/backend/tcop/postgres.c,v 1.403 2004/05/11 21:57:14 momjian Exp $
+ * $PostgreSQL: pgsql/src/backend/tcop/postgres.c,v 1.404 2004/05/12 13:38:40 momjian Exp $
*
* NOTES
* this is the "main" module of the postgres backend and
static void
-usage(char *progname)
+usage(const char *progname)
{
printf(gettext("%s is the PostgreSQL stand-alone backend. It is not\nintended to be used by normal users.\n\n"), progname);
* On some systems our dynloader code needs the executable's
* pathname. (If under postmaster, this was done already.)
*/
- if (find_my_binary(pg_pathname, argv[0], "postgres") < 0)
+ if (find_my_exec(pg_pathname, argv[0]) < 0)
ereport(FATAL,
(errmsg("%s: could not locate postgres executable",
argv[0])));
* Portions Copyright (c) 1994, Regents of the University of California
* Portions taken from FreeBSD.
*
- * $PostgreSQL: pgsql/src/bin/initdb/initdb.c,v 1.27 2004/05/11 21:57:14 momjian Exp $
+ * $PostgreSQL: pgsql/src/bin/initdb/initdb.c,v 1.28 2004/05/12 13:38:42 momjian Exp $
*
*-------------------------------------------------------------------------
*/
/* internal vars */
-char *progname;
+const char *progname;
char *postgres;
char *encodingid = "0";
char *bki_file;
sprintf(pgdenv, "PGDATA=%s", pg_data);
putenv(pgdenv);
- if ((ret = find_other_binary(backendbin, argv[0], progname, "postgres",
+ if ((ret = find_other_exec(backendbin, argv[0], "postgres",
PG_VERSIONSTR)) < 0)
{
if (ret == -1)
* copyright (c) Oliver Elphick <olly@lfix.co.uk>, 2001;
* licence: BSD
*
- * $PostgreSQL: pgsql/src/bin/pg_controldata/pg_controldata.c,v 1.14 2004/03/22 15:34:22 tgl Exp $
+ * $PostgreSQL: pgsql/src/bin/pg_controldata/pg_controldata.c,v 1.15 2004/05/12 13:38:43 momjian Exp $
*/
#include "postgres.h"
char ckpttime_str[128];
char sysident_str[32];
char *strftime_fmt = "%c";
- char *progname;
+ const char *progname;
setlocale(LC_ALL, "");
#ifdef ENABLE_NLS
* Portions Copyright (c) 1994, Regents of the University of California
*
*
- * $PostgreSQL: pgsql/src/bin/pg_dump/pg_dumpall.c,v 1.31 2004/05/11 21:57:14 momjian Exp $
+ * $PostgreSQL: pgsql/src/bin/pg_dump/pg_dumpall.c,v 1.32 2004/05/12 13:38:44 momjian Exp $
*
*-------------------------------------------------------------------------
*/
#define PG_VERSIONSTR "pg_dump (PostgreSQL) " PG_VERSION "\n"
-static char *progname;
+static const char *progname;
static void help(void);
}
}
- if ((ret = find_other_binary(pg_dump_bin, argv[0], progname, "pg_dump",
+ if ((ret = find_other_exec(pg_dump_bin, argv[0], "pg_dump",
PG_VERSIONSTR)) < 0)
{
if (ret == -1)
* Portions Copyright (c) 1996-2003, PostgreSQL Global Development Group
* Portions Copyright (c) 1994, Regents of the University of California
*
- * $PostgreSQL: pgsql/src/bin/pg_resetxlog/pg_resetxlog.c,v 1.17 2004/03/22 16:46:28 tgl Exp $
+ * $PostgreSQL: pgsql/src/bin/pg_resetxlog/pg_resetxlog.c,v 1.18 2004/05/12 13:38:44 momjian Exp $
*
*-------------------------------------------------------------------------
*/
static uint32 newXlogId,
newXlogSeg; /* ID/Segment of new XLOG segment */
static bool guessed = false; /* T if we had to guess at any values */
-static char *progname;
+static const char *progname;
static bool ReadControlFile(void);
static void GuessControlValues(void);
*
* Copyright (c) 2000-2003, PostgreSQL Global Development Group
*
- * $PostgreSQL: pgsql/src/bin/psql/settings.h,v 1.17 2004/03/21 22:29:11 tgl Exp $
+ * $PostgreSQL: pgsql/src/bin/psql/settings.h,v 1.18 2004/05/12 13:38:45 momjian Exp $
*/
#ifndef SETTINGS_H
#define SETTINGS_H
* loop */
bool cur_cmd_interactive;
- char *progname; /* in case you renamed psql */
+ const char *progname; /* in case you renamed psql */
char *inputfile; /* for error reporting */
unsigned lineno; /* also for error reporting */
*
* Copyright (c) 2000-2003, PostgreSQL Global Development Group
*
- * $PostgreSQL: pgsql/src/bin/psql/tab-complete.c,v 1.105 2004/05/07 00:24:58 tgl Exp $
+ * $PostgreSQL: pgsql/src/bin/psql/tab-complete.c,v 1.106 2004/05/12 13:38:46 momjian Exp $
*/
/*----------------------------------------------------------------------
void
initialize_readline(void)
{
- rl_readline_name = pset.progname;
+ rl_readline_name = (char *)pset.progname;
rl_attempted_completion_function = (void *) psql_completion;
rl_basic_word_break_characters = "\t\n@$><=;|&{( ";
*
* Portions Copyright (c) 2002-2003, PostgreSQL Global Development Group
*
- * $PostgreSQL: pgsql/src/bin/scripts/clusterdb.c,v 1.5 2004/01/01 19:27:15 tgl Exp $
+ * $PostgreSQL: pgsql/src/bin/scripts/clusterdb.c,v 1.6 2004/05/12 13:38:46 momjian Exp $
*
*-------------------------------------------------------------------------
*/
{NULL, 0, NULL, 0}
};
- char *progname;
+ const char *progname;
int optindex;
int c;
* Portions Copyright (c) 1996-2003, PostgreSQL Global Development Group
* Portions Copyright (c) 1994, Regents of the University of California
*
- * $PostgreSQL: pgsql/src/bin/scripts/createdb.c,v 1.7 2004/01/01 19:27:15 tgl Exp $
+ * $PostgreSQL: pgsql/src/bin/scripts/createdb.c,v 1.8 2004/05/12 13:38:47 momjian Exp $
*
*-------------------------------------------------------------------------
*/
{NULL, 0, NULL, 0}
};
- char *progname;
+ const char *progname;
int optindex;
int c;
* Portions Copyright (c) 1996-2003, PostgreSQL Global Development Group
* Portions Copyright (c) 1994, Regents of the University of California
*
- * $PostgreSQL: pgsql/src/bin/scripts/createlang.c,v 1.8 2004/03/19 18:58:07 tgl Exp $
+ * $PostgreSQL: pgsql/src/bin/scripts/createlang.c,v 1.9 2004/05/12 13:38:47 momjian Exp $
*
*-------------------------------------------------------------------------
*/
{NULL, 0, NULL, 0}
};
- char *progname;
+ const char *progname;
int optindex;
int c;
* Portions Copyright (c) 1996-2003, PostgreSQL Global Development Group
* Portions Copyright (c) 1994, Regents of the University of California
*
- * $PostgreSQL: pgsql/src/bin/scripts/createuser.c,v 1.9 2004/01/09 00:15:11 tgl Exp $
+ * $PostgreSQL: pgsql/src/bin/scripts/createuser.c,v 1.10 2004/05/12 13:38:48 momjian Exp $
*
*-------------------------------------------------------------------------
*/
{NULL, 0, NULL, 0}
};
- char *progname;
+ const char *progname;
int optindex;
int c;
* Portions Copyright (c) 1996-2003, PostgreSQL Global Development Group
* Portions Copyright (c) 1994, Regents of the University of California
*
- * $PostgreSQL: pgsql/src/bin/scripts/dropdb.c,v 1.8 2004/01/01 19:27:15 tgl Exp $
+ * $PostgreSQL: pgsql/src/bin/scripts/dropdb.c,v 1.9 2004/05/12 13:38:48 momjian Exp $
*
*-------------------------------------------------------------------------
*/
{NULL, 0, NULL, 0}
};
- char *progname;
+ const char *progname;
int optindex;
int c;
* Portions Copyright (c) 1996-2003, PostgreSQL Global Development Group
* Portions Copyright (c) 1994, Regents of the University of California
*
- * $PostgreSQL: pgsql/src/bin/scripts/droplang.c,v 1.7 2004/03/19 18:58:07 tgl Exp $
+ * $PostgreSQL: pgsql/src/bin/scripts/droplang.c,v 1.8 2004/05/12 13:38:48 momjian Exp $
*
*-------------------------------------------------------------------------
*/
{NULL, 0, NULL, 0}
};
- char *progname;
+ const char *progname;
int optindex;
int c;
* Portions Copyright (c) 1996-2003, PostgreSQL Global Development Group
* Portions Copyright (c) 1994, Regents of the University of California
*
- * $PostgreSQL: pgsql/src/bin/scripts/dropuser.c,v 1.7 2004/01/01 19:27:15 tgl Exp $
+ * $PostgreSQL: pgsql/src/bin/scripts/dropuser.c,v 1.8 2004/05/12 13:38:48 momjian Exp $
*
*-------------------------------------------------------------------------
*/
{NULL, 0, NULL, 0}
};
- char *progname;
+ const char *progname;
int optindex;
int c;
* Portions Copyright (c) 1996-2003, PostgreSQL Global Development Group
* Portions Copyright (c) 1994, Regents of the University of California
*
- * $PostgreSQL: pgsql/src/bin/scripts/vacuumdb.c,v 1.5 2004/01/01 19:27:15 tgl Exp $
+ * $PostgreSQL: pgsql/src/bin/scripts/vacuumdb.c,v 1.6 2004/05/12 13:38:48 momjian Exp $
*
*-------------------------------------------------------------------------
*/
{NULL, 0, NULL, 0}
};
- char *progname;
+ const char *progname;
int optindex;
int c;
* Portions Copyright (c) 1996-2003, PostgreSQL Global Development Group
* Portions Copyright (c) 1994, Regents of the University of California
*
- * $PostgreSQL: pgsql/src/include/port.h,v 1.29 2004/05/11 21:57:15 momjian Exp $
+ * $PostgreSQL: pgsql/src/include/port.h,v 1.30 2004/05/12 13:38:48 momjian Exp $
*
*-------------------------------------------------------------------------
*/
extern char *first_path_separator(const char *filename);
extern char *last_path_separator(const char *filename);
extern void canonicalize_path(char *path);
-extern char *get_progname(char *argv0);
+extern const char *get_progname(const char *argv0);
/* Portable way to find binaries */
-extern int find_my_binary(char *full_path, const char *argv0,
- const char *binary_name);
-extern int find_other_binary(char *retpath, const char *argv0, const char *progname,
+extern int find_my_exec(char *full_path, const char *argv0);
+extern int find_other_exec(char *retpath, const char *argv0,
char const *target, const char *versionstr);
#if defined(__CYGWIN__) || defined(WIN32)
-/* $PostgreSQL: pgsql/src/interfaces/ecpg/preproc/ecpg.c,v 1.85 2004/01/28 20:43:03 tgl Exp $ */
+/* $PostgreSQL: pgsql/src/interfaces/ecpg/preproc/ecpg.c,v 1.86 2004/05/12 13:38:48 momjian Exp $ */
/* New main for ecpg, the PostgreSQL embedded SQL precompiler. */
/* (C) Michael Meskes <meskes@postgresql.org> Feb 5th, 1998 */
verbose = false,
out_option = 0;
struct _include_path *ip;
- char *progname;
+ const char *progname;
progname = get_progname(argv[0]);
*
*
* IDENTIFICATION
- * $PostgreSQL: pgsql/src/port/exec.c,v 1.1 2004/05/11 21:57:15 momjian Exp $
+ * $PostgreSQL: pgsql/src/port/exec.c,v 1.2 2004/05/12 13:38:49 momjian Exp $
*
*-------------------------------------------------------------------------
*/
}
/*
- * find_my_binary -- find an absolute path to a valid executable
+ * find_my_exec -- find an absolute path to a valid executable
*
* The reason we have to work so hard to find an absolute path is that
* on some platforms we can't do dynamic loading unless we know the
* non-threaded binaries, not in library routines.
*/
int
-find_my_binary(char *full_path, const char *argv0, const char *binary_name)
+find_my_exec(char *full_path, const char *argv0)
{
char buf[MAXPGPATH + 2];
char *p;
char *path,
*startp,
*endp;
+ const char *binary_name = get_progname(argv0);
/*
* First try: use the binary that's located in the
* Find our binary directory, then make sure the "target" executable
* is the proper version.
*/
-int find_other_binary(char *retpath, const char *argv0, const char *progname,
+int find_other_exec(char *retpath, const char *argv0,
char const *target, const char *versionstr)
{
char cmd[MAXPGPATH];
char line[100];
FILE *pgver;
- if (find_my_binary(retpath, argv0, progname) < 0)
+ if (find_my_exec(retpath, argv0) < 0)
return -1;
/* Trim off program name and keep just directory */
*
*
* IDENTIFICATION
- * $PostgreSQL: pgsql/src/port/path.c,v 1.6 2004/05/11 21:57:15 momjian Exp $
+ * $PostgreSQL: pgsql/src/port/path.c,v 1.7 2004/05/12 13:38:49 momjian Exp $
*
*-------------------------------------------------------------------------
*/
/*
* Extracts the actual name of the program as called.
*/
-char *
-get_progname(char *argv0)
+const char *
+get_progname(const char *argv0)
{
if (!last_path_separator(argv0))
return argv0;