Skip to content

Instantly share code, notes, and snippets.

@9re
Created February 7, 2013 07:22
Show Gist options
  • Save 9re/4729176 to your computer and use it in GitHub Desktop.
Save 9re/4729176 to your computer and use it in GitHub Desktop.
iscntrl() in bionic (Android's libc)
#include <stdio.h>
#include <string.h>
#include <android/log.h>
#define LOGV(...) __android_log_print(ANDROID_LOG_VERBOSE,LOG_TAG,__VA_ARGS__)
void test(void) {
char log_line[256];
char buff[8];
int i = 0;
while (i < 0x100) {
memset((void *)log_line, 0, 256);
char *ptr = log_line;
sprintf(buff, "0x%02x | ", i);
strcpy(ptr, buff);
ptr = log_line + strlen(log_line);
for (int j = 0; j < 8; ++j) {
sprintf(buff, "%02d ", iscntrl(i));
++i;
strcpy(ptr, buff);
ptr = log_line + strlen(log_line);
}
LOGV(log_line);
}
}
0x00 | 32 32 32 32 32 32 32 32
0x08 | 32 32 32 32 32 32 32 32
0x10 | 32 32 32 32 32 32 32 32
0x18 | 32 32 32 32 32 32 32 32
0x20 | 00 00 00 00 00 00 00 00
0x28 | 00 00 00 00 00 00 00 00
0x30 | 00 00 00 00 00 00 00 00
0x38 | 00 00 00 00 00 00 00 00
0x40 | 00 00 00 00 00 00 00 00
0x48 | 00 00 00 00 00 00 00 00
0x50 | 00 00 00 00 00 00 00 00
0x58 | 00 00 00 00 00 00 00 00
0x60 | 00 00 00 00 00 00 00 00
0x68 | 00 00 00 00 00 00 00 00
0x70 | 00 00 00 00 00 00 00 00
0x78 | 00 00 00 00 00 00 00 32
0x80 | 32 32 32 32 32 32 32 32
0x88 | 32 32 32 32 32 32 32 32
0x90 | 32 32 32 32 32 32 32 32
0x98 | 32 32 32 32 32 32 32 32
0xa0 | 00 00 00 00 00 00 00 00
0xa8 | 00 00 00 00 00 00 00 00
0xb0 | 00 00 00 00 00 00 00 00
0xb8 | 00 00 00 00 00 00 00 00
0xc0 | 00 00 00 00 00 00 00 00
0xc8 | 00 00 00 00 00 00 00 00
0xd0 | 00 00 00 00 00 00 00 00
0xd8 | 00 00 00 00 00 00 00 00
0xe0 | 00 00 00 00 00 00 00 00
0xe8 | 00 00 00 00 00 00 00 00
0xf0 | 00 00 00 00 00 00 00 00
0xf8 | 00 00 00 00 00 00 00 00
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment