Remove SEP_CHAR, replace with / or '/' as appropriate.

This commit is contained in:
Bruce Momjian 2001-05-30 14:15:27 +00:00
parent f032b70c0c
commit 33f2614aa1
10 changed files with 55 additions and 62 deletions

View File

@ -7,7 +7,7 @@
* Portions Copyright (c) 1996-2001, PostgreSQL Global Development Group
* Portions Copyright (c) 1994, Regents of the University of California
*
* $Header: /cvsroot/pgsql/src/backend/access/transam/xlog.c,v 1.66 2001/05/22 16:52:49 momjian Exp $
* $Header: /cvsroot/pgsql/src/backend/access/transam/xlog.c,v 1.67 2001/05/30 14:15:25 momjian Exp $
*
*-------------------------------------------------------------------------
*/
@ -336,8 +336,8 @@ static ControlFileData *ControlFile = NULL;
#define XLogFileName(path, log, seg) \
snprintf(path, MAXPGPATH, "%s%c%08X%08X", \
XLogDir, SEP_CHAR, log, seg)
snprintf(path, MAXPGPATH, "%s/%08X%08X", \
XLogDir, log, seg)
#define PrevBufIdx(idx) \
(((idx) == 0) ? XLogCtl->XLogCacheBlck : ((idx) - 1))
@ -1300,8 +1300,8 @@ XLogFileInit(uint32 log, uint32 seg,
* up pre-creating an extra log segment. That seems OK, and better
* than holding the spinlock throughout this lengthy process.
*/
snprintf(tmppath, MAXPGPATH, "%s%cxlogtemp.%d",
XLogDir, SEP_CHAR, (int) getpid());
snprintf(tmppath, MAXPGPATH, "%s/xlogtemp.%d",
XLogDir, (int) getpid());
unlink(tmppath);
@ -1495,7 +1495,7 @@ MoveOfflineLogs(uint32 log, uint32 seg)
{
elog(LOG, "MoveOfflineLogs: %s %s", (XLOG_archive_dir[0]) ?
"archive" : "remove", xlde->d_name);
sprintf(path, "%s%c%s", XLogDir, SEP_CHAR, xlde->d_name);
sprintf(path, "%s/%s", XLogDir, xlde->d_name);
if (XLOG_archive_dir[0] == 0)
unlink(path);
}
@ -1911,9 +1911,8 @@ void
XLOGPathInit(void)
{
/* Init XLOG file paths */
snprintf(XLogDir, MAXPGPATH, "%s%cpg_xlog", DataDir, SEP_CHAR);
snprintf(ControlFilePath, MAXPGPATH, "%s%cglobal%cpg_control",
DataDir, SEP_CHAR, SEP_CHAR);
snprintf(XLogDir, MAXPGPATH, "%s/pg_xlog", DataDir);
snprintf(ControlFilePath, MAXPGPATH, "%s/global/pg_control", DataDir);
}
static void

View File

@ -8,7 +8,7 @@
*
*
* IDENTIFICATION
* $Header: /cvsroot/pgsql/src/backend/catalog/catalog.c,v 1.40 2001/03/22 03:59:19 momjian Exp $
* $Header: /cvsroot/pgsql/src/backend/catalog/catalog.c,v 1.41 2001/05/30 14:15:26 momjian Exp $
*
*-------------------------------------------------------------------------
*/
@ -80,7 +80,7 @@ relpath_blind(const char *dbname, const char *relname,
{
/* XXX why is this inconsistent with relpath() ? */
path = (char *) palloc(strlen(DatabasePath) + sizeof(NameData) + 2);
sprintf(path, "%s%c%s", DatabasePath, SEP_CHAR, relname);
sprintf(path, "%s/%s", DatabasePath, relname);
}
else
{
@ -99,7 +99,7 @@ relpath_blind(const char *dbname, const char *relname,
elog(FATAL, "relpath_blind: can't expand path for db %s",
dbname);
path = (char *) palloc(strlen(dbpath) + sizeof(NameData) + 2);
sprintf(path, "%s%c%s", dbpath, SEP_CHAR, relname);
sprintf(path, "%s/%s", dbpath, relname);
pfree(dbpath);
}
return path;
@ -122,13 +122,12 @@ relpath(RelFileNode rnode)
{
/* Shared system relations live in {datadir}/global */
path = (char *) palloc(strlen(DataDir) + 8 + sizeof(NameData) + 1);
sprintf(path, "%s%cglobal%c%u", DataDir, SEP_CHAR, SEP_CHAR, rnode.relNode);
sprintf(path, "%s/global/%u", DataDir, rnode.relNode);
}
else
{
path = (char *) palloc(strlen(DataDir) + 6 + 2 * sizeof(NameData) + 3);
sprintf(path, "%s%cbase%c%u%c%u", DataDir, SEP_CHAR, SEP_CHAR,
rnode.tblNode, SEP_CHAR, rnode.relNode);
sprintf(path, "%s/base/%u/%u", DataDir, rnode.tblNode, rnode.relNode);
}
return path;
}
@ -148,12 +147,12 @@ GetDatabasePath(Oid tblNode)
{
/* Shared system relations live in {datadir}/global */
path = (char *) palloc(strlen(DataDir) + 8);
sprintf(path, "%s%cglobal", DataDir, SEP_CHAR);
sprintf(path, "%s/global", DataDir);
}
else
{
path = (char *) palloc(strlen(DataDir) + 6 + sizeof(NameData) + 1);
sprintf(path, "%s%cbase%c%u", DataDir, SEP_CHAR, SEP_CHAR, tblNode);
sprintf(path, "%s/base/%u", DataDir, tblNode);
}
return path;
}

View File

@ -28,7 +28,7 @@
*
*
* IDENTIFICATION
* $Header: /cvsroot/pgsql/src/backend/postmaster/postmaster.c,v 1.214 2001/05/25 15:45:33 momjian Exp $
* $Header: /cvsroot/pgsql/src/backend/postmaster/postmaster.c,v 1.215 2001/05/30 14:15:26 momjian Exp $
*
* NOTES
*
@ -272,8 +272,7 @@ checkDataDir(const char *checkdir)
ExitPostmaster(2);
}
snprintf(path, sizeof(path), "%s%cglobal%cpg_control",
checkdir, SEP_CHAR, SEP_CHAR);
snprintf(path, sizeof(path), "%s/global/pg_control", checkdir);
fp = AllocateFile(path, PG_BINARY_R);
if (fp == NULL)

