]> git.ipfire.org Git - thirdparty/ntp.git/commitdiff
libopts-27.4.2
authorHarlan Stenn <stenn@ntp.org>
Fri, 28 Jul 2006 04:57:01 +0000 (00:57 -0400)
committerHarlan Stenn <stenn@ntp.org>
Fri, 28 Jul 2006 04:57:01 +0000 (00:57 -0400)
bk: 44c9991dlJ1g6E76BR64S_H1LsvYeA

12 files changed:
libopts/compat/snprintf.c
libopts/m4/libopts.m4
libopts/makeshell.c
libopts/proto.h
libopts/streqvcmp.c
libopts/version.c
sntp/libopts/compat/snprintf.c
sntp/libopts/m4/libopts.m4
sntp/libopts/makeshell.c
sntp/libopts/proto.h
sntp/libopts/streqvcmp.c
sntp/libopts/version.c

index 02155785983df9149164983554a51c62d8e4244a..78bda479be82ab5f899368bd3ea3351e1ac15c04 100644 (file)
@@ -3,6 +3,26 @@
 #include "choke-me: no vprintf and no snprintf"
 #endif
 
+#if defined(HAVE_STDARG_H)
+#  include <stdarg.h>
+#  ifndef   VA_START
+#    define VA_START(a, f)  va_start(a, f)
+#    define VA_END(a)      va_end(a)
+#  endif /* VA_START */
+#  define SNV_USING_STDARG_H
+
+#elif defined(HAVE_VARARGS_H)
+#  include <varargs.h>
+#  ifndef   VA_START
+#    define VA_START(a, f) va_start(a)
+#    define VA_END(a)   va_end(a)
+#  endif /* VA_START */
+#  undef  SNV_USING_STDARG_H
+
+#else
+#  include "must-have-stdarg-or-varargs"
+#endif
+
 static int
 snprintf(char *str, size_t n, const char *fmt, ...)
 {
@@ -11,17 +31,21 @@ snprintf(char *str, size_t n, const char *fmt, ...)
 
 #ifdef VSPRINTF_CHARSTAR
     char *rp;
-    va_start(ap, fmt);
+    VA_START(ap, fmt);
     rp = vsprintf(str, fmt, ap);
-    va_end(ap);
+    VA_END(ap);
     rval = strlen(rp);
 
 #else
-    va_start(ap, fmt);
+    VA_START(ap, fmt);
     rval = vsprintf(str, fmt, ap);
-    va_end(ap);
+    VA_END(ap);
 #endif
 
+    if (rval > n) {
+        fprintf(stderr, "snprintf buffer overrun %d > %d\n", rval, n);
+        abort();
+    }
     return rval;
 }
 
index fed65020d0d0d9e74b1410930087c06c793cbc66..d800dd95a95792f8b5a76aa2c024ab332e71e661 100644 (file)
@@ -2,7 +2,7 @@ dnl  -*- buffer-read-only: t -*- vi: set ro:
 dnl 
 dnl DO NOT EDIT THIS FILE   (libopts.m4)
 dnl 
-dnl It has been AutoGen-ed  Saturday July 22, 2006 at 08:36:51 AM PDT
+dnl It has been AutoGen-ed  Thursday July 27, 2006 at 09:14:31 PM PDT
 dnl From the definitions    libopts.def
 dnl and the template file   conftest.tpl
 dnl
