diff options
author | Chip Salzenberg <chip@perl.com> | 1997-03-07 03:48:20 +1200 |
---|---|---|
committer | Chip Salzenberg <chip@atlantic.net> | 1997-04-09 00:00:00 +0000 |
commit | a5571d593ac90d11dc2015dcb1d4f62bc0d28a6d (patch) | |
tree | 36d5c91e1099c5f6252ddad12663f2a81aa8a8d2 | |
parent | 8b6a6e55c8aee2cca22dc5eb0d7dfb73f878584c (diff) | |
download | perl-a5571d593ac90d11dc2015dcb1d4f62bc0d28a6d.tar.gz |
Add B<-o> option to a2p, for old awk; make new the default
-rw-r--r-- | x2p/a2p.h | 1 | ||||
-rw-r--r-- | x2p/a2p.pod | 6 | ||||
-rw-r--r-- | x2p/a2py.c | 3 | ||||
-rw-r--r-- | x2p/walk.c | 2 |
4 files changed, 11 insertions, 1 deletions
@@ -415,6 +415,7 @@ EXT bool nomemok INIT(FALSE); EXT char const_FS INIT(0); EXT char *namelist INIT(Nullch); EXT char fswitch INIT(0); +EXT bool old_awk INIT(0); EXT int saw_FS INIT(0); EXT int maxfld INIT(0); diff --git a/x2p/a2p.pod b/x2p/a2p.pod index 06c5ac7322..fa726fb101 100644 --- a/x2p/a2p.pod +++ b/x2p/a2p.pod @@ -41,6 +41,12 @@ Any delimiter can be used to separate the field names. causes a2p to assume that input will always have that many fields. +=item B<-o> + +tells a2p to use old awk behavior. For now, the only difference is +that old awk always has a line loop, even if there are no line +actions, whereas new awk does not. + =back =head2 "Considerations" diff --git a/x2p/a2py.c b/x2p/a2py.c index 46ec604c06..ad685fe7e9 100644 --- a/x2p/a2py.c +++ b/x2p/a2py.c @@ -80,6 +80,9 @@ register char **env; case 'n': namelist = savestr(argv[0]+2); break; + case 'o': + old_awk = TRUE; + break; case '-': argc--,argv++; goto switch_end; diff --git a/x2p/walk.c b/x2p/walk.c index 936f202df8..cb40073b22 100644 --- a/x2p/walk.c +++ b/x2p/walk.c @@ -145,7 +145,7 @@ int minprec; /* minimum precedence without parens */ if (saw_FNR) str_cat(str,"continue {\n $FNRbase = $. if eof;\n}\n"); } - else + else if (old_awk) str_cat(str,"while (<>) { } # (no line actions)\n"); if (ops[node+4].ival) { realexit = TRUE; |