Pod typos, pod2man bugs, and miscellaneous installation comments
[p5sagit/p5-mst-13.2.git] / x2p / a2py.c
index a092c8a..454e2dc 100644 (file)
@@ -6,37 +6,30 @@
  *    License or the Artistic License, as specified in the README file.
  *
  * $Log:       a2py.c,v $
- * Revision 4.1  92/08/07  18:29:14  lwall
- * 
- * Revision 4.0.1.2  92/06/08  16:15:16  lwall
- * patch20: in a2p, now warns about spurious backslashes
- * patch20: in a2p, now allows [ to be backslashed in pattern
- * patch20: in a2p, now allows numbers of the form 2.
- * 
- * Revision 4.0.1.1  91/06/07  12:12:59  lwall
- * patch4: new copyright notice
- * 
- * Revision 4.0  91/03/20  01:57:26  lwall
- * 4.0 baseline.
- * 
  */
 
 #ifdef OS2
 #include "../patchlevel.h"
 #endif
 #include "util.h"
-char *index();
 
 char *filename;
 char *myname;
 
 int checkers = 0;
+
+int oper0();
+int oper1();
+int oper2();
+int oper3();
+int oper4();
+int oper5();
 STR *walk();
 
 #ifdef OS2
 usage()
 {
-    printf("\nThis is the AWK to PERL translator, version 4.0, patchlevel %d\n", PATCHLEVEL);
+    printf("\nThis is the AWK to PERL translator, version 5.0, patchlevel %d\n", PATCHLEVEL);
     printf("\nUsage: %s [-D<number>] [-F<char>] [-n<fieldlist>] [-<number>] filename\n", myname);
     printf("\n  -D<number>      sets debugging flags."
            "\n  -F<character>   the awk script to translate is always invoked with"
@@ -54,7 +47,6 @@ register char **argv;
 register char **env;
 {
     register STR *str;
-    register char *s;
     int i;
     STR *tmpstr;
 
@@ -161,16 +153,13 @@ register char **env;
     /* second pass to produce new program */
 
     tmpstr = walk(0,0,root,&i,P_MIN);
-    str = str_make("#!");
-    str_cat(str, BIN);
-    str_cat(str, "/perl\neval \"exec ");
-    str_cat(str, BIN);
-    str_cat(str, "/perl -S $0 $*\"\n\
+    str = str_make(STARTPERL);
+    str_cat(str, "\neval 'exec perl -S $0 \"$@\"'\n\
     if $running_under_some_shell;\n\
                        # this emulates #! processing on NIH machines.\n\
                        # (remove #! line above if indigestible)\n\n");
     str_cat(str,
-      "eval '$'.$1.'$2;' while $ARGV[0] =~ /^([A-Za-z_]+=)(.*)/ && shift;\n");
+      "eval '$'.$1.'$2;' while $ARGV[0] =~ /^([A-Za-z_0-9]+=)(.*)/ && shift;\n");
     str_cat(str,
       "                        # process any FOO=bar switches\n\n");
     if (do_opens && opens) {
@@ -202,6 +191,7 @@ register char **env;
 
 int idtype;
 
+int
 yylex()
 {
     register char *s = bufptr;
@@ -211,7 +201,7 @@ yylex()
   retry:
 #ifdef YYDEBUG
     if (yydebug)
-       if (index(s,'\n'))
+       if (strchr(s,'\n'))
            fprintf(stderr,"Tokener at %s",s);
        else
            fprintf(stderr,"Tokener at %s\n",s);
@@ -841,6 +831,7 @@ register char *s;
     return s;
 }
 
+void
 yyerror(s)
 char *s;
 {
@@ -871,7 +862,7 @@ register char *s;
            else
                s++;
        }
-       if (index("eE",*s) && index("+-0123456789",s[1])) {
+       if (strchr("eE",*s) && strchr("+-0123456789",s[1])) {
            *d++ = *s++;
            if (*s == '+' || *s == '-')
                *d++ = *s++;
@@ -885,8 +876,10 @@ register char *s;
     return s;
 }
 
+int
 string(ptr,len)
 char *ptr;
+int len;
 {
     int retval = mop;
 
@@ -901,6 +894,7 @@ char *ptr;
     return retval;
 }
 
+int
 oper0(type)
 int type;
 {
@@ -914,6 +908,7 @@ int type;
     return retval;
 }
 
+int
 oper1(type,arg1)
 int type;
 int arg1;
@@ -929,6 +924,7 @@ int arg1;
     return retval;
 }
 
+int
 oper2(type,arg1,arg2)
 int type;
 int arg1;
@@ -946,6 +942,7 @@ int arg2;
     return retval;
 }
 
+int
 oper3(type,arg1,arg2,arg3)
 int type;
 int arg1;
@@ -965,6 +962,7 @@ int arg3;
     return retval;
 }
 
+int
 oper4(type,arg1,arg2,arg3,arg4)
 int type;
 int arg1;
@@ -986,6 +984,7 @@ int arg4;
     return retval;
 }
 
+int
 oper5(type,arg1,arg2,arg3,arg4,arg5)
 int type;
 int arg1;
@@ -1011,6 +1010,7 @@ int arg5;
 
 int depth = 0;
 
+void
 dump(branch)
 int branch;
 {
@@ -1038,6 +1038,7 @@ int branch;
     }
 }
 
+int
 bl(arg,maybe)
 int arg;
 int maybe;
@@ -1052,6 +1053,7 @@ int maybe;
        return arg;
 }
 
+void
 fixup(str)
 STR *str;
 {
@@ -1077,6 +1079,7 @@ STR *str;
     }
 }
 
+void
 putlines(str)
 STR *str;
 {
@@ -1153,6 +1156,7 @@ STR *str;
     }
 }
 
+void
 putone()
 {
     register char *t;
@@ -1175,6 +1179,7 @@ putone()
     fputs(tokenbuf,stdout);
 }
 
+int
 numary(arg)
 int arg;
 {
@@ -1189,6 +1194,7 @@ int arg;
     return arg;
 }
 
+int
 rememberargs(arg)
 int arg;
 {
@@ -1211,6 +1217,7 @@ int arg;
     return arg;
 }
 
+int
 aryrefarg(arg)
 int arg;
 {
@@ -1225,6 +1232,7 @@ int arg;
     return arg;
 }
 
+int
 fixfargs(name,arg,prevargs)
 int name;
 int arg;
@@ -1263,6 +1271,7 @@ int prevargs;
     return numargs;
 }
 
+int
 fixrargs(name,arg,prevargs)
 char *name;
 int arg;