mirror of
https://github.com/gnustep/tools-make.git
synced 2025-05-30 00:41:14 +00:00
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:
parent
383b3ae631
commit
65c6400de7
3 changed files with 44 additions and 4 deletions
|
@ -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
|
||||
|
|
|
@ -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
|
||||
|
|
41
user_home.c
41
user_home.c
|
@ -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);
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue