aboutsummaryrefslogtreecommitdiffstats
path: root/util
diff options
context:
space:
mode:
Diffstat (limited to 'util')
-rw-r--r--util/argparse.c17
-rw-r--r--util/memory.c16
2 files changed, 21 insertions, 12 deletions
diff --git a/util/argparse.c b/util/argparse.c
index 89e6b26c0..2f733eb4b 100644
--- a/util/argparse.c
+++ b/util/argparse.c
@@ -349,7 +349,10 @@ show_help( ARGPARSE_OPTS *opts, unsigned flags )
{
const char *s;
- puts( strusage(10) );
+ s = strusage(10);
+ fputs( s, stdout );
+ if( *s && s[strlen(s)-1] != '\n' )
+ putchar( '\n' );
s = strusage(12);
if( *s == '\n' )
s++;
@@ -366,6 +369,9 @@ show_help( ARGPARSE_OPTS *opts, unsigned flags )
indent += 10;
puts("Options:");
for(i=0; opts[i].short_opt; i++ ) {
+ s = opts[i].description;
+ if( s && *s== '\r' ) /* hide this line */
+ continue;
if( opts[i].short_opt < 256 )
printf(" -%c", opts[i].short_opt );
else
@@ -376,7 +382,7 @@ show_help( ARGPARSE_OPTS *opts, unsigned flags )
opts[i].long_opt );
for(;j < indent; j++ )
putchar(' ');
- if( (s = opts[i].description) ) {
+ if( s ) {
for(; *s; s++ ) {
if( *s == '\n' ) {
if( s[1] ) {
@@ -398,6 +404,10 @@ show_help( ARGPARSE_OPTS *opts, unsigned flags )
putchar('\n');
fputs(s, stdout);
}
+ if( *(s=strusage(30)) ) { /* special notes */
+ putchar('\n');
+ fputs(s, stdout);
+ }
fflush(stdout);
exit(0);
}
@@ -497,7 +507,7 @@ default_strusage( int level )
"it under the terms of the GNU General Public License as published by\n"
"the Free Software Foundation; either version 2 of the License, or\n"
"(at your option) any later version.\n\n"
- "WkLib is distributed in the hope that it will be useful,\n"
+ "It is distributed in the hope that it will be useful,\n"
"but WITHOUT ANY WARRANTY; without even the implied warranty of\n"
"MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the\n"
"GNU General Public License for more details.\n\n"
@@ -537,6 +547,7 @@ default_strusage( int level )
p = "UnknownOS";
#endif
break;
+ case 30: p = ""; break;
case 31: p =
"This program comes with ABSOLUTELY NO WARRANTY.\n"
"This is free software, and you are welcome to redistribute it\n"
diff --git a/util/memory.c b/util/memory.c
index 6ad57f9b0..683f042d6 100644
--- a/util/memory.c
+++ b/util/memory.c
@@ -63,10 +63,10 @@ const void membug( const char *fmt, ... );
#define FNAME(a) m_ ##a
#define FNAMEPRT
#define FNAMEARG
- #define store_len(p,n,m) do { ((byte*))p[0] = n; \
- ((byte*))p[2] = n >> 8 ; \
- ((byte*))p[3] = n >> 16 ; \
- ((byte*))p[4] = m? MAGIC_SEC_BYTE \
+ #define store_len(p,n,m) do { ((byte*)p)[0] = n; \
+ ((byte*)p)[1] = n >> 8 ; \
+ ((byte*)p)[2] = n >> 16 ; \
+ ((byte*)p)[3] = m? MAGIC_SEC_BYTE \
: MAGIC_NOR_BYTE; \
} while(0)
#endif
@@ -213,8 +213,6 @@ check_mem( const byte *p, const char *info )
membug("memory at %p corrupted: underflow=%02x (%s)\n", p+4, p[3], info );
if( p[4+e->user_n] != MAGIC_END_BYTE )
membug("memory at %p corrupted: overflow=%02x (%s)\n", p+4, p[4+e->user_n], info );
- if( e->info->count > 20000 )
- membug("memory at %p corrupted: count too high (%s)\n", p+4, info );
return e;
}
@@ -444,9 +442,9 @@ m_size( const void *a )
#ifdef M_DEBUG
n = check_mem(p-4, "m_size")->user_n;
#else
- n = ((byte*)p[-4];
- n |= ((byte*)p[-3] << 8;
- n |= ((byte*)p[-2] << 16;
+ n = ((byte*)p)[-4];
+ n |= ((byte*)p)[-3] << 8;
+ n |= ((byte*)p)[-2] << 16;
#endif
return n;
}