=================================================================== RCS file: /cvsrepo/anoncvs/cvs/src/usr.bin/make/for.c,v retrieving revision 1.2 retrieving revision 1.3 diff -c -r1.2 -r1.3 *** src/usr.bin/make/for.c 1996/06/26 05:36:30 1.2 --- src/usr.bin/make/for.c 1996/11/30 21:08:54 1.3 *************** *** 1,5 **** ! /* $OpenBSD: for.c,v 1.2 1996/06/26 05:36:30 deraadt Exp $ */ ! /* $NetBSD: for.c,v 1.3 1995/06/14 15:19:13 christos Exp $ */ /* * Copyright (c) 1992, The Regents of the University of California. --- 1,5 ---- ! /* $OpenBSD: for.c,v 1.3 1996/11/30 21:08:54 millert Exp $ */ ! /* $NetBSD: for.c,v 1.4 1996/11/06 17:59:05 christos Exp $ */ /* * Copyright (c) 1992, The Regents of the University of California. *************** *** 36,44 **** #ifndef lint #if 0 ! static char sccsid[] = "@(#)for.c 5.6 (Berkeley) 6/1/90"; #else ! static char rcsid[] = "$OpenBSD: for.c,v 1.2 1996/06/26 05:36:30 deraadt Exp $"; #endif #endif /* not lint */ --- 36,44 ---- #ifndef lint #if 0 ! static char sccsid[] = "@(#)for.c 8.1 (Berkeley) 6/6/93"; #else ! static char rcsid[] = "$OpenBSD: for.c,v 1.3 1996/11/30 21:08:54 millert Exp $"; #endif #endif /* not lint */ *************** *** 68,74 **** * The trick is to look for the matching end inside for for loop * To do that, we count the current nesting level of the for loops. * and the .endfor statements, accumulating all the statements between ! * the initial .for loop and the matching .endfor; * then we evaluate the for loop for each variable in the varlist. */ --- 68,74 ---- * The trick is to look for the matching end inside for for loop * To do that, we count the current nesting level of the for loops. * and the .endfor statements, accumulating all the statements between ! * the initial .for loop and the matching .endfor; * then we evaluate the for loop for each variable in the varlist. */ *************** *** 132,149 **** !isspace((unsigned char) ptr[3])) return FALSE; ptr += 3; ! /* * we found a for loop, and now we are going to parse it. */ while (*ptr && isspace((unsigned char) *ptr)) ptr++; ! /* * Grab the variable */ buf = Buf_Init(0); ! for (wrd = ptr; *ptr && !isspace((unsigned char) *ptr); ptr++) continue; Buf_AddBytes(buf, ptr - wrd, (Byte *) wrd); --- 132,149 ---- !isspace((unsigned char) ptr[3])) return FALSE; ptr += 3; ! /* * we found a for loop, and now we are going to parse it. */ while (*ptr && isspace((unsigned char) *ptr)) ptr++; ! /* * Grab the variable */ buf = Buf_Init(0); ! for (wrd = ptr; *ptr && !isspace((unsigned char) *ptr); ptr++) continue; Buf_AddBytes(buf, ptr - wrd, (Byte *) wrd); *************** *** 176,187 **** */ forLst = Lst_Init(FALSE); buf = Buf_Init(0); ! sub = Var_Subst(NULL, ptr, VAR_GLOBAL, FALSE); #define ADDWORD() \ Buf_AddBytes(buf, ptr - wrd, (Byte *) wrd), \ Buf_AddByte(buf, (Byte) '\0'), \ ! Lst_AtEnd(forLst, (ClientData) Buf_GetAll(buf, &varlen)), \ Buf_Destroy(buf, FALSE) for (ptr = sub; *ptr && isspace((unsigned char) *ptr); ptr++) --- 176,187 ---- */ forLst = Lst_Init(FALSE); buf = Buf_Init(0); ! sub = Var_Subst(NULL, ptr, VAR_GLOBAL, FALSE); #define ADDWORD() \ Buf_AddBytes(buf, ptr - wrd, (Byte *) wrd), \ Buf_AddByte(buf, (Byte) '\0'), \ ! Lst_AtFront(forLst, (ClientData) Buf_GetAll(buf, &varlen)), \ Buf_Destroy(buf, FALSE) for (ptr = sub; *ptr && isspace((unsigned char) *ptr); ptr++) *************** *** 197,208 **** } if (DEBUG(FOR)) (void) fprintf(stderr, "For: Iterator %s List %s\n", forVar, sub); ! if (ptr - wrd > 0) ADDWORD(); else Buf_Destroy(buf, TRUE); free((Address) sub); ! forBuf = Buf_Init(0); forLevel++; return 1; --- 197,208 ---- } if (DEBUG(FOR)) (void) fprintf(stderr, "For: Iterator %s List %s\n", forVar, sub); ! if (ptr - wrd > 0) ADDWORD(); else Buf_Destroy(buf, TRUE); free((Address) sub); ! forBuf = Buf_Init(0); forLevel++; return 1; *************** *** 263,269 **** Var_Set(arg->var, name, VAR_GLOBAL); if (DEBUG(FOR)) (void) fprintf(stderr, "--- %s = %s\n", arg->var, name); ! Parse_FromString(Var_Subst(arg->var, (char *) Buf_GetAll(arg->buf, &len), VAR_GLOBAL, FALSE)); Var_Delete(arg->var, VAR_GLOBAL); --- 263,269 ---- Var_Set(arg->var, name, VAR_GLOBAL); if (DEBUG(FOR)) (void) fprintf(stderr, "--- %s = %s\n", arg->var, name); ! Parse_FromString(Var_Subst(arg->var, (char *) Buf_GetAll(arg->buf, &len), VAR_GLOBAL, FALSE)); Var_Delete(arg->var, VAR_GLOBAL);