If there are no files listed, or if a filename is '-', the standard
input is processed. Before, only stadard input (with no filenames listed)
OR files could be processed, limiting flexibility.
Two lines in main.c were added and the man page was updated.
+.\" @(#) $Id: m4.1,v 1.3 1993/12/21 02:27:40 alm Exp $
.\"
.Dd January 26, 1993
.Dt m4 1
.\"
.Dd January 26, 1993
.Dt m4 1
.Fl D Ns Ar name Ns Op Ar =value
.Oc
.Op Fl U Ns Ar name
.Fl D Ns Ar name Ns Op Ar =value
.Oc
.Op Fl U Ns Ar name
+.Op Ar filename
+\|.\|.\|.
.Sh DESCRIPTION
The
.Nm m4
utility is a macro processor that can be used as a front end to any
language (e.g., C, ratfor, fortran, lex, and yacc).
.Sh DESCRIPTION
The
.Nm m4
utility is a macro processor that can be used as a front end to any
language (e.g., C, ratfor, fortran, lex, and yacc).
-.Nm m4
-reads from the standard input and writes
-the processed text to the standard output.
+Each of the argument files is processed in order.
+If there are no files, or if a filename is \`-\', the standard input is read.
+The processed text is sent to the standard output.
.Pp
Macro calls have the form name(argument1[, argument2, ...,] argumentN).
.Pp
.Pp
Macro calls have the form name(argument1[, argument2, ...,] argumentN).
.Pp
} else /* file names in commandline */
for (; optind < argc; optind++) {
char *name = argv[optind]; /* next file name */
} else /* file names in commandline */
for (; optind < argc; optind++) {
char *name = argv[optind]; /* next file name */
- infile[0] = fopen(name, "r");
+ if(name[1] == 0 && name[0] == '-')
+ infile[0] = stdin;
+ else
+ infile[0] = fopen(name, "r");
if (!infile[0]) cantread(name);
sp = -1; /* stack pointer initialized */
fp = 0; /* frame pointer initialized */
if (!infile[0]) cantread(name);
sp = -1; /* stack pointer initialized */
fp = 0; /* frame pointer initialized */