diff options
Diffstat (limited to 'util')
-rw-r--r-- | util/argparse.c | 3 | ||||
-rw-r--r-- | util/errors.c | 1 | ||||
-rw-r--r-- | util/strgutil.c | 25 |
3 files changed, 28 insertions, 1 deletions
diff --git a/util/argparse.c b/util/argparse.c index 89c873ce0..09c820a72 100644 --- a/util/argparse.c +++ b/util/argparse.c @@ -27,6 +27,7 @@ #include <string.h> #include "util.h" +#include "i18n.h" /********************************* @@ -544,7 +545,7 @@ show_help( ARGPARSE_OPTS *opts, unsigned flags ) indent += 10; puts("Options:"); for(i=0; opts[i].short_opt; i++ ) { - s = opts[i].description; + s = _(opts[i].description); if( s && *s== '\r' ) /* hide this line */ continue; if( opts[i].short_opt < 256 ) diff --git a/util/errors.c b/util/errors.c index b6024cb99..79a96d698 100644 --- a/util/errors.c +++ b/util/errors.c @@ -66,6 +66,7 @@ g10_errstr( int err ) X(SIG_CLASS ,"Unknown signature class") X(TRUSTDB ,"TrustDB error") X(BAD_CERT ,"Bad certificate") + X(INV_USER_ID ,"malformed user id") default: p = buf; sprintf(buf, "g10err=%d", err); break; } diff --git a/util/strgutil.c b/util/strgutil.c index cb80c57ab..286e90237 100644 --- a/util/strgutil.c +++ b/util/strgutil.c @@ -73,6 +73,31 @@ memistr( char *buf, size_t buflen, const char *sub ) return NULL ; } +/**************** + * Wie strncpy(), aber es werden maximal n-1 zeichen kopiert und ein + * '\0' angeh�ngt. Ist n = 0, so geschieht nichts, ist Destination + * gleich NULL, so wird via m_alloc Speicher besorgt, ist dann nicht + * gen�gend Speicher vorhanden, so bricht die funktion ab. + */ +char * +mem2str( char *dest , const void *src , size_t n ) +{ + char *d; + const char *s; + + if( n ) { + if( !dest ) + dest = m_alloc( n ) ; + d = dest; + s = src ; + for(n--; n && *s; n-- ) + *d++ = *s++; + *d = '\0' ; + } + + return dest ; +} + /**************** * remove leading and trailing white spaces |