aboutsummaryrefslogtreecommitdiffstats
path: root/awk9.c
diff options
context:
space:
mode:
authorArnold D. Robbins <arnold@skeeve.com>2010-07-02 15:49:42 +0300
committerArnold D. Robbins <arnold@skeeve.com>2010-07-02 15:49:42 +0300
commit483a58b779f2bd6c5fff64c9429a766d33e46a41 (patch)
tree41ee58e21c390c40d90893b277542b309e7d0de7 /awk9.c
parent3711eedc1b995eb1926c9ffb902d5d796cacf8d0 (diff)
downloadegawk-483a58b779f2bd6c5fff64c9429a766d33e46a41.tar.gz
egawk-483a58b779f2bd6c5fff64c9429a766d33e46a41.tar.bz2
egawk-483a58b779f2bd6c5fff64c9429a766d33e46a41.zip
Now at 2.03.
Diffstat (limited to 'awk9.c')
-rw-r--r--awk9.c49
1 files changed, 40 insertions, 9 deletions
diff --git a/awk9.c b/awk9.c
index 64e39907..c6eb1ccb 100644
--- a/awk9.c
+++ b/awk9.c
@@ -1,8 +1,5 @@
/*
* routines for node management
- *
- * Copyright (C) 1988 Free Software Foundation
- *
*/
/*
@@ -29,8 +26,6 @@ AWKNUM
r_force_number(n)
NODE *n;
{
- double atof();
-
#ifdef DEBUG
if (n == NULL)
cant_happen();
@@ -75,7 +70,7 @@ NODE *s;
s->stlen = strlen(buf);
s->stref = 1;
emalloc(s->stptr, char *, s->stlen + 1, "force_string");
- memcpy(s->stptr, buf, s->stlen+1);
+ bcopy(buf, s->stptr, s->stlen+1);
return s;
}
@@ -83,6 +78,7 @@ NODE *s;
* This allocates a new node of type ty. Note that this node will not go
* away unless freed.
*/
+#ifdef notdef
NODE *
newnode(ty)
NODETYPE ty;
@@ -95,6 +91,13 @@ NODETYPE ty;
return r;
}
+freenode(n)
+NODE *n;
+{
+ free((char *)n);
+}
+#endif
+
/*
* Duplicate a node. (For global strings, "duplicate" means crank up the
* reference count.) This creates global nodes. . .
@@ -115,7 +118,7 @@ NODE *n;
n->stref++;
return n;
}
- emalloc(r, NODE *, sizeof(NODE), "dupnode");
+ r = newnode(Node_illegal);
*r = *n;
r->flags &= ~(PERM|TEMP);
r->flags |= MALLOC;
@@ -214,6 +217,12 @@ char *s;
break;
}
break;
+ case 'a':
+ if (strict)
+ goto def;
+ else
+ c = BELL;
+ break;
case 'b':
c = '\b';
break;
@@ -230,9 +239,31 @@ char *s;
c = '\t';
break;
case 'v':
- c = '\v';
+ if (strict)
+ goto def;
+ else
+ c = '\v';
+ break;
+ case 'x':
+ if (strict)
+ goto def;
+ else {
+ register int i;
+
+ c = 0;
+ while (*pf && isxdigit(*pf)) {
+ if (isdigit(*pf))
+ c += *pf - '0';
+ else if (isupper(*pf))
+ c += *pf - 'A' + 10;
+ else
+ c += *pf - 'a' + 10;
+ pf++;
+ }
+ }
break;
default:
+ def:
*pt++ = '\\';
break;
}
@@ -247,7 +278,7 @@ char *s;
len = pt - s;
}
r = newnode(Node_val);
- emalloc(r->stptr, char *, len + 1, "make_string");
+ emalloc(r->stptr, char *, len + 1, s);
r->stlen = len;
r->stref = 1;
bcopy(s, r->stptr, len);