X-Git-Url: http://git.shadowcat.co.uk/gitweb/gitweb.cgi?a=blobdiff_plain;f=x2p%2Fa2py.c;h=84fdc4873701a02afc2c8bc40372c92b18bd4383;hb=953f6acfa20ec275ec39a552dfac8124bd93ebdf;hp=df0a55cb21405b0f672a1328857dca59018f13ee;hpb=8665f9e443dd7c1aaeda99d470ddf0b6fe056f80;p=p5sagit%2Fp5-mst-13.2.git diff --git a/x2p/a2py.c b/x2p/a2py.c index df0a55c..84fdc48 100644 --- a/x2p/a2py.c +++ b/x2p/a2py.c @@ -18,8 +18,8 @@ #endif #include "util.h" -char *filename; -char *myname; +const char *filename; +const char *myname; int checkers = 0; @@ -59,7 +59,7 @@ usage() #endif int -main(register int argc, register char **argv, register char **env) +main(register int argc, register const char **argv, register const char **env) { register STR *str; int i; @@ -117,7 +117,7 @@ main(register int argc, register char **argv, register char **env) /* open script */ - if (argv[0] == Nullch) { + if (argv[0] == NULL) { #if defined(OS2) || defined(WIN32) || defined(NETWARE) if ( isatty(fileno(stdin)) ) usage(); @@ -126,14 +126,13 @@ main(register int argc, register char **argv, register char **env) } filename = savestr(argv[0]); - filename = savestr(argv[0]); if (strEQ(filename,"-")) argv[0] = ""; if (!*argv[0]) rsfp = stdin; else rsfp = fopen(argv[0],"r"); - if (rsfp == Nullfp) + if (rsfp == NULL) fatal("Awk script \"%s\" doesn't seem to exist.\n",filename); /* init tokener */ @@ -254,10 +253,10 @@ yylex(void) if (!rsfp) RETURN(0); line++; - if ((s = str_gets(linestr, rsfp)) == Nullch) { + if ((s = str_gets(linestr, rsfp)) == NULL) { if (rsfp != stdin) fclose(rsfp); - rsfp = Nullfp; + rsfp = NULL; s = str_get(linestr); RETURN(0); } @@ -562,7 +561,7 @@ yylex(void) else if (strEQ(d,"function")) XTERM(FUNCTION); if (strEQ(d,"FILENAME")) - d = "ARGV"; + ID("ARGV"); if (strEQ(d,"foreach")) *d = toUPPER(*d); else if (strEQ(d,"format")) @@ -666,14 +665,14 @@ yylex(void) SNARFWORD; if (strEQ(d,"ORS")) { saw_ORS = TRUE; - d = "\\"; + ID("\\"); } if (strEQ(d,"OFS")) { saw_OFS = TRUE; - d = ","; + ID(","); } if (strEQ(d,"OFMT")) { - d = "#"; + ID("#"); } if (strEQ(d,"open")) *d = toUPPER(*d); @@ -701,8 +700,8 @@ yylex(void) case 'r': case 'R': SNARFWORD; if (strEQ(d,"RS")) { - d = "/"; saw_RS = TRUE; + ID("/"); } if (strEQ(d,"rand")) { yylval = ORAND; @@ -743,7 +742,7 @@ yylex(void) XTERM(FUN1); } if (strEQ(d,"SUBSEP")) { - d = ";"; + ID(";"); } if (strEQ(d,"sin")) { yylval = OSIN; @@ -878,7 +877,7 @@ scanpat(register char *s) } void -yyerror(char *s) +yyerror(const char *s) { fprintf(stderr,"%s in file %s at line %d\n", s,filename,line); @@ -921,7 +920,7 @@ scannum(register char *s) } int -string(char *ptr, int len) +string(const char *ptr, int len) { int retval = mop;