mirror of
https://github.com/postgres/postgres.git
synced 2025-12-12 02:37:31 +03:00
Add get_home_path() to use USERPROFILE on Win32 and HOME on Unix.
This commit is contained in:
@@ -3,7 +3,7 @@
|
||||
*
|
||||
* Copyright (c) 2000-2003, PostgreSQL Global Development Group
|
||||
*
|
||||
* $PostgreSQL: pgsql/src/bin/psql/common.c,v 1.87 2004/05/23 22:20:10 neilc Exp $
|
||||
* $PostgreSQL: pgsql/src/bin/psql/common.c,v 1.88 2004/08/18 02:59:11 momjian Exp $
|
||||
*/
|
||||
#include "postgres_fe.h"
|
||||
#include "common.h"
|
||||
@@ -1078,13 +1078,13 @@ expand_tilde(char **filename)
|
||||
if (**filename == '~')
|
||||
{
|
||||
char *fn;
|
||||
char *home;
|
||||
char oldp,
|
||||
*p;
|
||||
struct passwd *pw;
|
||||
char home[MAXPGPATH];
|
||||
|
||||
fn = *filename;
|
||||
home = NULL;
|
||||
*home = '\0';
|
||||
|
||||
p = fn + 1;
|
||||
while (*p != '/' && *p != '\0')
|
||||
@@ -1094,12 +1094,12 @@ expand_tilde(char **filename)
|
||||
*p = '\0';
|
||||
|
||||
if (*(fn + 1) == '\0')
|
||||
home = getenv("HOME");
|
||||
get_home_path(home);
|
||||
else if ((pw = getpwnam(fn + 1)) != NULL)
|
||||
home = pw->pw_dir;
|
||||
StrNCpy(home, pw->pw_dir, MAXPGPATH);
|
||||
|
||||
*p = oldp;
|
||||
if (home)
|
||||
if (strlen(home) != 0)
|
||||
{
|
||||
char *newfn;
|
||||
|
||||
|
||||
Reference in New Issue
Block a user