Skip site navigation (1)Skip section navigation (2)
Date:      Wed, 30 Apr 2003 16:34:48 +0200
From:      Jens Schweikhardt <schweikh@schweikhardt.net>
To:        freebsd-standards@freebsd.org
Subject:   bug or feature in m4?
Message-ID:  <20030430143448.GB5142@schweikhardt.net>

next in thread | raw e-mail | index | archive | help
hello, world\n

I'm not sure if this is a bug, feature or a misunderstanding of mine. I
would expect the m4 syscmd macro to be replaced at the point where it
appears in the input, but apparently its output appears at the very
beginning. How to repeat:

	$ m4 > x
	hello
	world
	syscmd(date)dnl
	foo
	bar
    ^D
	$ cat x
	Wed Apr 30 16:21:07 CEST 2003
	hello
	world
	foo
	bar

My expectation is to see

	hello
	world
	Wed Apr 30 16:21:07 CEST 2003
	foo
	bar

POSIX 2001 (SUSv3) says

  syscmd

    The syscmd macro shall interpret its first argument as a shell
    command line. The defining text shall be the string result of that
    command. No output redirection shall be performed by the m4 utility.
    The exit status value from the command can be retrieved using the
    sysval macro.

The esyscmd macro does what I expect, however it is not POSIX and I'd
like to write portable m4 input files.

Regards,

	Jens
-- 
Jens Schweikhardt http://www.schweikhardt.net/
SIGSIG -- signature too long (core dumped)



Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?20030430143448.GB5142>