]> git.ipfire.org Git - thirdparty/ntp.git/commitdiff
libopts-27.4.3 updates
authorHarlan Stenn <stenn@ntp.org>
Mon, 11 Sep 2006 00:47:32 +0000 (20:47 -0400)
committerHarlan Stenn <stenn@ntp.org>
Mon, 11 Sep 2006 00:47:32 +0000 (20:47 -0400)
bk: 4504b224D-wOmCNC6OrlxPqRyKhIfQ

29 files changed:
libopts/autoopts.c
libopts/autoopts.h
libopts/autoopts/options.h
libopts/autoopts/usage-txt.h
libopts/boolean.c
libopts/compat/compat.h
libopts/compat/pathfind.c
libopts/configfile.c
libopts/cook.c
libopts/enumeration.c
libopts/environment.c
libopts/genshell.c
libopts/genshell.h
libopts/load.c
libopts/m4/libopts.m4
libopts/makeshell.c
libopts/nested.c
libopts/numeric.c
libopts/pgusage.c
libopts/proto.h
libopts/putshell.c
libopts/restore.c
libopts/save.c
libopts/sort.c
libopts/stack.c
libopts/streqvcmp.c
libopts/text_mmap.c
libopts/usage.c
libopts/version.c

index 5c9b337aa84dc5bc3d4db23ef87c9433b82987fd..1cb86b6f2693a93023fc66bef650fdec8d489621 100644 (file)
@@ -1,7 +1,7 @@
 
 /*
- *  $Id: autoopts.c,v 4.13 2006/07/15 22:17:36 bkorb Exp $
- *  Time-stamp:      "2006-07-15 13:54:08 bkorb"
+ *  $Id: autoopts.c,v 4.22 2006/07/15 22:10:21 bkorb Exp $
+ *  Time-stamp:      "2006-09-10 14:42:45 bkorb"
  *
  *  This file contains all of the routines that must be linked into
  *  an executable to use the generated option processing.  The optional
@@ -88,6 +88,50 @@ static int
 checkConsistency( tOptions* pOpts );
 /* = = = END-STATIC-FORWARD = = = */
 
