m4-patches
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

36-fyi-libsnprintfv.patch


From: Akim Demaille
Subject: 36-fyi-libsnprintfv.patch
Date: Wed, 05 Sep 2001 09:16:33 +0200

Gary, how about introducing your lib soon?  It turns out that while
writing some documentation about Autotest, I used a file named
`dnl.at', which revealed the file names are not properly quoted in
Autotest, what resulted in:

| src/autotest/standalone % m4 --nesting-limit=1024 
--include=/usr/local/share/autoconf 
/usr/local/share/autoconf/autotest/autotest.m4 dnl.at >autom4te.cache/output.0 
--trace format -daeq
| m4trace: -1- m4_format([ %3d: %-15s %s], [1], [
|   1 ]) -> [   1:
|   1            ]
| m4trace: -1- m4_format([%3d: %-18s], [1], [    (
|       $at_traceon
|
| cat >input.m4 <<'_ATEOF'
| dnl This is killed.
| This is not
| _ATEOF
|
| $at_traceoff
| $at_verbose "$srcdir/echo ( $at_traceon; m4 input.m4 ) >at-stdout 2>at-stder1
| at_status=$?
| egrep '^ *\+' at-stder1 >&2
| egrep -v '^ *\+' at-stder1 >at-stderr
| at_failed=false
| $at_diff $at_devnull  at-stderr >&5 || at_failed=:
| echo >>at-stdout; echo "This is not
| " | $at_diff - at-stdout >&5 || at_failed=:
| case $at_status in
|    77) exit 77;;
|    0]) -> [  1:     (
|       $at_traceon
|
| cat >input.m4 <<'_ATEOF'
| dnl This is killed.
| This is not
| _ATEOF
|
| $at_traceoff
| $at_verbose "$srcdir/echo ( $at_traceon; m4 input.m4 ) >at-stdout 2>at-stder1
| at_status=$?
| egrep '^ *\+' at-stder1 >&2
| egrep -v '^ *\+' at-stder1 >at-stderr
| at_failed=false
| $at_diff $at_devnull  at-stderr >&5 || at_failed=:
| echo >>at-stdout; echo "This is not
| " | $at_diff - at-stdout >&5 || at_failed=:
| case $at_status in
|    77) exit 77;;
|    0]

i.e., arguments were shifted, of course, and `format' received way too
big a string to fit in str.  This is probably one of the poorer patch
I will ever apply in my life, well, I hope so...  But it helps me
continuing.

I checked with 1.4: it works.  The sprintf implementation of format is
definitely weaker than the previous one.  I'm fine with changing the
handling of %s which is the only culprit, or let you introduce
libsnprintv.  Just tell me what to do.

I don't know about snprintf's portability, so I did not try to die
with honors either.


Index: ChangeLog
from  Akim Demaille  <address@hidden>

        * modules/format.c (format): Have a bigger `str'.

Index: modules/format.c
--- modules/format.c Mon, 03 Sep 2001 15:40:52 +0200 akim
+++ modules/format.c Tue, 04 Sep 2001 16:30:28 +0200 akim
@@ -69,7 +69,7 @@
   char hflag;                  /* short flag */

   /* Buffer and stuff.  */
-  char str[256];               /* buffer for formatted text */
+  char str[4096];              /* buffer for formatted text */
   enum {INT, UINT, LONG, ULONG, DOUBLE, STR} datatype;

   fmt = ARG_STR (argc, argv);



reply via email to

[Prev in Thread] Current Thread [Next in Thread]