version 1.3, 1996/06/26 05:36:38 |
version 1.4, 1996/09/02 16:04:19 |
|
|
/* $OpenBSD$ */ |
/* $OpenBSD$ */ |
/* $NetBSD: suff.c,v 1.11 1995/11/02 23:55:08 christos Exp $ */ |
/* $NetBSD: suff.c,v 1.12 1996/08/13 16:42:16 christos Exp $ */ |
|
|
/* |
/* |
* Copyright (c) 1988, 1989, 1990 The Regents of the University of California. |
* Copyright (c) 1988, 1989, 1990 The Regents of the University of California. |
|
|
if (ln == NILLNODE) { |
if (ln == NILLNODE) { |
s = (Suff *) emalloc (sizeof (Suff)); |
s = (Suff *) emalloc (sizeof (Suff)); |
|
|
s->name = strdup (str); |
s->name = estrdup (str); |
s->nameLen = strlen (s->name); |
s->nameLen = strlen (s->name); |
s->searchPath = Lst_Init (FALSE); |
s->searchPath = Lst_Init (FALSE); |
s->children = Lst_Init (FALSE); |
s->children = Lst_Init (FALSE); |
|
|
* that... |
* that... |
*/ |
*/ |
s2 = (Src *) emalloc (sizeof (Src)); |
s2 = (Src *) emalloc (sizeof (Src)); |
s2->file = strdup(targ->pref); |
s2->file = estrdup(targ->pref); |
s2->pref = targ->pref; |
s2->pref = targ->pref; |
s2->parent = targ; |
s2->parent = targ; |
s2->node = NILGNODE; |
s2->node = NILGNODE; |
|
|
* again (ick)), and return the new structure. |
* again (ick)), and return the new structure. |
*/ |
*/ |
ret = (Src *)emalloc (sizeof (Src)); |
ret = (Src *)emalloc (sizeof (Src)); |
ret->file = strdup(s->name); |
ret->file = estrdup(s->name); |
ret->pref = targ->pref; |
ret->pref = targ->pref; |
ret->suff = suff; |
ret->suff = suff; |
suff->refCount++; |
suff->refCount++; |
|
|
* Allocate a Src structure to which things can be transformed |
* Allocate a Src structure to which things can be transformed |
*/ |
*/ |
targ = (Src *)emalloc(sizeof (Src)); |
targ = (Src *)emalloc(sizeof (Src)); |
targ->file = strdup(gn->name); |
targ->file = estrdup(gn->name); |
targ->suff = (Suff *)Lst_Datum(ln); |
targ->suff = (Suff *)Lst_Datum(ln); |
targ->suff->refCount++; |
targ->suff->refCount++; |
targ->node = gn; |
targ->node = gn; |
|
|
} |
} |
|
|
targ = (Src *)emalloc(sizeof (Src)); |
targ = (Src *)emalloc(sizeof (Src)); |
targ->file = strdup(gn->name); |
targ->file = estrdup(gn->name); |
targ->suff = suffNull; |
targ->suff = suffNull; |
targ->suff->refCount++; |
targ->suff->refCount++; |
targ->node = gn; |
targ->node = gn; |
targ->parent = (Src *)NULL; |
targ->parent = (Src *)NULL; |
targ->children = 0; |
targ->children = 0; |
targ->pref = strdup(sopref); |
targ->pref = estrdup(sopref); |
#ifdef DEBUG_SRC |
#ifdef DEBUG_SRC |
targ->cp = Lst_Init(FALSE); |
targ->cp = Lst_Init(FALSE); |
#endif |
#endif |
|
|
gn->suffix->refCount++; |
gn->suffix->refCount++; |
if (gn->path != NULL) |
if (gn->path != NULL) |
free(gn->path); |
free(gn->path); |
gn->path = strdup(gn->name); |
gn->path = estrdup(gn->name); |
} |
} |
|
|
goto sfnd_return; |
goto sfnd_return; |
|
|
*/ |
*/ |
if (gn->path) |
if (gn->path) |
free(gn->path); |
free(gn->path); |
gn->path = strdup(gn->name); |
gn->path = estrdup(gn->name); |
|
|
/* |
/* |
* Nuke the transformation path and the Src structures left over in the |
* Nuke the transformation path and the Src structures left over in the |
|
|
*/ |
*/ |
emptySuff = suffNull = (Suff *) emalloc (sizeof (Suff)); |
emptySuff = suffNull = (Suff *) emalloc (sizeof (Suff)); |
|
|
suffNull->name = strdup (""); |
suffNull->name = estrdup (""); |
suffNull->nameLen = 0; |
suffNull->nameLen = 0; |
suffNull->searchPath = Lst_Init (FALSE); |
suffNull->searchPath = Lst_Init (FALSE); |
Dir_Concat(suffNull->searchPath, dirSearchPath); |
Dir_Concat(suffNull->searchPath, dirSearchPath); |