+LOCAL void *
+ao_malloc( size_t sz )
+{
+    void * res = malloc(sz);
+    if (res == NULL) {
+        fprintf( stderr, "malloc of %d bytes failed\n", sz );
+        exit( EXIT_FAILURE );
+    }
+    return res;
+}
+
+
+LOCAL void *
+ao_realloc( void *p, size_t sz )
+{
+    void * res = realloc(p, sz);
+    if (res == NULL) {
+        fprintf( stderr, "realloc of %d bytes at 0x%p failed\n", sz, p );
+        exit( EXIT_FAILURE );
+    }
+    return res;
+}
+
+
+LOCAL void
+ao_free( void *p )
+{
+    if (p != NULL)
+        free(p);
+}
+
+
+LOCAL char *
+ao_strdup( char const *str )
+{
+    char * res = strdup(str);
+    if (res == NULL) {
+        fprintf( stderr, "strdup of %d byte string failed\n", strlen(str) );
+        exit( EXIT_FAILURE );
+    }
+    return res;
+}
+
+
 /*
  *  handleOption
  *
index 628b14cf3bda6a595f74de202a9cddf4fbc62fe9..219baedafb370c41e527ddd4c7ae19a1e1d28a00 100644 (file)
@@ -1,8 +1,8 @@
 
 /*
- *  Time-stamp:      "2006-08-12 10:26:19 bkorb"
+ *  Time-stamp:      "2006-09-10 14:43:25 bkorb"
  *
- *  autoopts.h  $Id: autoopts.h,v 4.14 2006/08/12 17:36:43 bkorb Exp $
+ *  autoopts.h  $Id: autoopts.h,v 4.26 2006/08/12 17:31:50 bkorb Exp $
  *  Time-stamp:      "2005-02-14 05:59:50 bkorb"
  *
  *  This file defines all the global structures and special values
@@ -195,11 +195,12 @@ typedef struct {
     tCC*    pzOptFmt;
 } arg_types_t;
 
-#  define AGALOC( c, w )        malloc( (unsigned)c )
-#  define AGREALOC( p, c, w )   realloc( p, (unsigned)c )
-#  define AGFREE( p )           free( p )
-#  define AGDUPSTR( p, s, w )   p = strdup( s )
-#  define TAGMEM( m, t )
+#define AGALOC( c, w )        ao_malloc( (unsigned)c )
+#define AGREALOC( p, c, w )   ao_realloc( p, (unsigned)c )
+#define AGFREE( p )           ao_free( p )
+#define AGDUPSTR( p, s, w )   p = ao_strdup( s )
+
+#define TAGMEM( m, t )
 
 /*
  *  DO option handling?
index c55497ca34193c495ddea3a74a7b69b4e44f9eef..f15d7d525e6c37df6b3106769a9a4eee8aa5a734 100644 (file)
@@ -2,7 +2,7 @@
  *  
  *  DO NOT EDIT THIS FILE   (options.h)
  *  
- *  It has been AutoGen-ed  Saturday September  9, 2006 at 01:15:17 PM PDT
+ *  It has been AutoGen-ed  Sunday September 10, 2006 at 04:03:10 PM PDT
  *  From the definitions    funcs.def
  *  and the template file   options_h
  *
@@ -446,7 +446,7 @@ extern token_list_t* ao_string_tokenize( const char* );
 extern const tOptionValue* configFileLoad( const char* );
 
 
-/* From: configfile.c line 869
+/* From: configfile.c line 872
  *
  * optionFileLoad - Load the locatable config files, in order
  *
@@ -601,7 +601,7 @@ extern const tOptionValue* optionNextValue( const tOptionValue*, const tOptionVa
 extern void optionOnlyUsage( tOptions*, int );
 
 
-/* From: autoopts.c line 936
+/* From: autoopts.c line 980
  *
  * optionProcess - this is the main option processing routine
  *
index 542a9599369f02bede85ec4889c6c4caeeb1e18e..bd229551bd47a7a777478652f357b0d8e60450a4 100644 (file)
@@ -2,7 +2,7 @@
  *  
  *  DO NOT EDIT THIS FILE   (usage-txt.h)
  *  
- *  It has been AutoGen-ed  Saturday September  9, 2006 at 01:15:15 PM PDT
+ *  It has been AutoGen-ed  Sunday September 10, 2006 at 04:03:08 PM PDT
  *  From the definitions    usage-txt.def
  *  and the template file   usage-txt.tpl
  *
index b0c40a7fa8791c35338a1a42015fcfba81a46ca8..d09833003472e82eb61fdf865e6a2cb4f35a6dda 100644 (file)
@@ -1,6 +1,6 @@
 
 /*
- *  $Id: boolean.c,v 4.4 2006/03/31 19:52:10 bkorb Exp $
+ *  $Id: boolean.c,v 4.6 2006/03/25 19:23:28 bkorb Exp $
  * Time-stamp:      "2005-02-14 08:24:12 bkorb"
  *
  *   Automated Options Paged Usage module.
index cb58336fdb8a045f35a84dcc278e4763e0634c03..38b50cc696661f41c084f1813b21d00356d82a99 100644 (file)
@@ -7,7 +7,7 @@
  * Author:           Gary V Vaughan <gvaughan@oranda.demon.co.uk>
  * Created:          Mon Jun 30 15:54:46 1997
  *
- * $Id: compat.h,v 4.11 2006/09/07 14:48:05 bkorb Exp $
+ * $Id: compat.h,v 4.12 2006/09/07 14:46:34 bkorb Exp $
  */
 #ifndef COMPAT_H_GUARD
 #define COMPAT_H_GUARD 1
index 9cfbebb1d1f81bd9cc8fdcb346de7e8290d777e9..540e08f9c12f5312168ac653b3736b815751961e 100644 (file)
@@ -5,10 +5,10 @@
 /*
  * Author:           Gary V Vaughan <gvaughan@oranda.demon.co.uk>
  * Created:          Tue Jun 24 15:07:31 1997
- * Last Modified:    $Date: 2006/08/22 16:09:02 $
+ * Last Modified:    $Date: 2006/08/22 16:06:36 $
  *            by: bkorb
  *
- * $Id: pathfind.c,v 4.7 2006/08/22 16:09:02 bkorb Exp $
+ * $Id: pathfind.c,v 4.7 2006/08/22 16:06:36 bkorb Exp $
  */
 
 /* Code: */