index 0d7f39e95541e643087ce015b6b8c6e9d837c99e..dbb4ff590d9aa18ca33db4533f64ecd7f3016acb 100644 (file)
@@ -1,7 +1,7 @@
 
 /*
- *  $Id: makeshell.c,v 4.13 2006/07/15 22:10:21 bkorb Exp $
- * Time-stamp:      "2006-07-15 08:18:01 bkorb"
+ *  $Id: makeshell.c,v 4.14 2006/07/27 02:51:47 bkorb Exp $
+ * Time-stamp:      "2006-07-24 21:30:51 bkorb"
  *
  *  This module will interpret the options set in the tOptions
  *  structure and create a Bourne shell script capable of parsing them.
@@ -499,6 +499,13 @@ optionParseShell( tOptions* pOpts )
 static void
 textToVariable( tOptions* pOpts, teTextTo whichVar, tOptDesc* pOD )
 {
+#   define _TT_(n) tSCC z ## n [] = #n;
+    TEXTTO_TABLE
+#   undef _TT_
+#   define _TT_(n) z ## n ,
+      static const char*  apzTTNames[] = { TEXTTO_TABLE };
+#   undef _TT_
+
 #if defined(__windows__) && !defined(__CYGWIN__)
     printf( "%1$s_%2$s_TEXT='no %2$s text'\n",
             pOpts->pzPROGNAME, apzTTNames[ whichVar ]);
@@ -507,13 +514,6 @@ textToVariable( tOptions* pOpts, teTextTo whichVar, tOptDesc* pOD )
     int  pipeFd[2];
     FILE* fp;
 
-#   define _TT_(n) tSCC z ## n [] = #n;
-    TEXTTO_TABLE
-#   undef _TT_
-#   define _TT_(n) z ## n ,
-      static const char*  apzTTNames[] = { TEXTTO_TABLE };
-#   undef _TT_
-
     printf( "%s_%s_TEXT='", pOpts->pzPROGNAME, apzTTNames[ whichVar ]);
     fflush( stdout );
 
index 574728e3e33f182d8631bb1485bb4e8956ddcd0a..fc05366370a1d981cb7e2448abc8fc5922714d62 100644 (file)
@@ -1,7 +1,7 @@
 /* -*- buffer-read-only: t -*- vi: set ro:
  *
  * Prototypes for autoopts
- * Generated Sat Jul 22 08:37:30 PDT 2006
+ * Generated Thu Jul 27 21:15:11 PDT 2006
  */
 #ifndef AUTOOPTS_PROTO_H_GUARD
 #define AUTOOPTS_PROTO_H_GUARD 1
index 28b255a36b76c99950e95ce05159d327f35e482f..42336dc97c40d532f33e0935981cbea1529bf987 100644 (file)
@@ -1,7 +1,7 @@
 
 /*
- *  $Id: streqvcmp.c,v 4.9 2006/03/25 19:23:28 bkorb Exp $
- * Time-stamp:      "2005-10-29 14:05:07 bkorb"
+ *  $Id: streqvcmp.c,v 4.10 2006/07/27 02:51:47 bkorb Exp $
+ * Time-stamp:      "2006-07-26 18:25:53 bkorb"
  *
  *  String Equivalence Comparison
  *
@@ -273,9 +273,7 @@ strequate( const char* s )
  * err:  none.
 =*/
 void
