Improve example
This commit is contained in:
parent
2ac92827bc
commit
b269c243c8
2 changed files with 12 additions and 4 deletions
|
|
@ -15,6 +15,8 @@ int main(int argc, char** argv) {
|
|||
c[0] = 0;
|
||||
|
||||
while(fread(&b, 1, 1, stdin) == 1) {
|
||||
int n;
|
||||
|
||||
if(b == '\n') {
|
||||
} else if(b != '\r') {
|
||||
int l = strlen(c);
|
||||
|
|
@ -26,10 +28,16 @@ int main(int argc, char** argv) {
|
|||
}
|
||||
|
||||
i = 0;
|
||||
while((strlen(c) - i) > 0 && (i += cl2knj(ctx, (u_char*)c + i, strlen(c) - i, (u_char*)out))) {
|
||||
STDYOUT* s = (STDYOUT*)out;
|
||||
while((strlen(c) - i) > 0 && (i += (n = cl2knj(ctx, (u_char*)c + i, strlen(c) - i, (u_char*)out)))) {
|
||||
STDYOUT* s = (STDYOUT*)out;
|
||||
char* str = malloc(n + 1);
|
||||
|
||||
printf("> %s\n", out + sizeof(STDYOUT));
|
||||
memcpy(str, c + i - n, n);
|
||||
str[i] = 0;
|
||||
|
||||
printf("> %s -> %s\n", str, out + sizeof(STDYOUT));
|
||||
|
||||
free(str);
|
||||
}
|
||||
|
||||
c[0] = 0;
|
||||
|
|
|
|||
|
|
@ -2,4 +2,4 @@
|
|||
while [ ! -d .git ]; do
|
||||
cd ..
|
||||
done
|
||||
clang-format --verbose -i `find src lib include "(" -name "*.c" -or -name "*.h" ")" -and -not -name ucstable.h -and -not -name maindic.c`
|
||||
clang-format --verbose -i `find src lib include "(" -name "*.c" -or -name "*.h" ")" -and -not -name ucstable.h -and -not -name maindic"*".c`
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue