* Eric Blake wrote on Sat, Oct 25, 2008 at 02:11:01PM CEST: > According to Ralf Wildenhues on 10/25/2008 3:36 AM: > > > > For bonus points, is it possible to defun AS_EXIT as plain exit for as > > long as the trap isn't in place, or as '(exit X); exit X' for as long > > as we are before any shell function, and the redefun it as the cool > > version at that point? That way you could keep using AS_EXIT > > everywhere, consistently. > > How would m4sh know whether it is in a trap context? The user would be > required to call the as-yet-unwritten AS_TRAP to set up all trap contexts > for this to work (ie. any existing m4sh code that uses m4sh writes their > own trap code without informing m4 that context has changed). Not to > mention the issue with diversions (just because a trap is active in the > main body does not mean the trap is still active if you AS_REQUIRE > additional text into an earlier diversion). So I think it is safer to > always assume we are in trap context. The amount of code prior to > functions being defined is well-defined; but maybe there, I could use > m4_pushdef([AS_EXIT],[exit $1])/m4_popdef([AS_EXIT]) inside those few > macros (_AS_SANITIZE, ...), so that we never see raw exit in autoconf's > source base outside of the AS_EXIT macro.
Yes, I meant something like the latter; a general solution with knowing about trap context seems hard. Thanks, Ralf
