=================================================================== RCS file: /cvsrepo/anoncvs/cvs/src/usr.bin/awk/tran.c,v retrieving revision 1.5 retrieving revision 1.6 diff -c -r1.5 -r1.6 *** src/usr.bin/awk/tran.c 1999/04/20 17:31:31 1.5 --- src/usr.bin/awk/tran.c 1999/12/08 23:09:46 1.6 *************** *** 1,4 **** ! /* $OpenBSD: tran.c,v 1.5 1999/04/20 17:31:31 millert Exp $ */ /**************************************************************** Copyright (C) Lucent Technologies 1997 All Rights Reserved --- 1,4 ---- ! /* $OpenBSD: tran.c,v 1.6 1999/12/08 23:09:46 millert Exp $ */ /**************************************************************** Copyright (C) Lucent Technologies 1997 All Rights Reserved *************** *** 144,150 **** ap = (Array *) malloc(sizeof(Array)); tp = (Cell **) calloc(n, sizeof(Cell *)); if (ap == NULL || tp == NULL) ! ERROR "out of space in makesymtab" FATAL; ap->nelem = 0; ap->size = n; ap->tab = tp; --- 144,150 ---- ap = (Array *) malloc(sizeof(Array)); tp = (Cell **) calloc(n, sizeof(Cell *)); if (ap == NULL || tp == NULL) ! FATAL("out of space in makesymtab"); ap->nelem = 0; ap->size = n; ap->tab = tp; *************** *** 211,217 **** } p = (Cell *) malloc(sizeof(Cell)); if (p == NULL) ! ERROR "out of space for symbol table at %s", n FATAL; p->nval = tostring(n); p->sval = s ? tostring(s) : tostring(""); p->fval = f; --- 211,217 ---- } p = (Cell *) malloc(sizeof(Cell)); if (p == NULL) ! FATAL("out of space for symbol table at %s", n); p->nval = tostring(n); p->sval = s ? tostring(s) : tostring(""); p->fval = f; *************** *** 299,309 **** void funnyvar(Cell *vp, char *rw) { if (isarr(vp)) ! ERROR "can't %s %s; it's an array name.", rw, vp->nval FATAL; if (vp->tval & FCN) ! ERROR "can't %s %s; it's a function.", rw, vp->nval FATAL; ! ERROR "funny variable %p: n=%s s=\"%s\" f=%g t=%o", ! vp, vp->nval, vp->sval, vp->fval, vp->tval WARNING; } char *setsval(Cell *vp, char *s) /* set string val of a Cell */ --- 299,309 ---- void funnyvar(Cell *vp, char *rw) { if (isarr(vp)) ! FATAL("can't %s %s; it's an array name.", rw, vp->nval); if (vp->tval & FCN) ! FATAL("can't %s %s; it's a function.", rw, vp->nval); ! WARNING("funny variable %p: n=%s s=\"%s\" f=%g t=%o", ! vp, vp->nval, vp->sval, vp->fval, vp->tval); } char *setsval(Cell *vp, char *s) /* set string val of a Cell */ *************** *** 383,407 **** p = (char *) malloc(strlen(s)+1); if (p == NULL) ! ERROR "out of space in tostring on %s", s FATAL; strcpy(p, s); return(p); } char *qstring(char *s, int delim) /* collect string up to next delim */ { int c, n; ! char *buf = 0, *bp; if ((buf = (char *) malloc(strlen(s)+3)) == NULL) ! ERROR "out of space in qstring(%s)", s); for (bp = buf; (c = *s) != delim; s++) { if (c == '\n') ! ERROR "newline in string %.10s...", buf SYNTAX; else if (c != '\\') *bp++ = c; ! else { /* \something */ ! switch (c = *++s) { case '\\': *bp++ = '\\'; break; case 'n': *bp++ = '\n'; break; case 't': *bp++ = '\t'; break; --- 383,413 ---- p = (char *) malloc(strlen(s)+1); if (p == NULL) ! FATAL("out of space in tostring on %s", s); strcpy(p, s); return(p); } char *qstring(char *s, int delim) /* collect string up to next delim */ { + char *os = s; int c, n; ! char *buf, *bp; if ((buf = (char *) malloc(strlen(s)+3)) == NULL) ! FATAL( "out of space in qstring(%s)", s); for (bp = buf; (c = *s) != delim; s++) { if (c == '\n') ! SYNTAX( "newline in string %.20s...", os ); else if (c != '\\') *bp++ = c; ! else { /* \something */ ! c = *++s; ! if (c == 0) { /* \ at end */ ! *bp++ = '\\'; ! break; /* for loop */ ! } ! switch (c) { case '\\': *bp++ = '\\'; break; case 'n': *bp++ = '\n'; break; case 't': *bp++ = '\t'; break;