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