/usr/bin/gensgmlenv is in sgmltools-lite 3.0.3.0.cvs.20010909-15.1ubuntu1.
This file is owned by root:root, with mode 0o755.
The actual contents of the file can be viewed below.
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 111 112 113 114 115 116 | #!/usr/bin/python
#
# gensgmlenv.in
#
# $Id: gensgmlenv.in,v 1.2 2000/04/26 17:06:01 cdegroot Exp $
#
# Generate /etc/sgml/sgml.env, containing definition for SGML_CATALOG_FILES
#
# SGMLtools - an SGML toolkit.
# Copyright (C) 1999 Cees A. de Groot
#
# modified for Debian usage: taketoshi sano
#
# This program is free software; you can redistribute it and/or modify
# it under the terms of the GNU General Public License as published by
# the Free Software Foundation; either version 2 of the License, or
# (at your option) any later version.
#
# This program is distributed in the hope that it will be useful,
# but WITHOUT ANY WARRANTY; without even the implied warranty of
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
# GNU General Public License for more details.
#
# You should have received a copy of the GNU General Public License
# along with this program; if not, write to the Free Software
# Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
#
#
"""
head1 NAME
gensgmlenv - Generate /etc/sgml/sgml.env (and sgml.cenv)
SYNOPSIS
gensgmlenv
DESCRIPTION
The subroutine gensgmlenv generates a file /etc/sgml/sgml.env that contains
the bourne shell command that sets SGML_CATALOG_FILES. It is meant to be
included in SGML-processing scripts and/or in /etc/profile.
EXCEPTIONS
There are some exceptions which can be thrown by this module. They
are:
Error: Base error. If that module throws an exception, and you don't
want to catch every specific one, catching of Error would be enough.
NoCatalogError: There was no catalog files found.
ReadLinkError: There was an error occured during trial of getting
the real name of the file pointed by a symbolic link.
WriteScriptError: Could not write the configuration script. The type
of the shell will be thrown within the detail attribute.
"""
import glob, os, re, string
class Error(Exception):
pass
class NoCatalogError(Error):
pass
class ReadLinkError(Error):
pass
class WriteScriptError(Error):
pass
_subdot = re.compile("\.\.\/\.\.\/\.\.").sub
_subslash = re.compile("\/\/").sub
def gensgmlenv():
catfiles = []
# for link in glob.glob("/etc/sgml/catalog.d/*"):
# try:
# file = os.readlink(link)
# except os.error:
# raise ReadLinkError, file
# file = _subdot("", file, 1)
# file = _subslash("/", file)
# catfiles.append(file)
# if not catfiles:
# raise NoCatalogError
# files = string.join(catfiles, ":")
#
# Debian uses /etc/sgml/catalog for system SGML catalog
# file and it is maintained by update-catalog in sgml-base.
files = "/etc/sgml/catalog"
try:
sgmlenv = open("/etc/sgml/sgml.env", "w")
sgmlenv.write("SGML_CATALOG_FILES=%s\n"
"export SGML_CATALOG_FILES\n" % files)
sgmlenv.close()
except IOError:
raise WriteScriptError, "writing sh version"
try:
sgmlenv = open("/etc/sgml/sgml.cenv", "w")
sgmlenv.write("setenv SGML_CATALOG_FILES %s\n" % files)
sgmlenv.close()
except IOError:
raise WriteScriptError, "writing csh version"
if __name__ == "__main__":
# testcode
gensgmlenv()
|