[Reproducible-commits] [discount] 32/121: Imported Upstream version 2.1.0

Jérémy Bobbio lunar at moszumanska.debian.org
Tue Sep 23 20:56:14 UTC 2014


This is an automated email from the git hooks/post-receive script.

lunar pushed a commit to branch pu/reproducible_builds
in repository discount.

commit 53750f4b7a2ba3bbf27549c33542562f3cbea20a
Author: Alessandro Ghedini <al3xbio at gmail.com>
Date:   Wed Jul 13 20:34:30 2011 +0200

    Imported Upstream version 2.1.0
---
 Makefile.in             |  27 +++++--
 VERSION                 |   2 +-
 configure.inc           | 170 +++++++++++++++++++++++---------------------
 main.c                  | 131 +++++-----------------------------
 makepage.1              |  11 +++
 makepage.c              |  64 ++++++++++++++++-
 mkdio.h.in              |   1 +
 main.c => pgm_options.c | 184 ++++--------------------------------------------
 pgm_options.h           |   9 +++
 theme.1                 |  18 ++++-
 theme.c                 |   8 ++-
 11 files changed, 246 insertions(+), 379 deletions(-)

diff --git a/Makefile.in b/Makefile.in
index f5c64eb..53ec5e2 100644
--- a/Makefile.in
+++ b/Makefile.in
@@ -22,14 +22,14 @@ MAN3PAGES=mkd-callbacks.3 mkd-functions.3 markdown.3 mkd-line.3
 
 all: $(PGMS) $(SAMPLE_PGMS) $(TESTFRAMEWORK)
 
-install: $(PGMS)
+install: $(PGMS) $(DESTDIR)/$(BINDIR) $(DESTDIR)/$(LIBDIR) $(DESTDIR)/$(INCDIR)
 	@INSTALL_PROGRAM@ $(PGMS) $(DESTDIR)/$(BINDIR)
 	./librarian.sh install libmarkdown VERSION $(DESTDIR)/$(LIBDIR)
 	@INSTALL_DATA@ mkdio.h $(DESTDIR)/$(INCDIR)
 
 install.everything: install install.samples install.man
 
-install.samples: $(SAMPLE_PGMS) install
+install.samples: $(SAMPLE_PGMS) install $(DESTDIR)/$(BINDIR)
 	@INSTALL_PROGRAM@ $(SAMPLE_PGMS) $(DESTDIR)/$(BINDIR)
 	@INSTALL_DIR@ $(DESTDIR)/$(MANDIR)/man1
 	@INSTALL_DATA@ theme.1 makepage.1 mkd2html.1 $(DESTDIR)/$(MANDIR)/man1
@@ -53,12 +53,18 @@ install.man:
 
 install.everything: install install.man
 
+$(DESTDIR)/$(BINDIR):
+	@INSTALL_DIR@ $(DESTDIR)/$(BINDIR)
+
+$(DESTDIR)/$(INCDIR):
+	@INSTALL_DIR@ $(DESTDIR)/$(INCDIR)
+
+$(DESTDIR)/$(LIBDIR):
+	@INSTALL_DIR@ $(DESTDIR)/$(LIBDIR)
+
 version.o: version.c VERSION
 	$(CC) -DVERSION=\"`cat VERSION`\" -c version.c
 
-markdown: main.o $(MKDLIB)
-	$(CC) $(CFLAGS) -o markdown main.o -lmarkdown @LIBS@
-
 # example programs
 @THEME at theme:  theme.o $(MKDLIB) mkdio.h
 @THEME@	$(CC) -o theme theme.o -lmarkdown @LIBS@
@@ -67,8 +73,14 @@ markdown: main.o $(MKDLIB)
 mkd2html:  mkd2html.o $(MKDLIB) mkdio.h
 	$(CC) -o mkd2html mkd2html.o -lmarkdown @LIBS@
 
-makepage:  makepage.c $(MKDLIB) mkdio.h
-	$(CC) -o makepage makepage.c -lmarkdown @LIBS@
+markdown: main.o pgm_options.o $(MKDLIB)
+	$(CC) $(CFLAGS) -o markdown main.o pgm_options.o -lmarkdown @LIBS@
+	
+makepage:  makepage.c pgm_options.o $(MKDLIB) mkdio.h
+	$(CC) $(CFLAGS) -o makepage makepage.c pgm_options.o -lmarkdown @LIBS@
+
+pgm_options.o: pgm_options.c mkdio.h config.h
+	$(CC) -I. -c pgm_options.c
 
 main.o: main.c mkdio.h config.h
 	$(CC) -I. -c main.c
@@ -105,6 +117,7 @@ dumptree.o: dumptree.c markdown.h cstring.h amalloc.h config.h
 emmatch.o: emmatch.c config.h cstring.h amalloc.h markdown.h
 generate.o: generate.c config.h cstring.h amalloc.h markdown.h
 main.o: main.c config.h amalloc.h
+pgm_options.o: pgm_options.c pgm_options.h config.h amalloc.h
 makepage.o: makepage.c
 markdown.o: markdown.c config.h cstring.h amalloc.h markdown.h
 mkd2html.o: mkd2html.c config.h mkdio.h cstring.h amalloc.h
diff --git a/VERSION b/VERSION
index 09843e3..7ec1d6d 100644
--- a/VERSION
+++ b/VERSION
@@ -1 +1 @@
-2.0.9
+2.1.0
diff --git a/configure.inc b/configure.inc
index 1611139..5115c86 100755
--- a/configure.inc
+++ b/configure.inc
@@ -55,6 +55,13 @@ __ac_dirname() {
 }
 fi
 
+__remove() {
+    if [ \( -x "$1" \) -a "$__MACOS_DSYM" ]; then
+	rm -rf "$1".dSYM
+    fi
+    rm -f "$@"
+}
+
 ac_progname=$0
 ac_configure_command=
 Q=\'