-strtransform( d, s )
-    char*       d;
-    const char* s;
+strtransform( char* d, const char* s )
 {
     do  {
         *(d++) = (char)charmap[ (unsigned)*s ];
index 290ee0fe0fc2d3a9b41787c4a5990835a9ffc7e9..e01809a8053439e2d6f44cc189c7792501a1650b 100644 (file)
@@ -1,6 +1,6 @@
 
-/*  $Id: version.c,v 4.8 2006/03/25 19:23:28 bkorb Exp $
- * Time-stamp:      "2005-12-13 10:29:09 bkorb"
+/*  $Id: version.c,v 4.9 2006/07/27 02:51:47 bkorb Exp $
+ * Time-stamp:      "2006-07-26 18:38:16 bkorb"
  *
  *  This module implements the default usage procedure for
  *  Automated Options.  It may be overridden, of course.
@@ -146,9 +146,7 @@ printVersion( tOptions* pOpts, tOptDesc* pOD, FILE* fp )
  *  This routine will print the version to stdout.
 =*/
 void
-optionPrintVersion( pOpts, pOD )
-    tOptions*  pOpts;
-    tOptDesc*  pOD;
+optionPrintVersion( tOptions*  pOpts, tOptDesc*  pOD )
 {
     printVersion( pOpts, pOD, stdout );
 }
@@ -164,9 +162,7 @@ optionPrintVersion( pOpts, pOD )
  *  This routine will print the version to stderr.
 =*/
 void
-optionVersionStderr( pOpts, pOD )
-    tOptions*  pOpts;
-    tOptDesc*  pOD;
+optionVersionStderr( tOptions*  pOpts, tOptDesc*  pOD )
 {
     printVersion( pOpts, pOD, stderr );
 }
index 02155785983df9149164983554a51c62d8e4244a..78bda479be82ab5f899368bd3ea3351e1ac15c04 100644 (file)
@@ -3,6 +3,26 @@
 #include "choke-me: no vprintf and no snprintf"
 #endif
 
+#if defined(HAVE_STDARG_H)
+#  include <stdarg.h>
+#  ifndef   VA_START
+#    define VA_START(a, f)  va_start(a, f)
+#    define VA_END(a)      va_end(a)
+#  endif /* VA_START */
+#  define SNV_USING_STDARG_H
+
+#elif defined(HAVE_VARARGS_H)
+#  include <varargs.h>
+#  ifndef   VA_START
+#    define VA_START(a, f) va_start(a)
+#    define VA_END(a)   va_end(a)
+#  endif /* VA_START */
+#  undef  SNV_USING_STDARG_H
+
+#else
+#  include "must-have-stdarg-or-varargs"
+#endif
+
 static int
 snprintf(char *str, size_t n, const char *fmt, ...)
 {
@@ -11,17 +31,21 @@ snprintf(char *str, size_t n, const char *fmt, ...)
 
 #ifdef VSPRINTF_CHARSTAR
     char *rp;
-    va_start(ap, fmt);
+    VA_START(ap, fmt);
     rp = vsprintf(str, fmt, ap);
-    va_end(ap);
+    VA_END(ap);
     rval = strlen(rp);
 
 #else
-    va_start(ap, fmt);
+    VA_START(ap, fmt);
     rval = vsprintf(str, fmt, ap);
-    va_end(ap);
+    VA_END(ap);
 #endif
 
+    if (rval > n) {
+        fprintf(stderr, "snprintf buffer overrun %d > %d\n", rval, n);
+        abort();
+    }
     return rval;
 }
 
index fed65020d0d0d9e74b1410930087c06c793cbc66..d800dd95a95792f8b5a76aa2c024ab332e71e661 100644 (file)
@@ -2,7 +2,7 @@ dnl  -*- buffer-read-only: t -*- vi: set ro:
 dnl 
 dnl DO NOT EDIT THIS FILE   (libopts.m4)
 dnl 
-dnl It has been AutoGen-ed  Saturday July 22, 2006 at 08:36:51 AM PDT
+dnl It has been AutoGen-ed  Thursday July 27, 2006 at 09:14:31 PM PDT
 dnl From the definitions    libopts.def
 dnl and the template file   conftest.tpl
 dnl
index 0d7f39e95541e643087ce015b6b8c6e9d837c99e..dbb4ff590d9aa18ca33db4533f64ecd7f3016acb 100644 (file)
@@ -1,7 +1,7 @@
 
 /*
- *  $Id: makeshell.c,v 4.13 2006/07/15 22:10:21 bkorb Exp $
- * Time-stamp:      "2006-07-15 08:18:01 bkorb"
+ *  $Id: makeshell.c,v 4.14 2006/07/27 02:51:47 bkorb Exp $
+ * Time-stamp:      "2006-07-24 21:30:51 bkorb"
  *
  *  This module will interpret the options set in the tOptions
  *  structure and create a Bourne shell script capable of parsing them.
@@ -499,6 +499,13 @@ optionParseShell( tOptions* pOpts )
 static void
 textToVariable( tOptions* pOpts, teTextTo whichVar, tOptDesc* pOD )
 {
+#   define _TT_(n) tSCC z ## n [] = #n;
+    TEXTTO_TABLE
+#   undef _TT_
+#   define _TT_(n) z ## n ,
+      static const char*  apzTTNames[] = { TEXTTO_TABLE };
+#   undef _TT_
+
 #if defined(__windows__) && !defined(__CYGWIN__)
     printf( "%1$s_%2$s_TEXT='no %2$s text'\n",
             pOpts->pzPROGNAME, apzTTNames[ whichVar ]);
@@ -507,13 +514,6 @@ textToVariable( tOptions* pOpts, teTextTo whichVar, tOptDesc* pOD )
     int  pipeFd[2];
     FILE* fp;
 
-#   define _TT_(n) tSCC z ## n [] = #n;
-    TEXTTO_TABLE
-#   undef _TT_
-#   define _TT_(n) z ## n ,
-      static const char*  apzTTNames[] = { TEXTTO_TABLE };
-#   undef _TT_
-
     printf( "%s_%s_TEXT='", pOpts->pzPROGNAME, apzTTNames[ whichVar ]);
     fflush( stdout );
 
index 574728e3e33f182d8631bb1485bb4e8956ddcd0a..fc05366370a1d981cb7e2448abc8fc5922714d62 100644 (file)
@@ -1,7 +1,7 @@
 /* -*- buffer-read-only: t -*- vi: set ro:
  *
  * Prototypes for autoopts
- * Generated Sat Jul 22 08:37:30 PDT 2006
+ * Generated Thu Jul 27 21:15:11 PDT 2006
  */
 #ifndef AUTOOPTS_PROTO_H_GUARD
 #define AUTOOPTS_PROTO_H_GUARD 1
index 28b255a36b76c99950e95ce05159d327f35e482f..42336dc97c40d532f33e0935981cbea1529bf987 100644 (file)
@@ -1,7 +1,7 @@
 
 /*
- *  $Id: streqvcmp.c,v 4.9 2006/03/25 19:23:28 bkorb Exp $
- * Time-stamp:      "2005-10-29 14:05:07 bkorb"
+ *  $Id: streqvcmp.c,v 4.10 2006/07/27 02:51:47 bkorb Exp $
+ * Time-stamp:      "2006-07-26 18:25:53 bkorb"
  *
  *  String Equivalence Comparison
  *
@@ -273,9 +273,7 @@ strequate( const char* s )
  * err:  none.
 =*/
 void
-strtransform( d, s )
-    char*       d;
-    const char* s;
+strtransform( char* d, const char* s )
 {
     do  {
         *(d++) = (char)charmap[ (unsigned)*s ];
index 290ee0fe0fc2d3a9b41787c4a5990835a9ffc7e9..e01809a8053439e2d6f44cc189c7792501a1650b 100644 (file)
@@ -1,6 +1,6 @@
 
-/*  $Id: version.c,v 4.8 2006/03/25 19:23:28 bkorb Exp $
- * Time-stamp:      "2005-12-13 10:29:09 bkorb"
+/*  $Id: version.c,v 4.9 2006/07/27 02:51:47 bkorb Exp $
+ * Time-stamp:      "2006-07-26 18:38:16 bkorb"
  *
  *  This module implements the default usage procedure for
  *  Automated Options.  It may be overridden, of course.
@@ -146,9 +146,7 @@ printVersion( tOptions* pOpts, tOptDesc* pOD, FILE* fp )
  *  This routine will print the version to stdout.
 =*/
 void
-optionPrintVersion( pOpts, pOD )
-    tOptions*  pOpts;
-    tOptDesc*  pOD;
+optionPrintVersion( tOptions*  pOpts, tOptDesc*  pOD )
 {
     printVersion( pOpts, pOD, stdout );
 }
@@ -164,9 +162,7 @@ optionPrintVersion( pOpts, pOD )
  *  This routine will print the version to stderr.
 =*/
 void
-optionVersionStderr( pOpts, pOD )
-    tOptions*  pOpts;
-    tOptDesc*  pOD;
+optionVersionStderr( tOptions*  pOpts, tOptDesc*  pOD )
 {
     printVersion( pOpts, pOD, stderr );
 }