mirror of
https://github.com/Orc/discount.git
synced 2026-09-25 04:10:00 +03:00
(the return from notspecial() was reversed)
This commit is contained in:
+5
-1
@@ -22,7 +22,7 @@ OBJS=mkdio.o markdown.o dumptree.o generate.o \
|
||||
TESTFRAMEWORK=echo cols branch
|
||||
|
||||
# modules that markdown, makepage, mkd2html, &tc use
|
||||
COMMON=pgm_options.o gethopt.o
|
||||
COMMON=pgm_options.o gethopt.o notspecial.o
|
||||
|
||||
MAN3PAGES=mkd-callbacks.3 mkd-functions.3 markdown.3 mkd-line.3
|
||||
|
||||
@@ -104,6 +104,9 @@ makepage: makepage.c $(COMMON) $(MKDLIB) mkdio.h
|
||||
pgm_options.o: pgm_options.c mkdio.h config.h
|
||||
$(CC) $(CFLAGS) -I. -c pgm_options.c
|
||||
|
||||
notspecial.o: notspecial.c
|
||||
$(CC) $(CFLAGS) -I. -c notspecial.c
|
||||
|
||||
gethopt.o: gethopt.c
|
||||
$(CC) $(CFLAGS) -I. -c gethopt.c
|
||||
|
||||
@@ -159,3 +162,4 @@ setup.o: setup.c config.h cstring.h amalloc.h markdown.h
|
||||
github_flavoured.o: github_flavoured.c config.h cstring.h amalloc.h markdown.h
|
||||
gethopt.o: gethopt.c gethopt.h
|
||||
h1title.o: h1title.c markdown.h
|
||||
notspecial.o: notspecial.c config.h
|
||||
|
||||
@@ -112,6 +112,7 @@ AC_CHECK_BASENAME
|
||||
AC_CHECK_ALLOCA
|
||||
|
||||
AC_CHECK_HEADERS sys/types.h pwd.h && AC_CHECK_FUNCS getpwuid
|
||||
AC_CHECK_HEADERS sys/stat.h && AC_CHECK_FUNCS stat
|
||||
|
||||
if AC_CHECK_FUNCS srandom; then
|
||||
AC_DEFINE 'INITRNG(x)' 'srandom((unsigned int)x)'
|
||||
|
||||
+7
-3
@@ -41,6 +41,8 @@
|
||||
|
||||
char *pgm = "mkd2html";
|
||||
|
||||
extern int notspecial(char *filename);
|
||||
|
||||
#ifndef HAVE_BASENAME
|
||||
char *
|
||||
basename(char *path)
|
||||
@@ -154,9 +156,11 @@ char **argv;
|
||||
}
|
||||
strcpy(dest, source);
|
||||
|
||||
if (( dot = strrchr(dest, '.') ))
|
||||
*dot = 0;
|
||||
strcat(dest, ".html");
|
||||
if ( notspecial(dest) ) {
|
||||
if (( dot = strrchr(dest, '.') ))
|
||||
*dot = 0;
|
||||
strcat(dest, ".html");
|
||||
}
|
||||
|
||||
if ( (output = fopen(dest, "w")) == 0 )
|
||||
fail("can't write to %s", dest);
|
||||
|
||||
+3
-3
@@ -15,14 +15,14 @@ notspecial(char *file)
|
||||
struct stat info;
|
||||
|
||||
if ( stat(file, &info) != 0 )
|
||||
return 0;
|
||||
return 1;
|
||||
|
||||
return (info.st_flags & (S_IFIFO|S_IFCHR|S_IFSOCK));
|
||||
return !(info.st_flags & (S_IFIFO|S_IFCHR|S_IFSOCK));
|
||||
}
|
||||
#else
|
||||
int
|
||||
notspecial(char *file)
|
||||
{
|
||||
return 0;
|
||||
return 1;
|
||||
}
|
||||
#endif
|
||||
|
||||
@@ -53,6 +53,7 @@ struct stat *infop = 0;
|
||||
extern char* mkd_h1_title(MMIOT*);
|
||||
#endif
|
||||
|
||||
extern int notspecial(char *filename);
|
||||
|
||||
#define INTAG 0x01
|
||||
#define INHEAD 0x02
|
||||
@@ -626,10 +627,11 @@ char **argv;
|
||||
}
|
||||
}
|
||||
if ( output && strcmp(output, "-") ) {
|
||||
if ( force )
|
||||
if ( force && notspecial(output) )
|
||||
unlink(output);
|
||||
if ( !freopen(output, "w", stdout) )
|
||||
if ( !freopen(output, "w", stdout) ) {
|
||||
fail("can't write to %s", output);
|
||||
}
|
||||
}
|
||||
|
||||
if ( !pagename )
|
||||
|
||||
Reference in New Issue
Block a user