aboutsummaryrefslogtreecommitdiff
path: root/src/hyper
diff options
context:
space:
mode:
Diffstat (limited to 'src/hyper')
-rw-r--r--src/hyper/Makefile.in19
-rw-r--r--src/hyper/htadd.c28
2 files changed, 29 insertions, 18 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;
}