Made path handling much more configurable

git-svn-id: svn+ssh://svn.gna.org/svn/gnustep/tools/make/trunk@12943 72102866-910b-0410-8b05-ffd578937521
This commit is contained in:
Richard Frith-Macdonald 2002-03-01 16:47:45 +00:00
parent 383b3ae631
commit 65c6400de7
3 changed files with 44 additions and 4 deletions

View file

@ -1,3 +1,9 @@
2002-03-01 Richard Frith-Macdonald <rfm@gnu.org>
* user_home.c: Parse .GNUsteprc in configured GNUSTEP_SYSTEM_ROOT
if per-user version is not available. Treat ~ at start of root
as home directory of user.
Fri Mar 1 15:28:58 2002 Nicola Pero <n.pero@mi.flashnet.it>
* Instance/service.make: Use Instance/Shared/bundle.make to

View file

@ -114,6 +114,7 @@ which_lib$(EXEEXT): which_lib.c config.h
user_home$(EXEEXT): user_home.c config.h
$(CC) @CFLAGS@ @FORCE_USER_ROOT@ @FORCE_DEFAULTS_ROOT@ \
-DGNUSTEP_SYSTEM_ROOT=$(GNUSTEP_SYSTEM_ROOT) \
-Wall -I. -o $@ $<
install: all

View file

@ -236,6 +236,21 @@ int main (int argc, char** argv)
strcat(path, SEP);
strcat(path, ".GNUsteprc");
fptr = fopen(path, "r");
if (fptr == 0)
{
path[0] = '\0';
#if defined (__MINGW32__)
len0 = GetEnvironmentVariable("SystemDrive", buf0, 128);
if (len0 > 0)
{
strcpy(path, buf0);
}
#endif
strcat(path, stringify(GNUSTEP_SYSTEM_ROOT));
strcat(path, SEP);
strcat(path, ".GNUsteprc");
fptr = fopen(path, "r");
}
path[0] = '\0';
if (fptr != 0)
{
@ -260,13 +275,31 @@ int main (int argc, char** argv)
if (strcmp(key, "GNUSTEP_USER_ROOT") == 0)
{
user = malloc(strlen(val)+1);
strcpy(user, val);
if (*val == '~')
{
user = malloc(strlen(val) + strlen(home));
strcpy(user, home);
strcat(user, &val[1]);
}
else
{
user = malloc(strlen(val) + 1);
strcpy(user, val);
}
}
else if (strcmp(key, "GNUSTEP_DEFAULTS_ROOT") == 0)
{
defs = malloc(strlen(val)+1);
strcpy(user, val);
if (*val == '~')
{
defs = malloc(strlen(val) + strlen(home));
strcpy(defs, home);
strcat(defs, &val[1]);
}
else
{
defs = malloc(strlen(val) + 1);
strcpy(defs, val);
}
}
}
}