Skip to content

Commit

Permalink
[libc] Add isprint()
Browse files Browse the repository at this point in the history
Signed-off-by: Michael Brown <mcb30@ipxe.org>
  • Loading branch information
mcb30 committed Jan 6, 2014
1 parent bf15737 commit a4e8ef7
Show file tree
Hide file tree
Showing 2 changed files with 3 additions and 3 deletions.
5 changes: 2 additions & 3 deletions src/core/debug.c
Expand Up @@ -22,6 +22,7 @@ FILE_LICENCE ( GPL2_OR_LATER );
#include <stdio.h>
#include <stdint.h>
#include <stdarg.h>
#include <ctype.h>
#include <ipxe/console.h>

/**
Expand Down Expand Up @@ -96,9 +97,7 @@ static void dbg_hex_dump_da_row ( unsigned long dispaddr, const void *data,
continue;
}
byte = bytes[i];
if ( ( byte < 0x20 ) || ( byte >= 0x7f ) )
byte = '.';
dbg_printf ( "%c", byte );
dbg_printf ( "%c", ( isprint ( byte ) ? byte : '.' ) );
}
dbg_printf ( "\n" );
}
Expand Down
1 change: 1 addition & 0 deletions src/include/ctype.h
Expand Up @@ -12,6 +12,7 @@ FILE_LICENCE ( GPL2_OR_LATER );
#define islower(c) ((c) >= 'a' && (c) <= 'z')
#define isupper(c) ((c) >= 'A' && (c) <= 'Z')
#define isxdigit(c) (isdigit(c) || ((c) >= 'A' && (c) <= 'F') || ((c) >= 'a' && (c) <= 'f'))
#define isprint(c) ((c) >= ' ' && (c) <= '~' )

static inline unsigned char tolower(unsigned char c)
{
Expand Down

0 comments on commit a4e8ef7

Please sign in to comment.