errno=0 before
This commit is contained in:
parent
0039d6d297
commit
bfffbde238
@ -213,9 +213,14 @@ catch:
|
||||
recatch:
|
||||
kjv_(&kjv);
|
||||
finally:
|
||||
printf("kjv: %s.\n", kjv_to_string(&kjv));
|
||||
printf("kjv: closedir errno %d\n", errno);
|
||||
if(dir) { if(closedir(dir)) { dir = 0; goto recatch; } dir = 0; }
|
||||
printf("kjv: is_in_kjv errno %d\n", errno);
|
||||
if(is_in_kjv && (is_in_kjv = 0, chdir("..") == -1)) goto recatch;
|
||||
printf("kjv: ~text(backing) errno %d\n", errno);
|
||||
text_(&backing);
|
||||
printf("kjv: %p errno %d\n", (void *)&kjv, errno);
|
||||
return kjv;
|
||||
}
|
||||
|
||||
|
@ -187,10 +187,12 @@ int main(void) {
|
||||
errno = 0;
|
||||
struct journal j;
|
||||
struct journal_iterator it;
|
||||
printf("1. kjv\n");
|
||||
struct kjv bible = kjv();
|
||||
if(errno) goto catch;
|
||||
if(errno) { printf("kjv?\n"); goto catch; }
|
||||
union date32 k;
|
||||
const char *v;
|
||||
printf("2. journal\n");
|
||||
j = journal();
|
||||
if(errno) goto catch;
|
||||
fprintf(stderr, "Journal: %s.\n", journal_to_string(&j));
|
||||
@ -219,6 +221,7 @@ catch:
|
||||
success = EXIT_FAILURE;
|
||||
perror("journal");
|
||||
finally:
|
||||
kjv_(&bible);
|
||||
journal_(&j);
|
||||
return success;
|
||||
}
|
||||
|
@ -42,6 +42,6 @@ finally:
|
||||
}
|
||||
|
||||
struct text text(void) { struct text text; text.a = char_array(); return text; }
|
||||
void text_(struct text *const text) { char_array_(&text->a); }
|
||||
void text_(struct text *const text) { printf("~text: errno %d text.a.data %p\n", errno, (void *)text->a.data); char_array_(&text->a); printf("~text: errno %d\n", errno); }
|
||||
char *text_append_file(struct text *text, const char *const fn)
|
||||
{ return append_file(&text->a, fn); }
|
||||
|
@ -6,7 +6,7 @@
|
||||
#include <errno.h>
|
||||
|
||||
int main(void) {
|
||||
errno = 0;
|
||||
errno = 0; /* `errno` is not set correctly to 0 in some debug situations. */
|
||||
struct journal j = journal();
|
||||
int success = EXIT_SUCCESS;
|
||||
if(errno) goto catch;
|
||||
|
@ -1,12 +1,13 @@
|
||||
#define KJV_TEST
|
||||
#include "../src/kjv.h"
|
||||
#include <stdio.h>
|
||||
#include <inttypes.h> /* C99 */
|
||||
#include <stdlib.h>
|
||||
#include <assert.h>
|
||||
#include <errno.h>
|
||||
|
||||
int main(void) {
|
||||
int success = EXIT_SUCCESS;
|
||||
errno = 0; /* `errno` is not set correctly to 0 in some debug situations. */
|
||||
struct kjv k = kjv();
|
||||
fprintf(stderr, "%zu total words, %s.\n", k.words.total, kjv_to_string(&k));
|
||||
if(!kjv_is_valid(&k)) goto catch;
|
||||
|
@ -7,7 +7,7 @@
|
||||
|
||||
int main(void) {
|
||||
int success = EXIT_SUCCESS;
|
||||
errno = 0;
|
||||
errno = 0; /* `errno` is not set correctly to 0 in some debug situations. */
|
||||
struct journal j = journal();
|
||||
struct sources s = sources(&j);
|
||||
if(errno) goto catch;
|
||||
|
@ -1,11 +1,13 @@
|
||||
#include "../src/text.h"
|
||||
#include <stdlib.h>
|
||||
#include <stdio.h>
|
||||
#include <errno.h>
|
||||
|
||||
int main(void) {
|
||||
struct text t = text();
|
||||
char *content;
|
||||
int success = EXIT_SUCCESS;
|
||||
errno = 0; /* `errno` is not set correctly to 0 in some debug situations. */
|
||||
if(!(content = text_append_file(&t, "Makefile"))) goto catch;
|
||||
printf("%s", content);
|
||||
goto finally;
|
||||
|
Loading…
Reference in New Issue
Block a user