diff options
author | Shigeyuki Fukushima <shige@FreeBSD.org> | 2000-10-27 08:06:53 +0000 |
---|---|---|
committer | Shigeyuki Fukushima <shige@FreeBSD.org> | 2000-10-27 08:06:53 +0000 |
commit | 80e70145a6a7356eaa3d3fbb1b5322acf48fcdd5 (patch) | |
tree | dcd87c7370bed901483208cbe11ab3a4aaefb66f /textproc | |
parent | Add Jon Chen and I to the markers of freebsd committers from Troy NY. (diff) |
Newly port: mkcatalog.
A maintainance utility for sgml catalog files.
Notes
Notes:
svn path=/head/; revision=34282
Diffstat (limited to 'textproc')
-rw-r--r-- | textproc/Makefile | 1 | ||||
-rw-r--r-- | textproc/mkcatalog/Makefile | 37 | ||||
-rw-r--r-- | textproc/mkcatalog/pkg-comment | 1 | ||||
-rw-r--r-- | textproc/mkcatalog/pkg-descr | 47 | ||||
-rw-r--r-- | textproc/mkcatalog/pkg-plist | 1 | ||||
-rw-r--r-- | textproc/mkcatalog/scripts/configure | 12 | ||||
-rw-r--r-- | textproc/mkcatalog/src/mkcatalog.in | 116 |
7 files changed, 215 insertions, 0 deletions
diff --git a/textproc/Makefile b/textproc/Makefile index 104381631e5b..cf3bd61694ed 100644 --- a/textproc/Makefile +++ b/textproc/Makefile @@ -58,6 +58,7 @@ SUBDIR += lotusxsl SUBDIR += man2html SUBDIR += mgdiff + SUBDIR += mkcatalog SUBDIR += mswordview SUBDIR += nfbtrans SUBDIR += nicetext diff --git a/textproc/mkcatalog/Makefile b/textproc/mkcatalog/Makefile new file mode 100644 index 000000000000..438182e6550a --- /dev/null +++ b/textproc/mkcatalog/Makefile @@ -0,0 +1,37 @@ +# New ports collection makefile for: mkcatalog +# Date created: 26 Oct 2000 +# Whom: shige +# +# $FreeBSD$ +# +# This port is self contained in the src directory. +# + +PORTNAME= mkcatalog +PORTVERSION= 1.0 +CATEGORIES= textproc +MASTER_SITES= # none +DISTFILES= # none + +MAINTAINER= shige@FreeBSD.org + +NO_WRKSUBDIR= yes +NO_CHECKSUM= yes +NO_BUILD= yes +SCRIPTS_ENV= CONFIGURE_TARGETS=${CONFIGURE_TARGETS} + +SRC= ${.CURDIR}/src +CONFIGURE_TARGETS= mkcatalog + +do-fetch: + @${DO_NADA} + +pre-configure: + @for i in ${CONFIGURE_TARGETS} ; do \ + ${CP} ${SRC}/$${i}.in ${WRKDIR} ; \ + done + +do-install: + @${INSTALL_SCRIPT} ${WRKDIR}/mkcatalog ${PREFIX}/sbin/mkcatalog + +.include <bsd.port.mk> diff --git a/textproc/mkcatalog/pkg-comment b/textproc/mkcatalog/pkg-comment new file mode 100644 index 000000000000..f18b83e76c3a --- /dev/null +++ b/textproc/mkcatalog/pkg-comment @@ -0,0 +1 @@ +A maintainance utility for sgml catalog files. diff --git a/textproc/mkcatalog/pkg-descr b/textproc/mkcatalog/pkg-descr new file mode 100644 index 000000000000..c508fcdd619b --- /dev/null +++ b/textproc/mkcatalog/pkg-descr @@ -0,0 +1,47 @@ +A maintainance utility for sgml catalog files. + +mkcatalog maintains sgml "catalog" files. + +usage: mkcatalog [-pq] install|deinstall dtd-subdirectory [catalog-filename] + options: + -p preserve old catalog file. + -q silent mode + + commands(required): + install set DTD configuration to catalog files. + deinstall usset DTD configuration from catalog files. + + required arguments: + dtd-subdirectory DTD sub-directory. + (root sgml direcotry is ${PREFIX}/share/sgml.) + + optional arguments: + catalog-filename DTD catalog filename. + + for example: + # mkcatalog install html/4.0 + + This commands do the following actions: + 1. Add `CATALOG "html/catalog"' to ${PREFIX}/share/sgml/catalog. + 2. Add `CATALOG "html/4.0/catalog"' + to ${PREFIX}/share/sgml/html/catalog. + + + # mkcatalog install docbook/4.1 docbook41.cat + + This commands do the following actions: + 1. Add `CATALOG "docbook/catalog"' to ${PREFIX}/share/sgml/catalog. + 2. Add `CATALOG "docbook/4.1/docbook41.cat"' + to ${PREFIX}/share/sgml/docbook/catalog. + + + # mkcatalog deinstall docbook/4.1 docbook41.cat + + This commands do the following actions: + 1. Delete `CATALOG "docbook/4.1/docbook41.cat"' + from ${PREFIX}/share/sgml/docbook/catalog. + 2. Delete `CATALOG "docbook/catalog"' + from ${PREFIX}/share/sgml/catalog. + +--- +shige@FreeBSD.org diff --git a/textproc/mkcatalog/pkg-plist b/textproc/mkcatalog/pkg-plist new file mode 100644 index 000000000000..00a71ebbba5b --- /dev/null +++ b/textproc/mkcatalog/pkg-plist @@ -0,0 +1 @@ +sbin/mkcatalog diff --git a/textproc/mkcatalog/scripts/configure b/textproc/mkcatalog/scripts/configure new file mode 100644 index 000000000000..8b2dbab2fa60 --- /dev/null +++ b/textproc/mkcatalog/scripts/configure @@ -0,0 +1,12 @@ +#!/bin/sh +# $FreeBSD$ +# + +for i in ${CONFIGURE_TARGETS} +do + if [ -f ${WRKDIR}/${i}.in ]; then + cat ${WRKDIR}/${i}.in | /usr/bin/sed \ + -e "s;@@PREFIX@@;${PREFIX};g" \ + > ${WRKDIR}/${i} + fi +done diff --git a/textproc/mkcatalog/src/mkcatalog.in b/textproc/mkcatalog/src/mkcatalog.in new file mode 100644 index 000000000000..95eca9503692 --- /dev/null +++ b/textproc/mkcatalog/src/mkcatalog.in @@ -0,0 +1,116 @@ +#!/bin/sh +# +# mkcatalog - script for making sgml catalog file. +# +# Created: 20001015 Shigeyuki Fukushima <shige@FreeBSD.org>. +# Modified: 20001019 Hiroki Sato <hrs@FreeBSD.org>. +# +# $FreeBSD$ +# + +PREFIX=@@PREFIX@@ +CAT_DIR=${PREFIX}/share/sgml +TMPDIR=/tmp + +F_PRESERVE_OLD="" +F_QUIET="" +args=`getopt pq $*` ; set -- $args +for i +do + case "$i" in + -p) F_PRESERVE_OLD=1; shift ;; + -q) F_QUIET=1; shift ;; + --) shift; break ;; + esac +done + +[ "x${F_QUIET}" != "x" ] && exec 1> /dev/null 2>&1 + +dtd_install=$1 +dtd_dir=$2 +[ x"$3" != "x" ] && dtd_catalog=`basename "$3"` || dtd_catalog='' + +### option check +case "${dtd_install}" in +install|deinstall) + if [ -d "${CAT_DIR}/${dtd_dir}" -o -d "${dtd_dir}" ]; then + dtd_dir=`exec 2>/dev/null; cd ${CAT_DIR}/${dtd_dir} || cd ${dtd_dir}; pwd` + case "${dtd_dir}" in + ${CAT_DIR}/*) ;; + *) echo "`basename $0`: DTD directory \"${dtd_dir}\" is invalid." + exit 1 ;; + esac + else + echo "`basename $0`: DTD directory \"${dtd_dir}\" not found." + exit 1 + fi + ### normalize dtd_dir + dtd_dir=${dtd_dir#"${CAT_DIR}/"} + ;; +*) + echo "`basename $0`: missig options." + echo "usage: `basename $0` [-pq] [install|deinstall] dtd-directory-name [catalog-filename]." + exit 1 +esac + +echo "${dtd_install} catalog for \"${dtd_dir}\"" +TMPCAT=/tmp/catalog.$$ + +proc_catalog () { + catalog_high=${1:-${CAT_DIR}/catalog} + catalog_low=${2:-${dtd_name}/catalog} + cat_line="CATALOG \"${catalog_low}\"" + abs_path_head=${catalog_high%/catalog} + + touch ${catalog_high} || exit 1 + grep -v "CATALOG \"\(${abs_path_head}/\)\?${catalog_low}\"" ${catalog_high} > ${TMPCAT} + + ### preserve old catalog + if [ "x${F_PRESERVE_OLD}" != "x" ]; then + cp ${catalog_high} ${catalog_high}.old || exit 1 + fi + + case "${dtd_install}" in + install) + echo " * add ${cat_line} line to ${catalog_high}" + echo "${cat_line}" >> ${TMPCAT} + cp ${TMPCAT} ${catalog_high} || exit 1 + ;; + deinstall) + echo " * delete ${cat_line} line from ${catalog_high}" + if [ ! -s ${TMPCAT} ]; then + echo " * delete empty catalog ${catalog_high}" + rm -f ${catalog_high} + else + cp ${TMPCAT} ${catalog_high} || exit 1 + fi + ;; + esac + + if [ "x${F_PRESERVE_OLD}" != "x" ] && \ + cmp -s ${catalog_high}.old ${catalog_high}; then + rm -f ${catalog_high}.old + fi + rm -f ${TMPCAT} +} + +IFS=" /"; set -- ${dtd_dir} +dtd_name=$1 +dtd_list="$*" +IFS=" " +n_dtd_list=$# +counter=0 + +for i in ${dtd_list} +do + counter=`expr ${counter} + 1` + cat_high_dir=${CAT_DIR}${dtd_base} + + if [ ${counter} -ne ${n_dtd_list} ]; then + proc_catalog ${cat_high_dir}/catalog ${i}/catalog + else + proc_catalog ${cat_high_dir}/catalog ${i}/${dtd_catalog:-catalog} + fi + + dtd_base=${dtd_base}/$i +done |