Newly port: mkcatalog.
A maintainance utility for sgml catalog files.
This commit is contained in:
parent
bd96cefe0c
commit
80e70145a6
Notes:
svn2git
2021-03-31 03:12:20 +00:00
svn path=/head/; revision=34282
7 changed files with 215 additions and 0 deletions
|
@ -58,6 +58,7 @@
|
|||
SUBDIR += lotusxsl
|
||||
SUBDIR += man2html
|
||||
SUBDIR += mgdiff
|
||||
SUBDIR += mkcatalog
|
||||
SUBDIR += mswordview
|
||||
SUBDIR += nfbtrans
|
||||
SUBDIR += nicetext
|
||||
|
|
37
textproc/mkcatalog/Makefile
Normal file
37
textproc/mkcatalog/Makefile
Normal file
|
@ -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>
|
1
textproc/mkcatalog/pkg-comment
Normal file
1
textproc/mkcatalog/pkg-comment
Normal file
|
@ -0,0 +1 @@
|
|||
A maintainance utility for sgml catalog files.
|
47
textproc/mkcatalog/pkg-descr
Normal file
47
textproc/mkcatalog/pkg-descr
Normal file
|
@ -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
|
1
textproc/mkcatalog/pkg-plist
Normal file
1
textproc/mkcatalog/pkg-plist
Normal file
|
@ -0,0 +1 @@
|
|||
sbin/mkcatalog
|
12
textproc/mkcatalog/scripts/configure
vendored
Normal file
12
textproc/mkcatalog/scripts/configure
vendored
Normal file
|
@ -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
|
116
textproc/mkcatalog/src/mkcatalog.in
Normal file
116
textproc/mkcatalog/src/mkcatalog.in
Normal file
|
@ -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
|
Loading…
Reference in a new issue