diff options
-rw-r--r-- | doc/m4.texi | 64 |
1 files changed, 64 insertions, 0 deletions
diff --git a/doc/m4.texi b/doc/m4.texi index f262a7b4..801f9f94 100644 --- a/doc/m4.texi +++ b/doc/m4.texi @@ -1129,6 +1129,70 @@ If you need to read a file whose name starts with a @file{-}, you can specify it as @samp{./-file}, or use @option{--} to mark the end of options. +@ignore +@comment Test that 'm4 file/' detects that file is not a directory; we +@comment can assume that the current directory contains a Makefile. +@comment mingw fails with EINVAL rather than ENOTDIR. + +@comment status: 1 +@comment xerr: ignore +@comment options: Makefile/ +@example +@error{}m4: cannot open file 'Makefile/': No such file or directory +@end example + +@comment Test that closed stderr does not cause a crash. Not all +@comment systems have the same message for EBADF. + +@comment xerr: ignore +@example +ifdef(`__unix__', , + `errprint(` skipping: syscmd does not have unix semantics +')m4exit(`77')')dnl +syscmd(`echo | cat >&- 2>/dev/null')ifelse(sysval, `0', + `errprint(` skipping: system does not allow closing stdout +')m4exit(`77')')dnl +changequote(`[', `]')dnl +syscmd([echo | ']__program__[' >&-])dnl +@error{}m4: write error: Bad file descriptor +sysval +@result{}1 +@end example + +@example +ifdef(`__unix__', , + `errprint(` skipping: syscmd does not have unix semantics +')m4exit(`77')')dnl +syscmd(`echo | cat >&- 2>/dev/null')ifelse(sysval, `0', + `errprint(` skipping: system does not allow closing stdout +')m4exit(`77')')dnl +changequote(`[', `]')dnl +syscmd([echo 'esyscmd(echo hi >&2 && echo err"print(bye +)d"nl)dnl' > tmp.m4 \ + && ']__program__[' tmp.m4 <&- >&- \ + && rm tmp.m4])sysval +@error{}hi +@error{}bye +@result{}0 +@end example + +@comment Test that we obey POSIX semantics with -D interspersed with +@comment files, even with POSIXLY_CORRECT (BSD getopt gets it wrong). + +$ @kbd{m4 } +@example +ifdef(`__unix__', , + `errprint(` skipping: syscmd does not have unix semantics +')m4exit(`77')')dnl +changequote(`[', `]')dnl +syscmd([POSIXLY_CORRECT=1 ']__program__[' -Dbar=hello foo -Dbar=world foo])dnl +@result{}hello +@result{}world +sysval +@result{}0 +@end example +@end ignore + @node Syntax @chapter Lexical and syntactic conventions |