ts@chyde.uwasa.fi (Timo Salmi) (05/22/91)
Tue 21-May-91: I have programmed three sets of various MsDos
filters, and now updated the first set to be /pc/ts/tsfile17.arc. In
general, the true (Unix-type) filters are written to rely on pipes
and/or redirection. A common practical problem with these filters is
that if you type the filter name all by itself, you appear to be
stuck. In actual fact the filter is just expecting input from the
console. The remedy to this problem is to program the filter in a
way that it senses whether it is getting piped (or redirected)
input. If it is not, then instead of filtering, the call to the
filter should give the instructions. As an example consider the
filter UNIX2PC which converts Unix eolns (end of lines) to PC eolns
(useful if you transfer Unix text files to your PC). The common
syntax using pipe and redirection is
TYPE UNIX.TXT | UNIX2PC > PC.TXT
What I have done is to reprogram UNIX2PC in such a way that if you
write alone
UNIX2PC
this call will give you the instructions, instead of waiting for
input from the console to the filter. Technically speaking this is
achieved by a program code which detects where the input comes from,
and acts accordingly. The idea for using this redirection detection
code comes from an article in the PC Magazine, April 16, 1991, p.
374. (This does not work for MsDos versions earlier than 2.00).
I have included this feature in the following of the filters in
the updated tsfilt17.arc package:
PC2UNIX.EXE PC text eolns to Unix eolns
UNIX2PC.EXE Unix text eolns to PC eolns
ASC2IBM.EXE 7 ascii to Scandinavian 8bit ibm
IBM2ASC.EXE 8bit ibm to Scandinavian 7 ascii
The input and output of also ASC2IBM.EXE and IBM2ASC.EXE has not
been buffered for faster disk access (in other words these filters
kind of have a cache of their own).
The following edited extract from my Frequently Asked Questions
is also of interest here:
23. *****
Q: Where can I find compress for MsDos to handle .Z files?
A: Unix has compress, uncompress and zcat programs to pack or
unpack files which are given the .Z extension. These files can also
be handled under MsDos using for example /pc/unix/comp430d.zip,
which is available from anonymous FTP sites like garbo.uwasa.fi,
SIMTEL20, etc.
There is one useful trick if you uncompress on MsDos such text
files that have been made on Unix with compress. Unix and MsDos have
different eolns (end of lines). You can extract a Unix compressed
text file as follows
comp430d -d -c YourZFile | unix2pc > YourOutputFile
where unix2pc.exe is taken from /pc/ts/tsfilt17.arc (or whatever is
the current verion number).
TSFILT17.ARC Filters for textfiles by T.Salmi
Filename Comment Date Time
-------- -------------------------------- ---- ----
ASC2IBM.EXE toasc.exe in filter format 05-22-91 06:46:36
FLMARG.EXE Filter for adding a left margin 08-16-89 20:21:20
FLRMARG.EXE Filter for a right margin 08-16-89 20:21:34
FLSUBS.EXE Filter for string substitution 08-16-89 20:21:06
IBM2ASC.EXE toibm.exe in filter format 05-22-91 06:56:48
LOGFILT.EXE Filters backspaces from logfiles 08-16-89 21:32:02
PC2UNIX.EXE PC text eolns to Unix eolns 05-21-91 21:02:46
QUOTE.EXE Quotes to messages 08-25-89 20:58:06
TOASC.EXE 8bit ibm to Scandinavian 7 ascii 08-16-89 21:35:48
TOASCI.EXE 8bit ibm to International 7ascii 08-16-89 21:34:56
TOIBM.EXE 7 ascii to Scandinavian 8bit ibm 08-16-89 21:34:06
TSFILT.INF Document (a readme) 05-22-91 09:43:02
TSFILT.NWS News announcements about tsfilt 05-22-91 09:39:30
TSPROG.INF List of PD programs from T.Salmi 03-30-91 10:23:20
UNIX2PC.EXE Unix text eolns to PC eolns 05-21-91 21:02:02
VAASA.INF Info: Finland, Vaasa, U of Vaasa 02-02-90 11:52:54
---- ------ ------ -----
0016 171168 126366 27%
...................................................................
Prof. Timo Salmi
Moderating at garbo.uwasa.fi anonymous ftp archives 128.214.12.37
School of Business Studies, University of Vaasa, SF-65101, Finland
Internet: ts@chyde.uwasa.fi Funet: gado::salmi Bitnet: salmi@finfunvalley@gsbsun.uchicago.edu (Doug Dougherty) (05/22/91)
ts@chyde.uwasa.fi (Timo Salmi) writes: >Tue 21-May-91: I have programmed three sets of various MsDos (much deleted) > TYPE UNIX.TXT | UNIX2PC > PC.TXT Just a small note (nit-pick): The above is equivalent to and a lot slower than: UNIX2PC < UNIX.TXT > PC.TXT (Just because that is the example they give in the DOS manual, for the use of the MORE cmd, doesn't make it right [or something to be emulated]) (Flame off...) -- (Another fine mess brought to you by valley@gsbsun.uchicago.edu)