mirror of
https://github.com/cathugger/mkp224o.git
synced 2025-01-09 11:07:19 -03:00
delet trailing whitespace
This commit is contained in:
parent
cf5ac5f929
commit
ebe1d5b678
5 changed files with 12 additions and 12 deletions
2
base64.h
2
base64.h
|
@ -10,4 +10,4 @@ size_t base64_from(u8 *dst,const char *src,size_t slen);
|
||||||
// returns 1 if whole string is good, 0 if string contains invalid data
|
// returns 1 if whole string is good, 0 if string contains invalid data
|
||||||
int base64_valid(const char *src,size_t *count);
|
int base64_valid(const char *src,size_t *count);
|
||||||
// aligns data length to something base64 can represent without padding
|
// aligns data length to something base64 can represent without padding
|
||||||
#define BASE64_DATA_ALIGN(l) (((l + 2) / 3) * 3)
|
#define BASE64_DATA_ALIGN(l) ((((l) + 2) / 3) * 3)
|
||||||
|
|
|
@ -45,6 +45,6 @@ int main(void)
|
||||||
//fprintf(stderr, "%s -- %s\n", buf2, tests0[i].rev);
|
//fprintf(stderr, "%s -- %s\n", buf2, tests0[i].rev);
|
||||||
assert(strcmp(buf2, tests0[i].rev) == 0);
|
assert(strcmp(buf2, tests0[i].rev) == 0);
|
||||||
}
|
}
|
||||||
|
|
||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
|
|
|
@ -23,7 +23,7 @@ struct texttestcase {
|
||||||
|
|
||||||
/*
|
/*
|
||||||
r:0, mask:FF
|
r:0, mask:FF
|
||||||
--
|
--
|
||||||
r:2, mask:C0
|
r:2, mask:C0
|
||||||
f -- f
|
f -- f
|
||||||
r:3, mask:F0
|
r:3, mask:F0
|
||||||
|
@ -75,10 +75,10 @@ int main(void)
|
||||||
//fprintf(stderr, "%s -- %s\n", buf2, tests0[i].rev);
|
//fprintf(stderr, "%s -- %s\n", buf2, tests0[i].rev);
|
||||||
assert(strcmp(buf2, tests0[i].rev) == 0);
|
assert(strcmp(buf2, tests0[i].rev) == 0);
|
||||||
}
|
}
|
||||||
|
|
||||||
//randombytes_buf(buf, 128);
|
//randombytes_buf(buf, 128);
|
||||||
//base32_to(buf2, (const u8 *)buf, 128);
|
//base32_to(buf2, (const u8 *)buf, 128);
|
||||||
//fprintf(stderr, ">%s\n", buf2);
|
//fprintf(stderr, ">%s\n", buf2);
|
||||||
|
|
||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
|
|
|
@ -61,6 +61,6 @@ int main(void)
|
||||||
fprintf(stderr, "expected: %s got %s\n", str1, str2);
|
fprintf(stderr, "expected: %s got %s\n", str1, str2);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
|
|
12
yaml.c
12
yaml.c
|
@ -139,17 +139,17 @@ int yamlin_parseandcreate(FILE *fin,char *sname,const char *hostname)
|
||||||
while (!feof(fin) && !ferror(fin)) {
|
while (!feof(fin) && !ferror(fin)) {
|
||||||
if (!fgets(line,sizeof(line),fin))
|
if (!fgets(line,sizeof(line),fin))
|
||||||
break;
|
break;
|
||||||
|
|
||||||
len = strlen(line);
|
len = strlen(line);
|
||||||
|
|
||||||
// trim whitespace from the end
|
// trim whitespace from the end
|
||||||
while (len != 0 && (line[len-1] == ' ' || line[len-1] == '\n' || line[len-1] == '\r'))
|
while (len != 0 && (line[len-1] == ' ' || line[len-1] == '\n' || line[len-1] == '\r'))
|
||||||
line[--len] = '\0';
|
line[--len] = '\0';
|
||||||
|
|
||||||
// skip empty lines
|
// skip empty lines
|
||||||
if (len == 0)
|
if (len == 0)
|
||||||
continue;
|
continue;
|
||||||
|
|
||||||
if (len >= 3 && line[0] == '-' && line[1] == '-' && line[2] == '-') {
|
if (len >= 3 && line[0] == '-' && line[1] == '-' && line[2] == '-') {
|
||||||
// end of document indicator
|
// end of document indicator
|
||||||
if (!skipthis && (hashost || haspub || hassec)) {
|
if (!skipthis && (hashost || haspub || hassec)) {
|
||||||
|
@ -159,10 +159,10 @@ int yamlin_parseandcreate(FILE *fin,char *sname,const char *hostname)
|
||||||
hashost = haspub = hassec = skipthis = 0;
|
hashost = haspub = hassec = skipthis = 0;
|
||||||
continue;
|
continue;
|
||||||
}
|
}
|
||||||
|
|
||||||
if (skipthis)
|
if (skipthis)
|
||||||
continue;
|
continue;
|
||||||
|
|
||||||
char *start = line;
|
char *start = line;
|
||||||
// trim whitespace
|
// trim whitespace
|
||||||
while (len != 0 && *start == ' ') {
|
while (len != 0 && *start == ' ') {
|
||||||
|
|
Loading…
Reference in a new issue