projects
/
mmh
/ blobdiff
commit
grep
author
committer
pickaxe
?
search:
re
summary
|
shortlog
|
log
|
commit
|
commitdiff
|
tree
raw
|
inline
| side by side
Adjust the tests to less tolerant m_getfld2()
[mmh]
/
sbr
/
fmt_new.c
diff --git
a/sbr/fmt_new.c
b/sbr/fmt_new.c
index
e71b8d0
..
9a7988e
100644
(file)
--- a/
sbr/fmt_new.c
+++ b/
sbr/fmt_new.c
@@
-10,6
+10,7
@@
#include <h/utils.h>
#include <unistd.h>
#include <sys/stat.h>
#include <h/utils.h>
#include <unistd.h>
#include <sys/stat.h>
+#include <sysexits.h>
static char *formats = NULL;
static char *formats = NULL;
@@
-26,7
+27,7
@@
char *
new_fs(char *form, char *def_form)
{
struct stat st;
new_fs(char *form, char *def_form)
{
struct stat st;
- register FILE *fp;
+ FILE *fp;
if (formats) {
free(formats);
if (formats) {
free(formats);
@@
-37,14
+38,14
@@
new_fs(char *form, char *def_form)
formats = getcpy(form+1);
} else {
if ((fp = fopen(etcpath(form), "r")) == NULL) {
formats = getcpy(form+1);
} else {
if ((fp = fopen(etcpath(form), "r")) == NULL) {
- adios(form, "unable to open format file");
+ adios(EX_IOERR, form, "unable to open format file");
}
if (fstat(fileno(fp), &st) == -1) {
}
if (fstat(fileno(fp), &st) == -1) {
- adios(form, "unable to stat format file");
+ adios(EX_IOERR, form, "unable to stat format file");
}
formats = mh_xmalloc((size_t) st.st_size + 1);
if (read(fileno(fp), formats, (int)st.st_size) != st.st_size) {
}
formats = mh_xmalloc((size_t) st.st_size + 1);
if (read(fileno(fp), formats, (int)st.st_size) != st.st_size) {
- adios(form, "error reading format file");
+ adios(EX_IOERR, form, "error reading format file");
}
formats[st.st_size] = '\0';
fclose(fp);
}
formats[st.st_size] = '\0';
fclose(fp);
@@
-54,14
+55,14
@@
new_fs(char *form, char *def_form)
formats = getcpy(def_form+1);
} else {
if ((fp = fopen(etcpath(def_form), "r")) == NULL) {
formats = getcpy(def_form+1);
} else {
if ((fp = fopen(etcpath(def_form), "r")) == NULL) {
- adios(def_form, "unable to open format file");
+ adios(EX_IOERR, def_form, "unable to open format file");
}
if (fstat(fileno(fp), &st) == -1) {
}
if (fstat(fileno(fp), &st) == -1) {
- adios(def_form, "unable to stat format file");
+ adios(EX_IOERR, def_form, "unable to stat format file");
}
formats = mh_xmalloc((size_t) st.st_size + 1);
if (read(fileno(fp), formats, (int)st.st_size) != st.st_size) {
}
formats = mh_xmalloc((size_t) st.st_size + 1);
if (read(fileno(fp), formats, (int)st.st_size) != st.st_size) {
- adios(def_form, "error reading format file");
+ adios(EX_IOERR, def_form, "error reading format file");
}
formats[st.st_size] = '\0';
fclose(fp);
}
formats[st.st_size] = '\0';
fclose(fp);