From: Harlan Stenn Date: Mon, 11 Sep 2006 00:47:32 +0000 (-0400) Subject: libopts-27.4.3 updates X-Git-Tag: NTP_4_2_3P44~1 X-Git-Url: http://git.ipfire.org/cgi-bin/gitweb.cgi?a=commitdiff_plain;h=fda2dc35bf39350418b00f10a335c4fe15f8bb1f;p=thirdparty%2Fntp.git libopts-27.4.3 updates bk: 4504b224D-wOmCNC6OrlxPqRyKhIfQ --- diff --git a/libopts/autoopts.c b/libopts/autoopts.c index 5c9b337aa..1cb86b6f2 100644 --- a/libopts/autoopts.c +++ b/libopts/autoopts.c @@ -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 * diff --git a/libopts/autoopts.h b/libopts/autoopts.h index 628b14cf3..219baedaf 100644 --- a/libopts/autoopts.h +++ b/libopts/autoopts.h @@ -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? diff --git a/libopts/autoopts/options.h b/libopts/autoopts/options.h index c55497ca3..f15d7d525 100644 --- a/libopts/autoopts/options.h +++ b/libopts/autoopts/options.h @@ -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 * diff --git a/libopts/autoopts/usage-txt.h b/libopts/autoopts/usage-txt.h index 542a95993..bd229551b 100644 --- a/libopts/autoopts/usage-txt.h +++ b/libopts/autoopts/usage-txt.h @@ -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 * diff --git a/libopts/boolean.c b/libopts/boolean.c index b0c40a7fa..d09833003 100644 --- a/libopts/boolean.c +++ b/libopts/boolean.c @@ -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. diff --git a/libopts/compat/compat.h b/libopts/compat/compat.h index cb58336fd..38b50cc69 100644 --- a/libopts/compat/compat.h +++ b/libopts/compat/compat.h @@ -7,7 +7,7 @@ * Author: Gary V Vaughan * 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 diff --git a/libopts/compat/pathfind.c b/libopts/compat/pathfind.c index 9cfbebb1d..540e08f9c 100644 --- a/libopts/compat/pathfind.c +++ b/libopts/compat/pathfind.c @@ -5,10 +5,10 @@ /* * Author: Gary V Vaughan * 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: */ diff --git a/libopts/configfile.c b/libopts/configfile.c index fa163acf6..c73364654 100644 --- a/libopts/configfile.c +++ b/libopts/configfile.c @@ -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) { diff --git a/libopts/cook.c b/libopts/cook.c index 134be4cfd..aecd4ec48 100644 --- a/libopts/cook.c +++ b/libopts/cook.c @@ -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 diff --git a/libopts/enumeration.c b/libopts/enumeration.c index cf5d6d117..0dbe56614 100644 --- a/libopts/enumeration.c +++ b/libopts/enumeration.c @@ -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. diff --git a/libopts/environment.c b/libopts/environment.c index d7e9e8c74..caaa712ba 100644 --- a/libopts/environment.c +++ b/libopts/environment.c @@ -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 diff --git a/libopts/genshell.c b/libopts/genshell.c index 430ff2b73..5512fd27c 100644 --- a/libopts/genshell.c +++ b/libopts/genshell.c @@ -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 */ diff --git a/libopts/genshell.h b/libopts/genshell.h index 9694e0ffe..ee76422f4 100644 --- a/libopts/genshell.h +++ b/libopts/genshell.h @@ -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 */ diff --git a/libopts/load.c b/libopts/load.c index 350f8208e..19edbcd34 100644 --- a/libopts/load.c +++ b/libopts/load.c @@ -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 diff --git a/libopts/m4/libopts.m4 b/libopts/m4/libopts.m4 index 4edf4ad4a..eb2aaf14e 100644 --- a/libopts/m4/libopts.m4 +++ b/libopts/m4/libopts.m4 @@ -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 diff --git a/libopts/makeshell.c b/libopts/makeshell.c index 171cb23b8..dbb4ff590 100644 --- a/libopts/makeshell.c +++ b/libopts/makeshell.c @@ -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 diff --git a/libopts/nested.c b/libopts/nested.c index f8b612519..00b88691a 100644 --- a/libopts/nested.c +++ b/libopts/nested.c @@ -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. diff --git a/libopts/numeric.c b/libopts/numeric.c index 08c520be1..26790df3c 100644 --- a/libopts/numeric.c +++ b/libopts/numeric.c @@ -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" */ diff --git a/libopts/pgusage.c b/libopts/pgusage.c index 4dc707541..61684555d 100644 --- a/libopts/pgusage.c +++ b/libopts/pgusage.c @@ -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. diff --git a/libopts/proto.h b/libopts/proto.h index ea67c63db..e2950bcc8 100644 --- a/libopts/proto.h +++ b/libopts/proto.h @@ -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 @@ -14,6 +14,18 @@ /* * 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 ); diff --git a/libopts/putshell.c b/libopts/putshell.c index 1f7a611ce..f98f75260 100644 --- a/libopts/putshell.c +++ b/libopts/putshell.c @@ -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 diff --git a/libopts/restore.c b/libopts/restore.c index 798614cee..ce788b330 100644 --- a/libopts/restore.c +++ b/libopts/restore.c @@ -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 diff --git a/libopts/save.c b/libopts/save.c index 9c73057e4..d225c27b4 100644 --- a/libopts/save.c +++ b/libopts/save.c @@ -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 diff --git a/libopts/sort.c b/libopts/sort.c index 90c81a8c9..de0bd5634 100644 --- a/libopts/sort.c +++ b/libopts/sort.c @@ -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. diff --git a/libopts/stack.c b/libopts/stack.c index 65db828eb..5f51f37db 100644 --- a/libopts/stack.c +++ b/libopts/stack.c @@ -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 diff --git a/libopts/streqvcmp.c b/libopts/streqvcmp.c index f66ddd804..42336dc97 100644 --- a/libopts/streqvcmp.c +++ b/libopts/streqvcmp.c @@ -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 diff --git a/libopts/text_mmap.c b/libopts/text_mmap.c index 643989f2c..84d7242a0 100644 --- a/libopts/text_mmap.c +++ b/libopts/text_mmap.c @@ -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 ); diff --git a/libopts/usage.c b/libopts/usage.c index 18843cdd0..2dae8c09a 100644 --- a/libopts/usage.c +++ b/libopts/usage.c @@ -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 diff --git a/libopts/version.c b/libopts/version.c index dd50ec4d8..e01809a80 100644 --- a/libopts/version.c +++ b/libopts/version.c @@ -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