[Top][All Lists]
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[SCM] GNU gnutls branch, gnutls_3_0_x-2, updated. gnutls_3_0_19-8-g8182e
From: |
Nikos Mavrogiannopoulos |
Subject: |
[SCM] GNU gnutls branch, gnutls_3_0_x-2, updated. gnutls_3_0_19-8-g8182e80 |
Date: |
Wed, 09 May 2012 18:11:22 +0000 |
This is an automated email from the git hooks/post-receive script. It was
generated because a ref change was pushed to the repository containing
the project "GNU gnutls".
http://git.savannah.gnu.org/cgit/gnutls.git/commit/?id=8182e8059ea649d0296a71652cb59f6411293845
The branch, gnutls_3_0_x-2 has been updated
via 8182e8059ea649d0296a71652cb59f6411293845 (commit)
via 35d2bb2151a11c029e9a98d97a1277d899611970 (commit)
via 80d17ae5e9e55f5abad0633325b6b494f896438a (commit)
from ace8a662ff90679c575658e787f48577e2fd5940 (commit)
Those revisions listed above that are new to this repository have
not appeared on any other notification email; so we list those
revisions in full, below.
- Log -----------------------------------------------------------------
commit 8182e8059ea649d0296a71652cb59f6411293845
Author: Nikos Mavrogiannopoulos <address@hidden>
Date: Wed May 9 20:09:06 2012 +0200
added new functions
commit 35d2bb2151a11c029e9a98d97a1277d899611970
Author: Nikos Mavrogiannopoulos <address@hidden>
Date: Wed May 9 19:55:21 2012 +0200
updated libopts
commit 80d17ae5e9e55f5abad0633325b6b494f896438a
Author: Nikos Mavrogiannopoulos <address@hidden>
Date: Wed May 9 19:48:24 2012 +0200
Added gnutls_pubkey_verify_hash2() and gnutls_pk_to_sign().
-----------------------------------------------------------------------
Summary of changes:
NEWS | 9 +
README-alpha | 2 +-
doc/Makefile.am | 2 +
doc/cha-cert-auth2.texi | 2 +-
lib/abstract_int.h | 10 +-
lib/algorithms.h | 2 -
lib/algorithms/sign.c | 16 +-
lib/ext/signature.c | 2 +-
lib/gnutls_pubkey.c | 60 ++++-
lib/gnutls_sig.c | 21 +-
lib/includes/gnutls/abstract.h | 8 +
lib/includes/gnutls/gnutls.h.in | 3 +
lib/libgnutls.map | 2 +
lib/x509/verify.c | 33 ---
lib/x509/x509.c | 33 ++-
lib/x509/x509_int.h | 4 -
src/libopts/Makefile.am | 10 +-
src/libopts/ag-char-map.h | 535 ++++++++++++++++++++++++++++----------
src/libopts/ao-strs.c | 2 +-
src/libopts/ao-strs.h | 2 +-
src/libopts/autoopts.c | 19 +-
src/libopts/autoopts.h | 17 +-
src/libopts/autoopts/options.h | 81 ++++--
src/libopts/autoopts/project.h | 4 +-
src/libopts/autoopts/usage-txt.h | 320 ++++++++++++-----------
src/libopts/boolean.c | 14 +-
src/libopts/check.c | 32 ++-
src/libopts/compat/compat.h | 19 +-
src/libopts/compat/pathfind.c | 4 +-
src/libopts/configfile.c | 108 ++++----
src/libopts/cook.c | 16 +-
src/libopts/enum.c | 38 +++-
src/libopts/env.c | 11 +-
src/libopts/find.c | 8 +-
src/libopts/genshell.c | 79 ++++--
src/libopts/genshell.h | 14 +-
src/libopts/libopts.c | 4 +-
src/libopts/load.c | 93 ++++----
src/libopts/m4/libopts.m4 | 15 +-
src/libopts/makeshell.c | 6 +-
src/libopts/nested.c | 13 +-
src/libopts/parse-duration.c | 6 +-
src/libopts/pgusage.c | 15 +-
src/libopts/proto.h | 11 +-
src/libopts/putshell.c | 10 +-
src/libopts/reset.c | 8 +-
src/libopts/save.c | 6 +-
src/libopts/stack.c | 16 +-
src/libopts/streqvcmp.c | 6 +-
src/libopts/tokenize.c | 16 +-
src/libopts/usage.c | 62 +++---
src/libopts/value-type.h | 2 +-
src/libopts/xat-attribute.h | 2 +-
tests/x509sign-verify.c | 29 ++-
54 files changed, 1158 insertions(+), 704 deletions(-)
diff --git a/NEWS b/NEWS
index b540980..8282a1d 100644
--- a/NEWS
+++ b/NEWS
@@ -2,6 +2,15 @@ GnuTLS NEWS -- History of user-visible changes.
-*- outline -*-
Copyright (C) 2000-2012 Free Software Foundation, Inc.
See the end for copying conditions.
+* Version 3.0.20 (unreleased)
+
+** libgnutls: Added gnutls_pubkey_verify_hash2()
+
+** API and ABI modifications:
+gnutls_pk_to_sign: Added
+gnutls_pubkey_verify_hash2: Added
+
+
* Version 3.0.19 (released 2012-04-22)
** libgnutls: When decoding a PKCS #11 URL the pin-source field
diff --git a/README-alpha b/README-alpha
index aa49b81..46ae6f2 100644
--- a/README-alpha
+++ b/README-alpha
@@ -10,7 +10,7 @@ We require several tools to check out and build the software,
including:
- Make <http://www.gnu.org/software/make/>
- Automake <http://www.gnu.org/software/automake/>
- Autoconf <http://www.gnu.org/software/autoconf/>
-- Autogen <http://www.gnu.org/software/autogen/> (use 5.15pre15 or better)
+- Autogen <http://www.gnu.org/software/autogen/> (use 5.16 or better)
- Libtool <http://www.gnu.org/software/libtool/>
- Gettext <http://www.gnu.org/software/gettext/>
- Texinfo <http://www.gnu.org/software/texinfo/>
diff --git a/doc/Makefile.am b/doc/Makefile.am
index 7928971..6ae5ecb 100644
--- a/doc/Makefile.am
+++ b/doc/Makefile.am
@@ -503,6 +503,7 @@ FUNCS += functions/gnutls_pubkey_encrypt_data
FUNCS += functions/gnutls_x509_crt_set_pubkey
FUNCS += functions/gnutls_x509_crq_set_pubkey
FUNCS += functions/gnutls_pubkey_verify_hash
+FUNCS += functions/gnutls_pubkey_verify_hash2
FUNCS += functions/gnutls_pubkey_get_verify_algorithm
FUNCS += functions/gnutls_pubkey_verify_data
FUNCS += functions/gnutls_pubkey_verify_data2
@@ -621,6 +622,7 @@ FUNCS += functions/gnutls_kx_get_name
FUNCS += functions/gnutls_certificate_type_get_name
FUNCS += functions/gnutls_pk_get_name
FUNCS += functions/gnutls_sign_get_name
+FUNCS += functions/gnutls_pk_to_sign
FUNCS += functions/gnutls_mac_get_id
FUNCS += functions/gnutls_compression_get_id
FUNCS += functions/gnutls_cipher_get_id
diff --git a/doc/cha-cert-auth2.texi b/doc/cha-cert-auth2.texi
index 6838bf5..df0c799 100644
--- a/doc/cha-cert-auth2.texi
+++ b/doc/cha-cert-auth2.texi
@@ -615,7 +615,7 @@ The abstract key types can be used to access signing and
signature verification operations with the underlying keys.
@showfuncdesc{gnutls_pubkey_verify_data2}
address@hidden
address@hidden
@showfuncdesc{gnutls_pubkey_encrypt_data}
@showfuncdesc{gnutls_privkey_sign_data}
diff --git a/lib/abstract_int.h b/lib/abstract_int.h
index ca2be2b..429d27e 100644
--- a/lib/abstract_int.h
+++ b/lib/abstract_int.h
@@ -36,10 +36,12 @@ int
_gnutls_pubkey_get_mpis (gnutls_pubkey_t key,
gnutls_pk_params_st * params);
-int pubkey_verify_hashed_data (gnutls_pk_algorithm_t pk,
- const gnutls_datum_t * hash,
- const gnutls_datum_t * signature,
- gnutls_pk_params_st * issuer_params);
+int
+pubkey_verify_hashed_data (gnutls_pk_algorithm_t pk,
+ gnutls_digest_algorithm_t hash_algo,
+ const gnutls_datum_t * hash,
+ const gnutls_datum_t * signature,
+ gnutls_pk_params_st * issuer_params);
int pubkey_verify_data (gnutls_pk_algorithm_t pk,
gnutls_digest_algorithm_t algo,
diff --git a/lib/algorithms.h b/lib/algorithms.h
index e2600c6..9fe0272 100644
--- a/lib/algorithms.h
+++ b/lib/algorithms.h
@@ -106,8 +106,6 @@ enum encipher_type _gnutls_kx_encipher_type
(gnutls_kx_algorithm_t algorithm);
/* Functions for sign algorithms. */
gnutls_sign_algorithm_t _gnutls_x509_oid2sign_algorithm (const char *oid);
-gnutls_sign_algorithm_t _gnutls_x509_pk_to_sign (gnutls_pk_algorithm_t pk,
- gnutls_digest_algorithm_t
mac);
gnutls_pk_algorithm_t _gnutls_x509_sign_to_pk (gnutls_sign_algorithm_t sign);
const char *_gnutls_x509_sign_to_oid (gnutls_pk_algorithm_t,
gnutls_digest_algorithm_t mac);
diff --git a/lib/algorithms/sign.c b/lib/algorithms/sign.c
index ab81b83..d0cbfac 100644
--- a/lib/algorithms/sign.c
+++ b/lib/algorithms/sign.c
@@ -178,12 +178,22 @@ _gnutls_x509_oid2sign_algorithm (const char *oid)
return ret;
}
+/**
+ * gnutls_pk_to_sign:
+ * @pk: is a public key algorithm
+ * @hash: a hash algorithm
+ *
+ * This function maps public key and hash algorithms combinations
+ * to signature algorithms.
+ *
+ * Returns: return a #gnutls_sign_algorithm_t value, or %GNUTLS_SIGN_UNKNOWN
on error.
+ **/
gnutls_sign_algorithm_t
-_gnutls_x509_pk_to_sign (gnutls_pk_algorithm_t pk, gnutls_digest_algorithm_t
mac)
+gnutls_pk_to_sign (gnutls_pk_algorithm_t pk, gnutls_digest_algorithm_t hash)
{
gnutls_sign_algorithm_t ret = 0;
- GNUTLS_SIGN_LOOP (if (pk == p->pk && mac == p->mac)
+ GNUTLS_SIGN_LOOP (if (pk == p->pk && hash == p->mac)
{
ret = p->id; break;}
);
@@ -200,7 +210,7 @@ _gnutls_x509_sign_to_oid (gnutls_pk_algorithm_t pk,
gnutls_sign_algorithm_t sign;
const char *ret = NULL;
- sign = _gnutls_x509_pk_to_sign (pk, mac);
+ sign = gnutls_pk_to_sign (pk, mac);
if (sign == GNUTLS_SIGN_UNKNOWN)
return NULL;
diff --git a/lib/ext/signature.c b/lib/ext/signature.c
index 4fe9795..1da555e 100644
--- a/lib/ext/signature.c
+++ b/lib/ext/signature.c
@@ -264,7 +264,7 @@ _gnutls_session_get_sign_algo (gnutls_session_t session,
gnutls_pcert_st* cert)
|| priv->sign_algorithms_size == 0)
/* none set, allow SHA-1 only */
{
- return _gnutls_x509_pk_to_sign (cert_algo, GNUTLS_DIG_SHA1);
+ return gnutls_pk_to_sign (cert_algo, GNUTLS_DIG_SHA1);
}
for (i = 0; i < priv->sign_algorithms_size; i++)
diff --git a/lib/gnutls_pubkey.c b/lib/gnutls_pubkey.c
index 6496537..39246f7 100644
--- a/lib/gnutls_pubkey.c
+++ b/lib/gnutls_pubkey.c
@@ -1373,7 +1373,6 @@ gnutls_pubkey_verify_data2 (gnutls_pubkey_t pubkey,
return ret;
}
-
/**
* gnutls_pubkey_verify_hash:
* @key: Holds the public key
@@ -1382,7 +1381,8 @@ gnutls_pubkey_verify_data2 (gnutls_pubkey_t pubkey,
* @signature: contains the signature
*
* This function will verify the given signed digest, using the
- * parameters from the public key.
+ * parameters from the public key. Use gnutls_pubkey_verify_hash2()
+ * instead of this function.
*
* Returns: In case of a verification failure %GNUTLS_E_PK_SIG_VERIFY_FAILED
* is returned, and zero or positive code on success.
@@ -1394,6 +1394,41 @@ gnutls_pubkey_verify_hash (gnutls_pubkey_t key, unsigned
int flags,
const gnutls_datum_t * hash,
const gnutls_datum_t * signature)
{
+gnutls_digest_algorithm_t algo;
+int ret;
+
+ ret = gnutls_pubkey_get_verify_algorithm (key, signature, &algo);
+ if (ret < 0)
+ return gnutls_assert_val(ret);
+
+ return gnutls_pubkey_verify_hash2(key, gnutls_pk_to_sign(key->pk_algorithm,
algo),
+ flags, hash, signature);
+}
+
+
+/**
+ * gnutls_pubkey_verify_hash:
+ * @key: Holds the public key
+ * @algo: The signature algorithm used
+ * @flags: should be 0 for now
+ * @hash: holds the hash digest to be verified
+ * @signature: contains the signature
+ *
+ * This function will verify the given signed digest, using the
+ * parameters from the public key.
+ *
+ * Returns: In case of a verification failure %GNUTLS_E_PK_SIG_VERIFY_FAILED
+ * is returned, and zero or positive code on success.
+ *
+ * Since: 3.0
+ **/
+int
+gnutls_pubkey_verify_hash2 (gnutls_pubkey_t key,
+ gnutls_sign_algorithm_t algo,
+ unsigned int flags,
+ const gnutls_datum_t * hash,
+ const gnutls_datum_t * signature)
+{
if (key == NULL)
{
gnutls_assert ();
@@ -1404,8 +1439,8 @@ gnutls_pubkey_verify_hash (gnutls_pubkey_t key, unsigned
int flags,
return _gnutls_rsa_verify (hash, signature, &key->params, 1);
else
{
- return pubkey_verify_hashed_data (key->pk_algorithm, hash, signature,
- &key->params);
+ return pubkey_verify_hashed_data (key->pk_algorithm,
_gnutls_sign_get_hash_algorithm(algo),
+ hash, signature, &key->params);
}
}
@@ -1535,7 +1570,8 @@ _gnutls_pubkey_get_mpis (gnutls_pubkey_t key,
* params[1] is public key
*/
static int
-_pkcs1_rsa_verify_sig (const gnutls_datum_t * text,
+_pkcs1_rsa_verify_sig (gnutls_digest_algorithm_t hash_algo,
+ const gnutls_datum_t * text,
const gnutls_datum_t * prehash,
const gnutls_datum_t * signature,
gnutls_pk_params_st * params)
@@ -1569,6 +1605,9 @@ _pkcs1_rsa_verify_sig (const gnutls_datum_t * text,
_gnutls_free_datum (&decrypted);
+ if (hash_algo != GNUTLS_DIG_UNKNOWN && hash_algo != hash)
+ return gnutls_assert_val(GNUTLS_E_PK_SIG_VERIFY_FAILED);
+
if (digest_size != _gnutls_hash_get_algo_len (hash))
{
gnutls_assert ();
@@ -1672,9 +1711,10 @@ dsa_verify_data (gnutls_pk_algorithm_t pk,
*/
int
pubkey_verify_hashed_data (gnutls_pk_algorithm_t pk,
- const gnutls_datum_t * hash,
- const gnutls_datum_t * signature,
- gnutls_pk_params_st * issuer_params)
+ gnutls_digest_algorithm_t hash_algo,
+ const gnutls_datum_t * hash,
+ const gnutls_datum_t * signature,
+ gnutls_pk_params_st * issuer_params)
{
switch (pk)
@@ -1682,7 +1722,7 @@ pubkey_verify_hashed_data (gnutls_pk_algorithm_t pk,
case GNUTLS_PK_RSA:
if (_pkcs1_rsa_verify_sig
- (NULL, hash, signature, issuer_params) != 0)
+ (hash_algo, NULL, hash, signature, issuer_params) != 0)
{
gnutls_assert ();
return GNUTLS_E_PK_SIG_VERIFY_FAILED;
@@ -1724,7 +1764,7 @@ pubkey_verify_data (gnutls_pk_algorithm_t pk,
case GNUTLS_PK_RSA:
if (_pkcs1_rsa_verify_sig
- (data, NULL, signature, issuer_params) != 0)
+ (algo, data, NULL, signature, issuer_params) != 0)
{
gnutls_assert ();
return GNUTLS_E_PK_SIG_VERIFY_FAILED;
diff --git a/lib/gnutls_sig.c b/lib/gnutls_sig.c
index 051fe85..b30dcc3 100644
--- a/lib/gnutls_sig.c
+++ b/lib/gnutls_sig.c
@@ -272,6 +272,7 @@ static int
verify_tls_hash (gnutls_protocol_t ver, gnutls_pcert_st* cert,
const gnutls_datum_t * hash_concat,
gnutls_datum_t * signature, size_t sha1pos,
+ gnutls_sign_algorithm_t sign_algo,
gnutls_pk_algorithm_t pk_algo)
{
int ret;
@@ -326,8 +327,8 @@ verify_tls_hash (gnutls_protocol_t ver, gnutls_pcert_st*
cert,
return GNUTLS_E_INTERNAL_ERROR;
}
- ret = gnutls_pubkey_verify_hash(cert->pubkey, flags, &vdata,
- signature);
+ ret = gnutls_pubkey_verify_hash2(cert->pubkey, sign_algo, flags,
+ &vdata, signature);
if (ret < 0)
return gnutls_assert_val(ret);
@@ -344,7 +345,7 @@ int
_gnutls_handshake_verify_data (gnutls_session_t session, gnutls_pcert_st* cert,
const gnutls_datum_t * params,
gnutls_datum_t * signature,
- gnutls_sign_algorithm_t algo)
+ gnutls_sign_algorithm_t sign_algo)
{
gnutls_datum_t dconcat;
int ret;
@@ -357,17 +358,17 @@ _gnutls_handshake_verify_data (gnutls_session_t session,
gnutls_pcert_st* cert,
if (_gnutls_version_has_selectable_sighash (ver))
{
_gnutls_handshake_log ("HSK[%p]: verify handshake data: using %s\n",
- session, gnutls_sign_algorithm_get_name (algo));
+ session, gnutls_sign_algorithm_get_name (sign_algo));
- ret = _gnutls_pubkey_compatible_with_sig(cert->pubkey, ver, algo);
+ ret = _gnutls_pubkey_compatible_with_sig(cert->pubkey, ver, sign_algo);
if (ret < 0)
return gnutls_assert_val(ret);
- ret = _gnutls_session_sign_algo_enabled (session, algo);
+ ret = _gnutls_session_sign_algo_enabled (session, sign_algo);
if (ret < 0)
return gnutls_assert_val(ret);
- hash_algo = _gnutls_sign_get_hash_algorithm (algo);
+ hash_algo = _gnutls_sign_get_hash_algorithm (sign_algo);
}
else
{
@@ -420,7 +421,8 @@ _gnutls_handshake_verify_data (gnutls_session_t session,
gnutls_pcert_st* cert,
ret = verify_tls_hash (ver, cert, &dconcat, signature,
dconcat.size -
_gnutls_hash_get_algo_len (hash_algo),
- _gnutls_sign_get_pk_algorithm (algo));
+ sign_algo,
+ _gnutls_sign_get_pk_algorithm (sign_algo));
if (ret < 0)
{
gnutls_assert ();
@@ -465,7 +467,7 @@ _gnutls_handshake_verify_crt_vrfy12 (gnutls_session_t
session,
dconcat.size = _gnutls_hash_get_algo_len (hash_algo);
ret =
- verify_tls_hash (ver, cert, &dconcat, signature, 0, pk);
+ verify_tls_hash (ver, cert, &dconcat, signature, 0, sign_algo, pk);
if (ret < 0)
{
gnutls_assert ();
@@ -560,6 +562,7 @@ _gnutls_handshake_verify_crt_vrfy (gnutls_session_t session,
ret =
verify_tls_hash (ver, cert, &dconcat, signature, 16,
+ GNUTLS_SIGN_UNKNOWN,
gnutls_pubkey_get_pk_algorithm(cert->pubkey, NULL));
if (ret < 0)
{
diff --git a/lib/includes/gnutls/abstract.h b/lib/includes/gnutls/abstract.h
index b89da86..50c1eca 100644
--- a/lib/includes/gnutls/abstract.h
+++ b/lib/includes/gnutls/abstract.h
@@ -140,6 +140,14 @@ int
gnutls_pubkey_verify_hash (gnutls_pubkey_t key, unsigned int flags,
const gnutls_datum_t * hash,
const gnutls_datum_t * signature);
+
+int
+gnutls_pubkey_verify_hash2 (gnutls_pubkey_t key,
+ gnutls_sign_algorithm_t algo,
+ unsigned int flags,
+ const gnutls_datum_t * hash,
+ const gnutls_datum_t * signature);
+
int
gnutls_pubkey_get_verify_algorithm (gnutls_pubkey_t key,
const gnutls_datum_t * signature,
diff --git a/lib/includes/gnutls/gnutls.h.in b/lib/includes/gnutls/gnutls.h.in
index 035f638..5eff94a 100644
--- a/lib/includes/gnutls/gnutls.h.in
+++ b/lib/includes/gnutls/gnutls.h.in
@@ -791,6 +791,9 @@ gnutls_ecc_curve_t gnutls_ecc_curve_get(gnutls_session_t
session);
type);
const char *gnutls_pk_get_name (gnutls_pk_algorithm_t algorithm);
const char *gnutls_sign_get_name (gnutls_sign_algorithm_t algorithm);
+ gnutls_sign_algorithm_t gnutls_pk_to_sign (gnutls_pk_algorithm_t pk,
+ gnutls_digest_algorithm_t d);
+
#define gnutls_sign_algorithm_get_name gnutls_sign_get_name
gnutls_mac_algorithm_t gnutls_mac_get_id (const char *name);
diff --git a/lib/libgnutls.map b/lib/libgnutls.map
index 3193848..33df09b 100644
--- a/lib/libgnutls.map
+++ b/lib/libgnutls.map
@@ -786,6 +786,8 @@ GNUTLS_3_0_0 {
gnutls_x509_crt_set_private_key_usage_period;
gnutls_x509_crq_set_private_key_usage_period;
gnutls_session_get_random;
+ gnutls_pubkey_verify_hash2;
+ gnutls_pk_to_sign;
} GNUTLS_2_12;
GNUTLS_PRIVATE {
diff --git a/lib/x509/verify.c b/lib/x509/verify.c
index 4a133d4..23bdcf7 100644
--- a/lib/x509/verify.c
+++ b/lib/x509/verify.c
@@ -788,39 +788,6 @@ _gnutls_x509_verify_data (gnutls_digest_algorithm_t algo,
return ret;
}
-int
-_gnutls_x509_verify_hashed_data (const gnutls_datum_t * hash,
- const gnutls_datum_t * signature,
- gnutls_x509_crt_t issuer)
-{
- gnutls_pk_params_st issuer_params;
- int ret;
-
- /* Read the MPI parameters from the issuer's certificate.
- */
- ret =
- _gnutls_x509_crt_get_mpis (issuer, &issuer_params);
- if (ret < 0)
- {
- gnutls_assert ();
- return ret;
- }
-
- ret =
- pubkey_verify_hashed_data (gnutls_x509_crt_get_pk_algorithm (issuer, NULL),
- hash, signature, &issuer_params);
- if (ret < 0)
- {
- gnutls_assert ();
- }
-
- /* release all allocated MPIs
- */
- gnutls_pk_params_release(&issuer_params);
-
- return ret;
-}
-
/**
* gnutls_x509_crt_list_verify:
* @cert_list: is the certificate list to be verified
diff --git a/lib/x509/x509.c b/lib/x509/x509.c
index d0de3cb..643f316 100644
--- a/lib/x509/x509.c
+++ b/lib/x509/x509.c
@@ -2693,7 +2693,7 @@ gnutls_x509_crt_verify_data (gnutls_x509_crt_t crt,
unsigned int flags,
* This function will verify the given signed digest, using the
* parameters from the certificate.
*
- * Deprecated. Please use gnutls_pubkey_verify_data().
+ * Deprecated. Please use gnutls_pubkey_verify_data2() or
gnutls_pubkey_verify_hash2().
*
* Returns: In case of a verification failure %GNUTLS_E_PK_SIG_VERIFY_FAILED
* is returned, and zero or positive code on success.
@@ -2703,7 +2703,9 @@ gnutls_x509_crt_verify_hash (gnutls_x509_crt_t crt,
unsigned int flags,
const gnutls_datum_t * hash,
const gnutls_datum_t * signature)
{
- int result;
+ gnutls_pk_params_st params;
+ gnutls_digest_algorithm_t algo;
+ int ret;
if (crt == NULL)
{
@@ -2711,14 +2713,33 @@ gnutls_x509_crt_verify_hash (gnutls_x509_crt_t crt,
unsigned int flags,
return GNUTLS_E_INVALID_REQUEST;
}
- result = _gnutls_x509_verify_hashed_data (hash, signature, crt);
- if (result < 0)
+ ret = gnutls_x509_crt_get_verify_algorithm (crt, signature, &algo);
+ if (ret < 0)
+ return gnutls_assert_val(ret);
+
+ /* Read the MPI parameters from the issuer's certificate.
+ */
+ ret =
+ _gnutls_x509_crt_get_mpis (crt, ¶ms);
+ if (ret < 0)
{
gnutls_assert ();
- return result;
+ return ret;
}
- return result;
+ ret =
+ pubkey_verify_hashed_data (gnutls_x509_crt_get_pk_algorithm (crt, NULL),
algo,
+ hash, signature, ¶ms);
+ if (ret < 0)
+ {
+ gnutls_assert ();
+ }
+
+ /* release all allocated MPIs
+ */
+ gnutls_pk_params_release(¶ms);
+
+ return ret;
}
/**
diff --git a/lib/x509/x509_int.h b/lib/x509/x509_int.h
index 19c2c12..3cc18e4 100644
--- a/lib/x509/x509_int.h
+++ b/lib/x509/x509_int.h
@@ -151,10 +151,6 @@ int _gnutls_x509_verify_data (gnutls_digest_algorithm_t
algo,
const gnutls_datum_t * signature,
gnutls_x509_crt_t issuer);
-int _gnutls_x509_verify_hashed_data (const gnutls_datum_t * hash,
- const gnutls_datum_t * signature,
- gnutls_x509_crt_t issuer);
-
/* privkey.h */
ASN1_TYPE _gnutls_privkey_decode_pkcs1_rsa_key (const gnutls_datum_t *
raw_key,
diff --git a/src/libopts/Makefile.am b/src/libopts/Makefile.am
index 33977a8..db754db 100644
--- a/src/libopts/Makefile.am
+++ b/src/libopts/Makefile.am
@@ -7,14 +7,14 @@ noinst_LTLIBRARIES = libopts.la
endif
libopts_la_SOURCES = libopts.c
libopts_la_CPPFLAGS = -I$(top_srcdir)
-libopts_la_LDFLAGS = -version-info 36:3:11
+libopts_la_LDFLAGS = -version-info 36:4:11
EXTRA_DIST = \
ag-char-map.h alias.c ao-strs.c \
- ao-strs.h autoopts/project.h autoopts/options.h \
+ ao-strs.h autoopts/options.h autoopts/project.h \
autoopts/usage-txt.h autoopts.c autoopts.h \
- boolean.c check.c compat/pathfind.c \
- compat/strchr.c compat/windows-config.h compat/snprintf.c \
- compat/compat.h compat/strdup.c configfile.c \
+ boolean.c check.c compat/strchr.c \
+ compat/pathfind.c compat/strdup.c compat/windows-config.h \
+ compat/snprintf.c compat/compat.h configfile.c \
cook.c COPYING.gplv3 COPYING.lgplv3 \
COPYING.mbsd enum.c env.c \
file.c find.c genshell.c \
diff --git a/src/libopts/ag-char-map.h b/src/libopts/ag-char-map.h
index c06b46a..33d4fe6 100644
--- a/src/libopts/ag-char-map.h
+++ b/src/libopts/ag-char-map.h
@@ -1,5 +1,6 @@
/*
- * Character mapping generated 02/26/12 11:08:40
+ * 28 bits for 44 character classifications
+ * generated by char-mapper on 05/06/12 at 16:20:58
*
* This file contains the character classifications
* used by AutoGen and AutoOpts for identifying tokens.
@@ -46,159 +47,399 @@
//
// %guard
// %file ag-char-map.h
+// %backup
+// %optimize
//
// %comment -- see above
// %
//
-// lower-case "a-z"
-// upper-case "A-Z"
-// alphabetic +lower-case +upper-case
+// newline "\n"
+// nul-byte "\x00"
+// dir-sep "/\\"
+// percent "%"
+// comma ","
+// colon ":"
+// underscore "_"
+// plus "+"
+// dollar "$"
+//
+// horiz-white "\t "
+// alt-white "\v\f\r\b"
+// whitespace +horiz-white +newline +alt-white
+// non-nl-white +horiz-white +alt-white
+// quote "'\""
+// parentheses "()"
+//
+// graphic "!-~"
+// inversion "~-"
// oct-digit "0-7"
// dec-digit "89" +oct-digit
// hex-digit "a-fA-F" +dec-digit
+// lower-case "a-z"
+// upper-case "A-Z"
+// alphabetic +lower-case +upper-case
// alphanumeric +alphabetic +dec-digit
-// var-first "_" +alphabetic
+// var-first +underscore +alphabetic
// variable-name +var-first +dec-digit
// option-name "^-" +variable-name
-// value-name ":" +option-name
-// horiz-white "\t "
+// value-name +colon +option-name
// name-sep "[.]"
// compound-name +value-name +name-sep +horiz-white
-// whitespace "\v\f\r\n\b" +horiz-white
-// unquotable "!-~" -"\"#(),;<=>[\\]`{}?*'"
+// scheme-note +parentheses +quote
+//
+// unquotable "!-~" -"#,;<=>[\\]`{}?*" -quote -parentheses
// end-xml-token "/>" +whitespace
-// graphic "!-~"
-// plus-n-space "+" +whitespace
+// plus-n-space +plus +whitespace
// punctuation "!-~" -alphanumeric -"_"
// suffix "-._" +alphanumeric
-// suffix-fmt "%/" +suffix
-// false-type "nNfF0\x00"
-// file-name "/" +suffix
-// end-token "\x00" +whitespace
-// end-list-entry "," +end-token
+// suffix-fmt +percent +suffix +dir-sep
+// false-type "nNfF0" +nul-byte
+// file-name +dir-sep +suffix
+// end-token +nul-byte +whitespace
+// end-list-entry +comma +end-token
// set-separator "|+" +end-list-entry
+// signed-number +inversion +dec-digit
+// make-script +dollar +newline
//
#endif /* 0 -- mapping spec. source */
typedef uint32_t ag_char_map_mask_t;
-#define IS_LOWER_CASE_CHAR( _c) is_ag_char_map_char((char)( _c),
0x000001)
-#define SPN_LOWER_CASE_CHARS(_s) spn_ag_char_map_chars((char *)_s,
0x000001)
-#define BRK_LOWER_CASE_CHARS(_s) brk_ag_char_map_chars((char *)_s,
0x000001)
-#define IS_UPPER_CASE_CHAR( _c) is_ag_char_map_char((char)( _c),
0x000002)
-#define SPN_UPPER_CASE_CHARS(_s) spn_ag_char_map_chars((char *)_s,
0x000002)
-#define BRK_UPPER_CASE_CHARS(_s) brk_ag_char_map_chars((char *)_s,
0x000002)
-#define IS_ALPHABETIC_CHAR( _c) is_ag_char_map_char((char)( _c),
0x000003)
-#define SPN_ALPHABETIC_CHARS(_s) spn_ag_char_map_chars((char *)_s,
0x000003)
-#define BRK_ALPHABETIC_CHARS(_s) brk_ag_char_map_chars((char *)_s,
0x000003)
-#define IS_OCT_DIGIT_CHAR( _c) is_ag_char_map_char((char)( _c),
0x000004)
-#define SPN_OCT_DIGIT_CHARS(_s) spn_ag_char_map_chars((char *)_s,
0x000004)
-#define BRK_OCT_DIGIT_CHARS(_s) brk_ag_char_map_chars((char *)_s,
0x000004)
-#define IS_DEC_DIGIT_CHAR( _c) is_ag_char_map_char((char)( _c),
0x00000C)
-#define SPN_DEC_DIGIT_CHARS(_s) spn_ag_char_map_chars((char *)_s,
0x00000C)
-#define BRK_DEC_DIGIT_CHARS(_s) brk_ag_char_map_chars((char *)_s,
0x00000C)
-#define IS_HEX_DIGIT_CHAR( _c) is_ag_char_map_char((char)( _c),
0x00001C)
-#define SPN_HEX_DIGIT_CHARS(_s) spn_ag_char_map_chars((char *)_s,
0x00001C)
-#define BRK_HEX_DIGIT_CHARS(_s) brk_ag_char_map_chars((char *)_s,
0x00001C)
-#define IS_ALPHANUMERIC_CHAR( _c) is_ag_char_map_char((char)( _c),
0x00000F)
-#define SPN_ALPHANUMERIC_CHARS(_s) spn_ag_char_map_chars((char *)_s,
0x00000F)
-#define BRK_ALPHANUMERIC_CHARS(_s) brk_ag_char_map_chars((char *)_s,
0x00000F)
-#define IS_VAR_FIRST_CHAR( _c) is_ag_char_map_char((char)( _c),
0x000023)
-#define SPN_VAR_FIRST_CHARS(_s) spn_ag_char_map_chars((char *)_s,
0x000023)
-#define BRK_VAR_FIRST_CHARS(_s) brk_ag_char_map_chars((char *)_s,
0x000023)
-#define IS_VARIABLE_NAME_CHAR( _c) is_ag_char_map_char((char)( _c),
0x00002F)
-#define SPN_VARIABLE_NAME_CHARS(_s) spn_ag_char_map_chars((char *)_s,
0x00002F)
-#define BRK_VARIABLE_NAME_CHARS(_s) brk_ag_char_map_chars((char *)_s,
0x00002F)
-#define IS_OPTION_NAME_CHAR( _c) is_ag_char_map_char((char)( _c),
0x00006F)
-#define SPN_OPTION_NAME_CHARS(_s) spn_ag_char_map_chars((char *)_s,
0x00006F)
-#define BRK_OPTION_NAME_CHARS(_s) brk_ag_char_map_chars((char *)_s,
0x00006F)
-#define IS_VALUE_NAME_CHAR( _c) is_ag_char_map_char((char)( _c),
0x0000EF)
-#define SPN_VALUE_NAME_CHARS(_s) spn_ag_char_map_chars((char *)_s,
0x0000EF)
-#define BRK_VALUE_NAME_CHARS(_s) brk_ag_char_map_chars((char *)_s,
0x0000EF)
-#define IS_HORIZ_WHITE_CHAR( _c) is_ag_char_map_char((char)( _c),
0x000100)
-#define SPN_HORIZ_WHITE_CHARS(_s) spn_ag_char_map_chars((char *)_s,
0x000100)
-#define BRK_HORIZ_WHITE_CHARS(_s) brk_ag_char_map_chars((char *)_s,
0x000100)
-#define IS_NAME_SEP_CHAR( _c) is_ag_char_map_char((char)( _c),
0x000200)
-#define SPN_NAME_SEP_CHARS(_s) spn_ag_char_map_chars((char *)_s,
0x000200)
-#define BRK_NAME_SEP_CHARS(_s) brk_ag_char_map_chars((char *)_s,
0x000200)
-#define IS_COMPOUND_NAME_CHAR( _c) is_ag_char_map_char((char)( _c),
0x0003EF)
-#define SPN_COMPOUND_NAME_CHARS(_s) spn_ag_char_map_chars((char *)_s,
0x0003EF)
-#define BRK_COMPOUND_NAME_CHARS(_s) brk_ag_char_map_chars((char *)_s,
0x0003EF)
-#define IS_WHITESPACE_CHAR( _c) is_ag_char_map_char((char)( _c),
0x000500)
-#define SPN_WHITESPACE_CHARS(_s) spn_ag_char_map_chars((char *)_s,
0x000500)
-#define BRK_WHITESPACE_CHARS(_s) brk_ag_char_map_chars((char *)_s,
0x000500)
-#define IS_UNQUOTABLE_CHAR( _c) is_ag_char_map_char((char)( _c),
0x000800)
-#define SPN_UNQUOTABLE_CHARS(_s) spn_ag_char_map_chars((char *)_s,
0x000800)
-#define BRK_UNQUOTABLE_CHARS(_s) brk_ag_char_map_chars((char *)_s,
0x000800)
-#define IS_END_XML_TOKEN_CHAR( _c) is_ag_char_map_char((char)( _c),
0x001500)
-#define SPN_END_XML_TOKEN_CHARS(_s) spn_ag_char_map_chars((char *)_s,
0x001500)
-#define BRK_END_XML_TOKEN_CHARS(_s) brk_ag_char_map_chars((char *)_s,
0x001500)
-#define IS_GRAPHIC_CHAR( _c) is_ag_char_map_char((char)( _c),
0x002000)
-#define SPN_GRAPHIC_CHARS(_s) spn_ag_char_map_chars((char *)_s,
0x002000)
-#define BRK_GRAPHIC_CHARS(_s) brk_ag_char_map_chars((char *)_s,
0x002000)
-#define IS_PLUS_N_SPACE_CHAR( _c) is_ag_char_map_char((char)( _c),
0x004500)
-#define SPN_PLUS_N_SPACE_CHARS(_s) spn_ag_char_map_chars((char *)_s,
0x004500)
-#define BRK_PLUS_N_SPACE_CHARS(_s) brk_ag_char_map_chars((char *)_s,
0x004500)
-#define IS_PUNCTUATION_CHAR( _c) is_ag_char_map_char((char)( _c),
0x008000)
-#define SPN_PUNCTUATION_CHARS(_s) spn_ag_char_map_chars((char *)_s,
0x008000)
-#define BRK_PUNCTUATION_CHARS(_s) brk_ag_char_map_chars((char *)_s,
0x008000)
-#define IS_SUFFIX_CHAR( _c) is_ag_char_map_char((char)( _c),
0x01000F)
-#define SPN_SUFFIX_CHARS(_s) spn_ag_char_map_chars((char *)_s,
0x01000F)
-#define BRK_SUFFIX_CHARS(_s) brk_ag_char_map_chars((char *)_s,
0x01000F)
-#define IS_SUFFIX_FMT_CHAR( _c) is_ag_char_map_char((char)( _c),
0x03000F)
-#define SPN_SUFFIX_FMT_CHARS(_s) spn_ag_char_map_chars((char *)_s,
0x03000F)
-#define BRK_SUFFIX_FMT_CHARS(_s) brk_ag_char_map_chars((char *)_s,
0x03000F)
-#define IS_FALSE_TYPE_CHAR( _c) is_ag_char_map_char((char)( _c),
0x040000)
-#define SPN_FALSE_TYPE_CHARS(_s) spn_ag_char_map_chars((char *)_s,
0x040000)
-#define BRK_FALSE_TYPE_CHARS(_s) brk_ag_char_map_chars((char *)_s,
0x040000)
-#define IS_FILE_NAME_CHAR( _c) is_ag_char_map_char((char)( _c),
0x09000F)
-#define SPN_FILE_NAME_CHARS(_s) spn_ag_char_map_chars((char *)_s,
0x09000F)
-#define BRK_FILE_NAME_CHARS(_s) brk_ag_char_map_chars((char *)_s,
0x09000F)
-#define IS_END_TOKEN_CHAR( _c) is_ag_char_map_char((char)( _c),
0x100500)
-#define SPN_END_TOKEN_CHARS(_s) spn_ag_char_map_chars((char *)_s,
0x100500)
-#define BRK_END_TOKEN_CHARS(_s) brk_ag_char_map_chars((char *)_s,
0x100500)
-#define IS_END_LIST_ENTRY_CHAR( _c) is_ag_char_map_char((char)( _c),
0x300500)
-#define SPN_END_LIST_ENTRY_CHARS(_s) spn_ag_char_map_chars((char *)_s,
0x300500)
-#define BRK_END_LIST_ENTRY_CHARS(_s) brk_ag_char_map_chars((char *)_s,
0x300500)
-#define IS_SET_SEPARATOR_CHAR( _c) is_ag_char_map_char((char)( _c),
0x700500)
-#define SPN_SET_SEPARATOR_CHARS(_s) spn_ag_char_map_chars((char *)_s,
0x700500)
-#define BRK_SET_SEPARATOR_CHARS(_s) brk_ag_char_map_chars((char *)_s,
0x700500)
+#define IS_NEWLINE_CHAR( _c) is_ag_char_map_char((char)( _c),
0x0000001)
+#define SPN_NEWLINE_CHARS(_s) spn_ag_char_map_chars((char *)_s, 0)
+#define BRK_NEWLINE_CHARS(_s) brk_ag_char_map_chars((char *)_s, 0)
+#define SPN_NEWLINE_BACK(s,e) spn_ag_char_map_back((char *)s, (char
*)e, 0)
+#define BRK_NEWLINE_BACK(s,e) brk_ag_char_map_back((char *)s, (char
*)e, 0)
+#define IS_NUL_BYTE_CHAR( _c) is_ag_char_map_char((char)( _c),
0x0000002)
+#define SPN_NUL_BYTE_CHARS(_s) spn_ag_char_map_chars((char *)_s, 1)
+#define BRK_NUL_BYTE_CHARS(_s) brk_ag_char_map_chars((char *)_s, 1)
+#define SPN_NUL_BYTE_BACK(s,e) spn_ag_char_map_back((char *)s, (char
*)e, 1)
+#define BRK_NUL_BYTE_BACK(s,e) brk_ag_char_map_back((char *)s, (char
*)e, 1)
+#define IS_DIR_SEP_CHAR( _c) is_ag_char_map_char((char)( _c),
0x0000004)
+#define SPN_DIR_SEP_CHARS(_s) spn_ag_char_map_chars((char *)_s, 2)
+#define BRK_DIR_SEP_CHARS(_s) brk_ag_char_map_chars((char *)_s, 2)
+#define SPN_DIR_SEP_BACK(s,e) spn_ag_char_map_back((char *)s, (char
*)e, 2)
+#define BRK_DIR_SEP_BACK(s,e) brk_ag_char_map_back((char *)s, (char
*)e, 2)
+#define IS_PERCENT_CHAR( _c) is_ag_char_map_char((char)( _c),
0x0000008)
+#define SPN_PERCENT_CHARS(_s) spn_ag_char_map_chars((char *)_s, 3)
+#define BRK_PERCENT_CHARS(_s) brk_ag_char_map_chars((char *)_s, 3)
+#define SPN_PERCENT_BACK(s,e) spn_ag_char_map_back((char *)s, (char
*)e, 3)
+#define BRK_PERCENT_BACK(s,e) brk_ag_char_map_back((char *)s, (char
*)e, 3)
+#define IS_COMMA_CHAR( _c) is_ag_char_map_char((char)( _c),
0x0000010)
+#define SPN_COMMA_CHARS(_s) spn_ag_char_map_chars((char *)_s, 4)
+#define BRK_COMMA_CHARS(_s) brk_ag_char_map_chars((char *)_s, 4)
+#define SPN_COMMA_BACK(s,e) spn_ag_char_map_back((char *)s, (char
*)e, 4)
+#define BRK_COMMA_BACK(s,e) brk_ag_char_map_back((char *)s, (char
*)e, 4)
+#define IS_COLON_CHAR( _c) is_ag_char_map_char((char)( _c),
0x0000020)
+#define SPN_COLON_CHARS(_s) spn_ag_char_map_chars((char *)_s, 5)
+#define BRK_COLON_CHARS(_s) brk_ag_char_map_chars((char *)_s, 5)
+#define SPN_COLON_BACK(s,e) spn_ag_char_map_back((char *)s, (char
*)e, 5)
+#define BRK_COLON_BACK(s,e) brk_ag_char_map_back((char *)s, (char
*)e, 5)
+#define IS_UNDERSCORE_CHAR( _c) is_ag_char_map_char((char)( _c),
0x0000040)
+#define SPN_UNDERSCORE_CHARS(_s) spn_ag_char_map_chars((char *)_s, 6)
+#define BRK_UNDERSCORE_CHARS(_s) brk_ag_char_map_chars((char *)_s, 6)
+#define SPN_UNDERSCORE_BACK(s,e) spn_ag_char_map_back((char *)s, (char
*)e, 6)
+#define BRK_UNDERSCORE_BACK(s,e) brk_ag_char_map_back((char *)s, (char
*)e, 6)
+#define IS_PLUS_CHAR( _c) is_ag_char_map_char((char)( _c),
0x0000080)
+#define SPN_PLUS_CHARS(_s) spn_ag_char_map_chars((char *)_s, 7)
+#define BRK_PLUS_CHARS(_s) brk_ag_char_map_chars((char *)_s, 7)
+#define SPN_PLUS_BACK(s,e) spn_ag_char_map_back((char *)s, (char
*)e, 7)
+#define BRK_PLUS_BACK(s,e) brk_ag_char_map_back((char *)s, (char
*)e, 7)
+#define IS_DOLLAR_CHAR( _c) is_ag_char_map_char((char)( _c),
0x0000100)
+#define SPN_DOLLAR_CHARS(_s) spn_ag_char_map_chars((char *)_s, 8)
+#define BRK_DOLLAR_CHARS(_s) brk_ag_char_map_chars((char *)_s, 8)
+#define SPN_DOLLAR_BACK(s,e) spn_ag_char_map_back((char *)s, (char
*)e, 8)
+#define BRK_DOLLAR_BACK(s,e) brk_ag_char_map_back((char *)s, (char
*)e, 8)
+#define IS_HORIZ_WHITE_CHAR( _c) is_ag_char_map_char((char)( _c),
0x0000200)
+#define SPN_HORIZ_WHITE_CHARS(_s) spn_ag_char_map_chars((char *)_s, 9)
+#define BRK_HORIZ_WHITE_CHARS(_s) brk_ag_char_map_chars((char *)_s, 9)
+#define SPN_HORIZ_WHITE_BACK(s,e) spn_ag_char_map_back((char *)s, (char
*)e, 9)
+#define BRK_HORIZ_WHITE_BACK(s,e) brk_ag_char_map_back((char *)s, (char
*)e, 9)
+#define IS_ALT_WHITE_CHAR( _c) is_ag_char_map_char((char)( _c),
0x0000400)
+#define SPN_ALT_WHITE_CHARS(_s) spn_ag_char_map_chars((char *)_s, 10)
+#define BRK_ALT_WHITE_CHARS(_s) brk_ag_char_map_chars((char *)_s, 10)
+#define SPN_ALT_WHITE_BACK(s,e) spn_ag_char_map_back((char *)s, (char
*)e, 10)
+#define BRK_ALT_WHITE_BACK(s,e) brk_ag_char_map_back((char *)s, (char
*)e, 10)
+#define IS_WHITESPACE_CHAR( _c) is_ag_char_map_char((char)( _c),
0x0000601)
+#define SPN_WHITESPACE_CHARS(_s) spn_ag_char_map_chars((char *)_s, 11)
+#define BRK_WHITESPACE_CHARS(_s) brk_ag_char_map_chars((char *)_s, 11)
+#define SPN_WHITESPACE_BACK(s,e) spn_ag_char_map_back((char *)s, (char
*)e, 11)
+#define BRK_WHITESPACE_BACK(s,e) brk_ag_char_map_back((char *)s, (char
*)e, 11)
+#define IS_NON_NL_WHITE_CHAR( _c) is_ag_char_map_char((char)( _c),
0x0000600)
+#define SPN_NON_NL_WHITE_CHARS(_s) spn_ag_char_map_chars((char *)_s, 12)
+#define BRK_NON_NL_WHITE_CHARS(_s) brk_ag_char_map_chars((char *)_s, 12)
+#define SPN_NON_NL_WHITE_BACK(s,e) spn_ag_char_map_back((char *)s, (char
*)e, 12)
+#define BRK_NON_NL_WHITE_BACK(s,e) brk_ag_char_map_back((char *)s, (char
*)e, 12)
+#define IS_QUOTE_CHAR( _c) is_ag_char_map_char((char)( _c),
0x0000800)
+#define SPN_QUOTE_CHARS(_s) spn_ag_char_map_chars((char *)_s, 13)
+#define BRK_QUOTE_CHARS(_s) brk_ag_char_map_chars((char *)_s, 13)
+#define SPN_QUOTE_BACK(s,e) spn_ag_char_map_back((char *)s, (char
*)e, 13)
+#define BRK_QUOTE_BACK(s,e) brk_ag_char_map_back((char *)s, (char
*)e, 13)
+#define IS_PARENTHESES_CHAR( _c) is_ag_char_map_char((char)( _c),
0x0001000)
+#define SPN_PARENTHESES_CHARS(_s) spn_ag_char_map_chars((char *)_s, 14)
+#define BRK_PARENTHESES_CHARS(_s) brk_ag_char_map_chars((char *)_s, 14)
+#define SPN_PARENTHESES_BACK(s,e) spn_ag_char_map_back((char *)s, (char
*)e, 14)
+#define BRK_PARENTHESES_BACK(s,e) brk_ag_char_map_back((char *)s, (char
*)e, 14)
+#define IS_GRAPHIC_CHAR( _c) is_ag_char_map_char((char)( _c),
0x0002000)
+#define SPN_GRAPHIC_CHARS(_s) spn_ag_char_map_chars((char *)_s, 15)
+#define BRK_GRAPHIC_CHARS(_s) brk_ag_char_map_chars((char *)_s, 15)
+#define SPN_GRAPHIC_BACK(s,e) spn_ag_char_map_back((char *)s, (char
*)e, 15)
+#define BRK_GRAPHIC_BACK(s,e) brk_ag_char_map_back((char *)s, (char
*)e, 15)
+#define IS_INVERSION_CHAR( _c) is_ag_char_map_char((char)( _c),
0x0004000)
+#define SPN_INVERSION_CHARS(_s) spn_ag_char_map_chars((char *)_s, 16)
+#define BRK_INVERSION_CHARS(_s) brk_ag_char_map_chars((char *)_s, 16)
+#define SPN_INVERSION_BACK(s,e) spn_ag_char_map_back((char *)s, (char
*)e, 16)
+#define BRK_INVERSION_BACK(s,e) brk_ag_char_map_back((char *)s, (char
*)e, 16)
+#define IS_OCT_DIGIT_CHAR( _c) is_ag_char_map_char((char)( _c),
0x0008000)
+#define SPN_OCT_DIGIT_CHARS(_s) spn_ag_char_map_chars((char *)_s, 17)
+#define BRK_OCT_DIGIT_CHARS(_s) brk_ag_char_map_chars((char *)_s, 17)
+#define SPN_OCT_DIGIT_BACK(s,e) spn_ag_char_map_back((char *)s, (char
*)e, 17)
+#define BRK_OCT_DIGIT_BACK(s,e) brk_ag_char_map_back((char *)s, (char
*)e, 17)
+#define IS_DEC_DIGIT_CHAR( _c) is_ag_char_map_char((char)( _c),
0x0018000)
+#define SPN_DEC_DIGIT_CHARS(_s) spn_ag_char_map_chars((char *)_s, 18)
+#define BRK_DEC_DIGIT_CHARS(_s) brk_ag_char_map_chars((char *)_s, 18)
+#define SPN_DEC_DIGIT_BACK(s,e) spn_ag_char_map_back((char *)s, (char
*)e, 18)
+#define BRK_DEC_DIGIT_BACK(s,e) brk_ag_char_map_back((char *)s, (char
*)e, 18)
+#define IS_HEX_DIGIT_CHAR( _c) is_ag_char_map_char((char)( _c),
0x0038000)
+#define SPN_HEX_DIGIT_CHARS(_s) spn_ag_char_map_chars((char *)_s, 19)
+#define BRK_HEX_DIGIT_CHARS(_s) brk_ag_char_map_chars((char *)_s, 19)
+#define SPN_HEX_DIGIT_BACK(s,e) spn_ag_char_map_back((char *)s, (char
*)e, 19)
+#define BRK_HEX_DIGIT_BACK(s,e) brk_ag_char_map_back((char *)s, (char
*)e, 19)
+#define IS_LOWER_CASE_CHAR( _c) is_ag_char_map_char((char)( _c),
0x0040000)
+#define SPN_LOWER_CASE_CHARS(_s) spn_ag_char_map_chars((char *)_s, 20)
+#define BRK_LOWER_CASE_CHARS(_s) brk_ag_char_map_chars((char *)_s, 20)
+#define SPN_LOWER_CASE_BACK(s,e) spn_ag_char_map_back((char *)s, (char
*)e, 20)
+#define BRK_LOWER_CASE_BACK(s,e) brk_ag_char_map_back((char *)s, (char
*)e, 20)
+#define IS_UPPER_CASE_CHAR( _c) is_ag_char_map_char((char)( _c),
0x0080000)
+#define SPN_UPPER_CASE_CHARS(_s) spn_ag_char_map_chars((char *)_s, 21)
+#define BRK_UPPER_CASE_CHARS(_s) brk_ag_char_map_chars((char *)_s, 21)
+#define SPN_UPPER_CASE_BACK(s,e) spn_ag_char_map_back((char *)s, (char
*)e, 21)
+#define BRK_UPPER_CASE_BACK(s,e) brk_ag_char_map_back((char *)s, (char
*)e, 21)
+#define IS_ALPHABETIC_CHAR( _c) is_ag_char_map_char((char)( _c),
0x00C0000)
+#define SPN_ALPHABETIC_CHARS(_s) spn_ag_char_map_chars((char *)_s, 22)
+#define BRK_ALPHABETIC_CHARS(_s) brk_ag_char_map_chars((char *)_s, 22)
+#define SPN_ALPHABETIC_BACK(s,e) spn_ag_char_map_back((char *)s, (char
*)e, 22)
+#define BRK_ALPHABETIC_BACK(s,e) brk_ag_char_map_back((char *)s, (char
*)e, 22)
+#define IS_ALPHANUMERIC_CHAR( _c) is_ag_char_map_char((char)( _c),
0x00D8000)
+#define SPN_ALPHANUMERIC_CHARS(_s) spn_ag_char_map_chars((char *)_s, 23)
+#define BRK_ALPHANUMERIC_CHARS(_s) brk_ag_char_map_chars((char *)_s, 23)
+#define SPN_ALPHANUMERIC_BACK(s,e) spn_ag_char_map_back((char *)s, (char
*)e, 23)
+#define BRK_ALPHANUMERIC_BACK(s,e) brk_ag_char_map_back((char *)s, (char
*)e, 23)
+#define IS_VAR_FIRST_CHAR( _c) is_ag_char_map_char((char)( _c),
0x00C0040)
+#define SPN_VAR_FIRST_CHARS(_s) spn_ag_char_map_chars((char *)_s, 24)
+#define BRK_VAR_FIRST_CHARS(_s) brk_ag_char_map_chars((char *)_s, 24)
+#define SPN_VAR_FIRST_BACK(s,e) spn_ag_char_map_back((char *)s, (char
*)e, 24)
+#define BRK_VAR_FIRST_BACK(s,e) brk_ag_char_map_back((char *)s, (char
*)e, 24)
+#define IS_VARIABLE_NAME_CHAR( _c) is_ag_char_map_char((char)( _c),
0x00D8040)
+#define SPN_VARIABLE_NAME_CHARS(_s) spn_ag_char_map_chars((char *)_s, 25)
+#define BRK_VARIABLE_NAME_CHARS(_s) brk_ag_char_map_chars((char *)_s, 25)
+#define SPN_VARIABLE_NAME_BACK(s,e) spn_ag_char_map_back((char *)s, (char
*)e, 25)
+#define BRK_VARIABLE_NAME_BACK(s,e) brk_ag_char_map_back((char *)s, (char
*)e, 25)
+#define IS_OPTION_NAME_CHAR( _c) is_ag_char_map_char((char)( _c),
0x01D8040)
+#define SPN_OPTION_NAME_CHARS(_s) spn_ag_char_map_chars((char *)_s, 26)
+#define BRK_OPTION_NAME_CHARS(_s) brk_ag_char_map_chars((char *)_s, 26)
+#define SPN_OPTION_NAME_BACK(s,e) spn_ag_char_map_back((char *)s, (char
*)e, 26)
+#define BRK_OPTION_NAME_BACK(s,e) brk_ag_char_map_back((char *)s, (char
*)e, 26)
+#define IS_VALUE_NAME_CHAR( _c) is_ag_char_map_char((char)( _c),
0x01D8060)
+#define SPN_VALUE_NAME_CHARS(_s) spn_ag_char_map_chars((char *)_s, 27)
+#define BRK_VALUE_NAME_CHARS(_s) brk_ag_char_map_chars((char *)_s, 27)
+#define SPN_VALUE_NAME_BACK(s,e) spn_ag_char_map_back((char *)s, (char
*)e, 27)
+#define BRK_VALUE_NAME_BACK(s,e) brk_ag_char_map_back((char *)s, (char
*)e, 27)
+#define IS_NAME_SEP_CHAR( _c) is_ag_char_map_char((char)( _c),
0x0200000)
+#define SPN_NAME_SEP_CHARS(_s) spn_ag_char_map_chars((char *)_s, 28)
+#define BRK_NAME_SEP_CHARS(_s) brk_ag_char_map_chars((char *)_s, 28)
+#define SPN_NAME_SEP_BACK(s,e) spn_ag_char_map_back((char *)s, (char
*)e, 28)
+#define BRK_NAME_SEP_BACK(s,e) brk_ag_char_map_back((char *)s, (char
*)e, 28)
+#define IS_COMPOUND_NAME_CHAR( _c) is_ag_char_map_char((char)( _c),
0x03D8260)
+#define SPN_COMPOUND_NAME_CHARS(_s) spn_ag_char_map_chars((char *)_s, 29)
+#define BRK_COMPOUND_NAME_CHARS(_s) brk_ag_char_map_chars((char *)_s, 29)
+#define SPN_COMPOUND_NAME_BACK(s,e) spn_ag_char_map_back((char *)s, (char
*)e, 29)
+#define BRK_COMPOUND_NAME_BACK(s,e) brk_ag_char_map_back((char *)s, (char
*)e, 29)
+#define IS_SCHEME_NOTE_CHAR( _c) is_ag_char_map_char((char)( _c),
0x0001800)
+#define SPN_SCHEME_NOTE_CHARS(_s) spn_ag_char_map_chars((char *)_s, 30)
+#define BRK_SCHEME_NOTE_CHARS(_s) brk_ag_char_map_chars((char *)_s, 30)
+#define SPN_SCHEME_NOTE_BACK(s,e) spn_ag_char_map_back((char *)s, (char
*)e, 30)
+#define BRK_SCHEME_NOTE_BACK(s,e) brk_ag_char_map_back((char *)s, (char
*)e, 30)
+#define IS_UNQUOTABLE_CHAR( _c) is_ag_char_map_char((char)( _c),
0x0400000)
+#define SPN_UNQUOTABLE_CHARS(_s) spn_ag_char_map_chars((char *)_s, 31)
+#define BRK_UNQUOTABLE_CHARS(_s) brk_ag_char_map_chars((char *)_s, 31)
+#define SPN_UNQUOTABLE_BACK(s,e) spn_ag_char_map_back((char *)s, (char
*)e, 31)
+#define BRK_UNQUOTABLE_BACK(s,e) brk_ag_char_map_back((char *)s, (char
*)e, 31)
+#define IS_END_XML_TOKEN_CHAR( _c) is_ag_char_map_char((char)( _c),
0x0800601)
+#define SPN_END_XML_TOKEN_CHARS(_s) spn_ag_char_map_chars((char *)_s, 32)
+#define BRK_END_XML_TOKEN_CHARS(_s) brk_ag_char_map_chars((char *)_s, 32)
+#define SPN_END_XML_TOKEN_BACK(s,e) spn_ag_char_map_back((char *)s, (char
*)e, 32)
+#define BRK_END_XML_TOKEN_BACK(s,e) brk_ag_char_map_back((char *)s, (char
*)e, 32)
+#define IS_PLUS_N_SPACE_CHAR( _c) is_ag_char_map_char((char)( _c),
0x0000681)
+#define SPN_PLUS_N_SPACE_CHARS(_s) spn_ag_char_map_chars((char *)_s, 33)
+#define BRK_PLUS_N_SPACE_CHARS(_s) brk_ag_char_map_chars((char *)_s, 33)
+#define SPN_PLUS_N_SPACE_BACK(s,e) spn_ag_char_map_back((char *)s, (char
*)e, 33)
+#define BRK_PLUS_N_SPACE_BACK(s,e) brk_ag_char_map_back((char *)s, (char
*)e, 33)
+#define IS_PUNCTUATION_CHAR( _c) is_ag_char_map_char((char)( _c),
0x1000000)
+#define SPN_PUNCTUATION_CHARS(_s) spn_ag_char_map_chars((char *)_s, 34)
+#define BRK_PUNCTUATION_CHARS(_s) brk_ag_char_map_chars((char *)_s, 34)
+#define SPN_PUNCTUATION_BACK(s,e) spn_ag_char_map_back((char *)s, (char
*)e, 34)
+#define BRK_PUNCTUATION_BACK(s,e) brk_ag_char_map_back((char *)s, (char
*)e, 34)
+#define IS_SUFFIX_CHAR( _c) is_ag_char_map_char((char)( _c),
0x20D8000)
+#define SPN_SUFFIX_CHARS(_s) spn_ag_char_map_chars((char *)_s, 35)
+#define BRK_SUFFIX_CHARS(_s) brk_ag_char_map_chars((char *)_s, 35)
+#define SPN_SUFFIX_BACK(s,e) spn_ag_char_map_back((char *)s, (char
*)e, 35)
+#define BRK_SUFFIX_BACK(s,e) brk_ag_char_map_back((char *)s, (char
*)e, 35)
+#define IS_SUFFIX_FMT_CHAR( _c) is_ag_char_map_char((char)( _c),
0x20D800C)
+#define SPN_SUFFIX_FMT_CHARS(_s) spn_ag_char_map_chars((char *)_s, 36)
+#define BRK_SUFFIX_FMT_CHARS(_s) brk_ag_char_map_chars((char *)_s, 36)
+#define SPN_SUFFIX_FMT_BACK(s,e) spn_ag_char_map_back((char *)s, (char
*)e, 36)
+#define BRK_SUFFIX_FMT_BACK(s,e) brk_ag_char_map_back((char *)s, (char
*)e, 36)
+#define IS_FALSE_TYPE_CHAR( _c) is_ag_char_map_char((char)( _c),
0x4000002)
+#define SPN_FALSE_TYPE_CHARS(_s) spn_ag_char_map_chars((char *)_s, 37)
+#define BRK_FALSE_TYPE_CHARS(_s) brk_ag_char_map_chars((char *)_s, 37)
+#define SPN_FALSE_TYPE_BACK(s,e) spn_ag_char_map_back((char *)s, (char
*)e, 37)
+#define BRK_FALSE_TYPE_BACK(s,e) brk_ag_char_map_back((char *)s, (char
*)e, 37)
+#define IS_FILE_NAME_CHAR( _c) is_ag_char_map_char((char)( _c),
0x20D8004)
+#define SPN_FILE_NAME_CHARS(_s) spn_ag_char_map_chars((char *)_s, 38)
+#define BRK_FILE_NAME_CHARS(_s) brk_ag_char_map_chars((char *)_s, 38)
+#define SPN_FILE_NAME_BACK(s,e) spn_ag_char_map_back((char *)s, (char
*)e, 38)
+#define BRK_FILE_NAME_BACK(s,e) brk_ag_char_map_back((char *)s, (char
*)e, 38)
+#define IS_END_TOKEN_CHAR( _c) is_ag_char_map_char((char)( _c),
0x0000603)
+#define SPN_END_TOKEN_CHARS(_s) spn_ag_char_map_chars((char *)_s, 39)
+#define BRK_END_TOKEN_CHARS(_s) brk_ag_char_map_chars((char *)_s, 39)
+#define SPN_END_TOKEN_BACK(s,e) spn_ag_char_map_back((char *)s, (char
*)e, 39)
+#define BRK_END_TOKEN_BACK(s,e) brk_ag_char_map_back((char *)s, (char
*)e, 39)
+#define IS_END_LIST_ENTRY_CHAR( _c) is_ag_char_map_char((char)( _c),
0x0000613)
+#define SPN_END_LIST_ENTRY_CHARS(_s) spn_ag_char_map_chars((char *)_s, 40)
+#define BRK_END_LIST_ENTRY_CHARS(_s) brk_ag_char_map_chars((char *)_s, 40)
+#define SPN_END_LIST_ENTRY_BACK(s,e) spn_ag_char_map_back((char *)s, (char
*)e, 40)
+#define BRK_END_LIST_ENTRY_BACK(s,e) brk_ag_char_map_back((char *)s, (char
*)e, 40)
+#define IS_SET_SEPARATOR_CHAR( _c) is_ag_char_map_char((char)( _c),
0x8000613)
+#define SPN_SET_SEPARATOR_CHARS(_s) spn_ag_char_map_chars((char *)_s, 41)
+#define BRK_SET_SEPARATOR_CHARS(_s) brk_ag_char_map_chars((char *)_s, 41)
+#define SPN_SET_SEPARATOR_BACK(s,e) spn_ag_char_map_back((char *)s, (char
*)e, 41)
+#define BRK_SET_SEPARATOR_BACK(s,e) brk_ag_char_map_back((char *)s, (char
*)e, 41)
+#define IS_SIGNED_NUMBER_CHAR( _c) is_ag_char_map_char((char)( _c),
0x001C000)
+#define SPN_SIGNED_NUMBER_CHARS(_s) spn_ag_char_map_chars((char *)_s, 42)
+#define BRK_SIGNED_NUMBER_CHARS(_s) brk_ag_char_map_chars((char *)_s, 42)
+#define SPN_SIGNED_NUMBER_BACK(s,e) spn_ag_char_map_back((char *)s, (char
*)e, 42)
+#define BRK_SIGNED_NUMBER_BACK(s,e) brk_ag_char_map_back((char *)s, (char
*)e, 42)
+#define IS_MAKE_SCRIPT_CHAR( _c) is_ag_char_map_char((char)( _c),
0x0000101)
+#define SPN_MAKE_SCRIPT_CHARS(_s) spn_ag_char_map_chars((char *)_s, 43)
+#define BRK_MAKE_SCRIPT_CHARS(_s) brk_ag_char_map_chars((char *)_s, 43)
+#define SPN_MAKE_SCRIPT_BACK(s,e) spn_ag_char_map_back((char *)s, (char
*)e, 43)
+#define BRK_MAKE_SCRIPT_BACK(s,e) brk_ag_char_map_back((char *)s, (char
*)e, 43)
static ag_char_map_mask_t const ag_char_map_table[128] = {
- /*NUL*/ 0x140000, /*x01*/ 0x000000, /*x02*/ 0x000000, /*x03*/ 0x000000,
- /*x04*/ 0x000000, /*x05*/ 0x000000, /*x06*/ 0x000000, /*BEL*/ 0x000000,
- /* BS*/ 0x000400, /* HT*/ 0x000100, /* NL*/ 0x000400, /* VT*/ 0x000400,
- /* FF*/ 0x000400, /* CR*/ 0x000400, /*x0E*/ 0x000000, /*x0F*/ 0x000000,
- /*x10*/ 0x000000, /*x11*/ 0x000000, /*x12*/ 0x000000, /*x13*/ 0x000000,
- /*x14*/ 0x000000, /*x15*/ 0x000000, /*x16*/ 0x000000, /*x17*/ 0x000000,
- /*x18*/ 0x000000, /*x19*/ 0x000000, /*x1A*/ 0x000000, /*ESC*/ 0x000000,
- /*x1C*/ 0x000000, /*x1D*/ 0x000000, /*x1E*/ 0x000000, /*x1F*/ 0x000000,
- /* */ 0x000100, /* ! */ 0x00A800, /* " */ 0x00A000, /* # */ 0x00A000,
- /* $ */ 0x00A800, /* % */ 0x02A800, /* & */ 0x00A800, /* ' */ 0x00A000,
- /* ( */ 0x00A000, /* ) */ 0x00A000, /* * */ 0x00A000, /* + */ 0x40E800,
- /* , */ 0x20A000, /* - */ 0x01A840, /* . */ 0x01AA00, /* / */ 0x0AB800,
- /* 0 */ 0x042804, /* 1 */ 0x002804, /* 2 */ 0x002804, /* 3 */ 0x002804,
- /* 4 */ 0x002804, /* 5 */ 0x002804, /* 6 */ 0x002804, /* 7 */ 0x002804,
- /* 8 */ 0x002808, /* 9 */ 0x002808, /* : */ 0x00A880, /* ; */ 0x00A000,
- /* < */ 0x00A000, /* = */ 0x00A000, /* > */ 0x00B000, /* ? */ 0x00A000,
- /* @ */ 0x00A800, /* A */ 0x002812, /* B */ 0x002812, /* C */ 0x002812,
- /* D */ 0x002812, /* E */ 0x002812, /* F */ 0x042812, /* G */ 0x002802,
- /* H */ 0x002802, /* I */ 0x002802, /* J */ 0x002802, /* K */ 0x002802,
- /* L */ 0x002802, /* M */ 0x002802, /* N */ 0x042802, /* O */ 0x002802,
- /* P */ 0x002802, /* Q */ 0x002802, /* R */ 0x002802, /* S */ 0x002802,
- /* T */ 0x002802, /* U */ 0x002802, /* V */ 0x002802, /* W */ 0x002802,
- /* X */ 0x002802, /* Y */ 0x002802, /* Z */ 0x002802, /* [ */ 0x00A200,
- /* \ */ 0x00A000, /* ] */ 0x00A200, /* ^ */ 0x00A840, /* _ */ 0x012820,
- /* ` */ 0x00A000, /* a */ 0x002811, /* b */ 0x002811, /* c */ 0x002811,
- /* d */ 0x002811, /* e */ 0x002811, /* f */ 0x042811, /* g */ 0x002801,
- /* h */ 0x002801, /* i */ 0x002801, /* j */ 0x002801, /* k */ 0x002801,
- /* l */ 0x002801, /* m */ 0x002801, /* n */ 0x042801, /* o */ 0x002801,
- /* p */ 0x002801, /* q */ 0x002801, /* r */ 0x002801, /* s */ 0x002801,
- /* t */ 0x002801, /* u */ 0x002801, /* v */ 0x002801, /* w */ 0x002801,
- /* x */ 0x002801, /* y */ 0x002801, /* z */ 0x002801, /* { */ 0x00A000,
- /* | */ 0x40A800, /* } */ 0x00A000, /* ~ */ 0x00A800, /*x7F*/ 0x000000
+ /*NUL*/ 0x0000002, /*x01*/ 0x0000000, /*x02*/ 0x0000000, /*x03*/ 0x0000000,
+ /*x04*/ 0x0000000, /*x05*/ 0x0000000, /*x06*/ 0x0000000, /*BEL*/ 0x0000000,
+ /* BS*/ 0x0000400, /* HT*/ 0x0000200, /* NL*/ 0x0000001, /* VT*/ 0x0000400,
+ /* FF*/ 0x0000400, /* CR*/ 0x0000400, /*x0E*/ 0x0000000, /*x0F*/ 0x0000000,
+ /*x10*/ 0x0000000, /*x11*/ 0x0000000, /*x12*/ 0x0000000, /*x13*/ 0x0000000,
+ /*x14*/ 0x0000000, /*x15*/ 0x0000000, /*x16*/ 0x0000000, /*x17*/ 0x0000000,
+ /*x18*/ 0x0000000, /*x19*/ 0x0000000, /*x1A*/ 0x0000000, /*ESC*/ 0x0000000,
+ /*x1C*/ 0x0000000, /*x1D*/ 0x0000000, /*x1E*/ 0x0000000, /*x1F*/ 0x0000000,
+ /* */ 0x0000200, /* ! */ 0x1402000, /* " */ 0x1002800, /* # */ 0x1002000,
+ /* $ */ 0x1402100, /* % */ 0x1402008, /* & */ 0x1402000, /* ' */ 0x1002800,
+ /* ( */ 0x1003000, /* ) */ 0x1003000, /* * */ 0x1002000, /* + */ 0x9402080,
+ /* , */ 0x1002010, /* - */ 0x3506000, /* . */ 0x3602000, /* / */ 0x1C02004,
+ /* 0 */ 0x440A000, /* 1 */ 0x040A000, /* 2 */ 0x040A000, /* 3 */ 0x040A000,
+ /* 4 */ 0x040A000, /* 5 */ 0x040A000, /* 6 */ 0x040A000, /* 7 */ 0x040A000,
+ /* 8 */ 0x0412000, /* 9 */ 0x0412000, /* : */ 0x1402020, /* ; */ 0x1002000,
+ /* < */ 0x1002000, /* = */ 0x1002000, /* > */ 0x1802000, /* ? */ 0x1002000,
+ /* @ */ 0x1402000, /* A */ 0x04A2000, /* B */ 0x04A2000, /* C */ 0x04A2000,
+ /* D */ 0x04A2000, /* E */ 0x04A2000, /* F */ 0x44A2000, /* G */ 0x0482000,
+ /* H */ 0x0482000, /* I */ 0x0482000, /* J */ 0x0482000, /* K */ 0x0482000,
+ /* L */ 0x0482000, /* M */ 0x0482000, /* N */ 0x4482000, /* O */ 0x0482000,
+ /* P */ 0x0482000, /* Q */ 0x0482000, /* R */ 0x0482000, /* S */ 0x0482000,
+ /* T */ 0x0482000, /* U */ 0x0482000, /* V */ 0x0482000, /* W */ 0x0482000,
+ /* X */ 0x0482000, /* Y */ 0x0482000, /* Z */ 0x0482000, /* [ */ 0x1202000,
+ /* \ */ 0x1002004, /* ] */ 0x1202000, /* ^ */ 0x1502000, /* _ */ 0x2402040,
+ /* ` */ 0x1002000, /* a */ 0x0462000, /* b */ 0x0462000, /* c */ 0x0462000,
+ /* d */ 0x0462000, /* e */ 0x0462000, /* f */ 0x4462000, /* g */ 0x0442000,
+ /* h */ 0x0442000, /* i */ 0x0442000, /* j */ 0x0442000, /* k */ 0x0442000,
+ /* l */ 0x0442000, /* m */ 0x0442000, /* n */ 0x4442000, /* o */ 0x0442000,
+ /* p */ 0x0442000, /* q */ 0x0442000, /* r */ 0x0442000, /* s */ 0x0442000,
+ /* t */ 0x0442000, /* u */ 0x0442000, /* v */ 0x0442000, /* w */ 0x0442000,
+ /* x */ 0x0442000, /* y */ 0x0442000, /* z */ 0x0442000, /* { */ 0x1002000,
+ /* | */ 0x9402000, /* } */ 0x1002000, /* ~ */ 0x1406000, /*x7F*/ 0x0000000
+};
+
+#include <stdlib.h>
+#include <string.h>
+
+static unsigned char const * ag_char_map_spanners[44];
+/**
+ * Character category masks. Some categories may have multiple bits,
+ * if their definition incorporates other character categories.
+ * This mask array is only used by calc_ag_char_map_spanners().
+ */
+static ag_char_map_mask_t const ag_char_map_masks[44] = {
+ 0x0000001, /* NEWLINE */
+ 0x0000002, /* NUL_BYTE */
+ 0x0000004, /* DIR_SEP */
+ 0x0000008, /* PERCENT */
+ 0x0000010, /* COMMA */
+ 0x0000020, /* COLON */
+ 0x0000040, /* UNDERSCORE */
+ 0x0000080, /* PLUS */
+ 0x0000100, /* DOLLAR */
+ 0x0000200, /* HORIZ_WHITE */
+ 0x0000400, /* ALT_WHITE */
+ 0x0000601, /* WHITESPACE */
+ 0x0000600, /* NON_NL_WHITE */
+ 0x0000800, /* QUOTE */
+ 0x0001000, /* PARENTHESES */
+ 0x0002000, /* GRAPHIC */
+ 0x0004000, /* INVERSION */
+ 0x0008000, /* OCT_DIGIT */
+ 0x0018000, /* DEC_DIGIT */
+ 0x0038000, /* HEX_DIGIT */
+ 0x0040000, /* LOWER_CASE */
+ 0x0080000, /* UPPER_CASE */
+ 0x00C0000, /* ALPHABETIC */
+ 0x00D8000, /* ALPHANUMERIC */
+ 0x00C0040, /* VAR_FIRST */
+ 0x00D8040, /* VARIABLE_NAME */
+ 0x01D8040, /* OPTION_NAME */
+ 0x01D8060, /* VALUE_NAME */
+ 0x0200000, /* NAME_SEP */
+ 0x03D8260, /* COMPOUND_NAME */
+ 0x0001800, /* SCHEME_NOTE */
+ 0x0400000, /* UNQUOTABLE */
+ 0x0800601, /* END_XML_TOKEN */
+ 0x0000681, /* PLUS_N_SPACE */
+ 0x1000000, /* PUNCTUATION */
+ 0x20D8000, /* SUFFIX */
+ 0x20D800C, /* SUFFIX_FMT */
+ 0x4000002, /* FALSE_TYPE */
+ 0x20D8004, /* FILE_NAME */
+ 0x0000603, /* END_TOKEN */
+ 0x0000613, /* END_LIST_ENTRY */
+ 0x8000613, /* SET_SEPARATOR */
+ 0x001C000, /* SIGNED_NUMBER */
+ 0x0000101, /* MAKE_SCRIPT */
};
+
+#define lock_ag_char_map_spanners()
+#define unlock_ag_char_map_spanners()
+
+static unsigned char const *
+calc_ag_char_map_spanners(unsigned int mask_ix)
+{
+ lock_ag_char_map_spanners();
+ if (ag_char_map_spanners[mask_ix] == NULL) {
+ int ix = 1;
+ ag_char_map_mask_t mask = ag_char_map_masks[mask_ix];
+ unsigned char * res = malloc(256 /* 1 << NBBY */);
+ memset(res, 0, 256);
+ for (; ix < 128; ix++)
+ if (ag_char_map_table[ix] & mask)
+ res[ix] = 1;
+ ag_char_map_spanners[mask_ix] = res;
+ }
+ unlock_ag_char_map_spanners();
+ return ag_char_map_spanners[mask_ix];
+}
+#define ag_char_map_masks POISONED_ag_char_map_masks
+
static inline int
is_ag_char_map_char(char ch, ag_char_map_mask_t mask)
{
@@ -207,16 +448,44 @@ is_ag_char_map_char(char ch, ag_char_map_mask_t mask)
}
static inline char *
-spn_ag_char_map_chars(char * p, ag_char_map_mask_t mask)
+spn_ag_char_map_chars(char * p, unsigned int mask_ix)
{
- while ((*p != '\0') && is_ag_char_map_char(*p, mask)) p++;
+ unsigned char const * v = ag_char_map_spanners[mask_ix];
+ if (v == NULL)
+ v = calc_ag_char_map_spanners(mask_ix);
+ while (v[(unsigned)*p]) p++;
return p;
}
static inline char *
-brk_ag_char_map_chars(char * p, ag_char_map_mask_t mask)
+brk_ag_char_map_chars(char * p, unsigned int mask_ix)
{
- while ((*p != '\0') && (! is_ag_char_map_char(*p, mask))) p++;
+ unsigned char const * v = ag_char_map_spanners[mask_ix];
+ if (v == NULL)
+ v = calc_ag_char_map_spanners(mask_ix);
+ while ((*p != '\0') && (! v[(unsigned)*p])) p++;
return p;
}
+
+static inline char *
+spn_ag_char_map_back(char * s, char * e, unsigned int mask_ix)
+{
+ unsigned char const * v = ag_char_map_spanners[mask_ix];
+ if (v == NULL)
+ v = calc_ag_char_map_spanners(mask_ix);
+ if (s >= e) e = s + strlen(s);
+ while ((e > s) && v[(unsigned)e[-1]]) e--;
+ return e;
+}
+
+static inline char *
+brk_ag_char_map_back(char * s, char * e, unsigned int mask_ix)
+{
+ unsigned char const * v = ag_char_map_spanners[mask_ix];
+ if (v == NULL)
+ v = calc_ag_char_map_spanners(mask_ix);
+ if (s == e) e += strlen(e);
+ while ((e > s) && (! v[(unsigned)e[-1]])) e--;
+ return e;
+}
#endif /* AG_CHAR_MAP_H_GUARD */
diff --git a/src/libopts/ao-strs.c b/src/libopts/ao-strs.c
index d0f4d1c..30bcbe5 100644
--- a/src/libopts/ao-strs.c
+++ b/src/libopts/ao-strs.c
@@ -2,7 +2,7 @@
*
* DO NOT EDIT THIS FILE (ao-strs.c)
*
- * It has been AutoGen-ed February 26, 2012 at 11:08:40 AM by AutoGen
5.15pre14
+ * It has been AutoGen-ed May 6, 2012 at 04:20:58 PM by AutoGen 5.16pre36
* From the definitions ao-strs.def
* and the template file strings
*
diff --git a/src/libopts/ao-strs.h b/src/libopts/ao-strs.h
index f14cc25..30bbc3b 100644
--- a/src/libopts/ao-strs.h
+++ b/src/libopts/ao-strs.h
@@ -2,7 +2,7 @@
*
* DO NOT EDIT THIS FILE (ao-strs.h)
*
- * It has been AutoGen-ed February 26, 2012 at 11:08:40 AM by AutoGen
5.15pre14
+ * It has been AutoGen-ed May 6, 2012 at 04:20:58 PM by AutoGen 5.16pre36
* From the definitions ao-strs.def
* and the template file strings
*
diff --git a/src/libopts/autoopts.c b/src/libopts/autoopts.c
index df9e3cb..1eff700 100644
--- a/src/libopts/autoopts.c
+++ b/src/libopts/autoopts.c
@@ -2,7 +2,7 @@
/**
* \file autoopts.c
*
- * Time-stamp: "2012-01-29 09:58:30 bkorb"
+ * Time-stamp: "2012-03-04 19:44:56 bkorb"
*
* This file contains all of the routines that must be linked into
* an executable to use the generated option processing. The optional
@@ -37,7 +37,7 @@
static char const zNil[] = "";
static arg_types_t argTypes = { NULL };
static char line_fmt_buf[32];
-static ag_bool displayEnum = AG_FALSE;
+static bool displayEnum = false;
static char const pkgdatadir_default[] = PKGDATADIR;
static char const * program_pkgdatadir = pkgdatadir_default;
static tOptionLoadMode option_load_mode = OPTION_LOAD_UNCOOKED;
@@ -50,7 +50,7 @@ static tSuccess
next_opt_arg_must(tOptions * pOpts, tOptState* pOptState);
static tSuccess
-next_opt_arg_may(tOptions * pOpts, tOptState* pOptState);
+next_opt_arg_may(tOptions * pOpts, tOptState * pOptState);
static tSuccess
next_opt_arg_none(tOptions * pOpts, tOptState* pOptState);
@@ -295,9 +295,18 @@ next_opt_arg_must(tOptions * pOpts, tOptState* pOptState)
return SUCCESS;
}
-
+/**
+ * Process an optional option argument. For short options, it looks at the
+ * character after the option character, or it consumes the next full argument.
+ * For long options, it looks for an '=' character attachment to the long
+ * option name before deciding to take the next command line argument.
+ *
+ * @param pOpts the option descriptor
+ * @param pOptState a structure for managing the current processing state
+ * @returns SUCCESS or does not return
+ */
static tSuccess
-next_opt_arg_may(tOptions * pOpts, tOptState* pOptState)
+next_opt_arg_may(tOptions * pOpts, tOptState * pOptState)
{
/*
* An option argument is optional.
diff --git a/src/libopts/autoopts.h b/src/libopts/autoopts.h
index 6c3fee7..194ea5a 100644
--- a/src/libopts/autoopts.h
+++ b/src/libopts/autoopts.h
@@ -2,7 +2,7 @@
/*
* \file autoopts.h
*
- * Time-stamp: "2012-02-12 09:04:40 bkorb"
+ * Time-stamp: "2012-03-04 19:05:01 bkorb"
*
* This file defines all the global structures and special values
* used in the automated option processing library.
@@ -31,9 +31,6 @@
#ifndef AUTOGEN_AUTOOPTS_H
#define AUTOGEN_AUTOOPTS_H
-#include "compat/compat.h"
-#include "ag-char-map.h"
-
#define AO_NAME_LIMIT 127
#define AO_NAME_SIZE ((size_t)(AO_NAME_LIMIT + 1))
@@ -59,15 +56,19 @@
# define DIRCH '/'
#endif
+#define AO_EXIT_REQ_USAGE 64
#ifndef EX_NOINPUT
+ /**
+ * option state was requested from a file that cannot be loaded.
+ */
# define EX_NOINPUT 66
#endif
#ifndef EX_SOFTWARE
+ /**
+ * AutoOpts Software failure.
+ */
# define EX_SOFTWARE 70
#endif
-#ifndef EX_CONFIG
-# define EX_CONFIG 78
-#endif
#define NL '\n'
@@ -199,8 +200,6 @@ ao_realloc(void *p, size_t sz);
static char *
ao_strdup(char const *str);
-#define TAGMEM(m, t)
-
/*
* DO option handling?
*
diff --git a/src/libopts/autoopts/options.h b/src/libopts/autoopts/options.h
index 35d9aa7..356e7e9 100644
--- a/src/libopts/autoopts/options.h
+++ b/src/libopts/autoopts/options.h
@@ -2,7 +2,7 @@
*
* DO NOT EDIT THIS FILE (options.h)
*
- * It has been AutoGen-ed February 26, 2012 at 11:08:44 AM by AutoGen
5.15pre14
+ * It has been AutoGen-ed May 6, 2012 at 04:21:03 PM by AutoGen 5.16pre36
* From the definitions funcs.def
* and the template file options_h
*
@@ -29,25 +29,46 @@
#include <sys/types.h>
#include <stdio.h>
-#if defined(HAVE_STDINT_H)
-# include <stdint.h>
-#elif defined(HAVE_INTTYPES_H)
-# include <inttypes.h>
-#endif /* HAVE_STDINT/INTTYPES_H */
-
-#if defined(HAVE_LIMITS_H)
-# include <limits.h>
-#elif defined(HAVE_SYS_LIMITS_H)
-# include <sys/limits.h>
-#endif /* HAVE_LIMITS/SYS_LIMITS_H */
-
-#if defined(HAVE_SYSEXITS_H)
-# include <sysexits.h>
-#endif /* HAVE_SYSEXITS_H */
+#ifndef COMPAT_H_GUARD
+/*
+ * This is needed for test compilations where the "compat.h"
+ * header is not usually available.
+ */
+# if defined(HAVE_STDINT_H)
+# include <stdint.h>
+# elif defined(HAVE_INTTYPES_H)
+# include <inttypes.h>
+# endif /* HAVE_STDINT/INTTYPES_H */
+
+# if defined(HAVE_LIMITS_H)
+# include <limits.h>
+# elif defined(HAVE_SYS_LIMITS_H)
+# include <sys/limits.h>
+# endif /* HAVE_LIMITS/SYS_LIMITS_H */
+
+# if defined(HAVE_SYSEXITS_H)
+# include <sysexits.h>
+# endif /* HAVE_SYSEXITS_H */
+
+# if defined(HAVE_STDBOOL_H)
+# include <stdbool.h>
+# else
+ typedef enum { false = 0, true = 1 } _Bool;
+# define bool _Bool
+
+ /* The other macros must be usable in preprocessor directives. */
+# define false 0
+# define true 1
+# endif /* HAVE_SYSEXITS_H */
+#endif /* COMPAT_H_GUARD */
// END-CONFIGURED-HEADERS
-#ifndef EX_USAGE
-# define EX_USAGE 64
-#endif
+
+/**
+ * Defined to normal value of EX_USAGE. Used to indicate that paged usage
+ * was requested. It is used to distinguish a --usage from a --help request.
+ * --usage is abbreviated and --help gives as much help as possible.
+ */
+#define AO_EXIT_REQ_USAGE 64
/*
* PUBLIC DEFINES
@@ -65,8 +86,8 @@
* See the relevant generated header file to determine which and what
* values for "opt_name" are available.
*/
-#define OPTIONS_STRUCT_VERSION 147459
-#define OPTIONS_VERSION_STRING "36:3:11"
+#define OPTIONS_STRUCT_VERSION 147460
+#define OPTIONS_VERSION_STRING "36:4:11"
#define OPTIONS_MINIMUM_VERSION 102400
#define OPTIONS_MIN_VER_STRING "25:0:0"
#define OPTIONS_VER_TO_NUM(_v, _r) (((_v) * 4096) + (_r))
@@ -302,7 +323,7 @@ typedef enum {
OPTPROC_NXLAT_OPT | OPTPROC_NXLAT_OPT_CFG \
/* 0x00030000U */ )
-#define STMTS(s) do { s; } while (0)
+#define STMTS(s) do { s; } while (false)
/*
* The following must be #defined instead of typedef-ed
@@ -534,7 +555,7 @@ CPLUSPLUS_OPENER
* The following routines may be coded into AutoOpts client code:
*/
-/* From: tokenize.c line 166
+/* From: tokenize.c line 164
*
* ao_string_tokenize - tokenize an input string
*
@@ -598,7 +619,7 @@ extern token_list_t* ao_string_tokenize(char const*);
extern const tOptionValue* configFileLoad(char const*);
-/* From: configfile.c line 1059
+/* From: configfile.c line 1066
*
* optionFileLoad - Load the locatable config files, in order
*
@@ -697,7 +718,7 @@ extern void optionFree(tOptions*);
extern const tOptionValue* optionGetValue(const tOptionValue*, char const*);
-/* From: load.c line 476
+/* From: load.c line 475
*
* optionLoadLine - process a string for an option name and value
*
@@ -740,7 +761,7 @@ extern void optionLoadLine(tOptions*, char const*);
extern const tOptionValue* optionNextValue(const tOptionValue*, const
tOptionValue*);
-/* From: usage.c line 202
+/* From: usage.c line 201
*
* optionOnlyUsage - Print usage text for just the options
*
@@ -755,7 +776,7 @@ extern const tOptionValue* optionNextValue(const
tOptionValue*, const tOptionVal
extern void optionOnlyUsage(tOptions*, int);
-/* From: autoopts.c line 598
+/* From: autoopts.c line 607
*
* optionProcess - this is the main option processing routine
*
@@ -849,7 +870,7 @@ extern void optionSaveFile(tOptions*);
extern void optionSaveState(tOptions*);
-/* From: nested.c line 562
+/* From: nested.c line 563
*
* optionUnloadNested - Deallocate the memory for a nested value
*
@@ -1028,6 +1049,8 @@ extern unsigned int ao_string_cook_escape_char(char
const*, char*, unsigned int)
extern void genshelloptUsage(tOptions*, int);
+extern int optionAlias(tOptions*, tOptDesc*, unsigned int);
+
extern void optionBooleanVal(tOptions*, tOptDesc*);
extern uintptr_t optionEnumerationVal(tOptions*, tOptDesc*, char const * const
*, unsigned int);
@@ -1038,7 +1061,7 @@ extern char const * optionKeywordName(tOptDesc*, unsigned
int);
extern void optionLoadOpt(tOptions*, tOptDesc*);
-extern ag_bool optionMakePath(char*, int, char const*, char const*);
+extern bool optionMakePath(char*, int, char const*, char const*);
extern void optionNestedVal(tOptions*, tOptDesc*);
diff --git a/src/libopts/autoopts/project.h b/src/libopts/autoopts/project.h
index b01affb..c0df391 100644
--- a/src/libopts/autoopts/project.h
+++ b/src/libopts/autoopts/project.h
@@ -3,6 +3,8 @@
#define AUTOGEN_PROJECT_H
#include "config.h"
+#include "compat/compat.h"
+#include "ag-char-map.h"
/*
* Procedure success codes
@@ -37,8 +39,6 @@ typedef int tSuccess;
# define STR(s) __STR(s)
#endif
-#define STRSIZE(s) (sizeof(s)-1)
-
#ifdef DEFINING
# define VALUE(s) = s
# define MODE
diff --git a/src/libopts/autoopts/usage-txt.h b/src/libopts/autoopts/usage-txt.h
index 7f9999a..3ed7f3b 100644
--- a/src/libopts/autoopts/usage-txt.h
+++ b/src/libopts/autoopts/usage-txt.h
@@ -2,12 +2,12 @@
*
* DO NOT EDIT THIS FILE (usage-txt.h)
*
- * It has been AutoGen-ed February 26, 2012 at 11:08:42 AM by AutoGen
5.15pre14
+ * It has been AutoGen-ed May 6, 2012 at 04:21:00 PM by AutoGen 5.16pre36
* From the definitions usage-txt.def
* and the template file usage-txt.tpl
*
* This file handles all the bookkeeping required for tracking all the little
- * tiny strings used by the AutoOpts library. There are 144
+ * tiny strings used by the AutoOpts library. There are 145
* of them. This is not versioned because it is entirely internal to the
* library and accessed by client code only in a very well-controlled way:
* they may substitute translated strings using a procedure that steps through
@@ -50,7 +50,7 @@ typedef struct {
char* utpz_GnuTimeArg;
char* utpz_GnuNumArg;
char* utpz_GnuStrArg;
- cch_t* apz_str[ 137 ];
+ cch_t* apz_str[ 138 ];
} usage_text_t;
/*
@@ -202,11 +202,12 @@ extern usage_text_t option_usage_text;
#define zTabHypAnd (option_usage_text.apz_str[129])
#define zTabout (option_usage_text.apz_str[130])
#define zThreeSpaces (option_usage_text.apz_str[131])
-#define zTwoSpaces (option_usage_text.apz_str[132])
-#define zUpTo (option_usage_text.apz_str[133])
-#define zValidKeys (option_usage_text.apz_str[134])
-#define zVendOptsAre (option_usage_text.apz_str[135])
-#define zVendIntro (option_usage_text.apz_str[136])
+#define zTooLarge (option_usage_text.apz_str[132])
+#define zTwoSpaces (option_usage_text.apz_str[133])
+#define zUpTo (option_usage_text.apz_str[134])
+#define zValidKeys (option_usage_text.apz_str[135])
+#define zVendOptsAre (option_usage_text.apz_str[136])
+#define zVendIntro (option_usage_text.apz_str[137])
/*
* First, set up the strings. Some of these are writable. These are all in
@@ -221,7 +222,7 @@ extern usage_text_t option_usage_text;
static char eng_zGnuTimeArg[] = "=Tim";
static char eng_zGnuNumArg[] = "=num";
static char eng_zGnuStrArg[] = "=str";
-static char const usage_txt[4575] =
+static char const usage_txt[4631] =
/* 0 */ "malloc of %d bytes failed\n\0"
/* 27 */ "AutoOpts function called without option descriptor\n\0"
/* 79 */ "\tThis exceeds the compiled library version: \0"
@@ -242,141 +243,142 @@ static char const usage_txt[4575] =
/* 707 */ " %s%s\n\0"
/* 715 */ "%s: Command line arguments required\n\0"
/* 752 */ "%d %s%s options allowed\n\0"
-/* 777 */ "version and help options:\0"
-/* 803 */ "Error %d (%s) from the pipe(2) syscall\n\0"
-/* 843 */ "ERROR: version option argument '%c' invalid. Use:\n"
+/* 777 */ "version, usage and configuration options:\0"
+/* 819 */ "Error %d (%s) from the pipe(2) syscall\n\0"
+/* 859 */ "ERROR: version option argument '%c' invalid. Use:\n"
"\t'v' - version only\n"
"\t'c' - version and copyright\n"
"\t'n' - version and copyright notice\n\0"
-/* 980 */ "ERROR: %s option conflicts with the %s option\n\0"
-/* 1028 */ "%s(optionSaveState): error: cannot allocate %d bytes\n\0"
-/* 1082 */ "auto-options\0"
-/* 1095 */ "program\0"
-/* 1103 */ "\t\t\t\t- default option for unnamed options\n\0"
-/* 1145 */ "\t\t\t\t- disabled as --%s\n\0"
-/* 1169 */ "%s: The ``%s'' option has been disabled\0"
-/* 1209 */ " --- %-14s %s\n\0"
-/* 1224 */ "This option has been disabled\0"
-/* 1254 */ "\t\t\t\t- enabled by default\n\0"
-/* 1280 */ "-equivalence\0"
-/* 1293 */ "ERROR: only \0"
-/* 1307 */ " - examining environment variables named %s_*\n\0"
-/* 1354 */ " \0"
-/* 1360 */ "Options are specified by doubled hyphens and their name or by a
single\n"
+/* 996 */ "ERROR: %s option conflicts with the %s option\n\0"
+/* 1044 */ "%s(optionSaveState): error: cannot allocate %d bytes\n\0"
+/* 1098 */ "auto-options\0"
+/* 1111 */ "program\0"
+/* 1119 */ "\t\t\t\t- default option for unnamed options\n\0"
+/* 1161 */ "\t\t\t\t- disabled as --%s\n\0"
+/* 1185 */ "%s: The ``%s'' option has been disabled\0"
+/* 1225 */ " --- %-14s %s\n\0"
+/* 1240 */ "This option has been disabled\0"
+/* 1270 */ "\t\t\t\t- enabled by default\n\0"
+/* 1296 */ "-equivalence\0"
+/* 1309 */ "ERROR: only \0"
+/* 1323 */ " - examining environment variables named %s_*\n\0"
+/* 1370 */ " \0"
+/* 1376 */ "Options are specified by doubled hyphens and their name or by a
single\n"
"hyphen and the flag character.\n\0"
-/* 1463 */ "%%-%ds %%s\n\0"
-/* 1475 */ "fs error %d (%s) on fork - cannot obtain %s usage\n\0"
-/* 1526 */ "fs error %d (%s) on freopen\n\0"
-/* 1555 */ "File error %d (%s) opening %s for loading options\n\0"
-/* 1606 */ "fs error %d (%s) reading file %s\n\0"
-/* 1640 */ "fs error %d (%s) on %s %s for option %s\n\0"
-/* 1681 */ "stat-ing for directory\0"
-/* 1704 */ "stat-ing for regular file\0"
-/* 1730 */ "stat-ing for non-existant file\0"
-/* 1761 */ "open-ing file\0"
-/* 1775 */ "fopen-ing file\0"
-/* 1790 */ "\t\t\t\t- file must not pre-exist\n\0"
-/* 1821 */ "\t\t\t\t- file must pre-exist\n\0"
-/* 1848 */ "\n"
+/* 1479 */ "%%-%ds %%s\n\0"
+/* 1491 */ "fs error %d (%s) on fork - cannot obtain %s usage\n\0"
+/* 1542 */ "fs error %d (%s) on freopen\n\0"
+/* 1571 */ "File error %d (%s) opening %s for loading options\n\0"
+/* 1622 */ "fs error %d (%s) reading file %s\n\0"
+/* 1656 */ "fs error %d (%s) on %s %s for option %s\n\0"
+/* 1697 */ "stat-ing for directory\0"
+/* 1720 */ "stat-ing for regular file\0"
+/* 1746 */ "stat-ing for non-existant file\0"
+/* 1777 */ "open-ing file\0"
+/* 1791 */ "fopen-ing file\0"
+/* 1806 */ "\t\t\t\t- file must not pre-exist\n\0"
+/* 1837 */ "\t\t\t\t- file must pre-exist\n\0"
+/* 1864 */ "\n"
"= = = = = = = =\n\n"
"This incarnation of genshell will produce\n"
"a shell script to parse the options for %s:\n\n\0"
-/* 1954 */ "\n"
+/* 1970 */ "\n"
"%s\n\n\0"
-/* 1960 */ "=Cplx\0"
-/* 1966 */ "[=arg]\0"
-/* 1973 */ "--%2$s%1$s\0"
-/* 1984 */ "%s: illegal option -- %c\n\0"
-/* 2010 */ "%s: illegal option -- %s\n\0"
-/* 2036 */ "%s: unknown vendor extension option -- %s\n\0"
-/* 2079 */ " or an integer from %d through %d\n\0"
-/* 2115 */ "AutoOpts ERROR: invalid option descriptor for %s\n\0"
-/* 2166 */ " or an integer mask with any of the lower %d bits set\n\0"
-/* 2222 */ "\t\t\t\t- is a set membership option\n\0"
-/* 2256 */ "%s: option `%s' requires an argument\n\0"
-/* 2294 */ "Equivalenced option '%s' was equivalenced to both\n"
+/* 1976 */ "=Cplx\0"
+/* 1982 */ "[=arg]\0"
+/* 1989 */ "--%2$s%1$s\0"
+/* 2000 */ "%s: illegal option -- %c\n\0"
+/* 2026 */ "%s: illegal option -- %s\n\0"
+/* 2052 */ "%s: unknown vendor extension option -- %s\n\0"
+/* 2095 */ " or an integer from %d through %d\n\0"
+/* 2131 */ "AutoOpts ERROR: invalid option descriptor for %s\n\0"
+/* 2182 */ " or an integer mask with any of the lower %d bits set\n\0"
+/* 2238 */ "\t\t\t\t- is a set membership option\n\0"
+/* 2272 */ "%s: option `%s' requires an argument\n\0"
+/* 2310 */ "Equivalenced option '%s' was equivalenced to both\n"
"\t'%s' and '%s'\0"
-/* 2359 */ "\t\t\t\t- must appear between %d and %d times\n\0"
-/* 2402 */ "ERROR: The %s option is required\n\0"
-/* 2437 */ "%s: option `%s' cannot have an argument\n\0"
-/* 2478 */ "%s: Command line arguments not allowed\n\0"
-/* 2518 */ "error %d (%s) creating %s\n\0"
-/* 2545 */ "Options are specified by single or double hyphens and their
name.\n\0"
-/* 2612 */ "%s error: `%s' does not match any %s keywords\n\0"
-/* 2660 */ "\t\t\t\t- may appear multiple times\n\0"
-/* 2693 */ "\t\t\t\t- may not be preset\n\0"
-/* 2718 */ "The 'reset-option' option requires an argument\n\0"
-/* 2766 */ " Arg Option-Name Description\n\0"
-/* 2801 */ " Flg Arg Option-Name Description\n\0"
-/* 2839 */ "error %d (%s) stat-ing %s\n\0"
-/* 2866 */ "%s(optionRestore): error: no saved option state\n\0"
-/* 2915 */ "none\0"
-/* 2920 */ "'%s' not defined\n\0"
-/* 2938 */ "'%s' is not a command line option\n\0"
-/* 2973 */ "ERROR: The %s option must appear %d times\n\0"
-/* 3017 */ "error: cannot load options from non-regular file %s\n\0"
-/* 3071 */ "%s error: `%s' is not a recognizable number\n\0"
-/* 3117 */ "%s error: `%s' is not a recognizable date/time\n\0"
-/* 3166 */ "%s error: `%s' is not a recognizable time duration\n\0"
-/* 3219 */ " %3s %s\0"
-/* 3227 */ "The '-#<number>' option may omit the hash char\n\0"
-/* 3275 */ "one %s%s option allowed\n\0"
-/* 3300 */ "All arguments are named options.\n\0"
-/* 3334 */ "Write failure to output file\0"
-/* 3363 */ " - reading file %s\0"
-/* 3382 */ "\n"
+/* 2375 */ "\t\t\t\t- must appear between %d and %d times\n\0"
+/* 2418 */ "ERROR: The %s option is required\n\0"
+/* 2453 */ "%s: option `%s' cannot have an argument\n\0"
+/* 2494 */ "%s: Command line arguments not allowed\n\0"
+/* 2534 */ "error %d (%s) creating %s\n\0"
+/* 2561 */ "Options are specified by single or double hyphens and their
name.\n\0"
+/* 2628 */ "%s error: `%s' does not match any %s keywords\n\0"
+/* 2676 */ "\t\t\t\t- may appear multiple times\n\0"
+/* 2709 */ "\t\t\t\t- may not be preset\n\0"
+/* 2734 */ "The 'reset-option' option requires an argument\n\0"
+/* 2782 */ " Arg Option-Name Description\n\0"
+/* 2817 */ " Flg Arg Option-Name Description\n\0"
+/* 2855 */ "error %d (%s) stat-ing %s\n\0"
+/* 2882 */ "%s(optionRestore): error: no saved option state\n\0"
+/* 2931 */ "none\0"
+/* 2936 */ "'%s' not defined\n\0"
+/* 2954 */ "'%s' is not a command line option\n\0"
+/* 2989 */ "ERROR: The %s option must appear %d times\n\0"
+/* 3033 */ "error: cannot load options from non-regular file %s\n\0"
+/* 3087 */ "%s error: `%s' is not a recognizable number\n\0"
+/* 3133 */ "%s error: `%s' is not a recognizable date/time\n\0"
+/* 3182 */ "%s error: `%s' is not a recognizable time duration\n\0"
+/* 3235 */ " %3s %s\0"
+/* 3243 */ "The '-#<number>' option may omit the hash char\n\0"
+/* 3291 */ "one %s%s option allowed\n\0"
+/* 3316 */ "All arguments are named options.\n\0"
+/* 3350 */ "Write failure to output file\0"
+/* 3379 */ " - reading file %s\0"
+/* 3398 */ "\n"
"please send bug reports to: %s\n\0"
-/* 3416 */ "\t\t\t\t- may NOT appear - preset only\n\0"
-/* 3452 */ "# preset/initialization file\n"
+/* 3432 */ "\t\t\t\t- may NOT appear - preset only\n\0"
+/* 3468 */ "# preset/initialization file\n"
"# %s#\n\0"
-/* 3490 */ "\n"
+/* 3506 */ "\n"
"The following option preset mechanisms are supported:\n\0"
-/* 3546 */ "prohibits these options:\n\0"
-/* 3572 */ "Operands and options may be intermixed. They will be
reordered.\n\0"
-/* 3638 */ "%s%ld to %ld\0"
-/* 3651 */ "%sgreater than or equal to %ld\0"
-/* 3682 */ "%sIt must lie in one of the ranges:\n\0"
-/* 3719 */ "%sIt must be in the range:\n\0"
-/* 3747 */ ", or\n\0"
-/* 3753 */ "%s error: %s option value %ld is out of range.\n\0"
-/* 3802 */ "%s%ld exactly\0"
-/* 3816 */ "%sis scalable with a suffix: k/K/m/M/g/G/t/T\n\0"
-/* 3862 */ "%sless than or equal to %ld\0"
-/* 3890 */ "The --reset-option has not been configured.\n\0"
-/* 3935 */ "ERROR: %s option requires the %s option\n\0"
-/* 3977 */ " %3s %-14s %s\0"
-/* 3991 */ "requires these options:\n\0"
-/* 4016 */ " Arg Option-Name Req? Description\n\0"
-/* 4056 */ " Flg Arg Option-Name Req? Description\n\0"
-/* 4099 */ "-_^\0"
-/* 4103 */ "or you may use a numeric representation. Preceding these with a
'!' will\n"
+/* 3562 */ "prohibits these options:\n\0"
+/* 3588 */ "Operands and options may be intermixed. They will be
reordered.\n\0"
+/* 3654 */ "%s%ld to %ld\0"
+/* 3667 */ "%sgreater than or equal to %ld\0"
+/* 3698 */ "%sIt must lie in one of the ranges:\n\0"
+/* 3735 */ "%sIt must be in the range:\n\0"
+/* 3763 */ ", or\n\0"
+/* 3769 */ "%s error: %s option value %ld is out of range.\n\0"
+/* 3818 */ "%s%ld exactly\0"
+/* 3832 */ "%sis scalable with a suffix: k/K/m/M/g/G/t/T\n\0"
+/* 3878 */ "%sless than or equal to %ld\0"
+/* 3906 */ "The --reset-option has not been configured.\n\0"
+/* 3951 */ "ERROR: %s option requires the %s option\n\0"
+/* 3993 */ " %3s %-14s %s\0"
+/* 4007 */ "requires these options:\n\0"
+/* 4032 */ " Arg Option-Name Req? Description\n\0"
+/* 4072 */ " Flg Arg Option-Name Req? Description\n\0"
+/* 4115 */ "-_^\0"
+/* 4119 */ "or you may use a numeric representation. Preceding these with a
'!' will\n"
"clear the bits, specifying 'none' will clear all bits, and 'all'
will set them\n"
"all. Multiple entries may be passed as an option argument
list.\n\0"
-/* 4322 */ "%s\0"
-/* 4325 */ " \0"
-/* 4332 */ "T/F\0"
-/* 4336 */ "\n"
+/* 4338 */ "%s\0"
+/* 4341 */ " \0"
+/* 4348 */ "T/F\0"
+/* 4352 */ "\n"
"%s\n\n"
"%s\0"
-/* 4344 */ "Fil\0"
-/* 4348 */ "KWd\0"
-/* 4352 */ "Mbr\0"
-/* 4356 */ "Tim\0"
-/* 4360 */ "Cpx\0"
-/* 4364 */ "no \0"
-/* 4368 */ "Num\0"
-/* 4372 */ "opt\0"
-/* 4376 */ "YES\0"
-/* 4380 */ "Str\0"
-/* 4384 */ "\t\t\t\t- \0"
-/* 4391 */ "\t\t\t\t-- and \0"
-/* 4403 */ "\t\t\t\t%s\n\0"
-/* 4411 */ " \0"
-/* 4415 */ " \0"
-/* 4418 */ "\t\t\t\t- may appear up to %d times\n\0"
-/* 4451 */ "The valid \"%s\" option keywords are:\n\0"
-/* 4488 */ "These additional options are:\0"
-/* 4518 */ "The next option supports vendor supported extra options:";
+/* 4360 */ "Fil\0"
+/* 4364 */ "KWd\0"
+/* 4368 */ "Mbr\0"
+/* 4372 */ "Tim\0"
+/* 4376 */ "Cpx\0"
+/* 4380 */ "no \0"
+/* 4384 */ "Num\0"
+/* 4388 */ "opt\0"
+/* 4392 */ "YES\0"
+/* 4396 */ "Str\0"
+/* 4400 */ "\t\t\t\t- \0"
+/* 4407 */ "\t\t\t\t-- and \0"
+/* 4419 */ "\t\t\t\t%s\n\0"
+/* 4427 */ " \0"
+/* 4431 */ "%s error: %s exceeds %s keyword count\n\0"
+/* 4471 */ " \0"
+/* 4474 */ "\t\t\t\t- may appear up to %d times\n\0"
+/* 4507 */ "The valid \"%s\" option keywords are:\n\0"
+/* 4544 */ "These additional options are:\0"
+/* 4574 */ "The next option supports vendor supported extra options:";
/*
@@ -385,7 +387,7 @@ static char const usage_txt[4575] =
* Aren't you glad you don't maintain this by hand?
*/
usage_text_t option_usage_text = {
- 144,
+ 145,
eng_zGnuBoolArg, eng_zGnuKeyArg, eng_zGnuFileArg, eng_zGnuKeyLArg,
eng_zGnuTimeArg, eng_zGnuNumArg, eng_zGnuStrArg,
{
@@ -393,37 +395,37 @@ static char const usage_txt[4575] =
usage_txt + 224, usage_txt + 260, usage_txt + 310, usage_txt + 343,
usage_txt + 434, usage_txt + 493, usage_txt + 543, usage_txt + 547,
usage_txt + 574, usage_txt + 623, usage_txt + 655, usage_txt + 707,
- usage_txt + 715, usage_txt + 752, usage_txt + 777, usage_txt + 803,
- usage_txt + 843, usage_txt + 980, usage_txt +1028, usage_txt +1082,
- usage_txt +1095, usage_txt +1103, usage_txt +1145, usage_txt +1169,
- usage_txt +1209, usage_txt +1224, usage_txt +1254, usage_txt +1280,
- usage_txt +1293, usage_txt +1307, usage_txt +1354, usage_txt +1360,
- usage_txt +1463, usage_txt +1475, usage_txt +1526, usage_txt +1555,
- usage_txt +1606, usage_txt +1640, usage_txt +1681, usage_txt +1704,
- usage_txt +1730, usage_txt +1761, usage_txt +1775, usage_txt +1790,
- usage_txt +1821, usage_txt +1848, usage_txt +1954, usage_txt +1960,
- usage_txt +1966, usage_txt +1973, usage_txt +1984, usage_txt +2010,
- usage_txt +2036, usage_txt +2079, usage_txt +2115, usage_txt +2166,
- usage_txt +2222, usage_txt +2256, usage_txt +2294, usage_txt +2359,
- usage_txt +2402, usage_txt +2437, usage_txt +2478, usage_txt +2518,
- usage_txt +2545, usage_txt +2612, usage_txt +2660, usage_txt +2693,
- usage_txt +2718, usage_txt +2766, usage_txt +2801, usage_txt +2839,
- usage_txt +2866, usage_txt +2915, usage_txt +2920, usage_txt +2938,
- usage_txt +2973, usage_txt +3017, usage_txt +3071, usage_txt +3117,
- usage_txt +3166, usage_txt +3219, usage_txt +3227, usage_txt +3275,
- usage_txt +3300, usage_txt +3334, usage_txt +3363, usage_txt +3382,
- usage_txt +3416, usage_txt +3452, usage_txt +3490, usage_txt +3546,
- usage_txt +3572, usage_txt +3638, usage_txt +3651, usage_txt +3682,
- usage_txt +3719, usage_txt +3747, usage_txt +3753, usage_txt +3802,
- usage_txt +3816, usage_txt +3862, usage_txt +3890, usage_txt +3935,
- usage_txt +3977, usage_txt +3991, usage_txt +4016, usage_txt +4056,
- usage_txt +4099, usage_txt +4103, usage_txt +4322, usage_txt +4325,
- usage_txt +4332, usage_txt +4336, usage_txt +4344, usage_txt +4348,
- usage_txt +4352, usage_txt +4356, usage_txt +4360, usage_txt +4364,
+ usage_txt + 715, usage_txt + 752, usage_txt + 777, usage_txt + 819,
+ usage_txt + 859, usage_txt + 996, usage_txt +1044, usage_txt +1098,
+ usage_txt +1111, usage_txt +1119, usage_txt +1161, usage_txt +1185,
+ usage_txt +1225, usage_txt +1240, usage_txt +1270, usage_txt +1296,
+ usage_txt +1309, usage_txt +1323, usage_txt +1370, usage_txt +1376,
+ usage_txt +1479, usage_txt +1491, usage_txt +1542, usage_txt +1571,
+ usage_txt +1622, usage_txt +1656, usage_txt +1697, usage_txt +1720,
+ usage_txt +1746, usage_txt +1777, usage_txt +1791, usage_txt +1806,
+ usage_txt +1837, usage_txt +1864, usage_txt +1970, usage_txt +1976,
+ usage_txt +1982, usage_txt +1989, usage_txt +2000, usage_txt +2026,
+ usage_txt +2052, usage_txt +2095, usage_txt +2131, usage_txt +2182,
+ usage_txt +2238, usage_txt +2272, usage_txt +2310, usage_txt +2375,
+ usage_txt +2418, usage_txt +2453, usage_txt +2494, usage_txt +2534,
+ usage_txt +2561, usage_txt +2628, usage_txt +2676, usage_txt +2709,
+ usage_txt +2734, usage_txt +2782, usage_txt +2817, usage_txt +2855,
+ usage_txt +2882, usage_txt +2931, usage_txt +2936, usage_txt +2954,
+ usage_txt +2989, usage_txt +3033, usage_txt +3087, usage_txt +3133,
+ usage_txt +3182, usage_txt +3235, usage_txt +3243, usage_txt +3291,
+ usage_txt +3316, usage_txt +3350, usage_txt +3379, usage_txt +3398,
+ usage_txt +3432, usage_txt +3468, usage_txt +3506, usage_txt +3562,
+ usage_txt +3588, usage_txt +3654, usage_txt +3667, usage_txt +3698,
+ usage_txt +3735, usage_txt +3763, usage_txt +3769, usage_txt +3818,
+ usage_txt +3832, usage_txt +3878, usage_txt +3906, usage_txt +3951,
+ usage_txt +3993, usage_txt +4007, usage_txt +4032, usage_txt +4072,
+ usage_txt +4115, usage_txt +4119, usage_txt +4338, usage_txt +4341,
+ usage_txt +4348, usage_txt +4352, usage_txt +4360, usage_txt +4364,
usage_txt +4368, usage_txt +4372, usage_txt +4376, usage_txt +4380,
- usage_txt +4384, usage_txt +4391, usage_txt +4403, usage_txt +4411,
- usage_txt +4415, usage_txt +4418, usage_txt +4451, usage_txt +4488,
- usage_txt +4518
+ usage_txt +4384, usage_txt +4388, usage_txt +4392, usage_txt +4396,
+ usage_txt +4400, usage_txt +4407, usage_txt +4419, usage_txt +4427,
+ usage_txt +4431, usage_txt +4471, usage_txt +4474, usage_txt +4507,
+ usage_txt +4544, usage_txt +4574
}
};
diff --git a/src/libopts/boolean.c b/src/libopts/boolean.c
index 37d18e1..f0e5498 100644
--- a/src/libopts/boolean.c
+++ b/src/libopts/boolean.c
@@ -2,7 +2,7 @@
/**
* \file boolean.c
*
- * Time-stamp: "2010-07-10 11:02:10 bkorb"
+ * Time-stamp: "2012-03-31 13:46:19 bkorb"
*
* Automated Options Paged Usage module.
*
@@ -43,16 +43,18 @@
* it is an empty string or it is a number that evaluates to zero.
=*/
void
-optionBooleanVal( tOptions* pOpts, tOptDesc* pOD )
+optionBooleanVal(tOptions * pOpts, tOptDesc * pOD )
{
char* pz;
- ag_bool res = AG_TRUE;
+ bool res = true;
+
+ (void)pOpts;
if ((pOD->fOptState & OPTST_RESET) != 0)
return;
if (pOD->optArg.argString == NULL) {
- pOD->optArg.argBool = AG_FALSE;
+ pOD->optArg.argBool = false;
return;
}
@@ -69,12 +71,12 @@ optionBooleanVal( tOptions* pOpts, tOptDesc* pOD )
case 'F':
case 'f':
case NUL:
- res = AG_FALSE;
+ res = false;
break;
case '#':
if (pOD->optArg.argString[1] != 'f')
break;
- res = AG_FALSE;
+ res = false;
}
if (pOD->fOptState & OPTST_ALLOC_ARG) {
diff --git a/src/libopts/check.c b/src/libopts/check.c
index 003fe13..019a235 100644
--- a/src/libopts/check.c
+++ b/src/libopts/check.c
@@ -3,7 +3,7 @@
*
* @brief consistency checks.
*
- * Time-stamp: "2011-05-24 17:50:10 bkorb"
+ * Time-stamp: "2012-03-31 13:46:35 bkorb"
*
* This file contains the routines that deal with processing quoted strings
* into an internal format.
@@ -32,7 +32,7 @@
/**
* Check for conflicts based on "must" and "cannot" attributes.
*/
-static ag_bool
+static bool
has_conflict(tOptions * pOpts, tOptDesc * pOD)
{
if (pOD->pOptMust != NULL) {
@@ -43,7 +43,7 @@ has_conflict(tOptions * pOpts, tOptDesc * pOD)
if (UNUSED_OPT(p)) {
const tOptDesc * pN = pOpts->pOptDesc + pMust[-1];
fprintf(stderr, zReqFmt, pOD->pz_Name, pN->pz_Name);
- return AG_TRUE;
+ return true;
}
}
}
@@ -56,26 +56,28 @@ has_conflict(tOptions * pOpts, tOptDesc * pOD)
if (SELECTED_OPT(p)) {
const tOptDesc* pN = pOpts->pOptDesc + pCant[-1];
fprintf(stderr, zCantFmt, pOD->pz_Name, pN->pz_Name);
- return AG_TRUE;
+ return true;
}
}
}
- return AG_FALSE;
+ return false;
}
/**
* Check that the option occurs often enough. Too often is already checked.
*/
-static ag_bool
+static bool
occurs_enough(tOptions * pOpts, tOptDesc * pOD)
{
+ (void)pOpts;
+
/*
* IF the occurrence counts have been satisfied,
* THEN there is no problem.
*/
if (pOD->optOccCt >= pOD->optMinCt)
- return AG_TRUE;
+ return true;
/*
* IF MUST_SET means SET and PRESET are okay,
@@ -83,12 +85,12 @@ occurs_enough(tOptions * pOpts, tOptDesc * pOD)
*/
if ( (pOD->fOptState & OPTST_MUST_SET)
&& (pOD->fOptState & (OPTST_PRESET | OPTST_SET)) )
- return AG_TRUE;
+ return true;
if (pOD->optMinCt > 1)
fprintf(stderr, zNotEnough, pOD->pz_Name, pOD->optMinCt);
else fprintf(stderr, zNeedOne, pOD->pz_Name);
- return AG_FALSE;
+ return false;
}
/**
@@ -96,7 +98,7 @@ occurs_enough(tOptions * pOpts, tOptDesc * pOD)
*
* Make sure that the argument list passes our consistency tests.
*/
-LOCAL ag_bool
+LOCAL bool
is_consistent(tOptions * pOpts)
{
tOptDesc * pOD = pOpts->pOptDesc;
@@ -114,7 +116,7 @@ is_consistent(tOptions * pOpts)
*/
if (SELECTED_OPT(pOD)) {
if (has_conflict(pOpts, pOD))
- return AG_FALSE;
+ return false;
}
/*
@@ -126,7 +128,7 @@ is_consistent(tOptions * pOpts)
|| (pOD->optEquivIndex == pOD->optIndex) )
if (! occurs_enough(pOpts, pOD))
- return AG_FALSE;
+ return false;
if (--oCt <= 0)
break;
@@ -145,7 +147,7 @@ is_consistent(tOptions * pOpts)
if ((pOpts->fOptSet & OPTPROC_NO_ARGS) != 0) {
if (pOpts->origArgCt > pOpts->curOptIdx) {
fprintf(stderr, zNoArgs, pOpts->pzProgName);
- return AG_FALSE;
+ return false;
}
}
@@ -155,10 +157,10 @@ is_consistent(tOptions * pOpts)
else if ((pOpts->fOptSet & OPTPROC_ARGS_REQ) != 0) {
if (pOpts->origArgCt <= pOpts->curOptIdx) {
fprintf(stderr, zArgsMust, pOpts->pzProgName);
- return AG_FALSE;
+ return false;
}
}
}
- return AG_TRUE;
+ return true;
}
diff --git a/src/libopts/compat/compat.h b/src/libopts/compat/compat.h
index 9fe9b29..9d1c02a 100644
--- a/src/libopts/compat/compat.h
+++ b/src/libopts/compat/compat.h
@@ -3,7 +3,7 @@
/**
* \file compat.h --- fake the preprocessor into handlng portability
*
- * Time-stamp: "2012-02-12 09:00:09 bkorb"
+ * Time-stamp: "2012-02-28 19:40:44 bkorb"
*
* compat.h is free software.
* This file is part of AutoGen.
@@ -181,15 +181,15 @@
#include <setjmp.h>
#include <signal.h>
-#if defined( HAVE_STDINT_H )
+#if defined(HAVE_STDINT_H)
# include <stdint.h>
-#elif defined( HAVE_INTTYPES_H )
+
+#elif defined(HAVE_INTTYPES_H)
# include <inttypes.h>
#endif
#include <stdlib.h>
#include <string.h>
-
#include <time.h>
#ifdef HAVE_UTIME_H
@@ -200,6 +200,17 @@
# include <unistd.h>
#endif
+#ifdef HAVE_STDBOOL_H
+# include <stdbool.h>
+#else
+ typedef enum { false = 0, true = 1 } _Bool;
+# define bool _Bool
+
+ /* The other macros must be usable in preprocessor directives. */
+# define false 0
+# define true 1
+#endif
+
/* * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * *
*
* FIXUPS and CONVIENCE STUFF:
diff --git a/src/libopts/compat/pathfind.c b/src/libopts/compat/pathfind.c
index 2d5b27d..2e6f881 100644
--- a/src/libopts/compat/pathfind.c
+++ b/src/libopts/compat/pathfind.c
@@ -4,7 +4,7 @@
/*
* Author: Gary V Vaughan <address@hidden>
- * Time-stamp: "2010-07-17 09:50:32 bkorb"
+ * Time-stamp: "2012-03-31 13:44:42 bkorb"
*/
/* Code: */
@@ -309,7 +309,7 @@ extract_colon_unit( char* pzDir, char const *string, int
*p_index )
goto copy_done;
}
- if ((pzDest - pzDir) >= AG_PATH_MAX)
+ if ((unsigned long)(pzDest - pzDir) >= AG_PATH_MAX)
break;
} copy_done:;
diff --git a/src/libopts/configfile.c b/src/libopts/configfile.c
index e3da1bb..56e22b5 100644
--- a/src/libopts/configfile.c
+++ b/src/libopts/configfile.c
@@ -1,7 +1,7 @@
/**
* \file configfile.c
*
- * Time-stamp: "2012-02-25 12:54:32 bkorb"
+ * Time-stamp: "2012-03-31 13:56:11 bkorb"
*
* configuration/rc/ini file handling.
*
@@ -52,7 +52,7 @@ static int
parse_xml_encoding(char ** ppz);
static char *
-trim_xml_text(char * pztxt, char const * pznm, tOptionLoadMode mode);
+trim_xml_text(char * intxt, char const * pznm, tOptionLoadMode mode);
static void
cook_xml_text(char * pzData);
@@ -202,7 +202,7 @@ optionFindValue(const tOptDesc* pOptDesc, char const*
pzName,
}
if (pRes == NULL)
errno = ENOENT;
- } while (0);
+ } while (false);
return pRes;
}
@@ -210,6 +210,8 @@ optionFindValue(const tOptDesc* pOptDesc, char const*
pzName,
/*=export_func optionFindNextValue
*
+ * FIXME: the handling of 'pzName' and 'pzVal' is just wrong.
+ *
* what: find a hierarcicaly valued option instance
* arg: + const tOptDesc* + pOptDesc + an option with a nested arg type +
* arg: + const tOptionValue* + pPrevVal + the last entry +
@@ -238,9 +240,12 @@ tOptionValue const *
optionFindNextValue(const tOptDesc * pOptDesc, const tOptionValue * pPrevVal,
char const * pzName, char const * pzVal)
{
- int foundOldVal = 0;
+ bool old_found = false;
tOptionValue* pRes = NULL;
+ (void)pzName;
+ (void)pzVal;
+
if ( (pOptDesc == NULL)
|| (OPTST_GET_ARGTYPE(pOptDesc->fOptState) != OPARG_TYPE_HIERARCHY)) {
errno = EINVAL;
@@ -255,23 +260,18 @@ optionFindNextValue(const tOptDesc * pOptDesc, const
tOptionValue * pPrevVal,
int ct = pAL->useCt;
void** ppOV = (void**)pAL->apzArgs;
- if (ct == 0) {
- errno = ENOENT;
- break;
- }
-
while (--ct >= 0) {
tOptionValue* pOV = *(ppOV++);
- if (foundOldVal) {
+ if (old_found) {
pRes = pOV;
break;
}
if (pOV == pPrevVal)
- foundOldVal = 1;
+ old_found = true;
}
if (pRes == NULL)
errno = ENOENT;
- } while (0);
+ } while (false);
return pRes;
}
@@ -431,7 +431,7 @@ file_preset(tOptions * opts, char const * fname, int dir)
do {
optst.flags = st_flags;
- while (IS_WHITESPACE_CHAR(*ftext)) ftext++;
+ ftext = SPN_WHITESPACE_CHARS(ftext);
if (IS_VAR_FIRST_CHAR(*ftext)) {
ftext = handle_cfg(opts, &optst, ftext, dir);
@@ -508,8 +508,8 @@ handle_cfg(tOptions * pOpts, tOptState * pOS, char *
pzText, int dir)
if (pzEnd == NULL)
return pzText + strlen(pzText);
- while (IS_VALUE_NAME_CHAR(*pzText)) pzText++;
- while (IS_WHITESPACE_CHAR(*pzText)) pzText++;
+ pzText = SPN_VALUE_NAME_CHARS(pzText);
+ pzText = SPN_WHITESPACE_CHARS(pzText);
if (pzText > pzEnd) {
name_only:
*pzEnd++ = NUL;
@@ -523,7 +523,7 @@ handle_cfg(tOptions * pOpts, tOptState * pOS, char *
pzText, int dir)
* is an invalid format and we give up parsing the text.
*/
if ((*pzText == '=') || (*pzText == ':')) {
- while (IS_WHITESPACE_CHAR(*++pzText)) ;
+ pzText = SPN_WHITESPACE_CHARS(pzText+1);
if (pzText > pzEnd)
goto name_only;
} else if (! IS_WHITESPACE_CHAR(pzText[-1]))
@@ -630,9 +630,9 @@ handle_directive(tOptions * pOpts, char * pzText)
static char *
aoflags_directive(tOptions * pOpts, char * pzText)
{
- char * pz = pzText;
+ char * pz;
- while (IS_WHITESPACE_CHAR(*++pz)) ;
+ pz = SPN_WHITESPACE_CHARS(pzText+1);
pzText = strchr(pz, '>');
if (pzText != NULL) {
@@ -665,7 +665,7 @@ program_directive(tOptions * pOpts, char * pzText)
memcpy(ttl + sizeof(ttlfmt) - 1, zCfgProg, ttl_len - (sizeof(ttlfmt) - 1));
do {
- while (IS_WHITESPACE_CHAR(*++pzText)) ;
+ pzText = SPN_WHITESPACE_CHARS(pzText+1);
if ( (strneqvcmp(pzText, pOpts->pzProgName, (int)name_len) == 0)
&& (IS_END_XML_TOKEN_CHAR(pzText[name_len])) ) {
@@ -809,28 +809,35 @@ parse_xml_encoding(char ** ppz)
* except for OPTION_LOAD_UNCOOKED.
*/
static char *
-trim_xml_text(char * pztxt, char const * pznm, tOptionLoadMode mode)
+trim_xml_text(char * intxt, char const * pznm, tOptionLoadMode mode)
{
static char const fmt[] = "</%s>";
- char z[64], *pz = z;
size_t len = strlen(pznm) + sizeof(fmt) - 2 /* for %s */;
+ char * etext;
- if (len > sizeof(z))
- pz = AGALOC(len, "scan name");
+ {
+ char z[64], *pz = z;
+ if (len >= sizeof(z))
+ pz = AGALOC(len, "scan name");
+
+ len = sprintf(pz, fmt, pznm);
+ *intxt = ' ';
+ etext = strstr(intxt, pz);
+ if (pz != z) AGFREE(pz);
+ }
- sprintf(pz, fmt, pznm);
- *pztxt = ' ';
- pztxt = strstr(pztxt, pz);
- if (pz != z) AGFREE(pz);
+ if (etext == NULL)
+ return etext;
- if (pztxt == NULL)
- return pztxt;
+ {
+ char * result = etext + len;
- if (mode != OPTION_LOAD_UNCOOKED)
- while (IS_WHITESPACE_CHAR(pztxt[-1])) len++, pztxt--;
+ if (mode != OPTION_LOAD_UNCOOKED)
+ etext = SPN_WHITESPACE_BACK(intxt, etext);
- *pztxt = NUL;
- return pztxt + len - 1 /* for NUL byte */;
+ *etext = NUL;
+ return result;
+ }
}
/**
@@ -889,14 +896,14 @@ handle_struct(tOptions * pOpts, tOptState * pOS, char *
pzText, int dir)
char* pzData;
char* pcNulPoint;
- while (IS_VALUE_NAME_CHAR(*pzText)) pzText++;
+ pzText = SPN_VALUE_NAME_CHARS(pzText);
pcNulPoint = pzText;
valu.valType = OPARG_TYPE_STRING;
switch (*pzText) {
case ' ':
case '\t':
- pzText = parseAttributes(pOpts, pzText, &mode, &valu);
+ pzText = parse_attrs(pOpts, pzText, &mode, &valu);
if (*pzText == '>')
break;
if (*pzText != '/')
@@ -933,7 +940,7 @@ handle_struct(tOptions * pOpts, tOptState * pOS, char *
pzText, int dir)
/*
* Rejoin the name and value for parsing by "loadOptionLine()".
- * Erase any attributes parsed by "parseAttributes()".
+ * Erase any attributes parsed by "parse_attrs()".
*/
memset(pcNulPoint, ' ', pzData - pcNulPoint);
@@ -1159,11 +1166,8 @@ optionLoadOpt(tOptions * pOpts, tOptDesc * pOptDesc)
* Parse the various attributes of an XML-styled config file entry
*/
LOCAL char*
-parseAttributes(
- tOptions* pOpts,
- char* pzText,
- tOptionLoadMode* pMode,
- tOptionValue* pType )
+parse_attrs(tOptions * pOpts, char * pzText, tOptionLoadMode * pMode,
+ tOptionValue * pType)
{
size_t len;
@@ -1177,9 +1181,8 @@ parseAttributes(
case NUL: return NULL;
}
- while (IS_WHITESPACE_CHAR(*++pzText)) ;
- len = 0;
- while (IS_LOWER_CASE_CHAR(pzText[len])) len++;
+ pzText = SPN_WHITESPACE_CHARS(pzText+1);
+ len = SPN_LOWER_CASE_CHARS(pzText) - pzText;
switch (find_xat_attribute_id(pzText, len)) {
case XAT_KWD_TYPE:
@@ -1237,6 +1240,9 @@ parseAttributes(
static char*
parse_keyword(tOptions * pOpts, char * pzText, tOptionValue * pType)
{
+ (void)pOpts;
+ (void)pType;
+
return skip_unkn(pzText);
}
@@ -1249,6 +1255,9 @@ parse_keyword(tOptions * pOpts, char * pzText,
tOptionValue * pType)
static char*
parse_set_mem(tOptions * pOpts, char * pzText, tOptionValue * pType)
{
+ (void)pOpts;
+ (void)pType;
+
return skip_unkn(pzText);
}
@@ -1264,16 +1273,15 @@ parse_value(char * pzText, tOptionValue * pType)
if (*(pzText++) != '=')
goto woops;
- while (IS_OPTION_NAME_CHAR(pzText[len])) len++;
- pzText += len;
+ len = SPN_OPTION_NAME_CHARS(pzText) - pzText;
- if ((len == 0) || (! IS_END_XML_TOKEN_CHAR(*pzText))) {
+ if ((len == 0) || (! IS_END_XML_TOKEN_CHAR(pzText[len]))) {
woops:
pType->valType = OPARG_TYPE_NONE;
- return skip_unkn(pzText);
+ return skip_unkn(pzText + len);
}
- switch (find_value_type_id(pzText - len, len)) {
+ switch (find_value_type_id(pzText, len)) {
default:
case VTP_KWD_INVALID: goto woops;
@@ -1304,7 +1312,7 @@ parse_value(char * pzText, tOptionValue * pType)
pType->valType = OPARG_TYPE_HIERARCHY;
}
- return pzText;
+ return pzText + len;
}
diff --git a/src/libopts/cook.c b/src/libopts/cook.c
index c681ea3..f34a6ed 100644
--- a/src/libopts/cook.c
+++ b/src/libopts/cook.c
@@ -1,7 +1,7 @@
/**
* \file cook.c
*
- * Time-stamp: "2012-02-12 09:00:47 bkorb"
+ * Time-stamp: "2012-02-28 19:40:47 bkorb"
*
* This file contains the routines that deal with processing quoted strings
* into an internal format.
@@ -28,7 +28,7 @@
*/
/* = = = START-STATIC-FORWARD = = = */
-static ag_bool
+static bool
contiguous_quote(char ** pps, char * pq, int * lnct_p);
/* = = = END-STATIC-FORWARD = = = */
@@ -130,7 +130,7 @@ ao_string_cook_escape_char(char const* pzIn, char* pRes,
uint_t nl)
* A quoted string has been found.
* Find the end of it and compress any escape sequences.
*/
-static ag_bool
+static bool
contiguous_quote(char ** pps, char * pq, int * lnct_p)
{
char * ps = *pps + 1;
@@ -149,7 +149,7 @@ contiguous_quote(char ** pps, char * pq, int * lnct_p)
case '\'':
*pq = *(ps++); /* assign new quote character and return */
*pps = ps;
- return AG_TRUE;
+ return true;
case '/':
/*
@@ -158,7 +158,7 @@ contiguous_quote(char ** pps, char * pq, int * lnct_p)
switch (ps[1]) {
default:
*pps = NULL;
- return AG_FALSE;
+ return false;
case '/':
/*
@@ -167,7 +167,7 @@ contiguous_quote(char ** pps, char * pq, int * lnct_p)
ps = strchr(ps, NL);
if (ps == NULL) {
*pps = NULL;
- return AG_FALSE;
+ return false;
}
break;
@@ -179,7 +179,7 @@ contiguous_quote(char ** pps, char * pq, int * lnct_p)
*/
if (p == NULL) {
*pps = NULL;
- return AG_FALSE;
+ return false;
}
while (ps < p) {
@@ -198,7 +198,7 @@ contiguous_quote(char ** pps, char * pq, int * lnct_p)
* The series of quoted strings has come to an end.
*/
*pps = ps;
- return AG_FALSE;
+ return false;
}
}
}
diff --git a/src/libopts/enum.c b/src/libopts/enum.c
index 6ce6b4b..2a9f9bc 100644
--- a/src/libopts/enum.c
+++ b/src/libopts/enum.c
@@ -2,7 +2,7 @@
/**
* \file enumeration.c
*
- * Time-stamp: "2012-01-29 19:07:59 bkorb"
+ * Time-stamp: "2012-03-31 13:22:33 bkorb"
*
* Automated Options Paged Usage module.
*
@@ -166,7 +166,16 @@ enum_err(tOptions * pOpts, tOptDesc * pOD,
}
}
-
+/**
+ * Convert a name or number into a binary number.
+ * "~0" and "-1" will be converted to the largest value in the enumeration.
+ *
+ * @param pzName the keyword name (number) to convert
+ * @param pOpts the program's option descriptor
+ * @param pOD the option descriptor for this option
+ * @param paz_names the list of keywords for this option
+ * @param name_ct the count of keywords
+ */
static uintptr_t
find_name(char const * pzName, tOptions * pOpts, tOptDesc * pOD,
char const * const * paz_names, unsigned int name_ct)
@@ -184,10 +193,19 @@ find_name(char const * pzName, tOptions * pOpts, tOptDesc
* pOD,
unsigned long val = strtoul(pz, &pz, 0);
if ((*pz == NUL) && (val < name_ct))
return (uintptr_t)val;
+ pz_enum_err_fmt = zTooLarge;
+ option_usage_fp = stderr;
enum_err(pOpts, pOD, paz_names, (int)name_ct);
return name_ct;
}
+ if (IS_INVERSION_CHAR(*pzName) && (pzName[2] == NUL)) {
+ if ( ((pzName[0] == '~') && (pzName[1] == '0'))
+ || ((pzName[0] == '-') && (pzName[1] == '1')))
+ return (uintptr_t)(name_ct - 1);
+ goto oops;
+ }
+
/*
* Look for an exact match, but remember any partial matches.
* Multiple partial matches means we have an ambiguous match.
@@ -197,13 +215,18 @@ find_name(char const * pzName, tOptions * pOpts, tOptDesc
* pOD,
if (paz_names[idx][len] == NUL)
return idx; /* full match */
- res = (res != name_ct) ? ~0 : idx; /* save partial match */
+ if (res == name_ct)
+ res = idx; /* save partial match */
+ else
+ res = ~0; /* may yet find full match */
}
}
if (res < name_ct)
return res; /* partial match */
+oops:
+
pz_enum_err_fmt = (res == name_ct) ? zNoKey : zAmbigKey;
option_usage_fp = stderr;
enum_err(pOpts, pOD, paz_names, (int)name_ct);
@@ -226,9 +249,9 @@ find_name(char const * pzName, tOptions * pOpts, tOptDesc *
pOD,
char const *
optionKeywordName(tOptDesc * pOD, unsigned int enum_val)
{
- tOptDesc od;
+ tOptDesc od = {
+ .optArg.argEnum = enum_val };
- od.optArg.argEnum = enum_val;
(*(pOD->pOptProc))(OPTPROC_RETURN_VALNAME, &od );
return od.optArg.argString;
}
@@ -317,6 +340,7 @@ set_memb_usage(tOptions * pOpts, tOptDesc * pOD, char const
* const * paz_names,
/*
* print the list of enumeration names.
*/
+ (void)pOpts;
enum_err(OPTPROC_EMIT_USAGE, pOD, paz_names, (int)name_ct );
}
@@ -331,6 +355,7 @@ set_memb_shell(tOptions * pOpts, tOptDesc * pOD, char const
* const * paz_names,
uintptr_t bits = (uintptr_t)pOD->optCookie;
size_t len = 0;
+ (void)pOpts;
bits &= ((uintptr_t)1 << (uintptr_t)name_ct) - (uintptr_t)1;
while (bits != 0) {
@@ -352,6 +377,7 @@ set_memb_names(tOptions * pOpts, tOptDesc * pOD, char const
* const * paz_names,
unsigned int ix = 0;
size_t len = NONE_STR_LEN + 1;
+ (void)pOpts;
bits &= ((uintptr_t)1 << (uintptr_t)name_ct) - (uintptr_t)1;
/*
@@ -494,7 +520,7 @@ optionSetMembers(tOptions * pOpts, tOptDesc * pOD,
if (iv)
res &= ~bit;
else res |= bit;
- } while (0);
+ } while (false);
if (pzArg[len] == NUL)
break;
diff --git a/src/libopts/env.c b/src/libopts/env.c
index 60e8a03..4dd18fa 100644
--- a/src/libopts/env.c
+++ b/src/libopts/env.c
@@ -2,7 +2,7 @@
/**
* \file environment.c
*
- * Time-stamp: "2011-07-19 17:43:34 bkorb"
+ * Time-stamp: "2012-04-01 05:59:15 bkorb"
*
* This file contains all of the routines that must be linked into
* an executable to use the generated option processing. The optional
@@ -45,11 +45,11 @@ do_env_opt(tOptState * os, char * env_name,
LOCAL void
doPrognameEnv(tOptions * pOpts, teEnvPresetType type)
{
- char const* pczOptStr = getenv(pOpts->pzPROGNAME);
+ char const * pczOptStr = getenv(pOpts->pzPROGNAME);
token_list_t* pTL;
int sv_argc;
tAoUI sv_flag;
- char** sv_argv;
+ char ** sv_argv;
/*
* No such beast? Then bail now.
@@ -78,7 +78,10 @@ doPrognameEnv(tOptions * pOpts, teEnvPresetType type)
* The option scanning code will skip the "program name" at the start
* of this list of tokens, so we accommodate this way ....
*/
- pOpts->origArgVect = (char**)(pTL->tkn_list - 1);
+ {
+ uintptr_t v = (uintptr_t)(pTL->tkn_list);
+ pOpts->origArgVect = (void *)(v - sizeof(char *));
+ }
pOpts->origArgCt = pTL->tkn_ct + 1;
pOpts->fOptSet &= ~OPTPROC_ERRSTOP;
diff --git a/src/libopts/find.c b/src/libopts/find.c
index aa730c6..f6510ee 100644
--- a/src/libopts/find.c
+++ b/src/libopts/find.c
@@ -99,7 +99,7 @@ opt_ambiguities(tOptions * opts, char const * name, int
nm_len)
*/
static int
opt_match_ct(tOptions * opts, char const * name, int nm_len,
- int * ixp, ag_bool * disable)
+ int * ixp, bool * disable)
{
int matchCt = 0;
int idx = 0;
@@ -136,7 +136,7 @@ opt_match_ct(tOptions * opts, char const * name, int nm_len,
else if ( (pOD->pz_DisableName != NULL)
&& (strneqvcmp(name, pOD->pz_DisableName, nm_len) == 0)
) {
- *disable = AG_TRUE;
+ *disable = true;
/*
* IF we have a complete match
@@ -173,7 +173,7 @@ opt_match_ct(tOptions * opts, char const * name, int nm_len,
* @param st state about current option
*/
static tSuccess
-opt_set(tOptions * opts, char * arg, int idx, ag_bool disable, tOptState * st)
+opt_set(tOptions * opts, char * arg, int idx, bool disable, tOptState * st)
{
tOptDesc * pOD = opts->pOptDesc + idx;
@@ -335,7 +335,7 @@ opt_find_long(tOptions * pOpts, char const * opt_name,
tOptState * pOptState)
int nm_len = parse_opt(&opt_name, &opt_arg, name_buf,
sizeof(name_buf));
int matchIdx = 0;
- ag_bool disable = AG_FALSE;
+ bool disable = false;
int match_ct =
opt_match_ct(pOpts, opt_name, nm_len, &matchIdx, &disable);
diff --git a/src/libopts/genshell.c b/src/libopts/genshell.c
index c8d3047..16ca245 100644
--- a/src/libopts/genshell.c
+++ b/src/libopts/genshell.c
@@ -2,11 +2,11 @@
*
* DO NOT EDIT THIS FILE (genshell.c)
*
- * It has been AutoGen-ed February 26, 2012 at 11:08:41 AM by AutoGen
5.15pre14
+ * It has been AutoGen-ed May 6, 2012 at 04:20:59 PM by AutoGen 5.16pre36
* From the definitions genshell.def
* and the template file options
*
- * Generated from AutoOpts 36:3:11 templates.
+ * Generated from AutoOpts 36:4:11 templates.
*
* AutoOpts is a copyrighted work. This source file is not encumbered
* by AutoOpts licensing, but is provided under the licensing terms chosen
@@ -39,6 +39,7 @@
* with this program. If not, see <http://www.gnu.org/licenses/>.
*/
+#ifndef __doxygen__
#define OPTION_CODE_COMPILE 1
#include "genshell.h"
#include <sys/types.h>
@@ -66,7 +67,7 @@ extern tUsageProc genshelloptUsage;
/*
* genshellopt option static const strings
*/
-static char const genshellopt_opt_strs[1691] =
+static char const genshellopt_opt_strs[1690] =
/* 0 */ "genshellopt 1\n"
"Copyright (C) 1999-2012 Bruce Korb, all rights reserved.\n"
"This is free software. It is licensed for use, modification and\n"
@@ -74,13 +75,13 @@ static char const genshellopt_opt_strs[1691] =
"GNU General Public License, version 3 or later\n"
" <http://gnu.org/licenses/gpl.html>\n\0"
/* 260 */ "genshellopt is free software: you can redistribute it and/or
modify it\n"
- "under the terms of the GNU General Public License as published by
the\n"
- "Free Software Foundation, either version 3 of the License, or (at
your\n"
- "option) any later version.\n\n"
+ "under the terms of the GNU General Public License as published by
the Free\n"
+ "Software Foundation, either version 3 of the License, or (at your
option)\n"
+ "any later version.\n\n"
"genshellopt is distributed in the hope that it will be useful,
but WITHOUT\n"
"ANY WARRANTY; without even the implied warranty of
MERCHANTABILITY or\n"
- "FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public
License\n"
- "for more details.\n\n"
+ "FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public
License for\n"
+ "more details.\n\n"
"You should have received a copy of the GNU General Public License
along\n"
"with this program. If not, see
<http://www.gnu.org/licenses/>.\n\0"
/* 871 */ "Output Script File\0"
@@ -102,13 +103,13 @@ static char const genshellopt_opt_strs[1691] =
/* 1235 */ "address@hidden"
/* 1271 */ "\n"
"Note that ``shell'' is only useful if the output file does not
already\n"
- "exist. If it does, then the shell name and optional first
argument will\n"
- "be extracted from the script file.\n\0"
+ "exist. If it does, then the shell name and optional first
argument will be\n"
+ "extracted from the script file.\n\0"
/* 1452 */ "\n"
"If the script file already exists and contains Automated Option
Processing\n"
"text, the second line of the file through the ending tag will be
replaced\n"
- "by the newly generated text. The first ``#!'' line will be
regenerated.\n\0"
-/* 1677 */ "genshellopt 1";
+ "by the newly generated text. The first ``#!'' line will be
regenerated.\n\0"
+/* 1676 */ "genshellopt 1";
/*
* script option description:
@@ -164,9 +165,11 @@ static tOptProc
doUsageOpt;
#define VER_PROC optionPrintVersion
-/* * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * *
- *
- * Define the Genshellopt Option Descriptions.
+/* * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * */
+/**
+ * Define the genshellopt Option Descriptions.
+ * This is an array of GENSHELL_OPTION_CT entries, one for each
+ * option that the genshellopt program responds to.
*/
static tOptDesc optDesc[GENSHELL_OPTION_CT] = {
{ /* entry idx, value */ 0, VALUE_GENSHELL_OPT_SCRIPT,
@@ -235,7 +238,7 @@ static tOptDesc optDesc[GENSHELL_OPTION_CT] = {
/* * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * *
*
- * Define the Genshellopt Option Environment
+ * Define the genshellopt Option Environment
*/
#define zPROGNAME (genshellopt_opt_strs+1102)
#define zUsageTitle (genshellopt_opt_strs+1114)
@@ -244,8 +247,8 @@ static tOptDesc optDesc[GENSHELL_OPTION_CT] = {
#define zBugsAddr (genshellopt_opt_strs+1235)
#define zExplain (genshellopt_opt_strs+1271)
#define zDetail (genshellopt_opt_strs+1452)
-#define zFullVersion (genshellopt_opt_strs+1677)
-/* extracted from optcode.tlib near line 349 */
+#define zFullVersion (genshellopt_opt_strs+1676)
+/* extracted from optcode.tlib near line 350 */
#if defined(ENABLE_NLS)
# define OPTPROC_BASE OPTPROC_TRANSLATE
@@ -260,27 +263,39 @@ static tOptDesc optDesc[GENSHELL_OPTION_CT] = {
#define genshellopt_short_usage (NULL)
+#endif /* not defined __doxygen__ */
+
/*
* Create the static procedure(s) declared above.
*/
/**
- * The callout function that invokes the GENSHELL_USAGE() macro.
+ * The callout function that invokes the genshelloptUsage function.
*
* @param pOptions the AutoOpts option description structure
* @param pOptDesc the descriptor for the "help" (usage) option.
+ * @noreturn
*/
static void
doUsageOpt(tOptions * pOptions, tOptDesc * pOptDesc)
{
+ genshelloptUsage(&genshelloptOptions, GENSHELLOPT_EXIT_SUCCESS);
+ /* NOTREACHED */
+ (void)pOptDesc;
(void)pOptions;
- GENSHELL_USAGE(GENSHELLOPT_EXIT_SUCCESS);
}
-/* extracted from optmain.tlib near line 1093 */
+/* extracted from optmain.tlib near line 1113 */
+/**
+ * The directory containing the data associated with genshellopt.
+ */
#ifndef PKGDATADIR
# define PKGDATADIR ""
#endif
+/**
+ * Information about the person or institution that packaged genshellopt
+ * for the current distribution.
+ */
#ifndef WITH_PACKAGER
# define genshellopt_packager_info NULL
#else
@@ -296,7 +311,13 @@ static char const genshellopt_packager_info[] =
# endif
"\n";
#endif
+#ifndef __doxygen__
+#endif /* __doxygen__ */
+/**
+ * The option definitions for genshellopt. The one structure that
+ * binds them all.
+ */
tOptions genshelloptOptions = {
OPTIONS_STRUCT_VERSION,
0, NULL, /* original argc + argv */
@@ -340,7 +361,16 @@ tOptions genshelloptOptions = {
static char* AO_gettext(char const* pz);
static void coerce_it(void** s);
-static char*
+/**
+ * AutoGen specific wrapper function for gettext.
+ * It relies on the macro _() to convert from English to the target
+ * language, then strdup-duplicates the result string.
+ *
+ * @param[in] pz the input text used as a lookup key.
+ * @returns the translated text (if there is one),
+ * or the original text (if not).
+ */
+static char *
AO_gettext(char const* pz)
{
char* pzRes;
@@ -360,8 +390,9 @@ AO_gettext(char const* pz)
static void coerce_it(void** s) { *s = AO_gettext(*s);
}
-/*
- * This invokes the translation code (e.g. gettext(3)).
+/**
+ * Translate all the translatable strings in the genshelloptOptions
+ * structure defined above. This is done only once.
*/
static void
translate_option_strings(void)
diff --git a/src/libopts/genshell.h b/src/libopts/genshell.h
index 1115d8f..d91c069 100644
--- a/src/libopts/genshell.h
+++ b/src/libopts/genshell.h
@@ -2,11 +2,11 @@
*
* DO NOT EDIT THIS FILE (genshell.h)
*
- * It has been AutoGen-ed February 26, 2012 at 11:08:41 AM by AutoGen
5.15pre14
+ * It has been AutoGen-ed May 6, 2012 at 04:20:59 PM by AutoGen 5.16pre36
* From the definitions genshell.def
* and the template file options
*
- * Generated from AutoOpts 36:3:11 templates.
+ * Generated from AutoOpts 36:4:11 templates.
*
* AutoOpts is a copyrighted work. This header file is not encumbered
* by AutoOpts licensing, but is provided under the licensing terms chosen
@@ -55,7 +55,7 @@
* tolerable version is at least as old as what was current when the header
* template was released.
*/
-#define AO_TEMPLATE_VERSION 147459
+#define AO_TEMPLATE_VERSION 147460
#if (AO_TEMPLATE_VERSION < OPTIONS_MINIMUM_VERSION) \
|| (AO_TEMPLATE_VERSION > OPTIONS_STRUCT_VERSION)
# error option template version mismatches autoopts/options.h header
@@ -104,7 +104,8 @@ typedef enum {
*/
typedef enum {
GENSHELLOPT_EXIT_SUCCESS = 0,
- GENSHELLOPT_EXIT_FAILURE = 1
+ GENSHELLOPT_EXIT_FAILURE = 1,
+ GENSHELLOPT_EXIT_LIBOPTS_FAILURE = 70
} genshellopt_exit_code_t;
/* * * * * *
*
@@ -125,7 +126,7 @@ typedef enum {
genshelloptOptions.pzCurOpt = NULL )
#define START_GENSHELL_OPT RESTART_GENSHELL_OPT(1)
#define GENSHELL_USAGE(c)
(*genshelloptOptions.pUsageProc)(&genshelloptOptions, c)
-/* extracted from opthead.tlib near line 469 */
+/* extracted from opthead.tlib near line 484 */
#ifdef __cplusplus
extern "C" {
@@ -140,9 +141,6 @@ extern tOptions genshelloptOptions;
#if defined(ENABLE_NLS)
# ifndef _
-# if defined(HAVE_GETTEXT)
-# include <libintl.h>
-# endif
# include <stdio.h>
static inline char* aoGetsText(char const* pz) {
if (pz == NULL) return NULL;
diff --git a/src/libopts/libopts.c b/src/libopts/libopts.c
index bd5f872..07cc035 100644
--- a/src/libopts/libopts.c
+++ b/src/libopts/libopts.c
@@ -1,6 +1,5 @@
-#include "autoopts/project.h"
#define AUTOOPTS_INTERNAL 1
-#include "compat/compat.h"
+#include "autoopts/project.h"
#define LOCAL static
#include "ao-strs.h"
#include "autoopts/options.h"
@@ -11,7 +10,6 @@
#include "ao-strs.h"
#include "ag-char-map.h"
#include "autoopts.h"
-#include "parse-duration.h"
#include "proto.h"
#include "parse-duration.c"
#include "ao-strs.c"
diff --git a/src/libopts/load.c b/src/libopts/load.c
index a138070..1ea7808 100644
--- a/src/libopts/load.c
+++ b/src/libopts/load.c
@@ -1,7 +1,7 @@
/**
* \file load.c
- * Time-stamp: "2012-01-29 19:37:15 bkorb"
+ * Time-stamp: "2012-03-31 13:13:34 bkorb"
*
* This file contains the routines that deal with processing text strings
* for options, either from a NUL-terminated string passed in or from an
@@ -29,13 +29,12 @@
*/
/* = = = START-STATIC-FORWARD = = = */
-static ag_bool
+static bool
add_prog_path(char * pzBuf, int bufSize, char const * pzName,
char const * pzProgPath);
-static ag_bool
-add_env_val(char * pzBuf, int bufSize, char const * pzName,
- char const * pzProgPath);
+static bool
+add_env_val(char * pzBuf, int bufSize, char const * pzName);
static char *
assemble_arg_val(char * pzTxt, tOptionLoadMode mode);
@@ -50,8 +49,8 @@ assemble_arg_val(char * pzTxt, tOptionLoadMode mode);
* arg: + char const* + pzName + The input name +
* arg: + char const* + pzProgPath + The full path of the current program +
*
- * ret-type: ag_bool
- * ret-desc: AG_TRUE if the name was handled, otherwise AG_FALSE.
+ * ret-type: bool
+ * ret-desc: true if the name was handled, otherwise false.
* If the name does not start with ``$'', then it is handled
* simply by copying the input name to the output buffer and
* resolving the name with either
@@ -77,7 +76,7 @@ assemble_arg_val(char * pzTxt, tOptionLoadMode mode);
* @code{pzName} string and must either be the entire string or be followed
* by the @code{'/'} (backslash on windows) character.
*
- * err: @code{AG_FALSE} is returned if:
+ * err: @code{false} is returned if:
* @*
* @bullet{} The input name exceeds @code{bufSize} bytes.
* @*
@@ -92,14 +91,14 @@ assemble_arg_val(char * pzTxt, tOptionLoadMode mode);
* @bullet{} @code{canonicalize_file_name} or @code{realpath} return
* errors (cannot resolve the resulting path).
=*/
-ag_bool
+bool
optionMakePath(char * pzBuf, int bufSize, char const * pzName,
char const * pzProgPath)
{
size_t name_len = strlen(pzName);
if (((size_t)bufSize <= name_len) || (name_len == 0))
- return AG_FALSE;
+ return false;
/*
* IF not an environment variable, just copy the data
@@ -113,7 +112,7 @@ optionMakePath(char * pzBuf, int bufSize, char const *
pzName,
if ( (*(pzD++) = *(pzS++)) == NUL)
break;
if (--ct <= 0)
- return AG_FALSE;
+ return false;
}
}
@@ -124,37 +123,37 @@ optionMakePath(char * pzBuf, int bufSize, char const *
pzName,
*/
else switch (pzName[1]) {
case NUL:
- return AG_FALSE;
+ return false;
case '$':
if (! add_prog_path(pzBuf, bufSize, pzName, pzProgPath))
- return AG_FALSE;
+ return false;
break;
case '@':
if (program_pkgdatadir[0] == NUL)
- return AG_FALSE;
+ return false;
if (snprintf(pzBuf, bufSize, "%s%s", program_pkgdatadir, pzName + 2)
>= bufSize)
- return AG_FALSE;
+ return false;
break;
default:
- if (! add_env_val(pzBuf, bufSize, pzName, pzProgPath))
- return AG_FALSE;
+ if (! add_env_val(pzBuf, bufSize, pzName))
+ return false;
}
#if defined(HAVE_CANONICALIZE_FILE_NAME)
{
char * pz = canonicalize_file_name(pzBuf);
if (pz == NULL)
- return AG_FALSE;
+ return false;
name_len = strlen(pz);
- if (name_len >= bufSize) {
+ if (name_len >= (size_t)bufSize) {
free(pz);
- return AG_FALSE;
+ return false;
}
memcpy(pzBuf, pz, name_len + 1);
@@ -166,20 +165,20 @@ optionMakePath(char * pzBuf, int bufSize, char const *
pzName,
char z[PATH_MAX+1];
if (realpath(pzBuf, z) == NULL)
- return AG_FALSE;
+ return false;
name_len = strlen(z);
if (name_len >= bufSize)
- return AG_FALSE;
+ return false;
memcpy(pzBuf, z, name_len + 1);
}
#endif
- return AG_TRUE;
+ return true;
}
-static ag_bool
+static bool
add_prog_path(char * pzBuf, int bufSize, char const * pzName,
char const * pzProgPath)
{
@@ -193,7 +192,7 @@ add_prog_path(char * pzBuf, int bufSize, char const *
pzName,
case NUL:
break;
default:
- return AG_FALSE;
+ return false;
}
/*
@@ -207,7 +206,7 @@ add_prog_path(char * pzBuf, int bufSize, char const *
pzName,
pzPath = pathfind(getenv("PATH"), (char*)pzProgPath, "rx");
if (pzPath == NULL)
- return AG_FALSE;
+ return false;
}
pz = strrchr(pzPath, DIRCH);
@@ -217,7 +216,7 @@ add_prog_path(char * pzBuf, int bufSize, char const *
pzName,
* THEN we do not have a path name to our executable file.
*/
if (pz == NULL)
- return AG_FALSE;
+ return false;
pzName += skip;
@@ -226,7 +225,7 @@ add_prog_path(char * pzBuf, int bufSize, char const *
pzName,
* The result may be either a file or a directory.
*/
if ((pz - pzPath)+1 + strlen(pzName) >= (unsigned)bufSize)
- return AG_FALSE;
+ return false;
memcpy(pzBuf, pzPath, (size_t)((pz - pzPath)+1));
strcpy(pzBuf + (pz - pzPath) + 1, pzName);
@@ -237,15 +236,14 @@ add_prog_path(char * pzBuf, int bufSize, char const *
pzName,
*/
if (pzPath != pzProgPath)
AGFREE(pzPath);
- return AG_TRUE;
+ return true;
}
-static ag_bool
-add_env_val(char * pzBuf, int bufSize, char const * pzName,
- char const * pzProgPath)
+static bool
+add_env_val(char * pzBuf, int bufSize, char const * pzName)
{
- char* pzDir = pzBuf;
+ char * pzDir = pzBuf;
for (;;) {
int ch = (int)*++pzName;
@@ -255,7 +253,7 @@ add_env_val(char * pzBuf, int bufSize, char const * pzName,
}
if (pzDir == pzBuf)
- return AG_FALSE;
+ return false;
*pzDir = NUL;
@@ -265,34 +263,34 @@ add_env_val(char * pzBuf, int bufSize, char const *
pzName,
* Environment value not found -- skip the home list entry
*/
if (pzDir == NULL)
- return AG_FALSE;
+ return false;
if (strlen(pzDir) + 1 + strlen(pzName) >= (unsigned)bufSize)
- return AG_FALSE;
+ return false;
sprintf(pzBuf, "%s%s", pzDir, pzName);
- return AG_TRUE;
+ return true;
}
LOCAL void
mungeString(char* pzTxt, tOptionLoadMode mode)
{
- char* pzE;
+ char * pzE;
if (mode == OPTION_LOAD_KEEP)
return;
if (IS_WHITESPACE_CHAR(*pzTxt)) {
- char* pzS = pzTxt;
- char* pzD = pzTxt;
- while (IS_WHITESPACE_CHAR(*++pzS)) ;
- while ((*(pzD++) = *(pzS++)) != NUL) ;
- pzE = pzD-1;
+ char * pzS = SPN_WHITESPACE_CHARS(pzTxt+1);
+ size_t l = strlen(pzS) + 1;
+ memmove(pzTxt, pzS, l);
+ pzE = pzTxt + l - 1;
+
} else
pzE = pzTxt + strlen(pzTxt);
- while ((pzE > pzTxt) && IS_WHITESPACE_CHAR(pzE[-1])) pzE--;
+ pzE = SPN_WHITESPACE_BACK(pzTxt, pzE);
*pzE = NUL;
if (mode == OPTION_LOAD_UNCOOKED)
@@ -343,9 +341,10 @@ assemble_arg_val(char * pzTxt, tOptionLoadMode mode)
*/
space_break = IS_WHITESPACE_CHAR(*pzEnd);
*(pzEnd++) = NUL;
- while (IS_WHITESPACE_CHAR(*pzEnd)) pzEnd++;
+
+ pzEnd = SPN_WHITESPACE_CHARS(pzEnd);
if (space_break && ((*pzEnd == ':') || (*pzEnd == '=')))
- while (IS_WHITESPACE_CHAR(*++pzEnd)) ;
+ pzEnd = SPN_WHITESPACE_CHARS(pzEnd+1);
return pzEnd;
}
@@ -365,7 +364,7 @@ loadOptionLine(
tDirection direction,
tOptionLoadMode load_mode )
{
- while (IS_WHITESPACE_CHAR(*pzLine)) pzLine++;
+ pzLine = SPN_WHITESPACE_CHARS(pzLine);
{
char* pzArg = assemble_arg_val(pzLine, load_mode);
diff --git a/src/libopts/m4/libopts.m4 b/src/libopts/m4/libopts.m4
index d9a1173..ce083de 100644
--- a/src/libopts/m4/libopts.m4
+++ b/src/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 February 26, 2012 at 11:08:37 AM by AutoGen
5.15pre14
+dnl It has been AutoGen-ed May 6, 2012 at 04:20:55 PM by AutoGen 5.16pre36
dnl From the definitions libopts.def
dnl and the template file conftest.tpl
dnl
@@ -16,11 +16,12 @@ AC_DEFUN([INVOKE_LIBOPTS_MACROS_FIRST],[
# AC_CHECK_HEADERS
# =================
AC_CHECK_HEADERS([ \
- dlfcn.h errno.h fcntl.h libgen.h \
- memory.h netinet/in.h setjmp.h sys/mman.h \
- sys/param.h sys/poll.h sys/procset.h sys/select.h \
- sys/socket.h sys/stropts.h sys/time.h sys/un.h \
- sys/wait.h unistd.h utime.h sysexits.h ])
+ sys/mman.h sys/param.h sys/poll.h sys/procset.h \
+ sys/select.h sys/socket.h sys/stropts.h sys/time.h \
+ sys/un.h sys/wait.h dlfcn.h errno.h \
+ fcntl.h libgen.h memory.h netinet/in.h \
+ setjmp.h stdbool.h sysexits.h unistd.h \
+ utime.h])
AC_CHECK_HEADERS([stdarg.h varargs.h],
[lo_have_arg_hdr=true;break],
@@ -100,7 +101,7 @@ AC_DEFUN([INVOKE_LIBOPTS_MACROS_FIRST],[
AC_FUNC_VPRINTF
AC_FUNC_FORK
AC_CHECK_FUNCS([mmap canonicalize_file_name snprintf strdup strchr \
- strrchr strsignal])
+ strrchr strsignal fchmod fstat chmod])
AC_PROG_SED
[while :
do
diff --git a/src/libopts/makeshell.c b/src/libopts/makeshell.c
index a2b0a2e..79edb70 100644
--- a/src/libopts/makeshell.c
+++ b/src/libopts/makeshell.c
@@ -2,7 +2,7 @@
/**
* \file makeshell.c
*
- * Time-stamp: "2012-01-29 19:01:07 bkorb"
+ * Time-stamp: "2012-04-07 09:03:16 bkorb"
*
* This module will interpret the options set in the tOptions
* structure and create a Bourne shell script capable of parsing them.
@@ -163,11 +163,11 @@ optionParseShell(tOptions * pOpts)
else if (ENABLED_GENSHELL_OPT(SHELL))
printf(SHOW_PROG_ENV, pOpts->pzPROGNAME);
- fflush(stdout);
#ifdef HAVE_FCHMOD
fchmod(STDOUT_FILENO, 0755);
#endif
fclose(stdout);
+
if (ferror(stdout)) {
fputs(zOutputFail, stderr);
exit(EXIT_FAILURE);
@@ -718,7 +718,7 @@ open_out(char const * pzFile)
*/
script_trailer = pzScan + END_MARK_LEN;
script_leader = pzData;
- } while (AG_FALSE);
+ } while (false);
if (freopen(pzFile, "w" FOPEN_BINARY_FLAG, stdout) != stdout) {
fprintf(stderr, zFreopenFail, errno, strerror(errno));
diff --git a/src/libopts/nested.c b/src/libopts/nested.c
index b7f1586..ed23fd2 100644
--- a/src/libopts/nested.c
+++ b/src/libopts/nested.c
@@ -2,7 +2,7 @@
/**
* \file nested.c
*
- * Time-stamp: "2012-01-29 07:00:04 bkorb"
+ * Time-stamp: "2012-03-04 13:30:07 bkorb"
*
* Automated Options Nested Values module.
*
@@ -397,7 +397,8 @@ scan_name(char const* pzName, tOptionValue* pRes)
static char const*
scan_xml(char const* pzName, tOptionValue* pRes)
{
- size_t nameLen = 1, valLen = 0;
+ size_t nameLen;
+ size_t valLen;
char const* pzScan = ++pzName;
char const* pzVal;
tOptionValue valu;
@@ -425,8 +426,8 @@ scan_xml(char const* pzName, tOptionValue* pRes)
return pzName;
}
- pzScan++;
- while (IS_VALUE_NAME_CHAR((int)*pzScan)) { pzScan++; nameLen++; }
+ pzScan = SPN_VALUE_NAME_CHARS(pzName+1);
+ nameLen = pzScan - pzName;
if (nameLen > 64)
return NULL;
valu.valType = OPARG_TYPE_STRING;
@@ -434,7 +435,7 @@ scan_xml(char const* pzName, tOptionValue* pRes)
switch (*pzScan) {
case ' ':
case '\t':
- pzScan = parseAttributes(
+ pzScan = parse_attrs(
NULL, (char*)pzScan, &option_load_mode, &valu );
if (*pzScan == '>') {
pzScan++;
@@ -489,7 +490,7 @@ scan_xml(char const* pzName, tOptionValue* pRes)
}
valLen = (pzScan - pzVal);
pzScan += nameLen + 3;
- while (IS_WHITESPACE_CHAR(*pzScan)) pzScan++;
+ pzScan = SPN_WHITESPACE_CHARS(pzScan);
}
switch (valu.valType) {
diff --git a/src/libopts/parse-duration.c b/src/libopts/parse-duration.c
index e49060a..655a5e5 100644
--- a/src/libopts/parse-duration.c
+++ b/src/libopts/parse-duration.c
@@ -54,14 +54,14 @@ typedef enum {
#define TIME_MAX 0x7FFFFFFF
/* Wrapper around strtoul that does not require a cast. */
-static unsigned long inline
+inline static unsigned long
str_const_to_ul (cch_t * str, cch_t ** ppz, int base)
{
return strtoul (str, (char **)ppz, base);
}
/* Wrapper around strtol that does not require a cast. */
-static long inline
+inline static long
str_const_to_l (cch_t * str, cch_t ** ppz, int base)
{
return strtol (str, (char **)ppz, base);
@@ -70,7 +70,7 @@ str_const_to_l (cch_t * str, cch_t ** ppz, int base)
/* Returns BASE + VAL * SCALE, interpreting BASE = BAD_TIME
with errno set as an error situation, and returning BAD_TIME
with errno set in an error situation. */
-static time_t inline
+inline static time_t
scale_n_add (time_t base, time_t val, int scale)
{
if (base == BAD_TIME)
diff --git a/src/libopts/pgusage.c b/src/libopts/pgusage.c
index 4dbbd53..7eae2b0 100644
--- a/src/libopts/pgusage.c
+++ b/src/libopts/pgusage.c
@@ -2,7 +2,7 @@
/**
* \file pgusage.c
*
- * Time-stamp: "2012-01-29 16:09:14 bkorb"
+ * Time-stamp: "2012-02-28 19:49:32 bkorb"
*
* Automated Options Paged Usage module.
*
@@ -43,7 +43,7 @@
* This is disabled on platforms without a working fork() function.
=*/
void
-optionPagedUsage(tOptions* pOptions, tOptDesc* pOD)
+optionPagedUsage(tOptions * pOptions, tOptDesc * pOD)
{
#if ! defined(HAVE_WORKING_FORK)
if ((pOD->fOptState & OPTST_RESET) != 0)
@@ -66,11 +66,7 @@ optionPagedUsage(tOptions* pOptions, tOptDesc* pOD)
return;
my_pid = getpid();
-#ifdef HAVE_SNPRINTF
snprintf(zPageUsage, sizeof(zPageUsage), TMP_USAGE_FMT, (tAoUL)my_pid);
-#else
- sprintf(zPageUsage, TMP_USAGE_FMT, (tAoUL)my_pid);
-#endif
unlink(zPageUsage);
/*
@@ -110,11 +106,8 @@ optionPagedUsage(tOptions* pOptions, tOptDesc* pOD)
/*
* Page the file and remove it when done.
*/
-#ifdef HAVE_SNPRINTF
- snprintf(zPageUsage, sizeof(zPageUsage), PAGE_USAGE_FMT, pzPager,
(tAoUL)my_pid);
-#else
- sprintf(zPageUsage, PAGE_USAGE_FMT, pzPager, (tAoUL)my_pid);
-#endif
+ snprintf(zPageUsage, sizeof(zPageUsage), PAGE_USAGE_FMT, pzPager,
+ (tAoUL)my_pid);
fclose(stderr);
dup2(STDOUT_FILENO, STDERR_FILENO);
diff --git a/src/libopts/proto.h b/src/libopts/proto.h
index 9f4bbff..ae1a110 100644
--- a/src/libopts/proto.h
+++ b/src/libopts/proto.h
@@ -1,7 +1,7 @@
/* -*- buffer-read-only: t -*- vi: set ro:
*
* Prototypes for autoopts
- * Generated Sun Feb 26 11:08:49 PST 2012
+ * Generated Sun May 6 16:21:08 PDT 2012
*/
#ifndef AUTOOPTS_PROTO_H_GUARD
#define AUTOOPTS_PROTO_H_GUARD 1
@@ -36,7 +36,7 @@ regular_opts(tOptions * pOpts);
/*
* Extracted from check.c
*/
-LOCAL ag_bool
+LOCAL bool
is_consistent(tOptions * pOpts);
/*
@@ -46,11 +46,8 @@ LOCAL void
intern_file_load(tOptions* pOpts);
LOCAL char*
-parseAttributes(
- tOptions* pOpts,
- char* pzText,
- tOptionLoadMode* pMode,
- tOptionValue* pType );
+parse_attrs(tOptions * pOpts, char * pzText, tOptionLoadMode * pMode,
+ tOptionValue * pType);
LOCAL tSuccess
validate_struct(tOptions * pOpts, char const * pzProgram);
diff --git a/src/libopts/putshell.c b/src/libopts/putshell.c
index 2c9dde5..d8e2d91 100644
--- a/src/libopts/putshell.c
+++ b/src/libopts/putshell.c
@@ -2,7 +2,7 @@
/**
* \file putshell.c
*
- * Time-stamp: "2012-02-12 09:14:49 bkorb"
+ * Time-stamp: "2012-03-31 13:14:18 bkorb"
*
* This module will interpret the options set in the tOptions
* structure and print them to standard out in a fashion that
@@ -142,7 +142,7 @@ print_membership(tOptions * pOpts, tOptDesc * pOD)
pz = pOD->optArg.argString + 7;
while (*pz != NUL) {
printf("typeset -x -i %s_", pOD->pz_NAME);
- while (IS_PLUS_N_SPACE_CHAR(*pz)) pz++;
+ pz = SPN_PLUS_N_SPACE_CHARS(pz);
for (;;) {
int ch = *(pz++);
@@ -182,11 +182,13 @@ print_stacked_arg(tOptions * pOpts, tOptDesc * pOD)
static void
print_reordering(tOptions * pOpts)
{
- int optIx;
+ unsigned int optIx;
fputs(set_dash, stdout);
- for (optIx = pOpts->curOptIdx; optIx < pOpts->origArgCt; optIx++) {
+ for (optIx = pOpts->curOptIdx;
+ optIx < pOpts->origArgCt;
+ optIx++) {
char* pzArg = pOpts->origArgVect[ optIx ];
diff --git a/src/libopts/reset.c b/src/libopts/reset.c
index 2345d51..b8c5b9e 100644
--- a/src/libopts/reset.c
+++ b/src/libopts/reset.c
@@ -69,7 +69,7 @@ optionResetEverything(tOptions * pOpts)
void
optionResetOpt( tOptions* pOpts, tOptDesc* pOD )
{
- static ag_bool reset_active = AG_FALSE;
+ static bool reset_active = false;
tOptState opt_state = OPTSTATE_INITIALIZER(DEFINED);
char const * pzArg = pOD->optArg.argString;
@@ -91,12 +91,12 @@ optionResetOpt( tOptions* pOpts, tOptDesc* pOD )
assert(0 == 1);
}
- reset_active = AG_TRUE;
+ reset_active = true;
if (pzArg[1] == NUL) {
if (*pzArg == '*') {
optionResetEverything(pOpts);
- reset_active = AG_FALSE;
+ reset_active = false;
return;
}
@@ -124,7 +124,7 @@ optionResetOpt( tOptions* pOpts, tOptDesc* pOD )
* Finally, clear the reset flag, too.
*/
optionReset(pOpts, opt_state.pOD);
- reset_active = AG_FALSE;
+ reset_active = false;
}
/*
* Local Variables:
diff --git a/src/libopts/save.c b/src/libopts/save.c
index a1357ff..9e95056 100644
--- a/src/libopts/save.c
+++ b/src/libopts/save.c
@@ -2,7 +2,7 @@
/*
* \file save.c
*
- * Time-stamp: "2012-01-29 19:30:39 bkorb"
+ * Time-stamp: "2012-03-31 13:15:19 bkorb"
*
* This module's routines will take the currently set options and
* store them into an ".rc" file for re-interpretation the next
@@ -192,7 +192,7 @@ find_file_name(tOptions * pOpts, int * p_free_name)
break; /* found directory -- viz., "." */
}
- if ((dirchp - pzDir) >= sizeof(z))
+ if ((size_t)(dirchp - pzDir) >= sizeof(z))
goto bogus_name;
memcpy(z, pzDir, (size_t)(dirchp - pzDir));
@@ -201,7 +201,7 @@ find_file_name(tOptions * pOpts, int * p_free_name)
if ((stat(z, &stBuf) != 0) || ! S_ISDIR(stBuf.st_mode))
goto bogus_name;
stBuf.st_mode = S_IFREG; /* file within this directory */
- } while (0);
+ } while (false);
/*
* IF what we found was a directory,
diff --git a/src/libopts/stack.c b/src/libopts/stack.c
index bb962f7..094b2a1 100644
--- a/src/libopts/stack.c
+++ b/src/libopts/stack.c
@@ -2,7 +2,7 @@
/**
* \file stack.c
*
- * Time-stamp: "2012-01-29 09:42:12 bkorb"
+ * Time-stamp: "2012-03-31 13:16:41 bkorb"
*
* This is a special option processing routine that will save the
* argument to an option in a FIFO queue.
@@ -43,11 +43,11 @@
* Invoked for options that are equivalenced to stacked options.
=*/
void
-optionUnstackArg(
- tOptions* pOpts,
- tOptDesc* pOptDesc )
+optionUnstackArg(tOptions * pOpts, tOptDesc * pOptDesc)
{
- tArgList* pAL;
+ tArgList * pAL;
+
+ (void)pOpts;
if ((pOptDesc->fOptState & OPTST_RESET) != 0)
return;
@@ -230,12 +230,12 @@ addArgListEntry(void** ppAL, void* entry)
* Keep an entry-ordered list of option arguments.
=*/
void
-optionStackArg(
- tOptions* pOpts,
- tOptDesc* pOD )
+optionStackArg(tOptions * pOpts, tOptDesc * pOD)
{
char * pz;
+ (void)pOpts;
+
if ((pOD->fOptState & OPTST_RESET) != 0) {
tArgList* pAL = (void*)pOD->optCookie;
int ix;
diff --git a/src/libopts/streqvcmp.c b/src/libopts/streqvcmp.c
index d08f9c9..54a063a 100644
--- a/src/libopts/streqvcmp.c
+++ b/src/libopts/streqvcmp.c
@@ -2,7 +2,7 @@
/**
* \file streqvcmp.c
*
- * Time-stamp: "2012-01-29 19:03:24 bkorb"
+ * Time-stamp: "2012-03-31 13:17:39 bkorb"
*
* String Equivalence Comparison
*
@@ -192,8 +192,8 @@ streqvmap(char From, char To, int ct)
}
else {
- int chTo = (int)To & 0xFF;
- int chFrom = (int)From & 0xFF;
+ unsigned int chTo = (int)To & 0xFF;
+ unsigned int chFrom = (int)From & 0xFF;
do {
charmap[chFrom] = (unsigned char)chTo;
diff --git a/src/libopts/tokenize.c b/src/libopts/tokenize.c
index ca0ad53..9563713 100644
--- a/src/libopts/tokenize.c
+++ b/src/libopts/tokenize.c
@@ -1,6 +1,6 @@
/*
* This file defines the string_tokenize interface
- * Time-stamp: "2012-01-29 19:02:51 bkorb"
+ * Time-stamp: "2012-03-04 13:23:50 bkorb"
*
* This file is part of AutoOpts, a companion to AutoGen.
* AutoOpts is free software.
@@ -128,7 +128,7 @@ alloc_token_list(char const * str)
* Trim leading white space. Use "ENOENT" and a NULL return to indicate
* an empty string was passed.
*/
- while (IS_WHITESPACE_CHAR(*str)) str++;
+ str = SPN_WHITESPACE_CHARS(str);
if (*str == NUL) goto enoent_res;
/*
@@ -137,17 +137,15 @@ alloc_token_list(char const * str)
* high and we'll squander the space for a few extra pointers.
*/
{
- cc_t* pz = (cc_t*)str;
+ char const * pz = str;
do {
max_token_ct++;
- while (! IS_WHITESPACE_CHAR(*++pz))
- if (*pz == NUL) goto found_nul;
- while (IS_WHITESPACE_CHAR(*pz)) pz++;
+ pz = BRK_WHITESPACE_CHARS(pz+1);
+ pz = SPN_WHITESPACE_CHARS(pz);
} while (*pz != NUL);
- found_nul:
- res = malloc(sizeof(*res) + (pz - (cc_t*)str)
+ res = malloc(sizeof(*res) + (pz - str)
+ (max_token_ct * sizeof(ch_t*)));
}
@@ -249,7 +247,7 @@ ao_string_tokenize(char const* str)
int ch = (ch_t)*str;
if (IS_WHITESPACE_CHAR(ch)) {
found_white_space:
- while (IS_WHITESPACE_CHAR(*++str)) ;
+ str = SPN_WHITESPACE_CHARS(str+1);
break;
}
diff --git a/src/libopts/usage.c b/src/libopts/usage.c
index 8634cfc..ebdc46a 100644
--- a/src/libopts/usage.c
+++ b/src/libopts/usage.c
@@ -2,7 +2,7 @@
/*
* \file usage.c
*
- * Time-stamp: "2012-01-29 09:57:43 bkorb"
+ * Time-stamp: "2012-03-31 19:19:26 bkorb"
*
* This module implements the default usage procedure for
* Automated Options. It may be overridden, of course.
@@ -38,10 +38,10 @@
#define OPTPROC_L_N_S (OPTPROC_LONGOPT | OPTPROC_SHORTOPT)
/* = = = START-STATIC-FORWARD = = = */
-static inline ag_bool
+static inline bool
do_gnu_usage(tOptions * pOpts);
-static inline ag_bool
+static inline bool
skip_misuse_usage(tOptions * pOpts);
static void
@@ -55,14 +55,14 @@ prt_one_vendor(tOptions * pOptions, tOptDesc * pOD,
arg_types_t * pAT, char const * usefmt);
static void
-prt_vendor_opts(tOptions * pOpts, arg_types_t * pAT, char const * pOptTitle);
+prt_vendor_opts(tOptions * pOpts, char const * pOptTitle);
static void
prt_extd_usage(tOptions * pOpts, tOptDesc * pOD,
- arg_types_t * pAT, char const * pOptTitle);
+ char const * pOptTitle);
static void
-prt_ini_list(char const * const * papz, ag_bool * pInitIntro,
+prt_ini_list(char const * const * papz, bool * pInitIntro,
char const * pzRc, char const * pzPN);
static void
@@ -116,14 +116,14 @@ set_usage_flags(tOptions * opts, char const * flg_txt)
};
# undef _aof_
- ao_flags_t flg = 0;
+ unsigned int flg = (ao_flags_t)0;
if (flg_txt == NULL) {
flg_txt = getenv("AUTOOPTS_USAGE");
if (flg_txt == NULL) return;
}
- while (IS_WHITESPACE_CHAR(*flg_txt)) flg_txt++;
+ flg_txt = SPN_WHITESPACE_CHARS(flg_txt);
if (*flg_txt == NUL)
return;
@@ -147,8 +147,7 @@ set_usage_flags(tOptions * opts, char const * flg_txt)
return;
flg |= 1 << ix;
- flg_txt += fnt->fnm_len;
- while (IS_WHITESPACE_CHAR(*flg_txt)) flg_txt++;
+ flg_txt = SPN_WHITESPACE_CHARS(flg_txt + fnt->fnm_len);
if (*flg_txt == NUL)
break;
@@ -157,7 +156,7 @@ set_usage_flags(tOptions * opts, char const * flg_txt)
/*
* skip the comma and following white space
*/
- while (IS_WHITESPACE_CHAR(*++flg_txt)) ;
+ flg_txt = SPN_WHITESPACE_CHARS(flg_txt + 1);
if (*flg_txt == NUL)
break;
}
@@ -182,20 +181,20 @@ set_usage_flags(tOptions * opts, char const * flg_txt)
* Figure out if we should try to format usage text sort-of like
* the way many GNU programs do.
*/
-static inline ag_bool
+static inline bool
do_gnu_usage(tOptions * pOpts)
{
- return (pOpts->fOptSet & OPTPROC_GNUUSAGE) ? AG_TRUE : AG_FALSE;
+ return (pOpts->fOptSet & OPTPROC_GNUUSAGE) ? true : false;
}
/*
* Figure out if we should try to format usage text sort-of like
* the way many GNU programs do.
*/
-static inline ag_bool
+static inline bool
skip_misuse_usage(tOptions * pOpts)
{
- return (pOpts->fOptSet & OPTPROC_MISUSE) ? AG_TRUE : AG_FALSE;
+ return (pOpts->fOptSet & OPTPROC_MISUSE) ? true : false;
}
@@ -326,16 +325,16 @@ print_usage_details(tOptions * opts, int exit_code)
* over-ride this, providing the value of it is set to either "gnu" or
* "autoopts". This routine will @strong{not} return.
*
- * If "exitCode" is "EX_USAGE" (normally 64), then output will to to stdout
- * and the actual exit code will be "EXIT_SUCCESS".
+ * If "exitCode" is "AO_EXIT_REQ_USAGE" (normally 64), then output will to
+ * to stdout and the actual exit code will be "EXIT_SUCCESS".
=*/
void
optionUsage(tOptions * pOptions, int usage_exit_code)
{
- int exit_code =
- (usage_exit_code == EX_USAGE) ? EXIT_SUCCESS : usage_exit_code;
+ int exit_code = (usage_exit_code == AO_EXIT_REQ_USAGE)
+ ? EXIT_SUCCESS : usage_exit_code;
- displayEnum = AG_FALSE;
+ displayEnum = false;
/*
* Paged usage will preset option_usage_fp to an output file.
@@ -467,7 +466,7 @@ prt_one_vendor(tOptions * pOptions, tOptDesc * pOD,
default: goto bogus_desc;
}
- while (IS_WHITESPACE_CHAR(*pzArgType)) pzArgType++;
+ pzArgType = SPN_WHITESPACE_CHARS(pzArgType);
if (*pzArgType == NUL)
snprintf(z, sizeof(z), "%s", pOD->pz_Name);
else
@@ -477,7 +476,7 @@ prt_one_vendor(tOptions * pOptions, tOptDesc * pOD,
switch (OPTST_GET_ARGTYPE(pOD->fOptState)) {
case OPARG_TYPE_ENUMERATION:
case OPARG_TYPE_MEMBERSHIP:
- displayEnum = (pOD->pOptProc != NULL) ? AG_TRUE : displayEnum;
+ displayEnum = (pOD->pOptProc != NULL) ? true : displayEnum;
}
}
@@ -494,10 +493,9 @@ bogus_desc:
*
* @param pOptions the program option descriptor
* @param pOD the option descriptor
- * @param pAT names of the option argument types
*/
static void
-prt_vendor_opts(tOptions * pOpts, arg_types_t * pAT, char const * pOptTitle)
+prt_vendor_opts(tOptions * pOpts, char const * pOptTitle)
{
static unsigned int const not_vended_mask =
OPTST_NO_USAGE_MASK | OPTST_DOCUMENT;
@@ -535,7 +533,7 @@ prt_vendor_opts(tOptions * pOpts, arg_types_t * pAT, char
const * pOptTitle)
continue;
prt_one_vendor(pOpts, pOD, &argTypes, vfmt);
- prt_extd_usage(pOpts, pOD, &argTypes, pOptTitle);
+ prt_extd_usage(pOpts, pOD, pOptTitle);
} while (pOD++, (--ct > 0));
}
@@ -549,11 +547,11 @@ prt_vendor_opts(tOptions * pOpts, arg_types_t * pAT, char
const * pOptTitle)
*/
static void
prt_extd_usage(tOptions * pOpts, tOptDesc * pOD,
- arg_types_t * pAT, char const * pOptTitle)
+ char const * pOptTitle)
{
if ( ((pOpts->fOptSet & OPTPROC_VENDOR_OPT) != 0)
&& (pOD->optActualValue == VENDOR_OPTION_VALUE)) {
- prt_vendor_opts(pOpts, pAT, pOptTitle);
+ prt_vendor_opts(pOpts, pOptTitle);
return;
}
@@ -666,7 +664,7 @@ prt_extd_usage(tOptions * pOpts, tOptDesc * pOD,
* squishy, but important to tell users how to find these files.
*/
static void
-prt_ini_list(char const * const * papz, ag_bool * pInitIntro,
+prt_ini_list(char const * const * papz, bool * pInitIntro,
char const * pzRc, char const * pzPN)
{
char zPath[AG_PATH_MAX+1];
@@ -675,7 +673,7 @@ prt_ini_list(char const * const * papz, ag_bool *
pInitIntro,
return;
fputs(zPresetIntro, option_usage_fp);
- *pInitIntro = AG_FALSE;
+ *pInitIntro = false;
for (;;) {
char const * pzPath = *(papz++);
@@ -792,7 +790,7 @@ prt_one_usage(tOptions * pOptions, tOptDesc * pOD,
arg_types_t * pAT)
switch (OPTST_GET_ARGTYPE(pOD->fOptState)) {
case OPARG_TYPE_ENUMERATION:
case OPARG_TYPE_MEMBERSHIP:
- displayEnum = (pOD->pOptProc != NULL) ? AG_TRUE : displayEnum;
+ displayEnum = (pOD->pOptProc != NULL) ? true : displayEnum;
}
}
@@ -880,7 +878,7 @@ prt_opt_usage(tOptions * pOpts, int ex_code, char const *
pOptTitle)
* THEN print all the extra info
*/
if (ex_code == EXIT_SUCCESS)
- prt_extd_usage(pOpts, pOD, &argTypes, pOptTitle);
+ prt_extd_usage(pOpts, pOD, pOptTitle);
} while (pOD++, optNo++, (--ct > 0));
@@ -895,7 +893,7 @@ prt_opt_usage(tOptions * pOpts, int ex_code, char const *
pOptTitle)
static void
prt_prog_detail(tOptions* pOptions)
{
- ag_bool initIntro = AG_TRUE;
+ bool initIntro = true;
/*
* Display all the places we look for config files
diff --git a/src/libopts/value-type.h b/src/libopts/value-type.h
index bc5fc26..d91b0fe 100644
--- a/src/libopts/value-type.h
+++ b/src/libopts/value-type.h
@@ -1,5 +1,5 @@
/*
- * Generated header for gperf generated source Sun Feb 26 11:08:41 PST 2012
+ * Generated header for gperf generated source Sun May 6 16:20:59 PDT 2012
* This file enumerates the list of names and declares the
* procedure for mapping string names to the enum value.
*/
diff --git a/src/libopts/xat-attribute.h b/src/libopts/xat-attribute.h
index 527cac2..e12bd4a 100644
--- a/src/libopts/xat-attribute.h
+++ b/src/libopts/xat-attribute.h
@@ -1,5 +1,5 @@
/*
- * Generated header for gperf generated source Sun Feb 26 11:08:41 PST 2012
+ * Generated header for gperf generated source Sun May 6 16:20:59 PDT 2012
* This file enumerates the list of names and declares the
* procedure for mapping string names to the enum value.
*/
diff --git a/tests/x509sign-verify.c b/tests/x509sign-verify.c
index 9ac6b5d..7e0727c 100644
--- a/tests/x509sign-verify.c
+++ b/tests/x509sign-verify.c
@@ -40,6 +40,12 @@
#include "utils.h"
+static void
+tls_log_func (int level, const char *str)
+{
+ fprintf (stderr, "<%d> %s", level, str);
+}
+
/* sha1 hash of "hello" string */
const gnutls_datum_t hash_data = {
(void *)
@@ -147,6 +153,7 @@ doit (void)
gnutls_pubkey_t pubkey;
gnutls_privkey_t privkey;
gnutls_digest_algorithm_t hash_algo;
+ gnutls_sign_algorithm_t sign_algo;
gnutls_datum_t signature;
gnutls_datum_t signature2;
int ret;
@@ -154,6 +161,10 @@ doit (void)
gnutls_global_init ();
+ gnutls_global_set_log_function (tls_log_func);
+ if (debug)
+ gnutls_global_set_log_level (6);
+
for (i = 0; i < sizeof (key_dat) / sizeof (key_dat[0]); i++)
{
if (debug)
@@ -210,7 +221,7 @@ doit (void)
ret = gnutls_pubkey_verify_hash (pubkey, 0, &hash_data, &signature);
if (ret < 0)
- fail ("gnutls_x509_privkey_verify_hash\n");
+ fail ("gnutls_x509_pubkey_verify_hash\n");
ret =
gnutls_pubkey_get_verify_algorithm (pubkey, &signature2, &hash_algo);
@@ -219,12 +230,24 @@ doit (void)
ret = gnutls_pubkey_verify_hash (pubkey, 0, &hash_data, &signature2);
if (ret < 0)
- fail ("gnutls_x509_privkey_verify_hash (hashed data)\n");
+ fail ("gnutls_x509_pubkey_verify_hash-1 (hashed data)\n");
/* should fail */
ret = gnutls_pubkey_verify_hash (pubkey, 0, &invalid_hash_data,
&signature2);
if (ret != GNUTLS_E_PK_SIG_VERIFY_FAILED)
- fail ("gnutls_x509_privkey_verify_hash (hashed data)\n");
+ fail ("gnutls_x509_pubkey_verify_hash-2 (hashed data)\n");
+
+ sign_algo = gnutls_pk_to_sign(gnutls_pubkey_get_pk_algorithm(pubkey,
NULL),
+ GNUTLS_DIG_SHA1);
+
+ ret = gnutls_pubkey_verify_hash2 (pubkey, sign_algo, 0, &hash_data,
&signature2);
+ if (ret < 0)
+ fail ("gnutls_x509_pubkey_verify_hash2-1 (hashed data)\n");
+
+ /* should fail */
+ ret = gnutls_pubkey_verify_hash2 (pubkey, sign_algo, 0,
&invalid_hash_data, &signature2);
+ if (ret != GNUTLS_E_PK_SIG_VERIFY_FAILED)
+ fail ("gnutls_x509_pubkey_verify_hash2-2 (hashed data)\n");
gnutls_free(signature.data);
hooks/post-receive
--
GNU gnutls
[Prev in Thread] |
Current Thread |
[Next in Thread] |
- [SCM] GNU gnutls branch, gnutls_3_0_x-2, updated. gnutls_3_0_19-8-g8182e80,
Nikos Mavrogiannopoulos <=