View File

@ -7,7 +7,7 @@
* Portions Copyright (c) 1994, Regents of the University of California
*
* IDENTIFICATION
* $Header: /cvsroot/pgsql/src/backend/storage/file/fd.c,v 1.78 2001/05/25 15:45:33 momjian Exp $
* $Header: /cvsroot/pgsql/src/backend/storage/file/fd.c,v 1.79 2001/05/30 14:15:26 momjian Exp $
*
* NOTES:
*
@ -580,11 +580,11 @@ filepath(char *filename)
int len;
/* Not an absolute path name? Then fill in with database path... */
if (*filename != SEP_CHAR)
if (*filename != '/')
{
len = strlen(DatabasePath) + strlen(filename) + 2;
buf = (char *) palloc(len);
sprintf(buf, "%s%c%s", DatabasePath, SEP_CHAR, filename);
sprintf(buf, "%s/%s", DatabasePath, filename);
}
else
{

View File

@ -8,7 +8,7 @@
*
*
* IDENTIFICATION
* $Header: /cvsroot/pgsql/src/backend/utils/cache/relcache.c,v 1.134 2001/05/14 22:06:41 momjian Exp $
* $Header: /cvsroot/pgsql/src/backend/utils/cache/relcache.c,v 1.135 2001/05/30 14:15:26 momjian Exp $
*
*-------------------------------------------------------------------------
*/
@ -2810,10 +2810,10 @@ write_irels(void)
* another backend starting at about the same time might crash trying
* to read the partially-complete file.
*/
snprintf(tempfilename, sizeof(tempfilename), "%s%c%s.%d",
DatabasePath, SEP_CHAR, RELCACHE_INIT_FILENAME, MyProcPid);
snprintf(finalfilename, sizeof(finalfilename), "%s%c%s",
DatabasePath, SEP_CHAR, RELCACHE_INIT_FILENAME);
snprintf(tempfilename, sizeof(tempfilename), "%s/%s.%d",
DatabasePath, RELCACHE_INIT_FILENAME, MyProcPid);
snprintf(finalfilename, sizeof(finalfilename), "%s/%s",
DatabasePath, RELCACHE_INIT_FILENAME);
fd = PathNameOpenFile(tempfilename, O_WRONLY | O_CREAT | O_TRUNC | PG_BINARY, 0600);
if (fd < 0)

View File

@ -8,7 +8,7 @@
*
*
* IDENTIFICATION
* $Header: /cvsroot/pgsql/src/backend/utils/error/elog.c,v 1.83 2001/03/22 03:59:58 momjian Exp $
* $Header: /cvsroot/pgsql/src/backend/utils/error/elog.c,v 1.84 2001/05/30 14:15:26 momjian Exp $
*
*-------------------------------------------------------------------------
*/
@ -562,8 +562,8 @@ DebugFileOpen(void)
fd = fileno(stderr);
if (fcntl(fd, F_GETFD, 0) < 0)
{
snprintf(OutputFileName, MAXPGPATH, "%s%cpg.errors.%d",
DataDir, SEP_CHAR, (int) MyProcPid);
snprintf(OutputFileName, MAXPGPATH, "%s/pg.errors.%d",
DataDir, (int) MyProcPid);
fd = open(OutputFileName, O_CREAT | O_APPEND | O_WRONLY, 0666);
}
if (fd < 0)

View File

@ -8,7 +8,7 @@
*
*
* IDENTIFICATION
* $Header: /cvsroot/pgsql/src/backend/utils/misc/Attic/database.c,v 1.45 2001/03/22 06:16:19 momjian Exp $
* $Header: /cvsroot/pgsql/src/backend/utils/misc/Attic/database.c,v 1.46 2001/05/30 14:15:27 momjian Exp $
*
*-------------------------------------------------------------------------
*/
@ -52,20 +52,19 @@ ExpandDatabasePath(const char *dbpath)
return NULL; /* ain't gonna fit nohow */
/* leading path delimiter? then already absolute path */
if (*dbpath == SEP_CHAR)
if (*dbpath == '/')
{
#ifdef ALLOW_ABSOLUTE_DBPATHS
cp = strrchr(dbpath, SEP_CHAR);
cp = strrchr(dbpath, '/');
len = cp - dbpath;
strncpy(buf, dbpath, len);
snprintf(&buf[len], MAXPGPATH - len, "%cbase%c%s",
SEP_CHAR, SEP_CHAR, (cp + 1));
snprintf(&buf[len], MAXPGPATH - len, "/base/%s", (cp + 1));
#else
return NULL;
#endif
}
/* path delimiter somewhere? then has leading environment variable */
else if ((cp = strchr(dbpath, SEP_CHAR)) != NULL)
else if ((cp = strchr(dbpath, '/')) != NULL)
{
const char *envvar;
@ -76,14 +75,12 @@ ExpandDatabasePath(const char *dbpath)
if (envvar == NULL)
return NULL;
snprintf(buf, sizeof(buf), "%s%cbase%c%s",
envvar, SEP_CHAR, SEP_CHAR, (cp + 1));
snprintf(buf, sizeof(buf), "%s/base/%s", envvar, (cp + 1));
}
else
{
/* no path delimiter? then add the default path prefix */
snprintf(buf, sizeof(buf), "%s%cbase%c%s",
DataDir, SEP_CHAR, SEP_CHAR, dbpath);
snprintf(buf, sizeof(buf), "%s/base/%s", DataDir, dbpath);
}
/*

View File

@ -22,7 +22,7 @@
*
*
* IDENTIFICATION
* $Header: /cvsroot/pgsql/src/bin/pg_dump/pg_dump.c,v 1.209 2001/05/22 16:37:16 petere Exp $
* $Header: /cvsroot/pgsql/src/bin/pg_dump/pg_dump.c,v 1.210 2001/05/30 14:15:27 momjian Exp $
*
* Modifications - 6/10/96 - dave@bensoft.com - version 1.13.dhb
*
@ -119,7 +119,7 @@
*
* - Dump dependency information in dumpType. This is necessary
* because placeholder types will have an OID less than the
* OID of the type functions, but type must be created after
* OID of the type functions, but type must be created after
* the functions.
*
* Modifications - 4-Apr-2001 - pjw@rhyme.com.au
@ -773,10 +773,10 @@ main(int argc, char **argv)
dataOnly = schemaOnly = dumpData = attrNames = false;
if (!strrchr(argv[0], SEP_CHAR))
if (!strrchr(argv[0], '/'))
progname = argv[0];
else
progname = strrchr(argv[0], SEP_CHAR) + 1;
progname = strrchr(argv[0], '/') + 1;
/* Set defaulty options based on progname */
if (strcmp(progname, "pg_backup") == 0)
@ -2078,7 +2078,7 @@ getTables(int *numTables, FuncInfo *finfo, int numFuncs)
"order by oid",
RELKIND_RELATION, RELKIND_SEQUENCE, RELKIND_VIEW);
} else {
/*
/*
* Before 7.1, view relkind was not set to 'v', so we must check
* if we have a view by looking for a rule in pg_rewrite.
*/
@ -2195,13 +2195,13 @@ getTables(int *numTables, FuncInfo *finfo, int numFuncs)
else
tblinfo[i].viewdef = NULL;
/*
/*
* Get non-inherited CHECK constraints, if any.
*
* Exclude inherited CHECKs from CHECK constraints total. If a
* constraint matches by name and condition with a constraint
* belonging to a parent class (OR conditions match and both
* names start with '$', we assume it was inherited.
* names start with '$', we assume it was inherited.
*/
if (tblinfo[i].ncheck > 0)
{
@ -2313,7 +2313,7 @@ getTables(int *numTables, FuncInfo *finfo, int numFuncs)
int n;
resetPQExpBuffer(query);
if (g_fout->remoteVersion < 70100)
if (g_fout->remoteVersion < 70100)
{
/* Fake the LOJ from below */
appendPQExpBuffer(query,
@ -2404,7 +2404,7 @@ getTables(int *numTables, FuncInfo *finfo, int numFuncs)
g_comment_end);
resetPQExpBuffer(query);
appendPQExpBuffer(query,
appendPQExpBuffer(query,
"SELECT tgname, tgfoid, tgtype, tgnargs, tgargs, "
"tgisconstraint, tgconstrname, tgdeferrable, "
"tgconstrrelid, tginitdeferred, oid, "
@ -2575,14 +2575,14 @@ getTables(int *numTables, FuncInfo *finfo, int numFuncs)
if (strcmp(tgconstrrelid, "0") != 0) {
if (PQgetisnull(res2, i2, i_tgconstrrelname))
{
fprintf(stderr, "getTables(): SELECT produced NULL referenced table name "
{
fprintf(stderr, "getTables(): SELECT produced NULL referenced table name "
"for trigger '%s' on relation '%s' (oid was %s).\n",
tgname, tblinfo[i].relname, tgconstrrelid);
exit_nicely(g_conn);
}
exit_nicely(g_conn);
}
appendPQExpBuffer(query, " FROM %s",
appendPQExpBuffer(query, " FROM %s",
fmtId(PQgetvalue(res2, i2, i_tgconstrrelname), force_quotes));
}
if (!tgdeferrable)
@ -2770,7 +2770,7 @@ getTableAttrs(TableInfo *tblinfo, int numTables)
if (g_fout->remoteVersion < 70100)
{
/* Fake the LOJ below */
appendPQExpBuffer(q,
appendPQExpBuffer(q,
" SELECT a.oid as attoid, a.attnum, a.attname, t.typname, a.atttypmod, "
" a.attnotnull, a.atthasdef, NULL as atttypedefn "
" from pg_attribute a, pg_type t "
@ -4649,7 +4649,7 @@ findLastBuiltinOid_V71(const char *dbname)
* this is probably not foolproof but comes close
*/
static Oid
static Oid
findLastBuiltinOid_V70(void)
{
PGresult *res;

View File

@ -3,7 +3,7 @@
*
* Copyright 2000 by PostgreSQL Global Development Group
*
* $Header: /cvsroot/pgsql/src/bin/psql/startup.c,v 1.48 2001/05/12 19:44:46 petere Exp $
* $Header: /cvsroot/pgsql/src/bin/psql/startup.c,v 1.49 2001/05/30 14:15:27 momjian Exp $
*/
#include "postgres_fe.h"
@ -102,10 +102,10 @@ main(int argc, char *argv[])
char *password = NULL;
bool need_pass;
if (!strrchr(argv[0], SEP_CHAR))
if (!strrchr(argv[0], '/'))
pset.progname = argv[0];
else
pset.progname = strrchr(argv[0], SEP_CHAR) + 1;
pset.progname = strrchr(argv[0], '/') + 1;
if (argc > 1)
{

View File

@ -12,7 +12,7 @@
* Portions Copyright (c) 1996-2001, PostgreSQL Global Development Group
* Portions Copyright (c) 1994, Regents of the University of California
*
* $Id: c.h,v 1.92 2001/03/22 04:00:24 momjian Exp $
* $Id: c.h,v 1.93 2001/05/30 14:15:27 momjian Exp $
*
*-------------------------------------------------------------------------
*/
@ -594,7 +594,6 @@ typedef NameData *Name;
/* These are for things that are one way on Unix and another on NT */
#define NULL_DEV "/dev/null"
#define SEP_CHAR '/'
/* defines for dynamic linking on Win32 platform */
#ifdef __CYGWIN__