@@ -133,17 +140,17 @@ AC_CONTINUE () {
 __MAKEDOTO() {
     AC_PROG_CC
 
-    if $AC_CC -c -o /tmp/doto$$.o "$@" $AC_LIBS 2>/tmp/doto$$.err; then
-	rm -f /tmp/doto$$.o /tmp/doto$$.err
+    if $AC_CC -c -o ngc$$.o "$@" $AC_LIBS 2>ngc$$.err; then
+	__remove ngc$$.o ngc$$.err
 	TLOG " (found)"
 	return 0
     fi
-    rm -f /tmp/doto$$.o
+    __remove ngc$$.o
     TLOG " (not found)"
-    echo "test failed:  command was $AC_CC -c -o /tmp/doto$$.o" "$@" $AC_LIBS
+    echo "test failed:  command was $AC_CC -c -o ngc$$.o" "$@" $AC_LIBS
     echo "output:"
-    cat /tmp/doto$$.err
-    rm -f /tmp/doto$$.err
+    cat ngc$$.err
+    __remove ngc$$.err
     echo "offending sources:"
     for x in "$@"; do
 	echo "$x:"
@@ -158,21 +165,21 @@ __MAKEDOTO() {
 #
 AC_CHECK_HEADERS () {
 
-    echo "/* AC_CHECK_HEADERS */" > /tmp/ngc$$.c
+    echo "/* AC_CHECK_HEADERS */" > ngc$$.c
     for hdr in $*; do
-	echo "#include <$hdr>" >> /tmp/ngc$$.c
+	echo "#include <$hdr>" >> ngc$$.c
     done
-    echo "main() { }" >> /tmp/ngc$$.c
+    echo "main() { }" >> ngc$$.c
 
     LOGN "looking for header $hdr"
 
-    if __MAKEDOTO /tmp/ngc$$.c; then
+    if __MAKEDOTO ngc$$.c; then
 	AC_DEFINE 'HAVE_'`echo $hdr | $AC_UPPERCASE | tr './' '_'` 1
 	rc=0
     else
 	rc=1
     fi
-    rm -f /tmp/ngc$$.c
+    __remove ngc$$.c
     return $rc
 }
 
@@ -191,14 +198,14 @@ AC_CHECK_FUNCS () {
     esac
 
     shift
-    rm -f /tmp/ngc$$.c
+    __remove ngc$$.c
 
     while [ "$1" ]; do
-	echo "#include <$1>" >> /tmp/ngc$$.c
+	echo "#include <$1>" >> ngc$$.c
 	shift
     done
 
-    cat >> /tmp/ngc$$.c << EOF
+    cat >> ngc$$.c << EOF
 main()
 {
 
@@ -208,18 +215,18 @@ EOF
 
     LOGN "looking for the $B function"
 
-    if $AC_CC -o /tmp/ngc$$ /tmp/ngc$$.c $LIBS; then
+    if $AC_CC -o ngc$$ ngc$$.c $LIBS; then
 	AC_DEFINE `echo ${2:-HAVE_$B} | $AC_UPPERCASE` 1
 	TLOG " (found)"
 	rc=0
     else
 	echo "offending command was:"
-	cat /tmp/ngc$$.c
-	echo "$AC_CC -o /tmp/ngc$$ /tmp/ngc$$.c $LIBS"
+	cat ngc$$.c
+	echo "$AC_CC -o ngc$$ ngc$$.c $LIBS"
 	TLOG " (not found)"
 	rc=1
     fi
-    rm -f /tmp/ngc$$.c /tmp/ngc$$
+    __remove ngc$$ ngc$$.c
     return $rc
 }
 
@@ -233,13 +240,13 @@ AC_CHECK_STRUCT () {
     struct=$1
     shift
 
-    rm -f /tmp/ngc$$.c
+    __remove ngc$$.c
 
     for include in $*; do
-	echo "#include <$include>" >> /tmp/ngc$$.c
+	echo "#include <$include>" >> ngc$$.c
     done
 
-    cat >> /tmp/ngc$$.c << EOF
+    cat >> ngc$$.c << EOF
 main()
 {
     struct $struct foo;
@@ -248,13 +255,13 @@ EOF
 
     LOGN "looking for struct $struct"
 
-    if __MAKEDOTO /tmp/ngc$$.c; then
+    if __MAKEDOTO ngc$$.c; then
 	AC_DEFINE HAVE_STRUCT_`echo ${struct} | $AC_UPPERCASE`
 	rc=0
     else
 	rc=1
     fi
-    rm -f /tmp/ngc$$.c
+    __remove ngc$$.c
     return $rc
 }
 
@@ -268,13 +275,13 @@ AC_CHECK_TYPE () {
     type=$1
     shift
 
-    rm -f /tmp/ngc$$.c
+    __remove ngc$$.c
 
     for include in $*; do
-	echo "#include <$include>" >> /tmp/ngc$$.c
+	echo "#include <$include>" >> ngc$$.c
     done
 
-    cat >> /tmp/ngc$$.c << EOF
+    cat >> ngc$$.c << EOF
 main()
 {
     $type foo;
@@ -283,13 +290,13 @@ EOF
 
     LOGN "looking for $type type"
 
-    if __MAKEDOTO /tmp/ngc$$.c; then
+    if __MAKEDOTO ngc$$.c; then
 	AC_DEFINE HAVE_TYPE_`echo ${type} | $AC_UPPERCASE`
 	rc=0
     else
 	rc=1
     fi
-    rm -f /tmp/ngc$$.c
+    __remove ngc$$.c
     return $rc
 }
 
@@ -305,13 +312,13 @@ AC_CHECK_FIELD () {
     field=$2
     shift 2
 
-    rm -f /tmp/ngc$$.c
+    __remove ngc$$.c
 
     for include in $*;do
-	echo "#include <$include>" >> /tmp/ngc$$.c
+	echo "#include <$include>" >> ngc$$.c
     done
 
-    cat >> /tmp/ngc$$.c << EOF
+    cat >> ngc$$.c << EOF
 main()
 {
     struct $struct foo;
@@ -322,13 +329,13 @@ EOF
 
     LOGN "checking that struct $struct has a $field field"
 
-    if __MAKEDOTO /tmp/ngc$$.c; then
+    if __MAKEDOTO ngc$$.c; then
 	AC_DEFINE HAVE_`echo ${struct}_$field | $AC_UPPERCASE`
 	rc=0
     else
 	rc=1
     fi
-    rm -f /tmp/ngc$$.c
+    __remove ngc$$.c
     return $rc
 }
 
@@ -339,7 +346,7 @@ EOF
 AC_PROG_CC () {
     test "$AC_CC" && return 0
 
-    cat > /tmp/ngc$$.c << \EOF
+    cat > ngc$$.c << \EOF
 #include <stdio.h>
 main()
 {
@@ -370,10 +377,13 @@ EOF
     fi
     echo "checking out the C compiler"
 
-    $AC_CC -o /tmp/ngc$$ /tmp/ngc$$.c
+    unset __MACOS_DSYM
+    $AC_CC -o ngc$$ ngc$$.c
     status=$?
+    test -d ngc$$.dSYM && __MACOS_DSYM=1
 
     TLOGN " ($AC_CC)"
+
     if [ $status -eq 0 ]; then
 	if $AC_CC -v 2>&1 | grep 'gcc version' >/dev/null; then
 	    TLOG " oh ick, it looks like gcc"
@@ -388,7 +398,7 @@ EOF
 
 	if [ "$CFLAGS" ]; then
 	    test "$CFLAGS" && echo "validating CFLAGS=${CFLAGS}"
-	    if $AC_CC $CFLAGS -o /tmp/ngc$$.o /tmp/ngc$$.c ; then
+	    if $AC_CC $CFLAGS -o ngc$$.o ngc$$.c ; then
 		AC_CFLAGS=${CFLAGS:-"-g"}
 		test "$CFLAGS" && echo "CFLAGS=\"${CFLAGS}\" are okay"
 	    elif [ "$CFLAGS" ]; then
@@ -399,7 +409,7 @@ EOF
 	fi
 	if [ "$LDFLAGS" ]; then
 	    test "$LDFLAGS" && echo "validating LDFLAGS=${LDFLAGS}"
-	    if $AC_CC $LDFLAGS -o /tmp/ngc$$ /tmp/ngc$$.o; then
+	    if $AC_CC $LDFLAGS -o ngc$$ ngc$$.o; then
 		AC_LDFLAGS=${LDFLAGS:-"-g"}
 		test "$LDFLAGS" && TLOG "LDFLAGS=\"${LDFLAGS}\" are okay"
 	    elif [ "$LDFLAGS" ]; then
@@ -414,7 +424,7 @@ EOF
 
     AC_SUB 'CC' "$AC_CC"
 
-    rm -f /tmp/ngc$$ /tmp/ngc$$.c /tmp/ngc$$.o
+    __remove ngc$$ ngc$$.c ngc$$.o
 
     return $status
 }
@@ -796,18 +806,18 @@ AC_TYPE_PID_T () {
 # AC_C_CONST checks to see if the compiler supports the const keyword
 #
 AC_C_CONST () {
-    cat > /tmp/pd$$.c << EOF
+    cat > ngc$$.c << EOF
 const char me=1;
 EOF
     LOGN "checking for \"const\" keyword"
 
-    if __MAKEDOTO /tmp/pd$$.c; then
+    if __MAKEDOTO ngc$$.c; then
 	rc=0
     else
 	AC_DEFINE 'const' '/**/'
 	rc=1
     fi
-    rm -f /tmp/pd$$.c
+    __remove ngc$$.c
     return $rc
 }
 
@@ -816,18 +826,18 @@ EOF
 # AC_C_VOLATILE checks to see if the compiler supports the volatile keyword
 #
 AC_C_VOLATILE () {
-    cat > /tmp/pd$$.c << EOF
+    cat > ngc$$.c << EOF
 f() { volatile char me=1; }
 EOF
     LOGN "checking for \"volatile\" keyword"
 
-    if __MAKEDOTO /tmp/pd$$.c; then
+    if __MAKEDOTO ngc$$.c; then
 	rc=0
     else
 	AC_DEFINE 'volatile' '/**/'
 	rc=1
     fi
-    rm -f /tmp/pd$$.c
+    __remove ngc$$.c
     return $rc
 }
 
@@ -836,7 +846,7 @@ EOF
 # AC_SCALAR_TYPES checks to see if the compiler can generate 2 and 4 byte ints.
 #
 AC_SCALAR_TYPES () {
-    cat > /tmp/pd$$.c << EOF
+    cat > ngc$$.c << EOF
 #include <stdio.h>
 #include <string.h>
 
@@ -879,25 +889,25 @@ char **argv;
 EOF
     rc=1
     LOGN "defining WORD & DWORD scalar types"
-    if $AC_CC /tmp/pd$$.c -o $__cwd/pd$$; then
+    if $AC_CC ngc$$.c -o ngc$$; then
 	while [ "$1" ]; do
 	    case "$1" in
-	    sub)if $__cwd/pd$$ sub >> $__cwd/config.sub; then
+	    sub)if ./ngc$$ sub >> $__cwd/config.sub; then
 		    rc=0
 		fi;;
-	    *)  if $__cwd/pd$$ >> $__cwd/config.h; then
+	    *)  if ./ngc$$ >> $__cwd/config.h; then
 		    rc=0
 		fi ;;
 	    esac
 	    shift
 	done
 	if [ "$rc" != 0 ]; then
-	    if $__cwd/pd$$ >> $__cwd/config.h; then
+	    if ./ngc$$ >> $__cwd/config.h; then
 		rc=1
 	    fi
 	fi
     fi
-    rm -f $__cwd/pd$$ /tmp/pd$$.c
+    __remove ngc$$ ngc$$.c
     case "$rc" in
     0) TLOG "" ;;
     *) AC_FAIL " ** FAILED **" ;;
@@ -1005,7 +1015,7 @@ AC_CHECK_FLOCK() {
 
     AC_CHECK_HEADERS sys/types.h sys/file.h fcntl.h
 
-    cat << EOF > $$.c
+    cat << EOF > ngc$$.c
 #include <stdio.h>
 #include <sys/file.h>
 #include <sys/types.h>
@@ -1026,7 +1036,7 @@ EOF
 
     LOGN "checking flock() sanity"
     HAS_FLOCK=0
-    if $AC_CC -o flock $$.c ; then
+    if $AC_CC -o ngc$$ ngc$$.c ; then
 	if ./flock ; then
 	    LOG " (good)"
 	    HAS_FLOCK=1
@@ -1038,7 +1048,7 @@ EOF
 	LOG " (not found)"
     fi
 
-    rm -f flock $$.c
+    __remove ngc$$ ngc$$.c
 
     case "$HAS_FLOCK" in
     0) return 1 ;;
@@ -1058,7 +1068,7 @@ AC_CHECK_RESOLVER () {
 
     __ACR_rc=0
 
-    cat > /tmp/ngc$$.c << EOF
+    cat > ngc$$.c << EOF
 #include <sys/types.h>
 #include <netinet/in.h>
 #include <arpa/nameser.h>
@@ -1073,22 +1083,22 @@ main()
 }
 EOF
 
-    if $AC_CC -o /tmp/ngc$$ /tmp/ngc$$.c; then
+    if $AC_CC -o ngc$$ ngc$$.c; then
 	TLOG " (found)"
-    elif $AC_CC -o /tmp/ngc$$ /tmp/ngc$$.c -lresolv; then
+    elif $AC_CC -o ngc$$ ngc$$.c -lresolv; then
 	TLOG " (found, needs -lresolv)"
 	AC_LIBS="$AC_LIBS -lresolv"
-    elif $AC_CC -DBIND_8_COMPAT -o /tmp/ngc$$ /tmp/ngc$$.c; then
+    elif $AC_CC -DBIND_8_COMPAT -o ngc$$ ngc$$.c; then
 	TLOG " (found, needs BIND_8_COMPAT)"
 	AC_DEFINE BIND_8_COMPAT 1
-    elif $AC_CC -DBIND_8_COMPAT -o /tmp/ngc$$ /tmp/ngc$$.c -lresolv; then
+    elif $AC_CC -DBIND_8_COMPAT -o ngc$$ ngc$$.c -lresolv; then
 	TLOG " (found, needs BIND_8_COMPAT & -lresolv)"
 	AC_DEFINE BIND_8_COMPAT 1
     else
 	TLOG " (not found)"
 	__ACR_rc=1
     fi
-    rm -f /tmp/ngc$$.c
+    __remove ngc$$ ngc$$.c
     return $__ACR_rc
 }
 
@@ -1101,7 +1111,7 @@ AC_CHECK_ALLOCA () {
     AC_PROG_CC
     AC_CHECK_HEADERS stdlib.h
 
-    cat - > /tmp/ngc$$.c << EOF
+    cat - > ngc$$.c << EOF
 #if T
 # include <alloca.h>
 #else
@@ -1114,18 +1124,18 @@ main()
 EOF
 
     LOGN "looking for the alloca function"
-    if $AC_CC -DT /tmp/ngc$$.c -o /tmp/ngc$$; then
+    if $AC_CC -DT ngc$$.c -o ngc$$; then
 	AC_DEFINE 'HAVE_ALLOCA_H' 1
 	status=0
 	TLOG " (found in alloca.h)"
-    elif $AC_CC /tmp/ngc$$.c -o /tmp/ngc$$; then
+    elif $AC_CC ngc$$.c -o ngc$$; then
 	TLOG " (found)"
 	status=0
     else
 	TLOG " (not found)"
 	status=1
     fi
-    rm -f /tmp/ngc$$.c /tmp/ngc
+    __remove ngc$$ ngc$$.c
     return $status
 
 }
@@ -1138,7 +1148,7 @@ EOF
 AC_CHECK_BASENAME() {
     TLOGN "looking for a reentrant basename "
 
-    cat > /tmp/ngc$$.c << EOF
+    cat > ngc$$.c << EOF
 #include <string.h>
 
 main()
@@ -1151,8 +1161,8 @@ main()
 }
 EOF
 
-    if $AC_CC -o $__cwd/ngc$$ /tmp/ngc$$.c $LIBS; then
-	if $__cwd/ngc$$; then
+    if $AC_CC -o ngc$$ ngc$$.c $LIBS; then
+	if ngc$$; then
 	    TLOG "(found)"
 	    AC_DEFINE 'HAVE_BASENAME' 1
 	    AC_CHECK_HEADERS libgen.h
@@ -1162,7 +1172,7 @@ EOF
     else
 	TLOG "(not found)"
     fi
-    rm -f $__cwd/ngc$$ /tmp/ngc$$.c
+    __remove ngc$$ ngc$$.c
 }
 
 #
@@ -1173,9 +1183,9 @@ AC_COMPILER_PIC () {
     AC_PROG_CC
 
     LOGN "checking for C compiler option to produce PIC "
-    echo "int some_variable = 0;" > /tmp/ngc$$.c 
+    echo "int some_variable = 0;" > ngc$$.c 
 
-    if $AC_CC -c -fPIC -o /tmp/ngc$$ /tmp/ngc$$.c $LIBS; then
+    if $AC_CC -c -fPIC -o ngc$$ ngc$$.c $LIBS; then
 	AC_CFLAGS="$AC_CFLAGS -fPIC"
         LOG "(-fPIC)"
 	__rc=0
@@ -1183,7 +1193,7 @@ AC_COMPILER_PIC () {
         LOG "(none)"
 	__rc=1
     fi
-    rm -f /tmp/ngc$$ /tmp/ngc$$.c
+    __remove ngc$$ ngc$$.c
     return $__rc
 }
 
@@ -1197,13 +1207,13 @@ AC_CC_SHLIBS () {
     AC_PROG_INSTALL || AC_FAIL "Need an install program to install shared libraries"
     LOGN "checking whether the C compiler can build shared libraries "
 
-    echo "int some_variable = 0;" > /tmp/ngc$$.c 
+    echo "int some_variable = 0;" > ngc$$.c 
 
-    if $AC_CC $AC_PICFLAG -shared -o /tmp/ngc$$.so /tmp/ngc$$.c; then
+    if $AC_CC $AC_PICFLAG -shared -o ngc$$.so ngc$$.c; then
 	AC_SUB LD_LIBRARY_PATH LD_LIBRARY_PATH
 	# -Wl option probably works, but be paranoid anyway
 	_VFLAGS="$AC_PICFLAG -shared -Wl,-soname,ngc$$.so.1"
-	if $AC_CC $_VFLAGS -o /tmp/ngc$$.so /tmp/ngc$$.c; then
+	if $AC_CC $_VFLAGS -o ngc$$.so ngc$$.c; then
 	    USE_SONAME=T
 	fi
 	LDCONFIG=`AC_PATH=/sbin:/usr/sbin:/usr/local/sbin acLookFor ldconfig`
@@ -1247,7 +1257,7 @@ EOF
 	chmod +x librarian.sh
         LOG "(yes; -shared)"
 	__rc=0
-    elif $AC_CC $AC_PICFLAG  -dynamiclib -o /tmp/ngc$$.so /tmp/ngc$$.c; then
+    elif $AC_CC $AC_PICFLAG  -dynamiclib -o ngc$$.so ngc$$.c; then
 	# macosx
 	AC_SUB LD_LIBRARY_PATH DYLD_LIBRARY_PATH
 	__config_files="$__config_files librarian.sh"
@@ -1289,7 +1299,7 @@ EOF
 	__rc=1
     fi
 
-    rm -f /tmp/ngc$$.so /tmp/ngc$$.c
+    __remove ngc$$.so ngc$$.c
 
     return $__rc
 }
@@ -1383,22 +1393,22 @@ EOD
 # compiler options
 #
 acCheckCPP () {
-	cat > /tmp/ngc$$.c << EOF
+	cat > ngc$$.c << EOF
 #define FOO BAR
 
 FOO
 EOF
 
-    if $1 $2 /tmp/ngc$$.c > /tmp/ngc$$.o; then
-	if grep -v '#define' /tmp/ngc$$.o | grep -s BAR >/dev/null; then
+    if $1 $2 ngc$$.c > ngc$$.o; then
+	if grep -v '#define' ngc$$.o | grep -s BAR >/dev/null; then
 	    echo "CPP=[$1], CPPFLAGS=[$2]"
 	    AC_SUB 'CPP' "$1"
 	    AC_SUB 'CPPFLAGS' "$2"
-	    rm /tmp/ngc$$.c /tmp/ngc$$.o
+	    rm ngc$$.c ngc$$.o
 	    return 0
 	fi
     fi
-    rm /tmp/ngc$$.c /tmp/ngc$$.o
+    rm ngc$$.c ngc$$.o
     return 1
 }
 
diff --git a/main.c b/main.c
index 6bf4d0c..39c1a16 100644
--- a/main.c
+++ b/main.c
@@ -13,9 +13,11 @@
 #include <mkdio.h>
 #include <errno.h>
 #include <string.h>
+#include <stdarg.h>
 
 #include "config.h"
 #include "amalloc.h"
+#include "pgm_options.h"
 
 #if HAVE_LIBGEN_H
 #include <libgen.h>
@@ -36,123 +38,24 @@ basename(char *p)
 
 char *pgm = "markdown";
 
-static struct _opt {
-    char *name;
-    char *desc;
-    int off:1;
-    int skip:1;
-    int sayenable:1;
-    mkd_flag_t flag;
-} opts[] = {
-    { "tabstop",       "default (4-space) tabstops", 0, 0, 1, MKD_TABSTOP  },
-    { "image",         "images",                     1, 0, 1, MKD_NOIMAGE  },
-    { "links",         "links",                      1, 0, 1, MKD_NOLINKS  },
-    { "relax",         "emphasis inside words",      1, 1, 1, MKD_STRICT   },
-    { "strict",        "emphasis inside words",      0, 0, 1, MKD_STRICT   },
-    { "tables",        "tables",                     1, 0, 1, MKD_NOTABLES },
-    { "header",        "pandoc-style headers",       1, 0, 1, MKD_NOHEADER },
-    { "html",          "raw html",                   1, 0, 1, MKD_NOHTML   },
-    { "ext",           "extended protocols",         1, 0, 1, MKD_NO_EXT   },
-    { "cdata",         "generate cdata",             0, 0, 0, MKD_CDATA    },
-    { "smarty",        "smartypants",                1, 0, 1, MKD_NOPANTS  },
-    { "pants",         "smartypants",                1, 1, 1, MKD_NOPANTS  },
-    { "toc",           "tables of contents",         0, 0, 1, MKD_TOC      },
-    { "autolink",      "autolinking",                0, 0, 1, MKD_AUTOLINK },
-    { "safelink",      "safe links",                 0, 0, 1, MKD_SAFELINK },
-    { "strikethrough", "strikethrough",              1, 0, 1, MKD_NOSTRIKETHROUGH },
-    { "del",           "strikethrough",              1, 1, 1, MKD_NOSTRIKETHROUGH },
-    { "superscript",   "superscript",                1, 0, 1, MKD_NOSUPERSCRIPT },
-    { "emphasis",      "emphasis inside words",      0, 0, 1, MKD_NORELAXED },
-    { "divquote",      ">%class% blockquotes",       1, 0, 1, MKD_NODIVQUOTE },
-    { "alphalist",     "alpha lists",                1, 0, 1, MKD_NOALPHALIST },
-    { "definitionlist","definition lists",           1, 0, 1, MKD_NODLIST },
-    { "1.0",           "markdown 1.0 compatibility", 0, 0, 1, MKD_1_COMPAT },
-    { "footnotes",     "markdown extra footnotes",   0, 0, 1, MKD_EXTRA_FOOTNOTE },
-    { "footnote",      "markdown extra footnotes",   0, 1, 1, MKD_EXTRA_FOOTNOTE },
-} ;
-
-#define NR(x)	(sizeof x / sizeof x[0])
-
-
-int
-sort_by_name(struct _opt *a, struct _opt *b)
-{
-    return strcmp(a->name,b->name);
-}
-
-int
-sort_by_flag(struct _opt *a, struct _opt *b)
+char *
+e_flags(const char *text, const int size, void *context)
 {
-    return a->flag - b->flag;
+    return (char*)context;
 }
 
 
 void
-show_flags(int byname)
-{
-    int i;
-
-    if ( byname ) {
-	qsort(opts, NR(opts), sizeof(opts[0]), sort_by_name);
-    
-	for (i=0; i < NR(opts); i++)
-	    if ( ! opts[i].skip )
-		fprintf(stderr, "%16s : %s\n", opts[i].name, opts[i].desc);
-    }
-    else {
-	qsort(opts, NR(opts), sizeof(opts[0]), sort_by_flag);
-	
-	for (i=0; i < NR(opts); i++)
-	    if ( ! opts[i].skip ) {
-		fprintf(stderr, "%08lx : ", (long)opts[i].flag);
-		if ( opts[i].sayenable )
-		    fprintf(stderr, opts[i].off ? "disable " : "enable ");
-		fprintf(stderr, "%s\n", opts[i].desc);
-	    }
-    }
-}
-    
-
-void
-set(mkd_flag_t *flags, char *optionstring)
-{
-    int i;
-    int enable;
-    char *arg;
-
-    for ( arg = strtok(optionstring, ","); arg; arg = strtok(NULL, ",") ) {
-	if ( *arg == '+' || *arg == '-' )
-	    enable = (*arg++ == '+') ? 1 : 0;
-	else if ( strncasecmp(arg, "no", 2) == 0 ) {
-	    arg += 2;
-	    enable = 0;
-	}
-	else
-	    enable = 1;
-
-	for ( i=0; i < NR(opts); i++ )
-	    if ( strcasecmp(arg, opts[i].name) == 0 )
-		break;
-
-	if ( i < NR(opts) ) {
-	    if ( opts[i].off )
-		enable = !enable;
-		
-	    if ( enable )
-		*flags |= opts[i].flag;
-	    else
-		*flags &= ~opts[i].flag;
-	}
-	else
-	    fprintf(stderr, "%s: unknown option <%s>\n", pgm, arg);
-    }
-}
-
-
-char *
-e_flags(const char *text, const int size, void *context)
+complain(char *fmt, ...)
 {
-    return (char*)context;
+    va_list ptr;
+
+    fprintf(stderr, "%s: ", pgm);
+    va_start(ptr, fmt);
+    vfprintf(stderr, fmt, ptr);
+    va_end(ptr);
+    fputc('\n', stderr);
+    fflush(stderr);
 }
 
 
@@ -204,8 +107,8 @@ main(int argc, char **argv)
 			show_flags(1);
 			exit(0);
 		    }
-		    else
-			set(&flags, optarg);
+		    else if ( !set_flag(&flags, optarg) )
+			complain("unknown option <%s>", optarg);
 		    break;
 	case 't':   text = optarg;
 		    use_mkd_line = 1;
@@ -217,7 +120,7 @@ main(int argc, char **argv)
 	case 'C':   extra_footnote_prefix = optarg;
 		    break;
 	case 'o':   if ( ofile ) {
-			fprintf(stderr, "Too many -o options\n");
+			complain("Too many -o options");
 			exit(1);
 		    }
 		    if ( !freopen(ofile = optarg, "w", stdout) ) {
diff --git a/makepage.1 b/makepage.1
index 0a78018..76b38dc 100644
--- a/makepage.1
+++ b/makepage.1
@@ -8,6 +8,9 @@
 .Nd convert markdown input to a fully-formed xhtml page
 .Sh SYNOPSIS
 .Nm
+.Op Fl V
+.Op Fl F Pa bitmap
+.Op Fl f Ar flags
 .Op Pa file
 .Sh DESCRIPTION
 The
@@ -18,6 +21,14 @@ utility parses a
 .Pq or stdin if not specified,
 compiles it, then prints a fully-formed xhtml page to stdout.
 .Pp
+The 
+.Fl F ,
+.Fl f , 
+and
+.Fl V
+flags are identical to the same options in 
+.Xr markdown 1 .
+.Pp
 .Nm
 is part of discount.
 .Sh RETURN VALUES
diff --git a/makepage.c b/makepage.c
index 8fa55ac..548d381 100644
--- a/makepage.c
+++ b/makepage.c
@@ -4,7 +4,23 @@
  */
 #include <stdio.h>
 #include <stdlib.h>
+#include <unistd.h>
+#include <string.h>
 #include <mkdio.h>
+#include "config.h"
+#include "pgm_options.h"
+
+#ifndef HAVE_BASENAME
+char*
+basename(char *p)
+{
+    char *ret = strrchr(p, '/');
+
+    return ret ? (1+ret) : p;
+}
+#endif
+
+char *pgm = "makepage";
 
 float
 main(argc, argv)
@@ -12,16 +28,60 @@ int argc;
 char **argv;
 {
     MMIOT *doc;
+    char *q;
+    int version = 0;
+    int opt;
+    mkd_flag_t flags = 0;
+
+    if ( (q = getenv("MARKDOWN_FLAGS")) )
+	flags = strtol(q, 0, 0);
+
+    opterr = 1;
+
+    while ( (opt=getopt(argc, argv, "F:f:V")) != EOF ) {
+	switch (opt) {
+	case 'V':   version++;
+		    break;
+	case 'F':   if ( strcmp(optarg, "?") == 0 ) {
+			show_flags(0);
+			exit(0);
+		    }
+		    else
+			flags = strtol(optarg, 0, 0);
+		    break;
+	case 'f':   if ( strcmp(optarg, "?") == 0 ) {
+			show_flags(1);
+			exit(0);
+		    }
+		    else if ( !set_flag(&flags, optarg) )
+			fprintf(stderr, "unknown option <%s>\n", optarg);
+		    break;
+	default:    fprintf(stderr, "usage: %s [-V] [-F bitmap] [-f {+-}flags]"
+				    " [file]\n", pgm);
+		    exit(1);
+	}
+    }
+    
+    argc -= optind;
+    argv += optind;
+    
+    if ( version ) {
+	printf("%s: discount %s", pgm, markdown_version);
+	if ( version > 1 )
+	    mkd_flags_are(stdout, flags, 0);
+	putchar('\n');
+	exit(0);
+    }    
     
     if ( (argc > 1) && !freopen(argv[1], "r", stdin) ) {
 	perror(argv[1]);
 	exit(1);
     }
 
-    if ( (doc = mkd_in(stdin, 0)) == 0 ) {
+    if ( (doc = mkd_in(stdin, flags)) == 0 ) {
 	perror( (argc > 1) ? argv[1] : "stdin" );
 	exit(1);
     }
 
-    exit(mkd_xhtmlpage(doc, 0, stdout));
+    exit(mkd_xhtmlpage(doc, flags, stdout));
 }
diff --git a/mkdio.h.in b/mkdio.h.in
index 36c0d8f..8f5490c 100644
--- a/mkdio.h.in
+++ b/mkdio.h.in
@@ -84,6 +84,7 @@ void mkd_ref_prefix(MMIOT*, char*);
 #define MKD_TAGTEXT	0x00000020	/* process text inside an html tag; no
 					 * <em>, no <bold>, no html or [] expansion */
 #define MKD_NO_EXT	0x00000040	/* don't allow pseudo-protocols */
+#define MKD_NOEXT	MKD_NO_EXT	/* ^^^ (aliased for user convenience) */
 #define MKD_CDATA	0x00000080	/* generate code for xml ![CDATA[...]] */
 #define MKD_NOSUPERSCRIPT 0x00000100	/* no A^B */
 #define MKD_NORELAXED	0x00000200	/* emphasis happens /everywhere/ */
diff --git a/main.c b/pgm_options.c
similarity index 52%
copy from main.c
copy to pgm_options.c
index 6bf4d0c..41c68b1 100644
--- a/main.c
+++ b/pgm_options.c
@@ -1,11 +1,10 @@
-/*
- * markdown: convert a single markdown document into html
- */
-/*
- * Copyright (C) 2007 David L Parsons.
+/* markdown: a C implementation of John Gruber's Markdown markup language.
+ *
+ * Copyright (C) 2007-2011 David L Parsons.
  * The redistribution terms are provided in the COPYRIGHT file that must
  * be distributed with this source code.
  */
+
 #include <stdio.h>
 #include <stdlib.h>
 #include <limits.h>
@@ -13,6 +12,7 @@
 #include <mkdio.h>
 #include <errno.h>
 #include <string.h>
+#include <stdarg.h>
 
 #include "config.h"
 #include "amalloc.h"
@@ -21,27 +21,12 @@
 #include <libgen.h>
 #endif
 
-#ifndef HAVE_BASENAME
-#include <string.h>
-
-char*
-basename(char *p)
-{
-    char *ret = strrchr(p, '/');
-
-    return ret ? (1+ret) : p;
-}
-#endif
-
-
-char *pgm = "markdown";
-
 static struct _opt {
     char *name;
     char *desc;
-    int off:1;
-    int skip:1;
-    int sayenable:1;
+    int off;
+    int skip;
+    int sayenable;
     mkd_flag_t flag;
 } opts[] = {
     { "tabstop",       "default (4-space) tabstops", 0, 0, 1, MKD_TABSTOP  },
@@ -113,8 +98,8 @@ show_flags(int byname)
 }
     
 
-void
-set(mkd_flag_t *flags, char *optionstring)
+int
+set_flag(mkd_flag_t *flags, char *optionstring)
 {
     int i;
     int enable;
@@ -144,152 +129,7 @@ set(mkd_flag_t *flags, char *optionstring)
 		*flags &= ~opts[i].flag;
 	}
 	else
-	    fprintf(stderr, "%s: unknown option <%s>\n", pgm, arg);
-    }
-}
-
-
-char *
-e_flags(const char *text, const int size, void *context)
-{
-    return (char*)context;
-}
-
-
-float
-main(int argc, char **argv)
-{
-    int opt;
-    int rc;
-    mkd_flag_t flags = 0;
-    int debug = 0;
-    int toc = 0;
-    int version = 0;
-    int with_html5 = 0;
-    int use_mkd_line = 0;
-    char *extra_footnote_prefix = 0;
-    char *urlflags = 0;
-    char *text = 0;
-    char *ofile = 0;
-    char *urlbase = 0;
-    char *q;
-    MMIOT *doc;
-
-    if ( q = getenv("MARKDOWN_FLAGS") )
-	flags = strtol(q, 0, 0);
-
-    pgm = basename(argv[0]);
-    opterr = 1;
-
-    while ( (opt=getopt(argc, argv, "5b:C:df:E:F:o:s:t:TV")) != EOF ) {
-	switch (opt) {
-	case '5':   with_html5 = 1;
-		    break;
-	case 'b':   urlbase = optarg;
-		    break;
-	case 'd':   debug = 1;
-		    break;
-	case 'V':   version++;
-		    break;
-	case 'E':   urlflags = optarg;
-		    break;
-	case 'F':   if ( strcmp(optarg, "?") == 0 ) {
-			show_flags(0);
-			exit(0);
-		    }
-		    else
-			flags = strtol(optarg, 0, 0);
-		    break;
-	case 'f':   if ( strcmp(optarg, "?") == 0 ) {
-			show_flags(1);
-			exit(0);
-		    }
-		    else
-			set(&flags, optarg);
-		    break;
-	case 't':   text = optarg;
-		    use_mkd_line = 1;
-		    break;
-	case 'T':   toc = 1;
-		    break;
-	case 's':   text = optarg;
-		    break;
-	case 'C':   extra_footnote_prefix = optarg;
-		    break;
-	case 'o':   if ( ofile ) {
-			fprintf(stderr, "Too many -o options\n");
-			exit(1);
-		    }
-		    if ( !freopen(ofile = optarg, "w", stdout) ) {
-			perror(ofile);
-			exit(1);
-		    }
-		    break;
-	default:    fprintf(stderr, "usage: %s [-dTV] [-b url-base]"
-				    " [-F bitmap] [-f {+-}flags]"
-				    " [-o ofile] [-s text]"
-				    " [-t text] [file]\n", pgm);
-		    exit(1);
-	}
-    }
-
-    if ( version ) {
-	printf("%s: discount %s%s", pgm, markdown_version,
-				  with_html5 ? " +html5":"");
-	if ( version > 1 )
-	    mkd_flags_are(stdout, flags, 0);
-	putchar('\n');
-	exit(0);
-    }
-
-    argc -= optind;
-    argv += optind;
-
-    if ( with_html5 )
-	mkd_with_html5_tags();
-
-    if ( use_mkd_line )
-	rc = mkd_generateline( text, strlen(text), stdout, flags);
-    else {
-	if ( text ) {
-	    if ( (doc = mkd_string(text, strlen(text), flags)) == 0 ) {
-		perror(text);
-		exit(1);
-	    }
-	}
-	else {
-	    if ( argc && !freopen(argv[0], "r", stdin) ) {
-		perror(argv[0]);
-		exit(1);
-	    }
-	    if ( (doc = mkd_in(stdin,flags)) == 0 ) {
-		perror(argc ? argv[0] : "stdin");
-		exit(1);
-	    }
-	}
-	if ( urlbase )
-	    mkd_basename(doc, urlbase);
-	if ( urlflags ) {
-	    mkd_e_data(doc, urlflags);
-	    mkd_e_flags(doc, e_flags);
-	}
-	if ( extra_footnote_prefix )
-	    mkd_ref_prefix(doc, extra_footnote_prefix);
-
-	if ( debug )
-	    rc = mkd_dump(doc, stdout, 0, argc ? basename(argv[0]) : "stdin");
-	else {
-	    rc = 1;
-	    if ( mkd_compile(doc, flags) ) {
-		rc = 0;
-		if ( toc )
-		    mkd_generatetoc(doc, stdout);
-		mkd_generatehtml(doc, stdout);
-		mkd_cleanup(doc);
-	    }
-	}
+	    return 0;
     }
-    mkd_deallocate_tags();
-    adump();
-    exit( (rc == 0) ? 0 : errno );
+    return 1;
 }
diff --git a/pgm_options.h b/pgm_options.h
new file mode 100644
index 0000000..b7544cd
--- /dev/null
+++ b/pgm_options.h
@@ -0,0 +1,9 @@
+#ifndef PGM_OPTIONS_D
+#define PGM_OPTIONS_D
+
+#include <mkdio.h>
+
+int set_flag(mkd_flag_t *flags, char *optionstring);
+void show_flags(int byname);
+
+#endif/*PGM_OPTIONS_D*/
diff --git a/theme.1 b/theme.1
index 473b913..3bcf38a 100644
--- a/theme.1
+++ b/theme.1
@@ -9,6 +9,7 @@
 .Sh SYNOPSIS
 .Nm
 .Op Fl d Pa root
+.Op Fl E
 .Op Fl f
 .Op Fl o Pa file
 .Op Fl p Pa pagename
@@ -94,7 +95,7 @@ that this copy of theme was compiled with.
 .El
 .Pp
 If input is coming from a file and the output was not set with the
-.Ar o
+.Fl o
 option, 
 .Nm writes the output to
 .Pa file-sans-text.html
@@ -115,6 +116,21 @@ Set the
 .Em "document root"
 to
 .Ar root
+.It Fl E
+Normally
+theme will not expand
+.Pa "<?theme body?>"
+or
+.Pa "<?theme toc?>"
+in the
+.Pa "<head>"
+section, or
+.Pa "<?theme style?>"
+in the
+.Pa "<body>"
+section, but the
+.Fl E
+option overrides this and allows expansions everywhere.
 .It Fl f
 Forcibly overwrite existing html files.
 .It Fl o Pa filename
diff --git a/theme.c b/theme.c
index 637fe5e..58f98fe 100644
--- a/theme.c
+++ b/theme.c
@@ -37,6 +37,8 @@ char *pgm = "theme";
 char *output = 0;
 char *pagename = 0;
 char *root = 0;
+int   everywhere = 0;	/* expand all <?theme elements everywhere */
+
 #if HAVE_PWD_H
 struct passwd *me = 0;
 #endif
@@ -466,7 +468,7 @@ spin(FILE *template, MMIOT *doc, FILE *output)
 
 		for (i=0; i < NR(keyword); i++)
 		    if ( thesame(p, keyword[i].kw) ) {
-			if ( keyword[i].where & where )
+			if ( everywhere || (keyword[i].where & where) )
 			    (*keyword[i].what)(doc,output,flags,where);
 			break;
 		    }
@@ -512,10 +514,12 @@ char **argv;
     opterr=1;
     pgm = basename(argv[0]);
 
-    while ( (opt=getopt(argc, argv, "fd:t:p:o:V")) != EOF ) {
+    while ( (opt=getopt(argc, argv, "Efd:t:p:o:V")) != EOF ) {
 	switch (opt) {
 	case 'd':   root = optarg;
 		    break;
+	case 'E':   everywhere = 1;
+		    break;
 	case 'p':   pagename = optarg;
 		    break;
 	case 'f':   force = 1;

-- 
Alioth's /usr/local/bin/git-commit-notice on /srv/git.debian.org/git/reproducible/discount.git



More information about the Reproducible-commits mailing list