more free_nhfile() will already call init_nhfile()
This commit is contained in:
+10
-9
@@ -80,12 +80,17 @@ static int length_without_val(const char *user_string, int len);
|
|||||||
static void usage(int argc, char **argv);
|
static void usage(int argc, char **argv);
|
||||||
static const char *briefname(const char *fnam);
|
static const char *briefname(const char *fnam);
|
||||||
|
|
||||||
void init_nhfile(NHFILE *);
|
extern void init_nhfile(NHFILE *); /* files.c */
|
||||||
NHFILE *new_nhfile(void);
|
extern NHFILE *new_nhfile(void); /* files.c */
|
||||||
void free_nhfile(NHFILE *);
|
extern void free_nhfile(NHFILE *); /* files.c */
|
||||||
void my_close_nhfile(NHFILE *);
|
|
||||||
|
/*
|
||||||
|
* This is a replacement tempered down version of same-named
|
||||||
|
* function in files.c within #ifndef SFCTOOL blocks.
|
||||||
|
*/
|
||||||
int delete_savefile(void);
|
int delete_savefile(void);
|
||||||
int nhclose(int fd);
|
|
||||||
|
// int nhclose(int fd);
|
||||||
int util_strncmpi(const char *s1, const char *s2, size_t sz);
|
int util_strncmpi(const char *s1, const char *s2, size_t sz);
|
||||||
|
|
||||||
#ifdef UNIX
|
#ifdef UNIX
|
||||||
@@ -462,7 +467,6 @@ open_srcfile(const char *fnam, enum saveformats mystyle)
|
|||||||
if (nhfp && nhfp->structlevel) {
|
if (nhfp && nhfp->structlevel) {
|
||||||
fd = open(fq_name, O_RDONLY | O_BINARY, 0);
|
fd = open(fq_name, O_RDONLY | O_BINARY, 0);
|
||||||
if (fd < 0) {
|
if (fd < 0) {
|
||||||
init_nhfile(nhfp);
|
|
||||||
free_nhfile(nhfp);
|
free_nhfile(nhfp);
|
||||||
fprintf(stderr,
|
fprintf(stderr,
|
||||||
"\nsfctool error - unable to open historical-style "
|
"\nsfctool error - unable to open historical-style "
|
||||||
@@ -482,7 +486,6 @@ open_srcfile(const char *fnam, enum saveformats mystyle)
|
|||||||
|
|
||||||
nhfp->fpdef = fopen(fnam, RDBMODE);
|
nhfp->fpdef = fopen(fnam, RDBMODE);
|
||||||
if (!nhfp->fpdef) {
|
if (!nhfp->fpdef) {
|
||||||
init_nhfile(nhfp);
|
|
||||||
free_nhfile(nhfp);
|
free_nhfile(nhfp);
|
||||||
fprintf(stderr,
|
fprintf(stderr,
|
||||||
"\nsfctool error - unable to open fieldlevel-style "
|
"\nsfctool error - unable to open fieldlevel-style "
|
||||||
@@ -577,7 +580,6 @@ create_dstfile(char *fnam, enum saveformats mystyle)
|
|||||||
fd = creat(dstfnam, FCMASK);
|
fd = creat(dstfnam, FCMASK);
|
||||||
#endif
|
#endif
|
||||||
if (fd < 0) {
|
if (fd < 0) {
|
||||||
init_nhfile(nhfp);
|
|
||||||
free_nhfile(nhfp);
|
free_nhfile(nhfp);
|
||||||
fprintf(
|
fprintf(
|
||||||
stderr,
|
stderr,
|
||||||
@@ -594,7 +596,6 @@ create_dstfile(char *fnam, enum saveformats mystyle)
|
|||||||
fq_name = fqname(dstfnam, SAVEPREFIX, 0);
|
fq_name = fqname(dstfnam, SAVEPREFIX, 0);
|
||||||
nhfp->fpdef = fopen(fq_name, WRBMODE);
|
nhfp->fpdef = fopen(fq_name, WRBMODE);
|
||||||
if (!nhfp->fpdef) {
|
if (!nhfp->fpdef) {
|
||||||
init_nhfile(nhfp);
|
|
||||||
free_nhfile(nhfp);
|
free_nhfile(nhfp);
|
||||||
fprintf(
|
fprintf(
|
||||||
stderr,
|
stderr,
|
||||||
|
|||||||
Reference in New Issue
Block a user