diff options
-rw-r--r-- | src/hyper/Makefile.in | 19 | ||||
-rw-r--r-- | src/hyper/htadd.c | 28 | ||||
-rw-r--r-- | src/include/cfuns.h | 3 | ||||
-rw-r--r-- | src/include/sockio.h | 3 | ||||
-rw-r--r-- | src/lib/cfuns-c.c | 10 |
5 files changed, 38 insertions, 25 deletions
diff --git a/src/hyper/Makefile.in b/src/hyper/Makefile.in index 1e9d22b1..cc8b1d1b 100644 --- a/src/hyper/Makefile.in +++ b/src/hyper/Makefile.in @@ -131,17 +131,20 @@ distclean-local: clean-local ${HYPER}/pages/ht.db: $(HTADD) $(srcdir)/pages/*.ht $(srcdir)/pages/*.pht @echo making ${HYPER}/pages from $(axiom_src_srcdir)/pages directory - @ mkdir -p ${HYPER}/pages - @ cp -pr $(srcdir)/pages/*.ht ${HYPER}/pages - @ for A in `ls $(srcdir)/pages/*.pht`; do \ + @ mkdir -p "${HYPER}"/pages + @ cp -pr "$(srcdir)"/pages/*.ht "${HYPER}"/pages + @ for A in `ls "$(srcdir)"/pages/*.pht`; do \ sed 's,/doc/viewports/,/share/viewports/,g' $$A \ > ${HYPER}/pages/`basename $$A`; \ done - @ rm -f ${HYPER}/pages/ht.db ; \ - rm -f ${HYPER}/pages/*~ ; AXIOM=$(AXIOM) \ - ${HTADD} -s ${HYPER}/pages/*.ht ${HYPER}/pages/*.pht || exit 1 - @ cp -pr $(srcdir)/bitmaps ${HYPER} - @ cp -pr $(srcdir)/viewports $(axiom_target_datadir) + @ rm -f "${HYPER}"/pages/ht.db + @ rm -f "${HYPER}"/pages/*~ + for f in `ls "${HYPER}"/pages/*.ht "${HYPER}"/pages/*.pht`; do \ + AXIOM="$(AXIOM)" $(HTADD) -s $$f || exit 1; done + @ mkdir -p "$(HYPER)"/bimaps + @ for f in `ls "$(srcdir)"/bitmaps/*.bitmap "$(srcdir)"/bitmaps/*.xbm`; do\ + cp -p $$f "$(HYPER)"/bitmaps; done + @ # cp -pr "$(srcdir)"/viewports "$(axiom_target_datadir)" ${OUTLIB}/htsearch: htsearch diff --git a/src/hyper/htadd.c b/src/hyper/htadd.c index c08ced6f..f08a6205 100644 --- a/src/hyper/htadd.c +++ b/src/hyper/htadd.c @@ -132,26 +132,26 @@ parse_args(char **argv, char *db_dir, char **filenames, short *fl) *fl = 0; while (*++argv) { - if (!strcmp(*argv, "-d")) + if (strcmp(*argv, "-d") == 0) *fl |= Delete; - else if (!strcmp(*argv, "-s")) { + else if (strcmp(*argv, "-s") == 0) { if (*fl & Current || *fl & Named) { fprintf(stderr, "%s\n", usage); exit(-1); } *fl |= System; } - else if (!strcmp(*argv, "-n")) { + else if (strcmp(*argv, "-n") == 0) { fresh = 1; } - else if (!strcmp(*argv, "-l")) { + else if (strcmp(*argv, "-l") == 0) { if (*fl & System || *fl & Named) { fprintf(stderr, "%s\n", usage); exit(-1); } *fl |= Current; } - else if (!strcmp(*argv, "-f")) { + else if (strcmp(*argv, "-f") == 0) { if (*fl & System || *fl & Current) { fprintf(stderr, "%s\n", usage); exit(-1); @@ -181,6 +181,7 @@ build_db_filename(short flag, char *db_dir, char *dbfilename) { int ret_status; char *SPAD; + struct stat buff; char path[256]; @@ -204,16 +205,23 @@ build_db_filename(short flag, char *db_dir, char *dbfilename) } /* fprintf(stderr,"htadd:build_db_filename:dbfilename=%s\n",dbfilename);*/ /* Now see if I can write to the file */ - ret_status = writeablep (dbfilename); + errno = 0; + ret_status = stat(dbfilename, &buff); if (ret_status == -1) { - perror("build_db_file"); - exit(-1); + if (errno == ENOENT) + /* If the file does not exist, check the path. */ + ret_status = stat(path, &buff); + if (ret_status == -1) { + perror("build_db_file"); + exit(1); + } } - else if (ret_status > 0) + + if (writeablep(dbfilename) != 0) return 1; fprintf(stderr, "build_db_filename: Database file name is not writable\n"); - exit(-1); + exit(1); return 0; } diff --git a/src/include/cfuns.h b/src/include/cfuns.h index 21f5d037..3ad83197 100644 --- a/src/include/cfuns.h +++ b/src/include/cfuns.h @@ -54,5 +54,8 @@ OPENAXIOM_EXPORT char* oa_getenv(const char*); OPENAXIOM_EXPORT char* oa_getcwd(void); OPENAXIOM_EXPORT int oa_access_file_for_read(const char*); OPENAXIOM_EXPORT const char* oa_get_tmpdir(void); +OPENAXIOM_EXPORT double plus_infinity(void); +OPENAXIOM_EXPORT double minus_infinity(void); +OPENAXIOM_EXPORT double NANQ(void); #endif /* OPENAXIOM_CFUNS_included */ diff --git a/src/include/sockio.h b/src/include/sockio.h index 652e0bda..8efc2347 100644 --- a/src/include/sockio.h +++ b/src/include/sockio.h @@ -103,9 +103,6 @@ OPENAXIOM_EXPORT double get_float(openaxiom_sio*); OPENAXIOM_EXPORT double sock_get_float(int); OPENAXIOM_EXPORT int get_sfloats(openaxiom_sio*, float*, int); OPENAXIOM_EXPORT char* get_string(openaxiom_sio*); -OPENAXIOM_EXPORT double plus_infinity(void); -OPENAXIOM_EXPORT double minus_infinity(void); -OPENAXIOM_EXPORT double NANQ(void); OPENAXIOM_EXPORT void sigpipe_handler(int); OPENAXIOM_EXPORT int fill_buf(openaxiom_sio*, openaxiom_byte*, int, const char*); diff --git a/src/lib/cfuns-c.c b/src/lib/cfuns-c.c index fe5380e8..ff78d8cf 100644 --- a/src/lib/cfuns-c.c +++ b/src/lib/cfuns-c.c @@ -524,16 +524,18 @@ oa_get_tmpdir(void) int bufsz = GetTempPath(0, NULL); if (bufsz == 0) { perror("oa_get_tmpdir"); - exit(-1); + exit(1); } else { + int new_size; buf = (char*) malloc(bufsz + 1); - if(GetTempPath(bufsz, buf) != bufsz) { + new_size = GetTempPath(bufsz, buf); + if(new_size = 0 || new_size >= bufsz) { perror("oa_get_tmpdir"); free(buf); - exit(-1); + exit(1); } - buf[bufsz] = '\0'; + buf[new_size] = '\0'; } return buf; #else |