THTTPD w/binfs: A few fixes

This commit is contained in:
Gregory Nutt 2015-06-02 11:55:45 -06:00
parent 09d002503e
commit 15fcf746be
3 changed files with 18 additions and 6 deletions

View File

@ -192,9 +192,7 @@ int thttp_main(int argc, char *argv[])
uint8_t mac[IFHWADDRLEN]; uint8_t mac[IFHWADDRLEN];
#endif #endif
char *thttpd_argv = "thttpd"; char *thttpd_argv = "thttpd";
#if defined(CONFIG_THTTPD_NXFLAT) || defined(CONFIG_NET_SLIP)
int ret; int ret;
#endif
/* Configure SLIP */ /* Configure SLIP */
@ -259,7 +257,7 @@ int thttp_main(int argc, char *argv[])
exit(1); exit(1);
} }
/* Mount the file system */ /* Mount the ROMFS file system */
printf("Mounting ROMFS filesystem at target=%s with source=%s\n", printf("Mounting ROMFS filesystem at target=%s with source=%s\n",
MOUNTPT, ROMFSDEV); MOUNTPT, ROMFSDEV);
@ -267,12 +265,24 @@ int thttp_main(int argc, char *argv[])
ret = mount(ROMFSDEV, MOUNTPT, "romfs", MS_RDONLY, NULL); ret = mount(ROMFSDEV, MOUNTPT, "romfs", MS_RDONLY, NULL);
if (ret < 0) if (ret < 0)
{ {
printf("ERROR: mount(%s,%s,romfs) failed: %s\n", printf("ERROR: mount(%s,%s,romfs) failed: %d\n",
ROMFSDEV, MOUNTPT, errno); ROMFSDEV, MOUNTPT, errno);
nxflat_uninitialize(); nxflat_uninitialize();
} }
#endif #endif
#ifdef CONFIG_THTTPD_BINFS
/* Mount the BINFS file system */
printf("Mounting BINFS filesystem at target=%s\n", MOUNTPT);
ret = mount(NULL, MOUNTPT, "binfs", MS_RDONLY, NULL);
if (ret < 0)
{
printf("ERROR: mount(NULL,%s,binfs) failed: %d\n", MOUNTPT, errno);
}
#endif
/* Start THTTPD. At present, symbol table info is passed via global variables */ /* Start THTTPD. At present, symbol table info is passed via global variables */
#ifdef CONFIG_THTTPD_NXFLAT #ifdef CONFIG_THTTPD_NXFLAT

View File

@ -157,7 +157,7 @@ endif
ifeq ($(CONFIG_THTTPD_BINFS),y) ifeq ($(CONFIG_THTTPD_BINFS),y)
$(BUILTIN_REGISTRY)$(DELIM)phf_main.bdat: $(DEPCONFIG) Makefile $(BUILTIN_REGISTRY)$(DELIM)phf_main.bdat: $(DEPCONFIG) Makefile
$(call REGISTER,phf,$(PRIORITY),$(STACKSIZE),php_main) $(call REGISTER,phf,$(PRIORITY),$(STACKSIZE),phf_main)
$(BUILTIN_REGISTRY)$(DELIM)redirect_main.bdat: $(DEPCONFIG) Makefile $(BUILTIN_REGISTRY)$(DELIM)redirect_main.bdat: $(DEPCONFIG) Makefile
$(call REGISTER,redirect,$(PRIORITY),$(STACKSIZE),redirect_main) $(call REGISTER,redirect,$(PRIORITY),$(STACKSIZE),redirect_main)

View File

@ -496,7 +496,7 @@ static void do_include(FILE *instream, char *vfilename, char *filename,
} }
static void do_echo(FILE *instream, char *vfilename, char *filename, static void do_echo(FILE *instream, char *vfilename, char *filename,
char *directive, char *tag, char *val) char *directive, char *tag, char *val)
{ {
char *cp; char *cp;
@ -551,6 +551,7 @@ static void do_echo(FILE *instream, char *vfilename, char *filename,
gettimeofday(&tm, NULL); gettimeofday(&tm, NULL);
show_time(tm.tv_sec, 1); show_time(tm.tv_sec, 1);
} }
#if 0 /* fstat is not yet supported */
else if (strcmp(val, "LAST_MODIFIED") == 0) else if (strcmp(val, "LAST_MODIFIED") == 0)
{ {
/* The last modification date of the current document. */ /* The last modification date of the current document. */
@ -560,6 +561,7 @@ static void do_echo(FILE *instream, char *vfilename, char *filename,
show_time(g_sb.st_mtime, 0); show_time(g_sb.st_mtime, 0);
} }
} }
#endif
else else
{ {
/* Try an environment variable. */ /* Try an environment variable. */