Index: Makefile ================================================================== --- Makefile +++ Makefile @@ -14,12 +14,13 @@ filed: filed.o $(CC) $(CFLAGS) $(LDFLAGS) -o "$@" $^ $(LIBS) filed.o: filed.c filed-mime-types.h -filed-mime-types.h: generate-mime-types - ./generate-mime-types "$(MIMETYPES)" > filed-mime-types.h.new +filed-mime-types.h: generate-mime-types mime.types + ./generate-mime-types "$(MIMETYPES)" > filed-mime-types.h.new || \ + ./generate-mime-types mime.types > filed-mime-types.h.new mv filed-mime-types.h.new filed-mime-types.h install: filed filed.1 test -d "$(DESTDIR)$(mandir)/man1" || mkdir -p "$(DESTDIR)$(mandir)/man1" test -d "$(DESTDIR)$(bindir)" || mkdir -p "$(DESTDIR)$(bindir)" Index: generate-mime-types ================================================================== --- generate-mime-types +++ generate-mime-types @@ -42,13 +42,23 @@ return $retval } # Read contents of mime types file -set fd [open $mimeinfofile] -set mimeinfo [read $fd] -close $fd +catch { + set fd [open $mimeinfofile] + set mimeinfo [read $fd] + close $fd +} + +if {![info exists mimeinfo]} { + puts stderr "Not using $mimeinfofile, unreadable." + + exit 1 +} + +puts stderr "Using $mimeinfofile as mime.types" # Parse into type and extensions pairs foreach line [split $mimeinfo "\n"] { regsub {#.*} $line {} line set line [string trim $line] ADDED mime.types Index: mime.types ================================================================== --- /dev/null +++ mime.types @@ -0,0 +1,5 @@ +text/html html htm +test/plain txt text +video/mp4 mp4 mpg4 +audio/mpeg mp3 mpg3 +application/zip zip