VTeX/2 v. 8.44.2 (OS/2 - readme, 11/2/2005, MicroPress, Michael Vulis, Walter Schmidt, Domald Arseneau, Jon Babcock, Denis Girou, Taco Hoekwater, Christoph Kloeters, Alexander Mai, Bernd Mulansky, Reinhard Zierke, DANTE) |
Readme/What's new |
============================================================
Installation instructions for VTeX/Free 8.44.2 on OS/2
( = VTeX/2 8.44b)
============================================================
2005-02-11
Walter Schmidt
Contents
--------
What is VTeX/2?
Prerequisites
Installing VTeX/2 over emTeX/TDS
Required files
Installing VTeX/2
What to do, if the installation fails ?
Installing the Adobe Euro fonts
Creating the LaTeX format file
Creating the plain TeX format file
Documentation
Using the EPM TeX Front End with VTeX/2
Support
Legal stuff
What is VTeX/2 ?
----------------
VTeX/2 is an eTeX program for OS/2 Warp to generate PDF or
PostScript output immediately from the TeX source file. It
comes with a basic LaTeX system, including many additional
packages and fonts, as well as the Bibtex and Makeindex
programs. Plain TeX is also included.
In contrast to traditional TeX systems, no intermediate DVI
files need to be generated, no "dvi driver programs" are
required, and there is no need to take care of their --
sometimes fussy -- setup.
In contrast to pdfTeX, VTeX includes a full PostScript
interpreter, so that inclusion of EPS images as well as inline
PostScript programming, i.e. PSTricks, psfrag etc. are
fully supported,
The common PostScript and PDF viewers GSView and Adobe
Reader can be used for (pre)viewing and printing.
Output files from VTeX are immediately suitable for public
distribution, e.g., over the WWW, since PostScript and PDF
are standardized document formats -- as opposed to the
TeX-specific DVI format.
The VTeX engine supports the eTeX extensions.
VTeX/2 can either be installed as a standalone LaTeX system
or on top of an existing emTeX/TDS system, version 0.56.
Prerequisites
-------------
* VTeX/2 requires Warp 3 or better, and at least 16Mb of
physical memory.
* You should have installed Ghostscript, so as to provide a
PostScript and PDF reader.
* It is highly recommended to provide also Acrobat Reader,
because this is the "canonical" PDF reader, and because
certain hypertext features of the PDF format are not
supported by Ghostscript.
* The VTeX/2 is to be installed on a HPFS drive, because it
will make use of long file names. The complete TeX system
will require about 80MB of disk space.
| The installation program requires the default OS/2 command
| shell CMD.EXE, i.e. there is absolutely no guarantee, that
| it works with any alternative shell such as 4OS2.
Installing VTeX/2 over emTeX/TDS
--------------------------------
VTeX/2 can be installed as a stand-alone TeX system or "on
top" of an existing emTeX/TDS, provided that you have got
the latest emTeX7DS version 0.56.
If you install VTeX/2 on the same drive as an existing
emTeX/TDS, they will share the same TeX directory tree,
thus saving lots of disk space. Also installing of VTeX
will update many components of your emTeX system.
If you keep VTeX and emTeX on different drives, they will be
completely independent.
| After installing VTeX over emTeX/TDS 0.56, you _must_
| re-make the emTeX format files.
|
| Furthermore, you _must_ change the environment variable
| TEXCONFIG so as to comply with the latest TDS
| specifications:
|
| TEXCONFIG=C:\TEXMF\DVIPS!!;C:\TEXMF\FONTS\MAP\DVIPS;C:\TEXMF\FONTS\ENC\DVIPS
|
| (Replace "C:" with the letter of the volume where you have
| actually installed emTeX.)
Installing VTeX/2 over emTeX/TDS will update the font map
files psfonts.map and cmfonts.map, so that dvips can use the
additional Type1 fonts that come with VTeX -- except for the
EC/TC and the Hebrew fonts of the ArabTeX system, which work
with VTeX only.
Required files
--------------
vtexinst.cmd (installation program)
vtex2-8442.zip
vtex-base-8442.zip
vtex-base2-8442.zip
vtex-special-8442.zip
vtex-fonts-8442.zip
vtex-fonts2.zip
vtex-doc-8422.zip
vtex-cbfonts.zip (optional)
vtex-sem.zip (optional)
vtex-gex.zip (optional)
vtex-koma.zip (optional)
Remarks:
vtex-gex.zip is unchanged since v7.320. vtex-fonts2.zip is
unchanged since v7.53. You need not download them once
again, if you have them already.
vtex-cbfonts.zip contains the Greek Computer Modren fonts,
aka "CB fonts". Omit this archive, if you do not intend to
use them.
vtex-gex.zip includes the documentation of VTeX's built-in
PostScript interpreter; omit this file, if you want.
The archive vtex-koma.zip includes the "KOMA-Script"
document classes for use with LaTeX. In case you have
already installed these document classes yourself, or if you
don't intend to use them, omit this archive.
The archive vtex-sem.zip includes the LaTeX packages seminar
and prosper; you need not install it, unless you actually
want to use these packages.
Optional files can be installed later, by simply unpacking
the archives in the root directory of the drive where VTeX/2
is installed.
Installing VTeX/2
-----------------
(0)
Any existent version of VTeX _prior_ to 7.10 must be deleted
manually. Later versions can be updated automatically.
(1)
Put the installation program vtexinst.cmd and all required
ZIP files (see above) into a temporary directory. The
contents of this directory can be removed, once the
installation is completed.
(2)
Go to the above directory; then start the installation
program "vtexinst". (Note that vtexinst CANNOT be executed
from a different directory!)
When the program asks you, for the version of VTeX/2 to
install, enter:
8.44.2
You will also be asked for the drive where VTeX is to be
installed or updated. It will be installed in the
directories \vtex and \texmf of that drive.
Note that the configuration program will update various
configuration files:
\texmf\vtex\config\hyphen.cfg
\texmf\vtex\config\plain.cfg
\vtex\bin\vtex.ini (*)
\texmf\vtex\config\ps.fm (*)
\texmf\vtex\config\pdf.fm (*)
The files marked by (*) are updated only if your previous
version of VTeX was < 8.44.
Existing configuration files are always backed up, with the
extension ".sav" appended to the original name. If you have
customized them, don't forget to check your changes against
the updated instances!
| If you have previously installed the "CB fonts" package
| from <http://home.vr-web.de/cb4vtex>, you must delete the
| record for cb.ali from the .fm files now (unless the files
| are updated, enyway.)
| Rationale: Records for the CB fonts are now part of the
| default configuration, see the file cm.ali.
(3)
VTeX/2 requires the following settings in the system
configuration file config.sys of OS/2:
PATH must include <drive>:\VTEX\BIN
LIBPATH must include <drive>:\VTEX\DLL
(Replace <drive> with the letter of the drive, where VTeX/2
is actually installed.)
The installaton program can modify config.sys appropriately;
however, it will _not_ do so without asking you before, and
you may chose to edit config.sys manually.
| Do _not_ forget to reboot OS/2, after any changes to
| config.sys have been made!
What to do, if the installation fails ?
---------------------------------------
The installation program should tell you about the reason
of the error; just read what it writes to the screen. Maybe
it is something you can fix, e.g., one of the required files
might be missing.
If you don't understand the message at all, or if the reason
of the failure seems to be outside your responsibility, you
may ask me for help: The installation program will generate
a transcript file named vtexinst.log. Please, send this
file, together with a verbal description of the problem to
<vtexfree(at)gmx.net>
Creating the LaTeX format file
------------------------------
Open an OS/2 comand line in an arbitrary directory and
execute the following command:
makevlatex
If there are any error messages, you should check the log
file, which is created in the directory \vtex\fmt.
Now you should check, whether the installation works: Run
the file ltxcheck.tex through LaTeX, thus making sure that
the installation works. The file resides in the directory
\texmf\source\latex\base. Switch to this directory
cd \texmf\source\latex\base
and execute the following command:
vlatex ltxcheck
This will produce a number of messages, each of which should
be "OK".
Creating the plain TeX format file
----------------------------------
Omit this step, if you don't know what "plain TeX" is!
Open an OS/2 comand line in an arbitrary working directory
and execute the following command:
makevplain
If thee are any error messages, you should check the log
file, which is created in the directory \vtex\fmt.
Documentation
-------------
See the files in the directory texmf\doc\vtex:
local.eng Preliminary LaTeX Local Guide
(READ THIS FIRST!)
plain.eng plain TeX Local Guide
(ignore it, if you don't know
what "plain TeX" is)
vtex.pdf The VTeX/Free manual
etex_man.pdf eTeX manual
gex.pdf GeX Manual
mm_man.pdf How to use MM fonts with VTeX
forms.pdf How to use PDF forms from TeX
animgif.pdf How to include animated GIFs into
PDF documents
examples\* Sample documents
The sample file tryanim.tex and part of the examples in the
document animgif.pdf may not work with Acrobat Reader 5 or
later, due to the "features" of the latest Acrobat. They
do, however, work with Acrobat 4 and (almost) with Acrobat
Reader 3 on OS/2.
Using the EPM TeX Front End with VTeX/2
---------------------------------------
The EPM TeX Front End is a powerful integrated TeX
environment, based on the OS/2 editor EPM; see
<ftp://dante.ctan.org/tex-archive/systems/os2/epmtfe/>
In conjunction with VTeX/2 v8.44 it is highly recommended to
use the latest version 4.x of the TeX Front End!
Support
-------
The NTG hosts a mailing list that can be used both to ask
questions and to report bugs in the software and/or
installation. The list has a web interface for subscribing,
unsubscribing, accessing the archives etc:
<http://www.ntg.nl/mailman/listinfo/ntg-vtex>
Legal stuff
-----------
MicroPress and VTeX are trademarks of MicroPress, Inc.
The MicroPress' components of the VTeX/Lnx distribution are
Copyright (C) 1998--2005 by MicroPress Inc.
The MicroPress' components of the VTeX/2 distribution are
free for personal use, subject to the following restriction:
Redistribution is allowed only as a part of the complete
VTeX/2 system, and only if all of the following files remain
unchanged and are distributed as a whole:
readme-os2.eng
vtexinst.cmd
vtex2-8442.zip
vtex-base-8442.zip
vtex-base2-8442.zip
vtex-special-8442.zip
vtex-fonts-8442.zip
vtex-fonts2.zip
vtex-doc-8422.zip
vtex-cbfonts.zip
vtex-sem.zip
vtex-gex.zip
vtex-koma.zip
Adobe, Acrobat and PostScript are trademarks of Adobe
Systems Incorporated.
== finis |
VTeX/2 v. 8.44.2 (OS/2 - VTeX/2 installation program, , Walter Schmidt, Erlangen) |
Readme/What's new |
/* REXX */
/*
vtexinst.cmd, version 2
Copyright (C) 2001--2005 Walter Schmidt, Erlangen
VTeX/2 installation program
to be run from a local directory,
which must contain all required files
*/
/* Load REXXUTIL */
ret = RxFuncAdd("SysLoadFuncs", "REXXUTIL", "SysLoadFuncs")
call SysLoadFuncs
/* Load text strings for SysFileDel and SysRmDir return codes. */
CALL LoadDELRCText /* provides text strings for SysFileDel return codes */
CALL LoadRDRCText /* provides text strings for SysRmDir return codes */
/*
Initialization
--------------
*/
/* This distribution */
SCRIPTVERSION = 8.442 /* version of the installation program */
EMTEX=0.56 /* matching version of emTeX/TDS */
INTRO = 'Installation program for VTeX/2 ' || SCRIPTVERSION || ' and later'
OBSOLETE = 'vtex/install/obsolete.os2' /* list of obsolete files */
OLDVERSION = 8.440
/* FM and INI files of this version can be used still. */
/* Also, the EC fonts are not reinstalled, when this verson is present, */
/* and "full reinstall" is not selected. */
/* The files in the distribution: */
/* number of version-dependent files*/
varfile.0 = 6
/* number of version-independent files */
fixedfile.0 = 1
/* number of optional files (which must be version-independent, too) */
optfile.0 = 4
varfile.1 = "vtex2"
varfile.2 = "vtex-doc"
varfile.3 = "vtex-special"
varfile.4 = "vtex-fonts"
varfile.5 = "vtex-base"
varfile.6 = "vtex-base2"
fixedfile.1 = "vtex-fonts2.zip"
optfile.1 = "vtex-gex.zip"
optfile.2 = "vtex-sem.zip"
optfile.3 = "vtex-koma.zip"
optfile.4 = "vtex-cbfonts.zip"
/* the name of the file, where the version info will be stored */
VERSIONFILE = "\vtex\install\VERSION"
/* query boot volume */
bootdrv = querybootdrv()
if bootdrv = '' then signal nobootdrv
/* query working directory */
wrkdir = strip(directory(), "T", "\")
/* start writing the log file */
logfile = wrkdir || "\vtexinst.log"
rc = sysfiledelete(logfile)
if rc > 2 then signal logfileerr
call wlog 'vtexinst ' || SCRIPTVERSION
call wlog date() time()
call wlog 'OS/2:' SysOS2Ver()
call wlog 'Shell:' value("OS2_SHELL", , "OS2ENVIRONMENT")
call wlog 'Boot drive =' bootdrv
call wlog 'Working directory = "' || wrkdir || '"'
call wlog 'PATH = "' || VALUE("PATH", , "OS2ENVIRONMENT") || '"'
call wlog 'Unzip program = "' || SysSearchPath("PATH", "unzip.exe") || '"'
/* Ask for the drive where to install or update VTeX */
say
say INTRO
say
say "Which version of VTeX/2 do you want to install?"
answer = linein()
call wlog 'Requested version: ' || '"' || answer || '"'
parse value answer with major '.' minor '.' subver
if (major='' or minor='') then signal versionerr
versionid = major|| minor || subver
newver = major || '.' || minor || subver
if newver < SCRIPTVERSION then signal tooold
else
call wlog 'New version ID:' newver
say "On which volume (drive) do you want VTeX/2 to be installed or updated?"
say "(hit <return> only to select the boot volume)"
answer = linein()
texdrive = translate(substr(answer,1,1)) || ":"
if texdrive = ":" then texdrive = bootdrv
call wlog 'VTeX volume = "' ||texdrive|| '"'
/* determine version of existing VTeX */
ver = SysIni(texdrive || VERSIONFILE, "VTEX2", "VERSION")
if ver = "ERROR:" then do
if stream(texdrive||"\texmf\vtex\config\psfig.sty", "C", "QUERY EXISTS") <> "" then
ver = 7.32
else
ver = 0
end
say
if ver > 7.32 then say "VTeX version " || ver || " detected on volume " || texdrive
call wlog 'Current version ID =' ver
if ver > newver then signal toonew
/* force full re-install ? */
if ver >= OLDVERSION then do
say
say "By default, your VTeX/2 system will be updated only."
say "However, you may also force a full reinstall, e.g.,"
say "in case the current installation is corrupt."
say
say "Do you request a full reinstall? (y/n)"
answer = translate(substr(linein(),1,1))
if answer = "Y" then do
ver = 0
call wlog 'Full install requested'
end
end
/* search for emTeX/TDS on the same drive */
emtexver = SysIni(texdrive"\texmf\emtex\data\EMTEXTDS.INI", "EMTEXTDS", "VERSION")
if emtexver <> "ERROR:" then do
say
say "emTeX/TDS version" emtexver "detected."
call wlog 'Current emTeX =' emtexver
if emtexver < EMTEX then signal oldemtex
end
/* determine the actual names of the required ZIP files */
/* and make sure they exist */
res = 1
if ver < newver then do
do i = 1 to varfile.0
varfile.i = varfile.i || '-' || versionid || '.zip'
call wlog 'Required: ' varfile.i
if (stream(varfile.i, "C", "QUERY EXISTS") = "") then do
res = 0
call wlog 'missing file:' varfile.i
say "missing file:" varfile.i
end
end
end
if ver < OLDVERSION then do
do i = 1 to fixedfile.0
call wlog 'Required: ' fixedfile.i
if (stream(fixedfile.i, "C", "QUERY EXISTS") = "") then do
res = 0
call wlog 'missing file:' fixedfile.i
say "missing file:" fixedfile.i
end
end
end
if res <> 1 then signal fileerr
/* Last exit */
say
say "VTeX/2 on volume " || texdrive || " will be installed/updated."
say "Continue? (y/n)"
answer = translate(substr(linein(),1,1))
if answer <> "Y" then signal cancel
/*
Go to the target drive
----------------------
*/
call setlocal
call directory(texdrive||"\")
call wlog 'current directory changed to' directory()
call wlog ' '
/*
Unpack the ZIP archives
-----------------------
*/
vtex:
SIGNAL on error name unziperr
/* overwrite existing files by default */
ret=value("UNZIP", "-qqo", "OS2ENVIRONMENT")
/* unzip the required files: */
if ver < newver then do
/* back up existing configuration files first */
call saveconfig("\vtex\bin\vtex.ini")
call saveconfig("\texmf\vtex\config\hyphen.cfg")
call saveconfig("\texmf\vtex\config\plain.cfg")
call saveconfig("\texmf\vtex\config\pdf.fm")
call saveconfig("\texmf\vtex\config\ps.fm")
do i = 1 to varfile.0
varfile.i = wrkdir || "\" || varfile.i
call wlog "unzip " || varfile.i
"unzip " || varfile.i
end
say "New configuration files \texmf\vtex\config\hyphen.cfg and .\plain.cfg installed."
call wlog "New configuration files \texmf\vtex\config\hyphen.cfg and .\plain.cfg installed."
end
if ver < OLDVERSION then do
do i = 1 to fixedfile.0
fixedfile.i = wrkdir || "\" || fixedfile.i
call wlog "unzip " || fixedfile.i
"unzip " || fixedfile.i
end
end
/* unzip optional files, if present */
do i = 1 to optfile.0
optfile.i = wrkdir || "\" || optfile.i
if stream(optfile.i, "C", "QUERY EXISTS") <> "" then do
call wlog "unzip " || optfile.i
"unzip " || optfile.i
end
end
SIGNAL on error
/*
Removing obsolete files created by previous versions
----------------------------------------------------
*/
if ver < newver then do
say "Removing possibly obsolete files..."
do while lines(OBSOLETE) > 0
l = strip(linein(OBSOLETE))
if l \= '' then do
if substr(l, length(l), 1) = "\" then do
l = substr(l, 1, (length(l)-1))
call wlog "Trying to delete directory" l
call ddt(l)
end
else do
call wlog "Trying to delete file" l
call SysFileDelete(l)
end
end
end
say " ...done."
end
/*
Writing the version number
--------------------------
*/
writever:
ret = SysIni(texdrive || VERSIONFILE, "VTEX2", "VERSION", newver)
say
if ret = "" then do
call wlog "version number" newver "written"
say "Version number" newver "written."
end
else do
call wlog "Writing version number failed with rc =" ret
say "Writing the version number failed."
end
cfgfiles:
call wlog ' '
say
/*
Restore FM and INI files or configure the new ones
--------------------------------------------------
*/
if ver < OLDVERSION then do
/* FM files: */
call readconfig "\texmf\vtex\config\pdf.fm"
call fmedit texdrive
config.1 = '% pdf.fm, for PDF mode, created by vtexinst ' date() time()
call writeconfig "\texmf\vtex\config\pdf.fm"
/* we just hope that writing of the file was successful... */
call readconfig "\texmf\vtex\config\ps.fm"
call fmedit texdrive
config.1 = '% ps.fm, for PS mode, created by vtexinst ' date() time()
call writeconfig "\texmf\vtex\config\ps.fm"
/* we just hope that writing of the file was successful... */
say "New configuration files \texmf\vtex\config\pdf.fm and .\ps.fm installed."
call wlog "New configuration files \texmf\vtex\config\pdf.fm and .\ps.fm installed."
/* configure INI file: */
if texdrive <> "c:" then do
call readconfig "\vtex\bin\vtex.ini"
call iniedit texdrive
call writeconfig "\vtex\bin\vtex.ini"
/* we just hope that writing of the file was successful... */
end
say "New configuration file \vtex\bin\vtex.ini installed."
call wlog "New configuration file \vtex\bin\vtex.ini installed."
end
else do
/* restore FM and INI files: */
call restconfig("\texmf\vtex\config\pdf.fm")
call restconfig("\texmf\vtex\config\ps.fm")
call restconfig("\vtex\bin\vtex.ini")
end
say
"@pause"
/*
Updating config.sys
-------------------
*/
/* Skip this step, if PATH includes vtex already */
/* In this case we assume that LIBPATH is ok, too. */
p = value("PATH", , "OS2ENVIRONMENT")
if substr(p, length(p), 1) <> ";" then p = p || ";"
call wlog ' '
call wlog 'PATH = "' || p || '"'
if pos(texdrive||"\VTEX\BIN;", translate(p)) <> 0 then signal done
say
say "The installation program is going to update the file config.sys now."
say "If you prefer to do this manually, then enter `n' below,"
say "otherwise enter `y' to continue."
say "Continue? (y/n)"
answer = translate(substr(linein(),1,1))
if answer <> "Y" then signal done
call wlog 'updating config.sys'
/* make sure that config.sys can be found */
configfile = bootdrv||"\config.sys"
if stream(configfile,"C","QUERY EXISTS") = "" then signal noconfig
call readconfig configfile
if pathedit("PATH", texdrive||"\vtex\bin;") = 0 then signal updfailed
if libpathedit(texdrive||"\vtex\dll;") = 0 then signal updfailed
tempfile=SysTempFileName(bootdrv||"\config??.sys")
if tempfile="" then signal updfailed
signal on error name updfailed
savedfile = filespec("N", tempfile)
"@ren" configfile savedfile
say
say "The file" configfile "has been renamed to" savedfile "."
call wlog configfile ' renamed to ' savedfile
res = writeconfig(configfile)
if res=0 then do
call beep 440,250
say "Writing a new file" configfile "failed".
say "Rename" savedfile "to config.sys and apply the changes manually."
call wlog 'Writing new' configfile 'failed.'
end
else do
say
say "A new file" configfile "has been written."
say "Shutdown and reboot OS/2 now to make the changes come into effect."
call wlog 'New config.sys created.'
end
/*
exiting
*/
done:
call wlog 'Finis.'
say
say "Finis."
say "Do not forget to generate (new) format files now!"
exit
/*
Error handling:
*/
logfileerr:
say
say "Error: I cannot write to the file" logfile "."
exit
versionerr:
say
say "The installation program cannot proceed,"
say "because you have specified an invalid version number,"
exit
toonew:
say
say "The version of VTeX/2 found on your PC is already newer"
say "than the version you have requested to install."
call wlog 'Existing VTeX/2 is newer than the version to be installed.'
exit
tooold:
say
say "This version of the installation program is not suitable"
say "for VTeX/2 prior to version" SCRIPTVERSION
say
exit
oldemtex:
call wlog 'Obsolete emTeX found.'
say
say "You cannot install VTeX/2" newver "over emTeX prior to" EMTEX
exit
nobootdrv:
call wlog 'Could not locate boot volume.'
say
say "The installation program cannot proceed,"
say " because the boot partition cannot be located."
say "VTeX/2 could not be installed."
exit
noconfig:
call wlog 'Could not locate config.sys.'
say
say "The installation program could not locate the file config.sys"
say "and was unable to determine whether it needs to be updated."
say "Please, see the installation instructions for the required changes"
say "and how to apply them manually."
exit
updfailed:
call wlog 'Updating config.sys failed.'
say
say "Updating config.sys failed for unknown reason."
say "The file config.sys has *** not *** been changed."
say "Please, read the installation instructions"
say "and apply any changes manually."
exit
error:
call wlog 'Error: "'condition('D')'"' 'failed.'
call beep 440,250
say
say 'Error: "'condition('D')'"' 'failed.'
say 'VTeX/2 could not be installed successfully.'
exit
fileerr:
call wlog 'Required file(s) not found.'
call beep 440,250
say
say "One or more of the files required to"
say "install or update VTeX/2" newver "were not found."
say "VTeX/2 could not be installed."
exit
unziperr:
call wlog '"unzip" failed.'
call beep 440,250
say
say 'The program "unzip" failed or was not found.'
say 'VTeX/2 could not be installed.'
exit
cancel:
call wlog 'Terminated by the user.'
say "You have terminated the installation program."
exit
/*
Procedures used above:
*/
/*
query boot drive
usage: querybootdrv()
returns: letter of boot drive incl. colon
*/
querybootdrv: PROCEDURE
bootdr = value('COMSPEC', , 'OS2ENVIRONMENT')
bootdr = filespec('D', bootdr)
if bootdr = "" then do
say "Please, tell me the letter of the boot volume:"
answer = linein()
bootdr = substr(strip(answer),1,1)||":"
end
return bootdr
/*
save file by appending .sav to the name
usage: call saveconfig file
returns: 1 if succesful
*/
saveconfig: PROCEDURE expose logfile
parse arg file
start = lastpos("\", file) + 1
if start > 1 then do
len = length(file) - start + 1
stem = substr(file, start, len)
end
else
stem = file
if (stream(file, "C", "QUERY EXISTS") <> '') then do
"@copy" file file||".sav"
call wlog "Configuration file" file "saved as" stem||".sav ."
return 1
end
else
return 0
/*
restore saved file
usage: call restconfig file
returns: 1 if successful
*/
restconfig: PROCEDURE expose logfile
parse arg file
if (stream(file||".sav", "C", "QUERY EXISTS") <> '') then do
"@copy" file||".sav" file
call wlog "Configuration file" file "restored."
return 1
end
else
return 0
/*
read config file
usage: call readconfig filename
returns: (nothing)
*/
readconfig: PROCEDURE expose config. cmax
parse arg infile
cmax=0
do while lines(infile) > 0
cmax=cmax+1
config.cmax=linein(infile)
end /* do */
call stream infile, "C", "CLOSE"
return
/*
write config file
usage: call writeconfig filename
returns: 1 if successful
0 if writing the file failed
*/
writeconfig: PROCEDURE expose config. cmax
parse arg outfile
call SysFileDelete outfile
do i = 1 TO cmax
if config.i <> "deleted" then do
res = lineout(outfile, config.i)
end
end /* do */
call stream outfile, "C", "CLOSE"
if res <> 0 then return 0
else return 1
/*
edit a path
usage: pathedit(path, entry, op)
op = "D" means "delete this entry"
op = "A" (default) means "add entry"
returns 1 if successful
0 if path or entry to be deleted not found
2 if entry to be added was already present
*/
pathedit: PROCEDURE expose config. cmax
parse arg rpath, rdirectory, rop
op = translate(rop)
path = strip(translate(rpath))
trigger = " "||path||"="
directory = translate(rdirectory)
i=0
do forever
i=i+1
if i>cmax then leave
posi = pos(trigger, translate(config.i))
if posi > 1 then do
cmd = subword(translate(config.i), 1, 1)
if cmd = "SET" then leave
end
end /* do */
if i>cmax then return 0
setting = substr(config.i, (posi+length(trigger)))
setting = strip(setting)
if substr(directory,length(directory),1) <> ";" then directory = directory || ";"
if substr(setting,length(setting),1) <> ";" then setting = setting || ";"
if op="D" then do
posi = pos(directory,translate(setting))
if posi<>0 then config.i= "SET " || path || "=" || delstr(setting, posi, length(directory))
else return 0
end /* do */
else do
if pos(directory,translate(setting))<>0 then return 2
else do
setting=setting || rdirectory
config.i = "SET " || path || "=" || setting
end /* do */
end /* do */
return 1
/*
edit LIBPATH
usage: libpathedit(entry, op)
op = "D" means "delete this entry, if existing"
op = "A" (default) means "add entry"
returns: 1 if successful
0 if LIBPATH or entry to be deleted not found
2 if entry to be added was already present
*/
libpathedit: PROCEDURE expose config. cmax
parse arg rdirectory, rop
directory = translate(rdirectory)
op = translate(rop)
i=0
do forever
i=i+1
if i>cmax then leave
posi = pos("LIBPATH=", translate(config.i))
if posi = 1 then leave
end /* do */
if i>cmax then return 0
setting = substr(config.i, 9)
setting=strip(setting)
if substr(directory,length(directory),1) <> ";" then directory = directory || ";"
if substr(setting,length(setting),1) <> ";" then setting = setting || ";"
if op="D" then do
posi = pos(directory,translate(setting))
if posi<>0 then config.i= "LIBPATH=" || delstr(setting, posi, length(directory))
else return 0
end /* do */
else do
if pos(directory,translate(setting))<>0 then return 2
else do
setting=setting || rdirectory
config.i = "LIBPATH=" || setting
end /* do */
end /* do */
return 1
/*
edit vtex,ini
usage: call iniedit drive
drive = drive letter of VTeX drive including colon
returns: 1 if successful
0 otherwise
*/
iniedit: PROCEDURE expose config. cmax
parse arg drive
drive = drive || "\"
default = "c:\"
i =0
do forever
i=i+1
if i>cmax then leave
start = 1
do forever
j = pos(default, config.i, start)
if j=0 then leave
config.i = overlay(drive, config.i, j)
start = j+2
end
end /* do */
return 1
/*
edit FM file
usage: call fmedit drive
drive = drive letter of VTeX drive including colon
returns: 1 if successful
0 otherwise
*/
fmedit: PROCEDURE expose config. cmax
parse arg drive
i = 0
ctrl =2
do forever
i = i+1
if i>cmax then leave
if pos('TEXMF = "c:/texmf/"', config.i) <> 0 then do
config.i = ' TEXMF = "'||drive||'/texmf/"'
ctrl = ctrl - 1
end
end
/* exactly 2 matches must be found */
if ctrl = 0 then return 1
else return 0
/*
write message to log file
*/
wlog: PROCEDURE expose logfile
parse arg string
rc = lineout(logfile, string)
return rc
/*
Procedures for deleting a directory tree
*/
DDT:
parse arg user_dir
/* Check to make sure the directory exists */
rc=SysFileTree(user_dir,dir_list, 'D')
IF dir_list.0 = 0 THEN
DO
SAY user_dir 'not found.'
RETURN
END
DROP dir_list.
/* Mark all the read-only files to be non read-only */
rc=SysFileTree(user_dir || '\*.*', dir_list, 'FSO', '****','----')
DROP dir_list.
/* Go through the list of files and delete each one */
rc=SysFileTree(user_dir || '\*.*', dir_list, 'FSO')
DO x = 1 TO dir_list.0
rc = SysFileDelete(dir_list.x)
if rc <> 0 then SAY dir_list.x '........' DELRCText.RC
END
DROP dir_list.
/* Go through all the subdirectories and remove them. */
/* We go backwards through the list in order to delete the */
/* lowest level sudirectories first and work our way back up */
/* the tree. */
rc=SysFileTree(user_dir || '\*.*', dir_list, 'DSO')
DO x = dir_list.0 TO 1 BY -1
rc=SysRmDir(dir_list.x)
if RC <> 0 then SAY dir_list.x '........' RDRCText.RC
END
DROP dir_list.
/* Delete the topmost directory */
rc=SysRmDir(user_dir)
SAY user_dir '........' RDRCText.RC
RETURN
LoadDELRCText:
/* provides text strings for SysFileDel return codes */
/* The return codes and strings are in the online Rexx manual */
DELRCText.0 = 'File deleted successfully. '
DELRCText.2 = 'Error. File not found. '
DELRCText.3 = 'Error. Path not found. '
DELRCText.5 = 'Error. Access denied. '
DELRCText.26 = 'Error. Not DOS disk. '
DELRCText.32 = 'Error. Sharing violation. '
DELRCText.36 = 'Error. Sharing buffer exceeded. '
DELRCText.87 = 'Error. Invalid parameter. '
DELRCText.206 = 'Error. Filename exceeds range error. '
RETURN
LoadRDRCText:
/* provides text strings for SysRmDir return codes */
/* The return codes and strings are in the online Rexx manual */
RDRCText.0 = 'Directory removal was successful. '
RDRCText.2 = 'Error. File not found. '
RDRCText.3 = 'Error. Path not found. '
RDRCText.5 = 'Error. Access denied. '
RDRCText.16 = 'Error. Current Directory. '
RDRCText.26 = 'Error. Not DOS disk. '
RDRCText.87 = 'Error. Invalid parameter. '
RDRCText.108 = 'Error. Drive locked. '
RDRCText.206 = 'Error. Filename exceeds range error. '
RETURN
/* finis */ |
Aggiungi un commento