summaryrefslogtreecommitdiff
path: root/sys/src/cmd/awk/parse.c
diff options
context:
space:
mode:
authorben <ben@rana>2016-04-26 22:23:44 -0500
committerben <ben@rana>2016-04-26 22:23:44 -0500
commit0a460e1722c50e31653359f8a86fe0b606d2b513 (patch)
treeb5a00bbfc883aa98709db012e0a7bacc67e234af /sys/src/cmd/awk/parse.c
parent651d6c2bc68e7e5224c3ba41b094e37b1c1890ed (diff)
New libregexp and APE ported to native
Diffstat (limited to 'sys/src/cmd/awk/parse.c')
-rw-r--r--sys/src/cmd/awk/parse.c21
1 files changed, 10 insertions, 11 deletions
diff --git a/sys/src/cmd/awk/parse.c b/sys/src/cmd/awk/parse.c
index 2ee6eca62..3e42d2ba7 100644
--- a/sys/src/cmd/awk/parse.c
+++ b/sys/src/cmd/awk/parse.c
@@ -22,10 +22,9 @@ ARISING OUT OF OR IN CONNECTION WITH THE USE OR PERFORMANCE OF
THIS SOFTWARE.
****************************************************************/
-#define DEBUG
-#include <stdio.h>
-#include <string.h>
-#include <stdlib.h>
+#include <u.h>
+#include <libc.h>
+#include <bio.h>
#include "awk.h"
#include "y.tab.h"
@@ -34,9 +33,9 @@ Node *nodealloc(int n)
Node *x;
x = (Node *) malloc(sizeof(Node) + (n-1)*sizeof(Node *));
- if (x == NULL)
+ if (x == nil)
FATAL("out of space in nodealloc");
- x->nnext = NULL;
+ x->nnext = nil;
x->lineno = lineno;
return(x);
}
@@ -220,11 +219,11 @@ Node *linkum(Node *a, Node *b)
if (errorflag) /* don't link things that are wrong */
return a;
- if (a == NULL)
+ if (a == nil)
return(b);
- else if (b == NULL)
+ else if (b == nil)
return(a);
- for (c = a; c->nnext != NULL; c = c->nnext)
+ for (c = a; c->nnext != nil; c = c->nnext)
;
c->nnext = b;
return(a);
@@ -245,7 +244,7 @@ void defn(Cell *v, Node *vl, Node *st) /* turn on FCN bit in definition, */
for (p = vl; p; p = p->nnext)
n++;
v->fval = n;
- dprintf( ("defining func %s (%d args)\n", v->nval, n) );
+ dprint( ("defining func %s (%d args)\n", v->nval, n) );
}
int isarg(char *s) /* is s in argument list for current function? */
@@ -262,7 +261,7 @@ int isarg(char *s) /* is s in argument list for current function? */
int ptoi(void *p) /* convert pointer to integer */
{
- return (int) (long) p; /* swearing that p fits, of course */
+ return (int) (vlong) p; /* swearing that p fits, of course */
}
Node *itonp(int i) /* and vice versa */