=================================================================== RCS file: /cvsrepo/anoncvs/cvs/src/usr.bin/make/suff.c,v retrieving revision 1.1 retrieving revision 1.2 diff -c -r1.1 -r1.2 *** src/usr.bin/make/suff.c 1995/10/18 08:45:43 1.1 --- src/usr.bin/make/suff.c 1995/12/14 03:23:38 1.2 *************** *** 1,4 **** ! /* $NetBSD: suff.c,v 1.10 1995/09/25 02:46:30 christos Exp $ */ /* * Copyright (c) 1988, 1989, 1990 The Regents of the University of California. --- 1,4 ---- ! /* $NetBSD: suff.c,v 1.11 1995/11/02 23:55:08 christos Exp $ */ /* * Copyright (c) 1988, 1989, 1990 The Regents of the University of California. *************** *** 42,48 **** #if 0 static char sccsid[] = "@(#)suff.c 5.6 (Berkeley) 6/1/90"; #else ! static char rcsid[] = "$NetBSD: suff.c,v 1.10 1995/09/25 02:46:30 christos Exp $"; #endif #endif /* not lint */ --- 42,48 ---- #if 0 static char sccsid[] = "@(#)suff.c 5.6 (Berkeley) 6/1/90"; #else ! static char rcsid[] = "$NetBSD: suff.c,v 1.11 1995/11/02 23:55:08 christos Exp $"; #endif #endif /* not lint */ *************** *** 1427,1433 **** /* * Add all elements of the members list to the parent node. */ ! while (!Lst_IsEmpty(members)) { gn = (GNode *)Lst_DeQueue(members); if (DEBUG(SUFF)) { --- 1427,1433 ---- /* * Add all elements of the members list to the parent node. */ ! while(!Lst_IsEmpty(members)) { gn = (GNode *)Lst_DeQueue(members); if (DEBUG(SUFF)) { *************** *** 1995,2000 **** --- 1995,2001 ---- (targ == NULL ? dirSearchPath : targ->suff->searchPath)); if (gn->path != NULL) { + char *ptr; Var_Set(TARGET, gn->path, gn); if (targ != NULL) { *************** *** 2002,2008 **** * Suffix known for the thing -- trim the suffix off * the path to form the proper .PREFIX variable. */ ! int len = strlen(gn->path); char savec; if (gn->suffix) --- 2003,2009 ---- * Suffix known for the thing -- trim the suffix off * the path to form the proper .PREFIX variable. */ ! int savep = strlen(gn->path) - targ->suff->nameLen; char savec; if (gn->suffix) *************** *** 2010,2021 **** gn->suffix = targ->suff; gn->suffix->refCount++; ! savec = gn->path[len-targ->suff->nameLen]; ! gn->path[len-targ->suff->nameLen] = '\0'; ! Var_Set(PREFIX, gn->path, gn); ! gn->path[len-targ->suff->nameLen] = savec; } else { /* * The .PREFIX gets the full path if the target has --- 2011,2027 ---- gn->suffix = targ->suff; gn->suffix->refCount++; ! savec = gn->path[savep]; ! gn->path[savep] = '\0'; ! if ((ptr = strrchr(gn->path, '/')) != NULL) ! ptr++; ! else ! ptr = gn->path; ! Var_Set(PREFIX, ptr, gn); ! ! gn->path[savep] = savec; } else { /* * The .PREFIX gets the full path if the target has *************** *** 2025,2031 **** gn->suffix->refCount--; gn->suffix = NULL; ! Var_Set(PREFIX, gn->path, gn); } } } else { --- 2031,2042 ---- gn->suffix->refCount--; gn->suffix = NULL; ! if ((ptr = strrchr(gn->path, '/')) != NULL) ! ptr++; ! else ! ptr = gn->path; ! ! Var_Set(PREFIX, ptr, gn); } } } else {