1N/A/* $RCSfile: walk.c,v $$Revision: 4.1 $$Date: 92/08/07 18:29:31 $ 1N/A * Copyright (C) 1991, 1992, 1993, 1994, 1995, 1997, 1998, 1999, 1N/A * 2000, 2001, 2002, by Larry Wall and others 1N/A * You may distribute under the terms of either the GNU General Public 1N/A * License or the Artistic License, as specified in the README file. 1N/A /* minimum precedence without parens */ 1N/A str_cat(
str,
"$\\ = \"\\n\";\t\t# set output record separator\n");
1N/A " if ($getline_ok = (($_ = <$fh>) ne ''))");
1N/A " if ($getline_ok = (($_ = <>) ne ''))");
1N/A local($mode,$name,$pipe) = @_;\n\ 1N/A open($name,$mode.$name.$pipe) unless $opened{$name}++;\n\ 1N/A /* translate \nnn to [\nnn] */ 1N/A len =
2;
/* a legal fiction */ 1N/A if (*t ==
'"' || *t ==
'\'')
1N/A fatal(
"Internal error: OGETLINE %s", t);
1N/A str_cat(
str,
" && ($RLENGTH = length($&), $RSTART = length($`)+1)");
1N/A for (t = s+
7; *t; t++) {
1N/A if (*t ==
';' || *t ==
'}')
1N/A *d++ =
'$' + (
char)
128;
1N/A *d++ =
'\\' + (
char)
128;
1N/A else if (*t ==
'\\') {
1N/A case '\\':
case '"':
case 'n':
case 't':
case '$':
1N/A default:
/* hide this from perl */ 1N/A *d++ =
'\\' + (
char)
128;
1N/A if (*t ==
'"' || *t ==
'\'')
1N/A lparen =
"";
/* set to parens if necessary */ 1N/A if (
len ==
3) {
/* output redirection */ 1N/A if (*t ==
'"' || *t ==
'\'')
1N/A for (t = s; (i = *t); t++) {
1N/A if (i ==
'}' || i ==
']')
1N/A "foreach %s ($[ .. $#%s) ",
1N/A "foreach %s (keys %%%s) ",
1N/A else if (*t ==
'\t')
1N/A /* strip trailing white space */ 1N/A while (s >=
str->
str_ptr && (*s ==
' ' || *s ==
'\t' || *s ==
'\n'))
1N/A while (s >=
str->
str_ptr && (*s ==
' ' || *s ==
'\t' || *s ==
'\n'))
1N/A if (
len ==
3) {
/* output redirection */