index fa163acf6b6015baacafec921fca2be24f59dfe2..c733646546b45dbc10019a694302988407dff1e6 100644 (file)
@@ -1,6 +1,6 @@
 /*
- *  $Id: configfile.c,v 1.10 2006/07/14 04:31:37 bkorb Exp $
- *  Time-stamp:      "2006-07-01 12:46:31 bkorb"
+ *  $Id: configfile.c,v 4.23 2006/07/01 21:57:23 bkorb Exp $
+ *  Time-stamp:      "2006-09-10 13:57:10 bkorb"
  *
  *  configuration/rc/ini file handling.
  */
@@ -542,6 +542,9 @@ handleConfig(
     char* pzName = pzText++;
     char* pzEnd  = strchr( pzText, '\n' );
 
+    if (pzEnd == NULL)
+        return pzText + strlen(pzText);
+
     while (ISNAMECHAR( *pzText ))  pzText++;
     while (isspace( *pzText )) pzText++;
     if (pzText > pzEnd) {
index 134be4cfd50d85591f75b07d95d50d571cd694ea..aecd4ec483d1d5b1f2048517ebaa442eb883eb30 100644 (file)
@@ -1,6 +1,6 @@
 
 /*
- *  $Id: cook.c,v 4.4 2006/06/24 23:36:07 bkorb Exp $
+ *  $Id: cook.c,v 4.6 2006/06/24 23:34:51 bkorb Exp $
  *  Time-stamp:      "2006-06-24 11:29:58 bkorb"
  *
  *  This file contains the routines that deal with processing quoted strings
index cf5d6d1172c5187e945888c5083d18f7eddc6e62..0dbe5661414c7e929aa259cc5f78edfa3565d609 100644 (file)
@@ -1,6 +1,6 @@
 
 /*
- *  $Id: enumeration.c,v 4.9 2006/06/24 23:36:08 bkorb Exp $
+ *  $Id: enumeration.c,v 4.11 2006/06/24 23:34:51 bkorb Exp $
  * Time-stamp:      "2006-06-24 10:46:02 bkorb"
  *
  *   Automated Options Paged Usage module.
index d7e9e8c74fad6ee05d271c13b0ff11ac4a181ca2..caaa712bac907f7167c805d222a4d62965f80beb 100644 (file)
@@ -1,6 +1,6 @@
 
 /*
- *  $Id: environment.c,v 4.7 2006/03/31 19:52:10 bkorb Exp $
+ *  $Id: environment.c,v 4.10 2006/03/25 19:23:28 bkorb Exp $
  * Time-stamp:      "2005-10-29 13:23:59 bkorb"
  *
  *  This file contains all of the routines that must be linked into
index 430ff2b737745377694acf828390125da65603c5..5512fd27c6219e83c6952216d0535863c4ba0309 100644 (file)
@@ -2,7 +2,7 @@
  *  
  *  DO NOT EDIT THIS FILE   (genshell.c)
  *  
- *  It has been AutoGen-ed  Saturday September  9, 2006 at 01:15:18 PM PDT
+ *  It has been AutoGen-ed  Sunday September 10, 2006 at 04:03:10 PM PDT
  *  From the definitions    genshell.def
  *  and the template file   options
  */
index 9694e0ffe4d73e2de4289679d985a259e8fc3481..ee76422f4a6fa76b32d5eef818742b659baa26f4 100644 (file)
@@ -2,7 +2,7 @@
  *  
  *  DO NOT EDIT THIS FILE   (genshell.h)
  *  
- *  It has been AutoGen-ed  Saturday September  9, 2006 at 01:15:18 PM PDT
+ *  It has been AutoGen-ed  Sunday September 10, 2006 at 04:03:10 PM PDT
  *  From the definitions    genshell.def
  *  and the template file   options
  */
index 350f8208edca77f4e685cc50f16d724fc051b896..19edbcd34c23f28a7ed61a7c5e6a652c9674381c 100644 (file)
@@ -1,6 +1,6 @@
 
 /*
- *  $Id: load.c,v 4.11 2006/07/14 04:31:37 bkorb Exp $
+ *  $Id: load.c,v 4.23 2006/07/01 21:57:23 bkorb Exp $
  *  Time-stamp:      "2006-07-01 12:43:03 bkorb"
  *
  *  This file contains the routines that deal with processing text strings
index 4edf4ad4aee63749dce2bd3c51b045aa4ade27ff..eb2aaf14e7cf6e6078a76257e35e6a5b415b9907 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 September  9, 2006 at 01:15:14 PM PDT
+dnl It has been AutoGen-ed  Sunday September 10, 2006 at 04:03:12 PM PDT
 dnl From the definitions    libopts.def
 dnl and the template file   conftest.tpl
 dnl
index 171cb23b812505348033821ef481d0145d4dd015..dbb4ff590d9aa18ca33db4533f64ecd7f3016acb 100644 (file)
@@ -1,6 +1,6 @@
 
 /*
- *  $Id: makeshell.c,v 4.10 2006/07/27 02:59:08 bkorb Exp $
+ *  $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
index f8b6125198a1aef81049d6984d8d42f215b3a4c1..00b88691afb4c87cdca25334427af11723b84d86 100644 (file)
@@ -1,6 +1,6 @@
 
 /*
- *  $Id: nested.c,v 4.4 2006/03/31 19:52:10 bkorb Exp $
+ *  $Id: nested.c,v 4.9 2006/03/25 19:23:28 bkorb Exp $
  *  Time-stamp:      "2005-07-27 10:10:28 bkorb"
  *
  *   Automated Options Nested Values module.
index 08c520be1def15ea9e5246b8d1957725d2fce008..26790df3c78b167b47b64cc6ac2ff662d271f9ff 100644 (file)
@@ -1,6 +1,6 @@
 
 /*
- *  $Id: numeric.c,v 4.5 2006/03/31 19:52:10 bkorb Exp $
+ *  $Id: numeric.c,v 4.7 2006/03/25 19:23:28 bkorb Exp $
  *  Time-stamp:      "2005-02-14 08:22:56 bkorb"
  */
 
index 4dc7075413bebece687e59498bf2112c7fd92b76..61684555d7f8fa9edff4b9b68b924110777d3f73 100644 (file)
@@ -1,6 +1,6 @@
 
 /*
- *  $Id: pgusage.c,v 4.10 2006/07/16 15:29:31 bkorb Exp $
+ *  $Id: pgusage.c,v 4.12 2006/07/16 15:27:50 bkorb Exp $
  * Time-stamp:      "2006-07-16 08:13:26 bkorb"
  *
  *   Automated Options Paged Usage module.
index ea67c63db80501a15387adfe825893a9838205c8..e2950bcc827f6a5a8659f42dade63a24e1e88410 100644 (file)
@@ -1,7 +1,7 @@
 /* -*- buffer-read-only: t -*- vi: set ro:
  *
  * Prototypes for autoopts
- * Generated Sat Sep  9 13:16:02 PDT 2006
+ * Generated Sun Sep 10 16:03:11 PDT 2006
  */
 #ifndef AUTOOPTS_PROTO_H_GUARD
 #define AUTOOPTS_PROTO_H_GUARD 1
 /*
  *  Extracted from autoopts.c
  */
+LOCAL void *
+ao_malloc( size_t sz );
+
+LOCAL void *
+ao_realloc( void *p, size_t sz );
+
+LOCAL void
+ao_free( void *p );
+
+LOCAL char *
+ao_strdup( char const *str );
+
 LOCAL tSuccess
 handleOption( tOptions* pOpts, tOptState* pOptState );
 
index 1f7a611ce804c662613bd3f2194a29eeadfdc05b..f98f75260bd797e72bee7c88285f2dd35b0613d6 100644 (file)
@@ -1,6 +1,6 @@
 
 /*
- *  $Id: putshell.c,v 4.9 2006/07/16 15:29:31 bkorb Exp $
+ *  $Id: putshell.c,v 4.12 2006/07/16 15:27:50 bkorb Exp $
  * Time-stamp:      "2006-07-16 08:13:24 bkorb"
  *
  *  This module will interpret the options set in the tOptions
index 798614cee90a616de93e0ab28522a82eff6453d4..ce788b3303c62cf41d5fef44a5280831b3f73aa6 100644 (file)
@@ -1,6 +1,6 @@
 
 /*
- *  restore.c  $Id: restore.c,v 4.5 2006/03/31 19:52:11 bkorb Exp $
+ *  restore.c  $Id: restore.c,v 4.7 2006/03/25 19:23:28 bkorb Exp $
  * Time-stamp:      "2005-02-23 15:10:20 bkorb"
  *
  *  This module's routines will save the current option state to memory
index 9c73057e431cc7c7c641675ba09869014a2116ed..d225c27b4e73de274ca63eed094095773faacc4c 100644 (file)
@@ -1,6 +1,6 @@
 
 /*
- *  save.c  $Id: save.c,v 4.8 2006/07/16 15:29:31 bkorb Exp $
+ *  save.c  $Id: save.c,v 4.16 2006/07/16 15:27:50 bkorb Exp $
  * Time-stamp:      "2006-07-16 08:13:22 bkorb"
  *
  *  This module's routines will take the currently set options and
index 90c81a8c93c059b276fce3a53daa6e5bb14bd96f..de0bd5634d1bfa997d7f71a81f343d0cacca5de8 100644 (file)
@@ -1,6 +1,6 @@
 
 /*
- *  sort.c  $Id: sort.c,v 4.7 2006/06/24 23:36:08 bkorb Exp $
+ *  sort.c  $Id: sort.c,v 4.10 2006/06/24 23:34:51 bkorb Exp $
  * Time-stamp:      "2006-06-24 10:53:35 bkorb"
  *
  *  This module implements argument sorting.
index 65db828eb59ae7b310d3478393cdd8177559bddf..5f51f37db7515ca29da417095cdf1800b0ecb9ec 100644 (file)
@@ -1,7 +1,7 @@
 
 /*
  *  stack.c
- *  $Id: stack.c,v 4.7 2006/07/14 04:31:38 bkorb Exp $
+ *  $Id: stack.c,v 4.10 2006/07/14 04:20:17 bkorb Exp $
  *  Time-stamp:      "2006-07-13 21:11:29 bkorb"
  *
  *  This is a special option processing routine that will save the
index f66ddd804fbf965bdca6c59f93b26055c13dfb33..42336dc97c40d532f33e0935981cbea1529bf987 100644 (file)
@@ -1,6 +1,6 @@
 
 /*
- *  $Id: streqvcmp.c,v 4.7 2006/07/27 02:59:08 bkorb Exp $
+ *  $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
index 643989f2c94f29afc752862d19ea536d135dbd34..84d7242a085e96cbb7766df8e1804f0bf1416f20 100644 (file)
@@ -1,7 +1,7 @@
 /*
- * $Id: text_mmap.c,v 4.10 2006/08/22 16:09:02 bkorb Exp $
+ * $Id: text_mmap.c,v 4.12 2006/08/22 16:06:36 bkorb Exp $
  *
- * Time-stamp:      "2006-08-22 07:17:49 bkorb"
+ * Time-stamp:      "2006-09-10 14:50:04 bkorb"
  */
 
 #ifndef MAP_ANONYMOUS
@@ -183,9 +183,8 @@ text_mmap( const char* pzFile, int prot, int flags, tmap_info_t* pMI )
             return pMI->txt_data;
 
         pMI->txt_errno = errno;
-#endif
 
-#if defined(HAVE_DEV_ZERO)
+#elif defined(HAVE_DEV_ZERO)
         pMI->txt_zero_fd = open( "/dev/zero", O_RDONLY );
 
         if (pMI->txt_zero_fd == AO_INVALID_FD) {
@@ -211,10 +210,6 @@ text_mmap( const char* pzFile, int prot, int flags, tmap_info_t* pMI )
 
     {
         void* p = AGALOC( pMI->txt_size+1, "file text" );
-        if (pMI->txt_data == NULL) {
-            pMI->txt_errno = ENOMEM;
-            goto fail_return;
-        }
         memcpy( p, pMI->txt_data, pMI->txt_size );
         ((char*)p)[pMI->txt_size] = NUL;
         munmap(pMI->txt_data, pMI->txt_size );
index 18843cdd0f0e7faa720a2e8aeabb48ecd75e79b9..2dae8c09ab6c697d976436221b22bc234333a308 100644 (file)
@@ -1,6 +1,6 @@
 
 /*
- *  usage.c  $Id: usage.c,v 4.10 2006/08/12 17:36:43 bkorb Exp $
+ *  usage.c  $Id: usage.c,v 4.15 2006/08/12 17:31:50 bkorb Exp $
  * Time-stamp:      "2006-07-01 12:41:02 bkorb"
  *
  *  This module implements the default usage procedure for
index dd50ec4d893c702b022d8bb6a29e5df2e03010f0..e01809a8053439e2d6f44cc189c7792501a1650b 100644 (file)
@@ -1,5 +1,5 @@
 
-/*  $Id: version.c,v 4.7 2006/07/27 02:59:08 bkorb Exp $
+/*  $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