




                             UNIX  Power  Tools for  DOS

                                     (UNIXDOS)O


                                  REFERENCE MANUAL



       UNIX on DOS Toolkiit (UNXIDOS)
                               Introduction



       Introduction__________________________________________________________6

       Intro (Introduction)__________________________________________________6

       add (Add numbers)_____________________________________________________8

       af (analyse file)____________________________________________________10

       b64 (Decode Base64 Text)_____________________________________________13

       banner (Print text in big letters horizontally)______________________14

       bbanner (Print text in very big letters vertically)__________________15

       basename (Extract filename+extension)________________________________16

       bed (Binary steam editor)____________________________________________17

       bell (Ring bell)_____________________________________________________18

       bgrep (Search pattern in binary file)________________________________19

       bsplit (Split binary file into chunks)_______________________________20

       bvi  (Binary Viewer)_________________________________________________21

       cal (Print calendar)_________________________________________________26

       cat  (display and concatenate files)_________________________________28

       cc (C Compiler Front End)____________________________________________29

       cc1 (C Compiler preparation)_________________________________________37

       cc3 (C Compiler post processing)_____________________________________39

       (u)cd (Change directory)_____________________________________________40

       chmod (Change file mode)_____________________________________________41

       cf (Fast Compare)____________________________________________________42

       clear (Clear screen)_________________________________________________43

       cmp (Compare two files)______________________________________________44

       cmpdir (Compare two directories)_____________________________________46

       comm (Select or reject common lines in two files)____________________48

       cp  (Copy files)_____________________________________________________50


       OB. Eichberger, Professional Software Solutions      Reference
       Manual (Version 3.0)       Page 2



       UNIX on DOS Toolkiit (UNXIDOS)
                               Introduction

       cpio (Copy files from input/to output)_______________________________54

       cut (Cut/Select specified fields from lines)_________________________61

       (u)date (Display/change the date & time)_____________________________63

       dd (Disk to Disk copy/conversion/extraction)_________________________65

       df  (Show free and total disk space)_________________________________67

       diff (Compare two text files and show the differences)_______________73

       dio (Direct Disk Input/Output)_______________________________________77

       dirname (Extract directory)__________________________________________78

       dos2unix (Convert DOS text files to UNIX)____________________________79

       extname (Extract file extension)_____________________________________80

       du (Show disk usage)_________________________________________________81

       drvname (Extract drive from filename)________________________________89

       (u)echo (Echo arguments)_____________________________________________90

       egrep (Search files for one or more pattern/expression)______________92

       env (Show/change environment/run command)___________________________102

       (u)exit (Exit with specified return code)___________________________105

       expr (Compute an expression)________________________________________106

       fgrep (Search files for one or more plain pattern)__________________111

       file (Determine file type)__________________________________________113

       filename (Extract file name without extension)______________________115

       (u)find (Find files)________________________________________________116

       getlines (Get range of lines from a file)___________________________127

       grep (Search files for one pattern/expression)______________________129

       head (Display top lines of a file)__________________________________131

       io (Input/output file areas)________________________________________132

       (u)join (Join two sorted text files via matching field)_____________133

       line (Read one line from user/keyboard)_____________________________136


       OB. Eichberger, Professional Software Solutions      Reference
       Manual (Version 3.0)       Page 3



       UNIX on DOS Toolkiit (UNXIDOS)
                               Introduction

       ls (List files)_____________________________________________________137

       mak2mk (Convert Visual C Makefile to UNIXDOS makefile)______________138

       M4 (Advanced Text Generator)________________________________________140

       mf (Show free memory)_______________________________________________169

       mkdir (Make a directory)____________________________________________170

       (u)more (Browse thru text file)_____________________________________171

       mv (Move or rename files)___________________________________________173

       mvdir (Rename a directory)__________________________________________174

       nl (Line numbering)_________________________________________________175

       od (Octal, hex, decimal, ascii file dump)___________________________176

       paste (Merge lines of files)________________________________________179

       pr (Print files)____________________________________________________182

       pwd (Print working directory)_______________________________________185

       rm (Remove files/directories)_______________________________________186

       saveexit (Save errorlevel of previous command)______________________187

       sed (Stream editor)_________________________________________________188

       setenv (Set environment variable(s))________________________________192

       show_exp (Show UNIX argument expansion)_____________________________194

       slash (Convert file slashes)________________________________________196

       sleep (Wait for specific time)______________________________________197

       (u)sort (Sort/merge text files)_____________________________________198

       split (Split text file into chunks)_________________________________200

       stderr (redirect stderr to stdout)__________________________________202

       strings (Extract text strings from binary files)____________________203

       sum (Display checksum and block count of file(s))___________________205

       tail (Print last part of a text file)_______________________________206

       tee (Display STDIN and copy to file(s))_____________________________207


       OB. Eichberger, Professional Software Solutions      Reference
       Manual (Version 3.0)       Page 4



       UNIX on DOS Toolkiit (UNXIDOS)
                               Introduction

       test (Test expression)______________________________________________208

       (u)time (time a command)____________________________________________215

       touch (Update date/time of file)____________________________________216

       tr (Translate characters)___________________________________________217

       uniq (Find unique lines/keys)_______________________________________219

       unix2dos (Convert UNIX text files to DOS)___________________________220

       uptime (Show elapsed time since reboot)_____________________________221

       usrchar (Prompt user for single character)__________________________222

       usrprmpt (Prompt user for text)_____________________________________223

       uudecode (decode a transmitted binary file)_________________________224

       uuenode (encode a binary file for transmission)_____________________225

       wc (Word/Line counter)______________________________________________226

       which (Locate a program)____________________________________________227






























       OB. Eichberger, Professional Software Solutions      Reference
       Manual (Version 3.0)       Page 5



       UNIX on DOS Toolkiit (UNXIDOS)
                               Introduction




       Introduction

       In this `
               `Reference Manual'
                                 ' you will find a detailed description of
       each UNIXDOS utility in alphabetical order. You will also find here
       many examples and notes.


       Intro (Introduction)

       Syntax:

       command [optional options] {required arguments} {choice1|choice2}
       In the `
              `Syntax'
                      ' paragraph you will see short summary of all the
       options which are available in this utility. Below the summary (os
       `
       `usage'
              ' information) you will see a short description of each of the
       presented choices.

       {...}     Required: Arguments which are required are enlosed in the

       curly brackets `
                      `{}'
                          '

       [...]     Optional: Arguments which are optional are enlosed in the

       square brackets `
                       `[]'
                           '

                 Alternatives:List of several mutually exclusive alternative

       choices
       choice1|choice2|more choices...

       Option Summary:

       [options] option description
       {args}    argument description


       Description:

       In the `
              `Description'
                           ' paragraph you will find a detailed desctiption
       about the functionality of this utility.

       Example:

       The the `
               `Example'
                        ' paragraph you will find actual examples and
       applications of this utility together with the output these example
       will generate. This is a good way to get `
                                                `warmed up'
                                                           '
       with the functionality of the utilities.
       The command lines as you would type it is printed in a fixed font,
       while the output which is generated by the utility is printed in a
       fixed italic font.


       OB. Eichberger, Professional Software Solutions      Reference
       Manual (Version 3.0)       Page 6



       UNIX on DOS Toolkiit (UNXIDOS)
                           Intro (Introduction)

       Notes:

       Here you will find additional information alerting you of limits or
       problematic situations regarding the current utility or differences
       between the UNIXDOS implementation and `
                                              `Classic UNIX'
                                                            '.

       Remarks:

       Here you will find little anectodes and interresting tidbits concerning
       this utility.













































       OB. Eichberger, Professional Software Solutions      Reference
       Manual (Version 3.0)       Page 7



       UNIX on DOS Toolkiit (UNXIDOS)
                            add (Add numbers)


       add (Add numbers)

       Syntax

       add [-d{del}] [-f{fld}] [-l{len}] [-m{mod}] [-p{p}] [file(s)...]
       -d{del}    = del   : use delimiter {del} (default is blank)
       -f{fld}    = field : use field number {fld} (default 1=first)
       -l{len}    = length: use display length {l} for numbers (default is 8)
       -p{p}      = prec  : use precision of {p} for numbers (default is 2)
       -m{mod}    = modulo: display result every {mod} lines (default is 1,
       0=none)
       file(s)    = input file(s) (if no files use STDIN)

       Description

       ADD will add and analyze numbers. It will provide the following
       information:
       . Sum Total
       . Minimum
       . Maximum
       . Average
       . Number of Values entered
       You can specify which field and which delimiter is to be used (-f and -
       d option).
       By default ADD will show the intermediate result after each input line
       - you can specify a different modulo factor or 0 to switch the
       intermediate display off (-m option).
       By default ADD will display each value 8 digits wide and 2 numbers
       after the decimal point (precision), but you can change those default
       settings (-l, -p option).

       Example:

       If file `
               `add1.txt'
                         ' contains:
       1,3
       2,2.54
       3,1.18
       4,10
       5,1.36

       To add the numbers in the second colum after the commas enter:
       add -f2 -d, add1.txt

       Will show:
          1. Value      3.00 ,Sum=    3.00, Min=    3.00, Max=    3.00
          2. Value      2.54 ,Sum=    5.54, Min=    2.54, Max=    3.00
          3. Value      1.18 ,Sum=    6.72, Min=    1.18, Max=    3.00
          4. Value     10.00 ,Sum=   16.72, Min=    1.18, Max=   10.00
          5. Value      1.36 ,Sum=   18.08, Min=    1.18, Max=   10.00
          5. Values     1.36 ,Sum=   18.08, Min=    1.18, Max=   10.00, Avg=
       3.62

       To switch the intermediate result display off enter:

       OB. Eichberger, Professional Software Solutions      Reference
       Manual (Version 3.0)       Page 8



       UNIX on DOS Toolkiit (UNXIDOS)
                            add (Add numbers)

       add -f2 -d, -m0 add1.txt
       And you will only the the summarization:
       5. Values     1.36 ,Sum=   18.08, Min=    1.18, Max=   10.00, Avg=
       3.62



















































       OB. Eichberger, Professional Software Solutions      Reference
       Manual (Version 3.0)       Page 9



       UNIX on DOS Toolkiit (UNXIDOS)
                            af (analyse file)


       af (analyse file)

       Syntax

       af {input file}

       Description

       AF will analyse the specified file (text or binary) and print a
       statistical overview of the count of each possible byte value (0-255 or
       0x00 - 0xFF).
       This can help you to spot invalid characters in text files (see
       `
       `Example'
                ' below).









































       OB. Eichberger, Professional Software Solutions      Reference
       Manual (Version 3.0)      Page 10



       UNIX on DOS Toolkiit (UNXIDOS)
                            af (analyse file)

       Example

       af af.exe

       Will print the following result:
       Analysing file '/autoexec.bat' ....
       1643 bytes read
       CODE:        0       1       2       3       4       5       6       7
                    8       9       A       B       C       D       E       F
       0x00:
       0x08:                       65                      65
       0x10:
       0x18:
       0x20:      103                               7
       0x28:                       51       1       5       3      12      19
       0x30:       17      10       7       4       3       2       5       4
       0x38:        9       2      65      19              27
       0x40:        1      20       9      42      28      43       7       7
       0x48:       18      31               1      41      36      30      24
       0x50:       21       1      18      33      32      15      15       8
       0x58:        6       3       1              92                       3
       0x60:               24      16      58      32      63      11       6
       0x68:       10      23       2       7      20      46      14      22
       0x70:       18              32      51      37      22      24       9
       0x78:        3       1
       0x80:
       0x88:
       0x90:
       0x98:
       0xA0:
       0xA8:
       0xB0:
       0xB8:
       0xC0:
       0xC8:
       0xD0:
       0xD8:
       0xE0:                                                1
       0xE8:
       0xF0:
       0xF8:

       This example shows for example that 'af.exe' contains 65 Linefeeds
       (0xA) and 65 carriage returns (0xD) in other words it has currently 65
       lines.
       Notice one `
                  `dirty'
                         ' non-printable character at 0xE5 which should not
       be in a pure text file.

       Remarks

       I used this utility on many occasions to if a plain ASCII text files
       actually contain only printable characters (range 0x20 thru 0x7E) and
       if the counts for carriage return `
                                         `CR'
                                             ' (0xD) is matching that of
       `
       `line feed'
                  ' LF (0xA).

       OB. Eichberger, Professional Software Solutions      Reference
       Manual (Version 3.0)      Page 11



       UNIX on DOS Toolkiit (UNXIDOS)
                            af (analyse file)

       You could also use it to detect is double quotes or commas actually
       appear in a database dump, posing probable problems when you use the
       same character os a field delimiter:
       First Name<tab>Middle Name<tab>O'
                                       'Neil<tab> Notice the problem in
       `
       `FirstName'
                  ',`
                     `O'
                        '
                        
                         
                         Neil'
                             '.


















































       OB. Eichberger, Professional Software Solutions      Reference
       Manual (Version 3.0)      Page 12



       UNIX on DOS Toolkiit (UNXIDOS)
                         b64 (Decode Base64 Text)


       b64 (Decode Base64 Text)

       Syntax:

       b64 (Decode Base64 Text)
       usage: b64 {file}

       Description:

       In some cases when you receive e-mail messages over the INTERNET the
       mail program is not recognizing the attached binary file and will just
       place the data within your e-mail message.
       B64 allows you to decode the textual \data back into the original
       binary form.

       B64 will read the specified text file which contains b64 encoded data.
       The following syntax is used to detect the data area(s):
       ---- next item ----
       Content-Type: ....; Name="output1.dat"
       Content-Transfer-Encoding: Base64

       UEsDBBQAAAAIAAAAdxj3C183084AAErYAAALAAAAX01TVEVTVC5FWF+8u/dfU9kb
       LbxzUggpECKCIiUgoCOiEdCRamhBR8XQgkqRoIyIoggJ6CgQBEs4gBGd0WHECZZR
       UZyA2AcJRbAMmmBXkYCowYiEIqFm3zPf+34+9z94f9nsdXLOyTbu8jxrrSdifVDQ
       Id0cd38gi8MBuHr9WkABAEyxvusgNAIA55LE+a4DeByOgGPQERtjgg3dl76aHkdP
       ..... (more data)

       ---- next item ------
       Content-Type: ....; Name="output2.dat"
       Content-Transfer-Encoding: Base64

       UEsDBBQAAAAIAAAAdxj3C183084AAErYAAALAAAAX01TVEVTVC5FWF+8u/dfU9kb
       LbxzUggpECKCIiUgoCOiEdCRamhBR8XQgkqRoIyIoggJ6CgQBEs4gBGd0WHECZZR
       UZyA2AcJRbAMmmBXkYCowYiEIqFm3zPf+34+9z94f9nsdXLOyTbu8jxrrSdifVDQ
       Id0cd38gi8MBuHr9WkABAEyxvusgNAIA55LE+a4DeByOgGPQERtjgg3dl76aHkdP
       ..... (more data)

       ---- next item ------

       B64 will automatically recreate the original binary files (in this
       example output1.dat, output2.dat)


       Example:

       b64 message1.msg

       Might display the following output:
       b64: Writing data to 'output1.dat' (Line 44) ...
       b64: Writing data to 'output2.dat' (Line 1048) ...




       OB. Eichberger, Professional Software Solutions      Reference
       Manual (Version 3.0)      Page 13



       UNIX on DOS Toolkiit (UNXIDOS)
             banner (Print text in big letters horizontally)


       banner (Print text in big letters horizontally)

       Syntax:

       banner [-c{c}]{text1} [text2...]

       -c{c}     Use character 'c' for printing (default is #)
       text      text to be display as a banner (up to 10 per line)

       Description:

       BANNER will display the specified text element 'text1...' in big
       letters horizontally.
       Each text element can be up to 10 characters long. Longer text will
       just be truncated - not wrapped around to the next line. If you want to
       include blanks within the text use the double quotes around your text
       so that the system passes the text with blanks as one single argument:
       banner `
              `with blanks'
                           '

       Example:

       banner `udate +%D` `udate +%T`

       Will display the current date like:
         ###   #             #   ###      #          #  #####     #
        #   #  #    #       #   #   #    ##         #  #     #   ##
       #     # #    #      #   #     #  # #        #   #     #  # #
       #     # #    #     #    #     #    #       #     ######    #
       #     # #######   #     #     #    #      #           #    #
        #   #       #   #       #   #     #     #      #     #    #
         ###        #  #         ###    #####  #        #####   #####

          #     #####     #       #     #####     #      ###    #####
         ##    #     #   ###     ##    #     #   ###    #   #  #     #
        # #    #     #    #     # #    #     #    #    #     # #
          #     #####             #     #####          #     # ######
          #    #     #    #       #    #     #    #    #     # #     #
          #    #     #   ###      #    #     #   ###    #   #  #     #
        #####   #####     #     #####   #####     #      ###    #####

       Remarks:

       This is a great utility to insert big headers into printouts or lengthy
       batch processes to indicate the start of a new step or the completion
       of a process.









       OB. Eichberger, Professional Software Solutions      Reference
       Manual (Version 3.0)      Page 14



       UNIX on DOS Toolkiit (UNXIDOS)
           bbanner (Print text in very big letters vertically)


       bbanner (Print text in very big letters vertically)

       Syntax:

       bbanner [-c{c}] [-l[d]] [-w{n}] {text1} [text2...]

       -c{c}     CHAR: use 'c' as the display character (default is #)
       -l[d]     LOOP: after text is printed stop for 'd' seconds
                 and repeat the same text again
       -w{n}     WIDTH: set the horizontal width to 'n' (default is 80)

       Description:

       BBANNER will display the specified text element 'text1...' in very big
       letters vertically.

       Example:

       bbanner -c@ -l2 SYSTEM IS IDLE

       Will continually display the message 'SYSTEM IS IDLE' with 2 seconds
       pause using the  character '@' instead of  the default '#':

       @@@@@@@@
       @@@@@@@@                   @@@@@@@
         @@@@@                 @@@@@@@@@@@@
        @@@@                 @@@@@@@@@@@@@@@@
        @@@                 @@@@@@@        @@@
        @                  @@@@@@@           @@@
       @@                  @@@@@@             @@
       @@                  @@@@@@              @
       @@                 @@@@@@@              @
       @@                 @@@@@@@              @
       @@                @@@@@@@              @@
        @@              @@@@@@@              @@@
        @@@            @@@@@@@@             @@@@
        @@@@@        @@@@@@@@@            @@@@@
         @@@@@@@@@@@@@@@@@@@@           @@@@@@@@
           @@@@@@@@@@@@@@@@             @@@@@@@@
             @@@@@@@@@@@@
                @@@@@@
                                               @
                                               @
                                             @@@
                                           @@@@@
                                        @@@@@@@@
                                    @@@@@@@@@@@@
                                 @@@@@@@@@@@@@@@
       @@                     @@@@@@@@@@@@@@   @
       @@                   @@@@@@@@@@@@@      @
       @@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@
       @@@@@@@@@@@@@@@@@@@@@@@@@@@
       @@@@@@@@@@@@@@@@@@@@@@@@@

       OB. Eichberger, Professional Software Solutions      Reference
       Manual (Version 3.0)      Page 15



       UNIX on DOS Toolkiit (UNXIDOS)
                  basename (Extract filename+extension)

       @@@@@@@@@@@@@@@@@@@@@@
       @@                  @@@@@
       @@                     @@@@@
                                  @@@@@@       @
                                      @@@@@    @
                                         @@@@@@@
                                            @@@@
                                               @
                                               @
                                               @

       .........




       basename (Extract filename+extension)

       Syntax:

       basename [-d] [file(s)]

       -d        dos: convert to DOS style (default is UNIX style)
       file(s)   filenames to be converted.
       If no filenames are given BASENAME will read STDIN and convert each
       input line.

       Description:

       BASENAME will extract the filename and extension from the filelist.

       You can either specify one or more filenames on the command line or
       provide a list of filenames in STDIN if you don't specify any filename.

       Example:

       basename \msvc\include\windows.h
       Will show:
       windows.h

       basename -d \msvc\include\windows.h
       Will show the basename is DOS style:
       WINDOWS.H

       To display all filenames in DOS style:
       ufind / -exec basename -d {} ^









       OB. Eichberger, Professional Software Solutions      Reference
       Manual (Version 3.0)      Page 16



       UNIX on DOS Toolkiit (UNXIDOS)
                        bed (Binary steam editor)


       bed (Binary steam editor)

       Syntax:

       bed {s:old:new:} {file}
       s:old:new:     substitute: any match of 'old' with 'new'
                      The pattern have to have the same length in bytes.
                      Use \XX to specify hex values.
       file           Binary file to operate on

       Description:

       BED will read the binary 'file' and search for the specified pattern in
       'old'.
       If BED finds a match it will replace it with new new pattern specified
       in 'new'.
       BED will write the modified file to STDOUT, use the redirection to
       catch the modified file.

       Example:

       The CD(Change Directory) command is hardcoded in the COMMAND.COM DOS
       shell.
       In oder to replace the internal CD command with the UNIXDOS (u)cd
       utility when you type `cd' on the command line we have to disable the
       internal CD within COMMAND.COM.
       BED can do the job:

       change to the root directory  and do the replacement:
       ucd c:/
       bed s:CD:XD: command.com > xnew

       save old command.com:
       mv command.com cmd_old.com

       plug in the new command.com:
       mv xnew command.com

       change to the directory where all the UNIXDOS utilities are located:
       ucd /put

       make the ucd.exe available also as `cd.exe':
       cp ucd.exe cd.exe

       reboot...and try the new cd:
       cd f:/login
       Will go to:
       F:\LOGIN

       Remarks:

       This utility is excellent to perform last minute patching off
       executables and other binary files instead of having to rebuild because

       OB. Eichberger, Professional Software Solutions      Reference
       Manual (Version 3.0)      Page 17



       UNIX on DOS Toolkiit (UNXIDOS)
                             bell (Ring bell)

       of on minor text change; but remember to change the source code as
       well!



       bell (Ring bell)

       Syntax:

       bell [n]

       n    number of rings or beeps (default is 1)

       Description:

       BELL will send ring(s) to STDOUT by using the ASCII control character
       7.
       You can specify more than one ring with the first argument on the
       command line.

       Example:

       Send 10 rings to the printer:

       bell 10 >> prn






























       OB. Eichberger, Professional Software Solutions      Reference
       Manual (Version 3.0)      Page 18



       UNIX on DOS Toolkiit (UNXIDOS)
                  bgrep (Search pattern in binary file)


       bgrep (Search pattern in binary file)

       Syntax:

       bgrep {pattern} {input} [start] [length]

       pattern   = text or string to be found (\XX = hex code)
                   (Example: \01\00 = short value of 1: 0x01,0x00)
       input     = input file
       start     = offset to start reading (default 0)
       length    = number of bytes to read (default all until end of file)

       Description:

       BGREP will read the binary 'file' and search for the specified pattern.
       BGREP will list all matches with the corresponding file decimal offset.
       By default the search starts at the beginning of the file (offset=0);
       but you can specify any offset with the `start' argument.
       You can also limit the search by specifying how many bytes the search
       should do from the starting offset (default is until the end of the
       file).

       Example:

       Search for 'CD' in COMMAND.COM:

       bgrep CD /COMMAND.COM

       Will print (under DOS 6.22):
       Hit    1 at offset     39801
       Hit    2 at offset     39820
       Hit    3 at offset     39905
       Hit    4 at offset     39978
       Hit    5 at offset     49575
       54645 bytes read from '/command.com' (starting at offset 0)
       5 Hits found

       Remarks:

       This is a fast way to find text or any data within binary non-text
       files. I wrote this utilitiy because the main search engine `
                                                                   `GREP'
                                                                         '
       works only on text files. To view the actual context of each occurance
       use the UNIXDOS Binary Viewer (bvi) (see below).











       OB. Eichberger, Professional Software Solutions      Reference
       Manual (Version 3.0)      Page 19



       UNIX on DOS Toolkiit (UNXIDOS)
                  bsplit (Split binary file into chunks)


       bsplit (Split binary file into chunks)

       Syntax:

       bsplit -{n} file  [out]
       -{n}  : minimum number of bytes for each chunk
       file  : file to be split
       out   : prefix - up to 5 characters (default is 'data')

       Description:

       BSPLIT will read the binary input file and writes this file in chunks
       of specified bytes into the a set of output files until the entire
       input file has been read. The first output file has the name 'data001',
       the second 'data002' and so on until 'data999'.
       You can change the output prefix from 'data' to any letter sequence up
       to 5 character.

       Example:

       File 'bin.dat' contains 275,000 bytes.
       You want to split it in 1000,000 bytes chunks with prefix 'new':
       bsplit -100000 bin.dat new

       Will show:
       bin.dat  -> new001 (100000 bytes)
       bin.dat  -> new002 (100000 bytes)
       bin.dat  -> new003 (75000 bytes)

       Note that the last chunk 'new003' contains no exactly 100,000 bytes but
       just the remainder of the binary file.























       OB. Eichberger, Professional Software Solutions      Reference
       Manual (Version 3.0)      Page 20



       UNIX on DOS Toolkiit (UNXIDOS)
                           bvi  (Binary Viewer)


       bvi  (Binary Viewer)

       Syntax:

       usage: bvi {file} [len] [off]
       file    = file to be examined
       len     = record length (default is 128 bytes)
       off     = offset within file (default is 0)
       If the record length of specified as 0, BVI will display the entire
       file in 100 byte chunks.

       Description:

       BVI allows you to view any file (binary or text).
       If you don't specify the record length BVI will assume the default of
       128 bytes.
       If you don't specify any offset BVI will assume the beginning of the
       file (offset 0).
       BVI will initially display a header with the filename, the total number
       of bytes in that file, the number of records based on the current
       record length and the record length:
       File 'bvi.exe': 69558 bytes, 543 records with 128 bytes

       BVI will display the following items for each record:
       . record number (zero based in decimal unless switched to hex)
       . record offset of the current line (zero based in 16 byte increments)
       . 16 bytes shown as hexaxedimal values
       . 16 bytes shown a text characters (non-printable char shown as dots
         '.')
       Example:

       File 'bvi.exe': 69558 bytes, 543 records with 128 bytes
            0/  0: 4D 5A B6 01 88 00 CA 02 C0 00 B8 04 FF FF B3 13
       MZ..............
            0/ 16: 00 14 00 00 12 00 51 06 1E 00 00 00 01 00 FE 02
       ......Q.........
            0/ 32: 00 00 D6 02 00 00 B5 02 00 00 97 02 00 00 3F 02
       ..............?.
            0/ 48: 00 00 17 02 00 00 F1 01 00 00 E1 01 00 00 D7 01
       ................
            0/ 64: 00 00 A7 01 00 00 87 01 00 00 5C 01 00 00 48 01
       ..........\...H.
            0/ 80: 00 00 3E 01 00 00 04 01 00 00 E5 00 00 00 D4 00
       ..>.............
            0/ 96: 00 00 CD 00 00 00 B9 00 00 00 AC 00 00 00 A2 00
       ................
            0/112: 00 00 93 00 00 00 89 00 00 00 79 00 00 00 6A 00
       ..........y...j.






       OB. Eichberger, Professional Software Solutions      Reference
       Manual (Version 3.0)      Page 21



       UNIX on DOS Toolkiit (UNXIDOS)
                           bvi  (Binary Viewer)

       BVI will display the following prompt after each record display:
          ext,(P)rev,(G)oto,(F)ind,(E)xit,(M)ode,(Q)uit,(S)tring,(H)ex:

       If the file is read-only the prompt will take out the update functions
       and show `
                `READ-ONLY'
                           ':
          ext,(P)rev,(G)oto,(F)ind,(E)xit,(M)ode,(Q)uit (READ-ONLY):

       BVI Commands:

       Commands can be entered in upper or lower case.
       Next (Enter or N)   goto next record (default if ENTER or any other key
       is entered)

       Previous (P or p)   goto previous record (if at the beginning wrap
       around to the last)

       Goto (G[n])         jump to specified record `n' (if `n' is not
       specified you wil be prompted)

       Find (F)       search the file for pattern, you will be asked to anwer
       the following prompts:
                 Enter decimal Start Record (<0> =  first): (default=0)
                 Enter decimal Stop  Record (Ret =    543): (default = all
       remaining records)
                 Enter the Search pattern (max 81):
                 Here you can enter straight text or binary values using \XX
       for hex values
                 Example: END\0D\0A will search for text `
                                                         `END'
                                                              ' followed by
       CR(0x0D) + LF(0x0A)

       Exit (E or Q)       exit BVI

       Mode(M{m})          switch to one of the following modes for displaying
       record number+offset:
                      md   decimal (default)
                      mh   hexadecimal
                      mo   octal

       Update Text (S)     change text within the current record, you will be
       prompted for the following:
                 Enter the start offset (0-127): (specify the start point of
       your update decimal)
                 Enter the end   offset (0-127): (specify the end point of
       your update decimal)
                 Offset   0, ('M') enter new character(s) (Return = no
       change):
                 Here you can enter the new text, either bytes by byte or you
       can enter it in one                single chunk. If the chunk is longer
       than the specified numbe rof bytes BVI will            ignore the
       excessive bytes. Once you have completed the new text entry BVI will
                 show you the new record and ask for your confirmation before
       it actually writes
                 your update to the file and therefore commits the change:
                 Do you want to write to the disk? (Y/   ):

       OB. Eichberger, Professional Software Solutions      Reference
       Manual (Version 3.0)      Page 22



       UNIX on DOS Toolkiit (UNXIDOS)
                           bvi  (Binary Viewer)

                 If you hit ENTER or not Y or y the last change will be thrown
       away.
                 After you confirmed the change by typing `Y' BVI will replay
       with:
                 128 bytes writen to disk
                 (In these examples the default record length of 128 bytes was
       used)

       Update Data(H) change data within the current record.
                      You will be prompted for the same information as in the
       `
       `Update Text'
                    ',
                      except you enter hexadecimal values for each byte:
                 Offset 000, (0x41) enter new Hex value (Return = no change):
       AA









































       OB. Eichberger, Professional Software Solutions      Reference
       Manual (Version 3.0)      Page 23



       UNIX on DOS Toolkiit (UNXIDOS)
                           bvi  (Binary Viewer)

       Example:

       Examine BVI itself:
       ucd \put
       bvi bvi.exe

       File 'bvi.exe': 69558 bytes, 543 records with 128 bytes
            0/  0: 4D 5A B6 01 88 00 CA 02 C0 00 B8 04 FF FF B3 13
       MZ..............
            0/ 16: 00 14 00 00 12 00 51 06 1E 00 00 00 01 00 FE 02
       ......Q.........
            0/ 32: 00 00 D6 02 00 00 B5 02 00 00 97 02 00 00 3F 02
       ..............?.
            0/ 48: 00 00 17 02 00 00 F1 01 00 00 E1 01 00 00 D7 01
       ................
            0/ 64: 00 00 A7 01 00 00 87 01 00 00 5C 01 00 00 48 01
       ..........\...H.
            0/ 80: 00 00 3E 01 00 00 04 01 00 00 E5 00 00 00 D4 00
       ..>.............
            0/ 96: 00 00 CD 00 00 00 B9 00 00 00 AC 00 00 00 A2 00
       ................
            0/112: 00 00 93 00 00 00 89 00 00 00 79 00 00 00 6A 00
       ..........y...j.
          ext,(P)rev,(G)oto,(F)ind,(E)xit,(M)ode,(Q)uit,(S)tring,(H)ex: g488
       (go to record 488)

          488/  0: 20 25 73 3C 20 72 65 74 20 25 6C 64 0A 00 25 73  %s< ret
       %ld..%s
          488/ 16: 20 28 42 69 6E 61 72 79 20 46 69 6C 65 20 56 69  (Binary
       File Vi
          488/ 32: 65 77 65 72 29 0A 00 75 73 61 67 65 3A 20 25 73
       ewer)..usage: %s

          488/ 48: 20 7B 66 69 6C 65 7D 20 5B 6C 65 6E 5D 20 5B 6F  {file}
       [len] [o
          488/ 64: 66 66 5D 0A 00 66 69 6C 65 20 20 20 20 3D 20 66 ff]..file
       = f
          488/ 80: 69 6C 65 20 74 6F 20 62 65 20 65 78 61 6D 69 6E ile to be
       examin
          488/ 96: 65 64 0A 00 6C 65 6E 20 20 20 20 20 3D 20 72 65 ed..len
       = re
          488/112: 63 6F 72 64 20 6C 65 6E 67 74 68 20 28 64 65 66 cord length
       (def
          ext,(P)rev,(G)oto,(F)ind,(E)xit,(M)ode,(Q)uit,(S)tring,(H)ex: s
       (Update Text)

       Enter the start offset (0 - 127): 39  (start at decimal offset 39 `u')

       Enter the end   offset (0 - 127): 43  (end at decimal offset 43 `e')

       Offset  39, ('u') enter new character(s) (Return = no change): USAGE
       (new text)



       OB. Eichberger, Professional Software Solutions      Reference
       Manual (Version 3.0)      Page 24



       UNIX on DOS Toolkiit (UNXIDOS)
                           bvi  (Binary Viewer)

          1e8/  0: 20 25 73 3C 20 72 65 74 20 25 6C 64 0A 00 25 73  %s< ret
       %ld..%s
          1e8/ 10: 20 28 42 69 6E 61 72 79 20 46 69 6C 65 20 56 69  (Binary
       File Vi
          1e8/ 20: 65 77 65 72 29 0A 00 55 53 41 47 45 3A 20 25 73
       ewer)..USAGE: %s

          1e8/ 30: 20 7B 66 69 6C 65 7D 20 5B 6C 65 6E 5D 20 5B 6F  {file}
       [len] [o
          1e8/ 40: 66 66 5D 0A 00 66 69 6C 65 20 20 20 20 3D 20 66 ff]..file
       = f
          1e8/ 50: 69 6C 65 20 74 6F 20 62 65 20 65 78 61 6D 69 6E ile to be
       examin
          1e8/ 60: 65 64 0A 00 6C 65 6E 20 20 20 20 20 3D 20 72 65 ed..len
       = re
          1e8/ 70: 63 6F 72 64 20 6C 65 6E 67 74 68 20 28 64 65 66 cord length
       (def
       Do you want to write to the disk? (Y/   ): (confirmation)

          ext,(P)rev,(G)oto,(F)ind,(E)xit,(M)ode,(Q)uit,(S)tring,(H)ex: mh
       (switch to hex mode)

          1e8/  0: 20 25 73 3C 20 72 65 74 20 25 6C 64 0A 00 25 73  %s< ret
       %ld..%s
          1e8/ 10: 20 28 42 69 6E 61 72 79 20 46 69 6C 65 20 56 69  (Binary
       File Vi
          1e8/ 20: 65 77 65 72 29 0A 00 75 73 61 67 65 3A 20 25 73
       ewer)..usage: %s
          1e8/ 30: 20 7B 66 69 6C 65 7D 20 5B 6C 65 6E 5D 20 5B 6F  {file}
       [len] [o
          1e8/ 40: 66 66 5D 0A 00 66 69 6C 65 20 20 20 20 3D 20 66 ff]..file
       = f
          1e8/ 50: 69 6C 65 20 74 6F 20 62 65 20 65 78 61 6D 69 6E ile to be
       examin
          1e8/ 60: 65 64 0A 00 6C 65 6E 20 20 20 20 20 3D 20 72 65 ed..len
       = re
          1e8/ 70: 63 6F 72 64 20 6C 65 6E 67 74 68 20 28 64 65 66 cord length
       (def


       Remarks:

       No wrap around search.
       This is an excellent workhorse when you have to examine any binary
       file.
       The search for text or data will miss those occasions when the pattern
       spawns across record boundaries. To double check use another record
       size and compare the search result or use BGREP to find all occurances.







       OB. Eichberger, Professional Software Solutions      Reference
       Manual (Version 3.0)      Page 25



       UNIX on DOS Toolkiit (UNXIDOS)
                           cal (Print calendar)


       cal (Print calendar)

       Syntax:

       cal [ [month] year ]

       month    = specify the month (defaults to current)
       year     = specify the year  (defaults to current)
       The Year can be entered as 1989 or 89

       Description:

       CAL will display the current month by default.
       If you specify one single number CAL will use this number as the year
       and show the entire year.
       You can specify the full year value or just the last two digits (96 is
       equivalent to 1996).
       If you specify two numbers CAL will use the first for the month (1-12)
       and then the second for the year.

       Example:

       Display the current month:
       cal

       Might show:
          September 1970
        S  M Tu  W Th  F  S
              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

       Display the October in 1963:
       cal 10 1963

       Will show:
         October 1963
        S  M Tu  W Th  F  S
              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









       OB. Eichberger, Professional Software Solutions      Reference
       Manual (Version 3.0)      Page 26



       UNIX on DOS Toolkiit (UNXIDOS)
                           cal (Print calendar)

       Display the entire year 1969::
       cal 69

       Will show:
                       1969

            Jan            Feb               Mar
        S  M Tu  W Th  F  S    S  M Tu  W Th  F  S    S  M Tu  W Th  F  S
                 1  2  3  4                      1                      1
        5  6  7  8  9 10 11    2  3  4  5  6  7  8    2  3  4  5  6  7  8
       12 13 14 15 16 17 18    9 10 11 12 13 14 15    9 10 11 12 13 14 15
       19 20 21 22 23 24 25   16 17 18 19 20 21 22   16 17 18 19 20 21 22
       26 27 28 29 30 31      23 24 25 26 27 28      23 24 25 26 27 28 29
                                                     30 31
            Apr            May               Jun
        S  M Tu  W Th  F  S    S  M Tu  W Th  F  S    S  M Tu  W Th  F  S
              1  2  3  4  5                1  2  3    1  2  3  4  5  6  7
        6  7  8  9 10 11 12    4  5  6  7  8  9 10    8  9 10 11 12 13 14
       13 14 15 16 17 18 19   11 12 13 14 15 16 17   15 16 17 18 19 20 21
       20 21 22 23 24 25 26   18 19 20 21 22 23 24   22 23 24 25 26 27 28
       27 28 29 30            25 26 27 28 29 30 31   29 30

            Jul            Aug               Sep
        S  M Tu  W Th  F  S    S  M Tu  W Th  F  S    S  M Tu  W Th  F  S
              1  2  3  4  5                   1  2       1  2  3  4  5  6
        6  7  8  9 10 11 12    3  4  5  6  7  8  9    7  8  9 10 11 12 13
       13 14 15 16 17 18 19   10 11 12 13 14 15 16   14 15 16 17 18 19 20
       20 21 22 23 24 25 26   17 18 19 20 21 22 23   21 22 23 24 25 26 27
       27 28 29 30 31         24 25 26 27 28 29 30   28 29 30
                              31
            Oct            Nov               Dec
        S  M Tu  W Th  F  S    S  M Tu  W Th  F  S    S  M Tu  W Th  F  S
                 1  2  3  4                      1       1  2  3  4  5  6
        5  6  7  8  9 10 11    2  3  4  5  6  7  8    7  8  9 10 11 12 13
       12 13 14 15 16 17 18    9 10 11 12 13 14 15   14 15 16 17 18 19 20
       19 20 21 22 23 24 25   16 17 18 19 20 21 22   21 22 23 24 25 26 27
       26 27 28 29 30 31      23 24 25 26 27 28 29   28 29 30 31
                              30

















       OB. Eichberger, Professional Software Solutions      Reference
       Manual (Version 3.0)      Page 27



       UNIX on DOS Toolkiit (UNXIDOS)
                   cat  (display and concatenate files)


       cat  (display and concatenate files)

       Syntax:

       cat [-estv] [-|file] ...

       -e     = end    : show end of line as '$' (with -v option)
       -s     = silent : don't print error messages
       -t     = tab    : show TAB character as '^I' (with -v option)
       -v     = verbose: show non-printable characters:
                         'M-' if bit7 is set (M = meta character)
                          ^X  Control-X


       Description:

       CAT  will read each specified file or files and send them all in one
       stream to the standard output STDOUT.
       If no files are specified or '-' it will read the STDIN.
       With CAT you can conCATinate separate files into one single file.

       Example:

       ConCATinate file1 and file2 (in that sequence) and write the output to
       'file3'.
       cat file1 file2 >> file3

       Display 'cat.mak' in verbose mode and display TABs as '^I' and the end
       of line as '$'
       cat -evt cat.mak

       CAT_DEP = c:\madhur\src\UNIXDOS\def\def.h \^M$
       ^Ic:\madhur\src\UNIXDOS\def\l_decl.h \^M$
       ^Ic:\madhur\src\UNIXDOS\def\exparg.h \^M$
       ^Ic:\madhur\src\UNIXDOS\def\def_s.h^M$
       ^M$
       ^M$
       all:^I$(PROJ).EXE^M$
       ^M$
       CAT.OBJ:^ICAT

       Notes:

       Never specify any input file also as the output file, because before
       CAT will read any input  the OPERATING SYSTEM will create the output
       file and destroy any old contents:
       cat file1 file2 >> file1







       OB. Eichberger, Professional Software Solutions      Reference
       Manual (Version 3.0)      Page 28



       UNIX on DOS Toolkiit (UNXIDOS)
                        cc (C Compiler Front End)


       cc (C Compiler Front End)

       Syntax:

       cc [options] {file(s)}

       options   compiler options specific to compiler
       file(s)   file(s) to work on

       Description:

       CC is a front end to the following compilers:
       . MicroSoft    (CL)
       . Zortech (ZTC)
       . TurboC/Borland (TCC)
       . Intel 486 (ICC)

       Most compiler will show the errors and warnings on the screen but will
       NOT create an error or warning file which contains only those messages
       for each compiled module. This means that you cannot compile
       automatically libraries and DLL's without loosing those important
       messages.
       CC allows you to compile AND catch those messages in a separate files
       for each compiled module.


       Example1:

       cc -c getsize.c
       Might produce the following diagnostics:
       getsize.c(34) : warning C4101: 'NotUsed' : unreferenced local variable
       getsize.c(29) : error C2065: 'Error' : undeclared identifier
       getsize.c(29) : error C2146: syntax error : missing ';' before
       identifier 'here'
       getsize.c(30) : error C2065: 'here' : undeclared identifier
       getsize.c(30) : error C2143: syntax error : missing ';' before 'type'
       getsize.c(33) : error C2065: 'statbuf' : undeclared identifier
       getsize.c(33) : warning C4049: 'argument' : indirection to different
       types
       getsize.c(33) : error C2224: left of '.st_size' must have
       class/struct/union type
       All these diagnostics would normally be lost but are now stored and
       available for later use
       in the error C file (*.ERC) for this module `getsize':
       getsize.erc









       OB. Eichberger, Professional Software Solutions      Reference
       Manual (Version 3.0)      Page 29



       UNIX on DOS Toolkiit (UNXIDOS)
                        cc (C Compiler Front End)

       Example2:

       When you compile a lot of modules the screen in usually cluttered with
       all the compiler options and you can easily overlook any diagnostics.
       Here is an example which compiles the `somedll' MicroSoft makefile
       (somedll.mak):
       nmake /nologo DEBUG=1 -f somedll.mak
       The screen would show something like:
               cl /nologo /G2 /Zp1 /W3 /Zi /ALw /Gx- /Od /D "_AFXDLL" /D
       "_DEBUG" /D "_
       RMMGRDLL" /D "STRICT" /GD /GEf /Fd"RMMGR.PDB" /YuRMSTDAFX.H /c
       RMPREV.CPP
       rmprev.cpp
               cl /nologo /G2 /Zp1 /W3 /Zi /ALw /Gx- /Od /D "_AFXDLL" /D
       "_DEBUG" /D "_
       RMMGRDLL" /D "STRICT" /GD /GEf /Fd"RMMGR.PDB" /YuRMSTDAFX.H /c
       RMPRINT.CPP
       rmprint.cpp
               cl /nologo /G2 /Zp1 /W3 /Zi /ALw /Gx- /Od /D "_AFXDLL" /D
       "_DEBUG" /D "_
       RMMGRDLL" /D "STRICT" /GD /GEf /Fd"RMMGR.PDB" /YuRMSTDAFX.H /c
       RMPRPTFT.CPP
       rmprptft.cpp
               cl /nologo /G2 /Zp1 /W3 /Zi /ALw /Gx- /Od /D "_AFXDLL" /D
       "_DEBUG" /D "_
       RMMGRDLL" /D "STRICT" /GD /GEf /Fd"RMMGR.PDB" /YuRMSTDAFX.H /c
       RMPRPTHD.CPP
       rmprpthd.cpp
               cl /nologo /G2 /Zp1 /W3 /Zi /ALw /Gx- /Od /D "_AFXDLL" /D
       "_DEBUG" /D "_
       RMMGRDLL" /D "STRICT" /GD /GEf /Fd"RMMGR.PDB" /YuRMSTDAFX.H /c
       GETSIZE.C
       getsize.c
       getsize.c(34) : warning C4101: 'NotUsed' : unreferenced local variable
       getsize.c(29) : error C2065: 'Error' : undeclared identifier
               cl /nologo /G2 /Zp1 /W3 /Zi /ALw /Gx- /Od /D "_AFXDLL" /D
       "_DEBUG" /D "_
       RMMGRDLL" /D "STRICT" /GD /GEf /Fd"RMMGR.PDB" /YuRMSTDAFX.H /c
       RMPRTBMP.CPP
       rmprtbmp.cpp
       cl /nologo /G2 /Zp1 /W3 /Zi /ALw /Gx- /Od /D "_AFXDLL" /D "_DEBUG" /D
       "_
       RMMGRDLL" /D "STRICT" /GD /GEf /Fd"RMMGR.PDB" /YuRMSTDAFX.H /c
       RMPRTCAL.CPP
       rmprtcal.cpp
               cl /nologo /G2 /Zp1 /W3 /Zi /ALw /Gx- /Od /D "_AFXDLL" /D
       "_DEBUG" /D "_
       RMMGRDLL" /D "STRICT" /GD /GEf /Fd"RMMGR.PDB" /YuRMSTDAFX.H /c
       RMPRTDB.CPP
       rmprtdb.cpp
               cl /nologo /G2 /Zp1 /W3 /Zi /ALw /Gx- /Od /D "_AFXDLL" /D
       "_DEBUG" /D "_
       RMMGRDLL" /D "STRICT" /GD /GEf /Fd"RMMGR.PDB" /YuRMSTDAFX.H /c
       RMPRTDLG.CPP

       OB. Eichberger, Professional Software Solutions      Reference
       Manual (Version 3.0)      Page 30



       UNIX on DOS Toolkiit (UNXIDOS)
                        cc (C Compiler Front End)

       rmprtdlg.cpp
               cl /nologo /G2 /Zp1 /W3 /Zi /ALw /Gx- /Od /D "_AFXDLL" /D
       "_DEBUG" /D "_
       RMMGRDLL" /D "STRICT" /GD /GEf /Fd"RMMGR.PDB" /YuRMSTDAFX.H /c
       RMPRTGRF.CPP
       rmprtgrf.cpp
               cl /nologo /G2 /Zp1 /W3 /Zi /ALw /Gx- /Od /D "_AFXDLL" /D
       "_DEBUG" /D "_
       RMMGRDLL" /D "STRICT" /GD /GEf /Fd"RMMGR.PDB" /YuRMSTDAFX.H /c
       RMPRTHGB.CPP
       rmprthgb.cpp
               cl /nologo /G2 /Zp1 /W3 /Zi /ALw /Gx- /Od /D "_AFXDLL" /D
       "_DEBUG" /D "_
       RMMGRDLL" /D "STRICT" /GD /GEf /Fd"RMMGR.PDB" /YuRMSTDAFX.H /c
       RMPRTITM.CPP
       rmprtitm.cpp

       In this example all the diagnostics are lost once they are gone from
       the screen:
       the module getsize has a few problems.
       To fix this situation check out the next example below...


































       OB. Eichberger, Professional Software Solutions      Reference
       Manual (Version 3.0)      Page 31



       UNIX on DOS Toolkiit (UNXIDOS)
                        cc (C Compiler Front End)

       Example3:

       Now we compile a library using the CC front end so that the screen is
       not cluttered with compiler options intersperced with the disgnostics.
       Here is an example which compiles the `llib' UNIXDOS makefile
       (llib.mk):
       nmake /nologo DEBUG=1 -f llib.mk

       The screen would now show something like:
               cc -c add_func.c                                 # LLIB
               cc -c bgetl.c                                    # LLIB
               cc -c bname_t.c                                  # LLIB
               cc -c bread.c                                    # LLIB
               cc -c bwrite.c                                   # LLIB
               cc -c chrchk.c                                   # LLIB
               cc -c cmp_file.c                                 # LLIB
               cc -c cntdel.c                                   # LLIB
               cc -c cntdeler.c                                 # LLIB
               cc -c crbe.c                                     # LLIB
               cc -c ctyp.c                                     # LLIB
               cc -c debfun.c                                   # LLIB
               cc -c dir.c                                      # LLIB
               cc -c do_arg.c                                   # LLIB
               cc -c dx_chdir.c                                 # LLIB
               cc -c dx_getdi.c                                 # LLIB
               cc -c fclose_.c                                  # LLIB
               cc -c fgetl.c                                    # LLIB
               cc -c fldcmp.c                                   # LLIB
               cc -c fn_cp.c                                    # LLIB
               cc -c fopen_.c                                   # LLIB
               cc -c get_fram.c                                 # LLIB
               cc -c get_free.c                                 # LLIB
               cc -c getopt.c                                   # LLIB
               cc -c get_fram.c                                 # LLIB
               cc -c get_free.c                                 # LLIB
               cc -c getopt.c                                   # LLIB
               cc -c getsize.c                                  # LLIB
       getsize.c(34) : warning C4101: 'NotUsed' : unreferenced local variable
       getsize.c(29) : error C2065: 'Error' : undeclared identifier
       getsize.c(29) : error C2146: syntax error : missing ';' before
       identifier 'here'
       getsize.c(30) : error C2065: 'here' : undeclared identifier
       getsize.c(30) : error C2143: syntax error : missing ';' before 'type'
       getsize.c(33) : error C2065: 'statbuf' : undeclared identifier
       getsize.c(33) : warning C4049: 'argument' : indirection to different
       types
       getsize.c(33) : error C2224: left of '.st_size' must have
       class/struct/union type
               cc -c htoi.c                                     # LLIB
               cc -c htol.c                                     # LLIB
               cc -c llib.c                                     # LLIB
               cc -c mem.c                                      # LLIB
               cc -c otol.c                                     # LLIB
               cc -c pk.c                                       # LLIB

       OB. Eichberger, Professional Software Solutions      Reference
       Manual (Version 3.0)      Page 32



       UNIX on DOS Toolkiit (UNXIDOS)
                        cc (C Compiler Front End)

               cc -c prin.c                                     # LLIB
       prin.c(50) : warning C4013: 'system' undefined; assuming extern
       returning int
               cc -c qsort_.c                                   # LLIB
               cc -c read.c                                     # LLIB
               cc -c regexp.c                                   # LLIB....
       Now you can easily spot diagnostics and see the module name.
       All diagnostics are also captured in the `
                                                `error C files'
                                                               ' (in this
       case `getsize.erc' and `prin.erc')














































       OB. Eichberger, Professional Software Solutions      Reference
       Manual (Version 3.0)      Page 33



       UNIX on DOS Toolkiit (UNXIDOS)
                        cc (C Compiler Front End)

       Example4:

       You can also easily check if there are any errors in any of the modules
       with the following command (which shows the number of lines `-l' in
       each error C file `*.erc'):
       wc -l *.erc

       The screen would now show something like:
             0 add_func.erc
             0 bgetl.erc
             0 bname_t.erc
             0 bread.erc
             0 bwrite.erc
             0 chrchk.erc
             0 cmp_file.erc
             0 cntdel.erc
             0 cntdeler.erc
             0 crbe.erc
             0 ctyp.erc
             0 debfun.erc
             0 dir.erc
             0 do_arg.erc
             0 dx_chdir.erc
             0 dx_getdi.erc
             0 fclose_.erc
             0 fgetl.erc
             0 fldcmp.erc
             0 fn_cp.erc
             0 fopen_.erc
             0 get_fram.erc
             0 get_free.erc
             0 getopt.erc
             8 getsize.erc
             0 htoi.erc
             0 htol.erc
             0 llib.erc
             0 mem.erc
             0 otol.erc
             0 pk.erc
             1 prin.erc
             9 TOTAL
       Or you can select only the files which don't have a zero lines (option
       `-n' added):
       wc -nl *.erc

       The screen would now show something like:
             8 getsize.erc
             1 prin.erc
             9 TOTAL

       All these error files will not clog up your hard disk because CC will
       produce a zero length error file when no error/warning has been
       produced. (Otherwise even though the error file might have only 40


       OB. Eichberger, Professional Software Solutions      Reference
       Manual (Version 3.0)      Page 34



       UNIX on DOS Toolkiit (UNXIDOS)
                        cc (C Compiler Front End)

       bytes it would still use up a whole DOS cluster which can be 32K on 1GB
       hard drives):





















































       OB. Eichberger, Professional Software Solutions      Reference
       Manual (Version 3.0)      Page 35



       UNIX on DOS Toolkiit (UNXIDOS)
                        cc (C Compiler Front End)

       Example5:

       To implement the CC front end you can convert the regular MicroSoft
       makefile generated from Visual C++ into the UNIXDOS makefile.
       Here we convert the `yourprog.mak' makefile into the UNIXDOS makefile
       `yourprog.mk':
       mak2mk  yourprog.mak > yourprog.mk

       Now to run the new `yourprog.mak' makefile type:
       nmake /nologo DEBUG=0 -f yourprog.mk

       Related utilities

       To use minimal memory while compiling CC is actually a batch
       file(cc.bat) which is calling the following UNIXDOS utilities:
       CC1  (C Compiler preparation)
       CC3  (CC Post processing)
       These utilities are described in detail below.

       Here is the actual cc.bat:
       cc1 %1 %2 %3 %4 %5 %6 %7 %8 %9
       command /c cc2
       del cc2.bat

       CC1 generates the temporary compile batch file `cc2.bat' which compiles
       and then calls the CC3 post processing utility. Then the temporary
       batch file `cc2.bat' is removed.

       If you don't use the MAK2MK conversion utility the following
       environment variables are needed
       (Examples for MicroSoft environment):
       CCDEF     main include directory:
                 set CCDEF=\src\local\def

       CCDEF_    secondary include directory:
                 set CCDEF_=\src\global\def

       CCFLAGS   release compile command line:
                 set CCFLAGS=cl  -nologo -AL -I%s -I%s -Gs -Os -DINSTALL

       CCFLAGS_  debug compile command line:
                 set CCFLAGS_=cl -nologo -AL -I%s -I%s -Od -Zi -DINSTALL













       OB. Eichberger, Professional Software Solutions      Reference
       Manual (Version 3.0)      Page 36



       UNIX on DOS Toolkiit (UNXIDOS)
                       cc1 (C Compiler preparation)


       cc1 (C Compiler preparation)

       Syntax:

       cc1 [C compiler options] {source file)

       Environment Variables used:
       %CFLAGS%     use C compiler options as is in CFLAGS

       If %CFLAGS% is not defined the following variables are used instead:
       %CCFLAGS%    defines the debug   compiler command line with options
                    (%CCFLAGS% is used if %DEBUG%=ON is set, otherwise
       %CCFLAGS_%)
       %CCFLAGS_%   defines the release compiler command line with options
       %CCDEF%      defines the first  include directory (-I%s)
       %CCDEF_%     defines the second include directory (-I%s, optional)
       '%s' wtithin 'CCFLAGS' or 'CCFLAGS_' is mapped to 'CCDEF and CCDEF_'
       %CCDEBUG%    will show internal debug information

       To specify '=' in FLAGS use '~' (i.e. set CCFLAGS=-DMYDEF~1 -AL)

       Description:

       CC1 is an internal UNIXDOS utility and most probably you will never
       call it yourself from the command line. I just document it here for a
       complete reference.
       CC1 will read the requested C compiler options and generate a custom
       batch file `CC2.BAT'.
       This batch file will do the actual compilation. I had to go this kind
       of round about way because the compiler usually needs the full
       convetional memory available to himself and calling it from within a
       program uses up too much memory, but generating a batch file and then
       calling it doesn't use any memory (except a few K for another the
       command.com shell)!

       Note that you have to include the actual compiler utility in the
       CCFLAGS environment:
       set CCFLAGS=cl  -nologo -AL -I%s -I%s -Gs -Os -DINSTALL

       . MicroSoft    (CL)
       . Zortech (ZTC)
       . TurboC/Borland (TCC)
       . Intel 486 (ICC)

       All the command line options are written to a temporary C response file
       (cc_crf.tmp) because the primitive DOS still cannot accept command
       lines longer than 128 characters and you can easily get long command
       line options with tons of compiler options.

       CC1 will generate the CC2.BAT which looks like this:
       @echo off
       CL /nologo @cc_crf.tmp > ~
       cc3 file1.erc file1.sp 0

       OB. Eichberger, Professional Software Solutions      Reference
       Manual (Version 3.0)      Page 37



       UNIX on DOS Toolkiit (UNXIDOS)
                       cc1 (C Compiler preparation)


       The compiler original output is written to the work file `~'.
       This work file is then processed from CC3 (see below).




















































       OB. Eichberger, Professional Software Solutions      Reference
       Manual (Version 3.0)      Page 38



       UNIX on DOS Toolkiit (UNXIDOS)
                     cc3 (C Compiler post processing)


       cc3 (C Compiler post processing)

       Syntax:

       cc3 {fnerr} {fnfast} {sw}
       fnerr   = Filename to write errors/warnings to
       fnfast  = Filename to write the speed optimization time stamp
       sw      = 0=no speed focus, 1=speed time optimization focus

       Description:

       CC3 is an internal UNIXDOS utility and most probably you will never
       call it yourself from the command line. I just document it here for a
       complete reference.
       CC3 will read the current work file `~' and depending on the compiler
       environment extract only the error(s) and warning(s) into the `fnerr'
       file as specified on the command line.

       Note that you have to include the actual compiler utility in the
       CCFLAGS environment:
       set CCFLAGS=cl  -nologo -AL -I%s -I%s -Gs -Os -DINSTALL

       . MicroSoft    (CL)
       . Zortech (ZTC)
       . TurboC/Borland (TCC)
       . Intel 486 (ICC)

       After CC3 is finished it will automatically remove the work file `~'
       and the temporary C compiler response file `cc_crf.tmp'.

























       OB. Eichberger, Professional Software Solutions      Reference
       Manual (Version 3.0)      Page 39



       UNIX on DOS Toolkiit (UNXIDOS)
                         (u)cd (Change directory)


        (u)cd (Change directory)

       Syntax:

       ucd [[drive:]new directory]

       drive     the drive letter (if not specified use the current drive)
       directory the new dirtectory to go to

       Description:

       UCD will change the current directory:
       ucd \tmp

       You can use forward or backward slashes:
       ucd \tmp/save
       ucd \tmp\save
       ucd /tmp/save

       UCD can also change directly to a new drive unlike the DOS CD command:
       ucd f:/login

       You can use regular expressions for the last directory name:
       ucd \tm*
       Will go to \tmp.
       ucd /tmp/sa*
       Will go to \tmp\save.

       If several directories are matching UCD will just use the first one!
       ucd /t*

       You can use the UNIX style multi dot upward change directory:
       cd ..          one directory up
       cd ...         two directories up
       cd ....        three directories up  ...

       If only the drive is specified UCD will go automatically to the root
       directory on that drive:
       ucd g:
       Will go to G:\

       If  the new directory does not start with the '/' or '\' character
       UCD will position you into a subdirectory with the specified name.

       Notes:

       If you call `
                   `cd'
                       ' under UNIX without specifying any directory it will
       place you into the
       `
       `home directory'
                       '. Since there is no reliable equivalent under DOS the
       UNIXDOS `
               `(u)cd'
                      ' will just display the current drive and directory, to
       keep it compatible with the DOS CD.



       OB. Eichberger, Professional Software Solutions      Reference
       Manual (Version 3.0)      Page 40



       UNIX on DOS Toolkiit (UNXIDOS)
                         chmod (Change file mode)


       chmod (Change file mode)

       Syntax:

       chmod [-l] {[+|-][r|w|h|s|a]} {file(s)...}

       -l     = list      : show each file being updated
       +|-    = on/off    : + sets , - resets specified attribute
       r      = read-only : read-only attribute
       w      = read/write: read/write attribute
       h      = hidden    : hidden file attribute
       s      = system    : system file attribute
       a      = archive   : archive file attribute
       {+|-{r|w|h|s|a}} {file(s)}

       Description:

       CHMOD will alter the file mode/attribute as specified (see above).

       Example:

       chmod -w *.c
       Will make all C source files read-only (-w stands for taking away the
       write permission!)
       Now they are protected agains updates and deletion:
       DEL *.c
       Will show something like:
       C:\tmp\CLEAR.C
       Access is denied.

       chmod -l +w *.c
       Will make all C source files again available for read/write and show
       them as thay are changed:
       clear.c
       ...

       Notes:

       Several options found in under UNIX do not apply to the DOS
       environment:
       group, other, execution permission, set-owner, sticky bit. Other
       options are DOS specify:
       hidden, system, archive.
       The direct octal assignment found under UNIX has been dropped since DOS
       does not have any equivalent to the 3 layered security:
       owner/group/other.








       OB. Eichberger, Professional Software Solutions      Reference
       Manual (Version 3.0)      Page 41



       UNIX on DOS Toolkiit (UNXIDOS)
                            cf (Fast Compare)


       cf (Fast Compare)

       Syntax:


       cf {file1} {file2} [bytes]
       file1 = fisrt file
       file2 = second file
       bytes = number of bytes to be compared (default is ALL)

       Description:

       CF compares the two files specified on the command line using a much
       faster method than the UNIX cmp command. By default CF will compare the
       entire file, but you can specify a smaller value if you want to compare
       only a sub segment. CF will show how many bytes it has actually
       compared. If you need to compare segments not starting at the file
       beginning just use first DD or IO utility to extract that segment into
       a new file.

       If the files have a different content CF will show the first
       difference:
       Comparing 21077 bytes
               0:  98  32
       File 'file1' and 'file2' are NOT identical (CONTENTS)

       If one file is shorter than the other CF will abort with a message:
       File 'file1' and 'file2' are NOT identical (SIZE)

       CF will exit with the following status:

       0    file1 and file2 is identical
       1    file1 and file2 have the same size but different contents
       2    file1 and file2 have different sizes
       3    internal error (out of memory etc.)
       4    cannot open file1
       5    cannot open file2

       Example:

       cf  cf.exe cmp.exe 10

       Will show:
       Comparing 10 bytes
               2: 163 238
       File 'cf.exe' and 'cmp.exe' are NOT identical (CONTENTS)

       Remarks:

       The main reason why i created this new utility is speed:
       it is approximately 20 times faster then the good old "cmp" which can
       make a big difference
       if you have to compare 200 MB.

       OB. Eichberger, Professional Software Solutions      Reference
       Manual (Version 3.0)      Page 42



       UNIX on DOS Toolkiit (UNXIDOS)
                           clear (Clear screen)



       clear (Clear screen)

       Syntax:

       clear

       Description:

       CLEAR will erase the screen using the "cls" DOS command.












































       OB. Eichberger, Professional Software Solutions      Reference
       Manual (Version 3.0)      Page 43



       UNIX on DOS Toolkiit (UNXIDOS)
                         cmp (Compare two files)


       cmp (Compare two files)

       Syntax:

       cmp [-b{size}] [-l] [-s] file1 file2
       -b{size}  = buffer: set the buffer size in memory (default = 20000)
       -l        = list  : show each difference:
                           offset as decimal(0 based), bytes in hex and char
       -s = silent: don't display error messages

       Description:

       CMP will compare each byte of file1 and file2.
       Depending on the result it will return the following exit codes:
       0    files are identical
       1    file are different
       2    cannot access file
       3    internal error (out of memory)

       If you also want to see the differences between the files use the `-l'
       option.
       It will show both the file names:
       Offset               cmp.exe                cf.exe
       Then it will list each byte mismatch:
       2               0xEE(^O)               0xA4(^F)
       You can see the decimal offset (2), the byte in file1 as hexadecimal
       value (0xEE) and as character (^O) and the the corresponding byte in
       file2 as hexadecimal value 0xA4 and again as text character (^F).

       Example:

       cmp -l cmp.exe cf.exe

       Will show all differences:
       Offset               cmp.exe                cf.exe
            2               0xEE(^O)               0xA4(^O)
            4               0x81(^O)               0x4E(N)
       ...

       Notes:

       The UNIX CMP will not give you any help which value belongs to which
       file and also show the bytes only as octal value:
          23 334 101
          24 007 102
          25 036 103


       Remarks:

       I never liked the octal only display from UNIX (os MKS) and found ASCII
       and hexadecimal representation much more useful.


       OB. Eichberger, Professional Software Solutions      Reference
       Manual (Version 3.0)      Page 44



       UNIX on DOS Toolkiit (UNXIDOS)
                         cmp (Compare two files)

       I also missed an indication which column relates to which file from the
       command line.





















































       OB. Eichberger, Professional Software Solutions      Reference
       Manual (Version 3.0)      Page 45



       UNIX on DOS Toolkiit (UNXIDOS)
                     cmpdir (Compare two directories)


       cmpdir (Compare two directories)

       Syntax:

       cmpdir {dir1} {dir2} [-{c|C|d|D|f|F|s|S|t|T}]
       dir1 = dir1    : first directory
       dir2 = dir2    : second directory
       -c   = content : use the file contents for comparison
       -d   = diff    : like -c' but will call the 'diff' program
                        the diff output is send to ./{file}.di{n}
                        {n} cycles thru '0-9' and then 'a-z' to get unique
       names
       -f   = func    : like '-d' but with function header information
       -s   = size    : use the file size for comparison
       -t   = time    : use the modification time (default)
       (Capital options will show the filenames as they are processed)
       The output is displayed on the screen and written to file 'cmpdir.out'

       You can specify a custom diff program: set UDDIFF=VDIFF -B
       (Uses '%TMP%/cmpdir1.tmp' and '%TMP%/cmpdir2.tmp' as workfiles)
       (or '/cmpdir1.tmp' and '/cmpdir1.tmp' if %TMP% is not defined)


       Description:

       CMPDIR will compare all the files in the two specified directories.
       By default it will focus on the modification time of the files as the
       criteria for comparisson.
       You can choose the following comparisson criteria:
       . file time (-t)
       . file size (-s)
       . file contents (-c)
       . file contents with automatic creation of a difference file by
         running: diff -b
       . file contents with automatic creation of a difference file by
         running: diff -b -f

       CMPDIR will produce a two column output showing all files on each
       directory.
       If the file is found in both directories CMPDIR will append the
       following comment depending on the comparisson criteria:
       . file time:        (same),(older),(newer)
       . file size         (same),(smaller),(bigger)
       . file content (same),(diff)

       CMPDIR will display the result and also write the result to
       'cmpdir.out' in the current directory so you can view and edit it.

       If you want to use a different program to show the differences set the
       UDDIFF environment:
       set UDDIFF=VDIFF -B



       OB. Eichberger, Professional Software Solutions      Reference
       Manual (Version 3.0)      Page 46



       UNIX on DOS Toolkiit (UNXIDOS)
                     cmpdir (Compare two directories)


       Example:

       Compare '/tmp' and '/dos' based on time:
       cmpdir /tmp /dos

       /tmp                             /dos
       -------------------------------------------------------------------
       4201.cpi     (same)              4201.cpi     (same)
       4208.cpi     (same)              4208.cpi     (same)
       5202.cpi     (same)              5202.cpi     (same)
       ansi.sys     (same)              ansi.sys     (same)
       append.exe   (newer)             append.exe   (older)
       appnotes.txt (same)              appnotes.txt (same)
       assign.com   (same)              assign.com   (same)
       attrib.exe   (same)              attrib.exe   (same)
       backup.exe   (same)              autoexec.bat
       chkdsk.exe   (older)             backup.exe   (same)
       cmd_orig.com (same)              chkdsk.exe   (newer)
       command.com  (same)              cmd_orig.com (same)
       comp.exe     (newer)             command.com  (same)
       m4                               comp.exe     (older)
                                        config.sys
                                        country.sys
                                        debug.exe
                                        diskcomp.com
                                        diskcopy.com
                                        display.sys

       Note that the files 'm4' and 'autoexec.bat' do not have a trailing
       comment which means that they don't have a corresponding file in the
       other directory.


       Notes:

       UNIX provides only the DIRCMP tool without a choice of the focus and
       a slower performance because DIRCMP is only a SHELL script instead
       on an executable like CMPDIR.
















       OB. Eichberger, Professional Software Solutions      Reference
       Manual (Version 3.0)      Page 47



       UNIX on DOS Toolkiit (UNXIDOS)
            comm (Select or reject common lines in two files)


       comm (Select or reject common lines in two files)

       Syntax:

       comm [-l] [-[123]] {file1} {file2}

       -l     = list : list filenames and results in 25 column format
       -1     = col1 : suppress lines only in file1
       -2     = col2 : suppress lines only in file2
       -3     = col3 : suppress lines found in both files

       Description:

       COMM will read the two specified text files and determine which lines
       are common to both files and which one appear in only one of them.

       COMM will then display the result according to the specified options:
       nothing   show all three categories: only file1, only file2, both files
       (this is the default)
       -1        show lines found only in file2 and in both files, not those
       only found in file1
       -2        show lines found only in file1 and in both files, not those
       only found in file2
       -3        show lines found only in file1 and file2, not those found in
       both files
       -12       show only lines found in both files, not those found only in
       file1 and file2
       -13       show lines found only in file 2, not those found only in
       file1 and in both files
       -23       show lines found only in file 1, not those found only in
       file2 and in both files
       -123      shows nothing because all three categories are supressed.






















       OB. Eichberger, Professional Software Solutions      Reference
       Manual (Version 3.0)      Page 48



       UNIX on DOS Toolkiit (UNXIDOS)
            comm (Select or reject common lines in two files)

       Example:


       If file 'comm1.txt' contains:
       1
       2
       3
       4
       5
       6

       and file 'comm2.txt' contains:
       1
       3
       5
       7
       9

       To compare both these files enter:
       comm comm1.txt comm2.txt

       The result is:
                      1
       2
                      3
       4
                      5
       6
            7
            9

       Which means:
       . 2,4 and 6 are found only in file1 (comm1.txt)
       . 7 and 9 are found only in file2 (comm2.txt)
       . 1,3 and 5 are found in both files

       To find only the lines which are common to both files:
       comm -12 comm1.txt comm2.txt

       The result is:
       1
       3
       5

       To find the lines which are only found in file1:
       comm -23 comm1.txt comm2.txt

       The result is:
       2
       4
       6




       OB. Eichberger, Professional Software Solutions      Reference
       Manual (Version 3.0)      Page 49



       UNIX on DOS Toolkiit (UNXIDOS)
                             cp  (Copy files)


       cp  (Copy files)

       Syntax:

       cp [-flv] {src} {dest}

       -f     = force : always remove old files (even if read-only)
       -l     = list  : show which file is currently copied
       -v     = verify: verify that input is identical to output
       src    = source: one or more files to be copied
       dest   = destination:
                 if several source files this must be a directory name
                 if one source file can be directory or filename

       Description:

       CP will copy one or several files to the specified destination.
       The modification time and file modes are preserved.

       Example1:

       To see the copy in progress specify the `-l' option:
       cp *.exe /put

       Might show:
       add.exe              -> /put/add.exe
       add_func.exe         -> /put/add_func.exe
       af.exe               -> /put/af.exe
       banner.exe           -> /put/banner.exe
       basename.exe         -> /put/basename.exe
       bbanner.exe          -> /put/bbanner.exe
       bed.exe              -> /put/bed.exe
       beep.exe             -> /put/beep.exe
       bell.exe             -> /put/bell.exe
       bgrep.exe            -> /put/bgrep.exe
       bmv.exe              -> /put/bmv.exe
       bvi.exe              -> /put/bvi.exe
       ...

       Example2:

       To ensure the copy is identical to the original specify the verify `-v'
       option.
       This is very useful especially when you copy files to a floppy disk,
       because CP will actually re-read the entire destination file and
       compare it byte by byte against the original
       (unlike the DOS COPY verify which just checks the verify of the
       controller):
       cp -lv bvi.exe a:

       Will show:
       bvi.exe              -> a:/bvi.exe
       1 files written succesfully

       OB. Eichberger, Professional Software Solutions      Reference
       Manual (Version 3.0)      Page 50



       UNIX on DOS Toolkiit (UNXIDOS)
                             cp  (Copy files)
























































       OB. Eichberger, Professional Software Solutions      Reference
       Manual (Version 3.0)      Page 51



       UNIX on DOS Toolkiit (UNXIDOS)
                             cp  (Copy files)

       Example3:


       To copy file1 to file2:
       cp file1 file2

       If file2 exists already it will be overwritten.
       If file2 is read-only protected CP will show the following error
       message:
       cp: Cannot remove old 'file2'

       Example4:

       To force the copy even on top of a read-only or write protected file
       use:
       cp -f file1 file2

       Example5:

       To copy several files use the regular expression or list the source
       files:
       cp  mod1.mak mod1.def *.c \tmp

       All modification times and file modes are preserved.

       Example6:

       In this example we are trying to copy several source files into a file
       or non existend directory:
       cp *.c  /notadir

       If the destination is not a directory and you specified several source
       files CP will show the following error message:
       cp: Target '/notadir' is not a directory

       Example7:

       cp file1 file1

       In this case you tried to copy a file onto itself and CP will show the
       following message:
       cp: Cannot copy 'file1' onto itself

       Notes:

       The UNIX CP does not offer the '-l' (list) or `-v'(verify) or `-
       f'(force) option and will not warn
       you when you copy several files into a file instead of a directory.


       Remarks:

       I always liked the DOS style progress report while the copy is
       crunching away but missed there the excact destination. I encountered

       OB. Eichberger, Professional Software Solutions      Reference
       Manual (Version 3.0)      Page 52



       UNIX on DOS Toolkiit (UNXIDOS)
                             cp  (Copy files)

       also several cases where the /V (verify) turned out to be bogus because
       it was not really re-reading the floppy disk I was copying to but just
       checking the controler return value - so i created a true verify (-v)
       which takes double the time since it truly has to re-reads the entire
       file again but offers absolute guaranty of a succesfull copy.


















































       OB. Eichberger, Professional Software Solutions      Reference
       Manual (Version 3.0)      Page 53



       UNIX on DOS Toolkiit (UNXIDOS)
                  cpio (Copy files from input/to output)


       cpio (Copy files from input/to output)


       Syntax:

       Create backup: cpio -o[vacdmf] [[D:]backup]
       Read   backup: cpio -i[tcdmnuvf] [[D:]backup] [pattern...]
       Move   files     : cpio -p[dvmau] [[D:]directory]
       -a = access    : reset access time of input files after copy
       -c = compatible: Write header in ASCII for portability
       -d = directory : create directories if needed
       -f = file      : specify backup file (default is stdin/stdout)
       -m = mod. time : retain modification time for newly created files
       -s = swap      : swap bytes
       -t = table     : print table of contents (only with '-i' option)
       -u = uncondit. : copy UNCONDITIONALY
                        (normally older file doesn't replace)
       -v = verbose   : print names of affected files after completion
       -V = invert    : do NOT copy files with match [pattern]

       Example CREATE : cpio -ovf a:\backup < files.lst
       Example RESTORE: cpio -idvmf a:\backup "*.c" (only C sources)
       Example MOVING : find . -print | cpio -pdvmf \newdir
       (Multi Volumes are supported!)

       Description:

       CPIO is an excellent tool to store/restore/move files or entire
       directory branches.
       CPIO functions in the three following modes:
       . Output/Backup:    creates a CPIO archive
       . Input/Restore:    reads a CPIO archive
       . Pass Thru:   copies files and subdirectories to new location

       OUTPUT/BACKUP (-o option)

       Read the incoming file list and creates one CPIO archive.
       Example: cpio -o < in.lst > out.cp
       will read `in.lst' and write the CPIO archive to `out.cp'

       When you write the CPIO archive onto a floppy drive CPIO first checks
       the available space, then substract 10K and write the new archive. If
       CPIO finds an old archive with the identical name it will first attempt
       to remove and then calculate the available space.
       If the space has run out it will beep and prompt you for the next
       volume/floppy:
       cpio -of a:new.cp < in.lst

       DISK FULL - Hit return to start Volume 2 (Abort CTRL C)

       This allows you to backup large set of files which can spawn across
       several floppy disks (-f option) and even compresses files as the
       backup is proceeding (-z option).

       OB. Eichberger, Professional Software Solutions      Reference
       Manual (Version 3.0)      Page 54



       UNIX on DOS Toolkiit (UNXIDOS)
                  cpio (Copy files from input/to output)
























































       OB. Eichberger, Professional Software Solutions      Reference
       Manual (Version 3.0)      Page 55



       UNIX on DOS Toolkiit (UNXIDOS)
                  cpio (Copy files from input/to output)

       INPUT/RESTORE (-I option):

       Read the specified CPIO archive and restores all the files from a that
       archive.
       Example: cpio -id < in.cp
       will read `in.cp' and re-create all the file in the appropriate
       directories (-d)

       PASS THRU (-p option):

       Read the specified input file list and copy the files to the new
       directory.
       Example: cpio -pd /newdir < in.lst
       will read filelist `in.lst' and re-create all files under the `/newdir'
       directory.

       Restore directories (-d option):

       This option will prompt CPIO to recreate the directories as it restores
       files - otherwise all files will end up in the current directory. This
       option is always recomended in conjunction with the `-I' option.

       Verbose (-v option)

       To see the files which are currently processed use the `-v' option.
       Example: cpio -iv < in.cp
       will read `in.cp' and show all the files in that archive while it
       restores its contents.

       Table of contents (-t option)

       To see the files in a CPIO archive use the `-t' option in conjunction
       with the verbose option to get a long listing `-tv'.
       Example: cpio -itv < in.cp
       will read `in.cp' and show all the files in that archive, but not
       restores any files.

       File List

       To generate a files list use the LS utility: ls *.c *.mak *.h > src.lst
       or
       the UFIND utility: ufind /src -print > src.lst
       Then you can edit the contents with any text editor: vi src.lst

       Undonditional restore (-u option)

       As a security device CPIO will by default NOT restore any file which
       exists already and have a newer or identical time stamp than the file
       in the archive. This is to prevent overwritting newer files in the hard
       disk with older versions from the archive.
       CPIO will display the following messages:
       current <your file here> same      (when the time stamps are identical)
       current <your file here> newer     (when the stored file timestamp is
       older than the existing one)

       OB. Eichberger, Professional Software Solutions      Reference
       Manual (Version 3.0)      Page 56



       UNIX on DOS Toolkiit (UNXIDOS)
                  cpio (Copy files from input/to output)

       To force CPIO to restore even older archive versions unconditional use
       the `-u' option.





















































       OB. Eichberger, Professional Software Solutions      Reference
       Manual (Version 3.0)      Page 57



       UNIX on DOS Toolkiit (UNXIDOS)
                  cpio (Copy files from input/to output)

       Relative and absolute locations

       When you store files in a CPIO archive you have the following two
       choises:
       . absolute file locations (the filename starts with a slash and shows
         the absolute location):
         /tmp/save/file1.c
         /tmp/save/file1.mak
         ...
       . relative file locations (the filename does not start with a slash):
         save/file1.c
         save/file1.mak
         ...
       When you restore the absolute file locations CPIO will always restore
       these in the same place on the hard drive.
       When Relative filenames are restored CPIO will place them relative to
       the current position:
       Example:
       Create an archive `archive.cp' relative to the `/tmp' directory with
       the two files `file1.c'(relative) and `file1.mak'(absoulte):
       cd /tmp
       cpio -ovf archive.cp < src.lst
       Will show:
       file1.c
       /tmp/file1.mak
       8 blocks

       Now we change to a new location and restore:
       cd /new
       cpio -idvm < /tmp/archive.cp
       Will show:
       file1.c
       current </tmp/file1.mak> same
       /tmp/file1.mak
       9 blocks
       The `file1.c' will be newly restored in `/new/file1.c'(relative).
       The `file1.mak' will not be restored because CPIO detected that it
       existed already in `/tmp/file1.mak' and that the time stamps are
       identical displaying the message:
       current </tmp/file1.mak> same















       OB. Eichberger, Professional Software Solutions      Reference
       Manual (Version 3.0)      Page 58



       UNIX on DOS Toolkiit (UNXIDOS)
                  cpio (Copy files from input/to output)


       Specify CPIO archive file (-f {out} option)

       Specifies the CPIO archive output file. This option is usually used
       to direct the output onto a floppy disk. If a file with the specified
       name {out} exists already it will be removed automatically. If the
       output file {out} fills all the available space on a floppy disk CPIO
       will pause and prompt you to insert a new free floppy disk. This
       continues
       until all the specified files in '{list}' are backed up. CPIO will
       always leave a small amount of space (10,240 bytes) on the floppy
       so that you can store the file list or other descriptive files.
       Example:
       ufind / -print | cpio -ovf  A:backup.cp

       Will backup all the files on the entire hard disk onto several
       volumes/floppies
       if needed into the file 'backup.cp' in drive 'A:'. Each floppy will
       contain a file 'backup.cp' with the CPIO archive. Note that the
       filenames
       generated from the UFIND command all start with the '/' which ensures
       that all files will be in the exact same directory and subdirectory
       when you restore.

       To backup only `*.c' and `*.h' files under the `/src' directory:
       ucd /src
       ufind . (-name '*.c' -o -name '*.h' ) -print > src.lst
       cpio -ovf B:src.cp < src.lst
       Will first create the list file 'src.lst' using the UNIXDOS UFIND
       command.
       CPIO will then  backup all C source (extension '.c') and C include
       files (extension '.h')  within the \SRC directory or any subdirectory.
       The output is written to the floppy in drive B:.
       If the space in that floppy is not enough to hold all the files CPIO
       will prompt you automatically for another floppy disk.
       Note that the filename does not start with the slash '/' because the
       UFIND command had  only '.' specified as the starting directory which
       allows you to restore the files into any directory later on.

       Character/Text header format (-c option)

       By default CPIO will use a binary form to store header information.
       This option allows you to store the header information in text form
       which is machine independent.

       Restore modufication time stamp (-m option)

       This option instructs CPIO to set the modification time and file
       attributes to the original values as they were when the archive has
       been created.
       By default the file modification time will be the current time and
       read-only files will be writable!
       This option is always recomended in conjunction with the `-I' option.


       OB. Eichberger, Professional Software Solutions      Reference
       Manual (Version 3.0)      Page 59



       UNIX on DOS Toolkiit (UNXIDOS)
                  cpio (Copy files from input/to output)

       Restore selectively:

       To restore files from the archive selectively specify your match
       criteria after the archive filename:
       Example:
       ucd /tmp
       cpio -itf B:src.cp 'a*.c' 'a*.h'
       Will give you a table of contents only of those files in the archive
       'B:src.cp' which match either the expression 'a*.c' (any file starting
       with letter 'a' and extension '.c') or 'a*.h'.
       Note that the single quotes (') around the search criteria are needed
       to avoid the premature filename expansion!

       Notes:

       The UNIX CPIO does not support spawning across multi volumes (-f
       option).
       The '-a' option does not apply since only the modification time stamp
       is maintained in DOS.

       Remarks:

       This is a great work horse I use extensively to move files and file-
       trees around especially across DOS/UNIX platforms. It works great in
       combination with the "(u)find" utility.






























       OB. Eichberger, Professional Software Solutions      Reference
       Manual (Version 3.0)      Page 60



       UNIX on DOS Toolkiit (UNXIDOS)
               cut (Cut/Select specified fields from lines)


       cut (Cut/Select specified fields from lines)

       Syntax:

       usage: cut [-c{list}|-C{list}|-f{list}] [-d{del}] [-s] {file(s)}
       (Maximum line length is 10000 bytes)
       -c     = cut out columns according to {list} (1 based, from beginning)
       -C     = cut out columns according to {list} (1 based, from end)
       -f     = cut out fields according to {list}
       -d     = {del} is the field delimiter (only in conjunction with -f)
                the default is white space (\t and blank)
                (Use hex for special characters like pipe character '|' -d\7C)
       -s     = supress lines with no delimiter (only with -f)
       {list} = decimal single numbers or ranges:
                1-10      = col/field 1,2,3,4,5,6,7,8,9,10
                10,1      = col/field 10,1
                10-       = col/field 10,11,...end
                1-4,7,10-12   = col/field 1,2,3,4,7,10,11,12
       Example: cut -c1-5,7-9 text (reads col 1-5 and 7-9 from file text)

       Description:

       CUT is an excellent tool to extract ("cut out") specific parts from
       text lines.

       You can either specify fixed column areas (-c option) or "fields" (-f
       option) which are separated by the "field delimiter" (default is blank
       and TAB).
       You cannot specify both extract types together (-c and -f).

       CUT will extract according to your specification in each specified
       file.
       If you did not specify any file CUT will use STDIN.
       The output will always be written to STDOUT which you can redirect or
       pipe to another command.

       CUT allows you to define your own field delimiter with the -d option.

       Example1:

       If the input (from UDATE) is: Wed Aug 05 07:07:10 1991

       udate | cut -f5,2,4
       will show:
       1991 Aug 07:07:55









       OB. Eichberger, Professional Software Solutions      Reference
       Manual (Version 3.0)      Page 61



       UNIX on DOS Toolkiit (UNXIDOS)
               cut (Cut/Select specified fields from lines)

       Example2:

       If file  'cut.txt' contains:
       1|2|3|4|5|6
       from|to|min|max
       A|B|CCC|D|E|F
       no delimiter
       |two|three|four|five

       To select now field 3, 1 and 5 until the end enter:
       cut `
           `-d|'
                ' -f3,1,5- -s cut.txt

       will show:
       3|1|5|6
       min|from
       CCC|A|E|F
       three||five

       Example3:

       To select column 2 thru 4 enter:
       cut -c2-4 cut.txt

       will show:
       |2|
       rom
       |B|
       n d
       wo|

       Remarks:

       It always irritated me that the field sequence is ignored in the UNIX
       version of CUT which prevents you from re-arranging the field order.





















       OB. Eichberger, Professional Software Solutions      Reference
       Manual (Version 3.0)      Page 62



       UNIX on DOS Toolkiit (UNXIDOS)
                 (u)date (Display/change the date & time)


       (u)date (Display/change the date & time)

       Syntax:

       usage: udate [+format|MMDDhhmm[yy]]
       MMDDhhmm[yy] = will set the date to month=MM(01-12), day=DD(01-31)
                      hh=hour(0-23), mm=minutes(0-59), yy=year(19xx)
       +format      = will display date/time according to format
                      %m  = month (01-12)            %d  = day   (01-31)
                      %y  = year  (00-99)            %H  = hour  (00-23)
                      %M  = minute(00-59)            %S  = second(00-59)
                      %D  = date  (MM/DD/YY)         %T  = time  (HH:MM:SS)
                      %j  = day number within year (000-366, 001=Jan 1st)
                      %w  = day number within week (0-6, 0=Sun)
                      %a  = day within week (Sun,Mon...Sat)
                      %h  = month in year (Jan,Feb...Dec)
                      %n  = insert a new line
                      %c  = no trailing new line
                      %t  = insert TAB
                      %r  = time    (HH:MM:SS [A|P]M)
                      %%  = percent itself
       Example: date "+DATE: %m/%d/%y%nTIME: %H:%M:%S" will print:
       DATE: 04/01/91
       TIME: 18:19:20

       Description:

       UDATE will show the current date/time if no arguments are specified in
       the following format:
       Wed Aug 05 07:18:00 1991

       You can specify your own custom format how UDATE should display the
       date and/or time.
       Just start the format specification with a plus(+) followed by text and
       any combination of the print commands listed above:
       Example1:

       udate "+DATE: %m/%d/%y%nTIME: %H:%M:%S"

       Will show something like:
       DATE: 04/01/91
       TIME: 18:19:20
       Note the double quotes around the custom format to pass it into UDATE
       as one single argument instead of splitting it up into three separate
       arguments:
       Arg1: `
             `+DATE:'
                     ', Arg2: `
                               `%m/%d/%y%nTIME:'
                                                ', Arg3: `
                                                         `%H:%M:%S"

       You can also change the system date/time by entering 8 or 10 digits on
       the command line:
       Example2:

       udate 0805071891
       This will set the system time to:

       OB. Eichberger, Professional Software Solutions      Reference
       Manual (Version 3.0)      Page 63



       UNIX on DOS Toolkiit (UNXIDOS)
                 (u)date (Display/change the date & time)

       Aug 08, 1991 07:18:00

       (08 stands for the month (August), 05 is the day, 07 is the hour, 18
       are the minutes and
       91 stands for the year 1991)


















































       OB. Eichberger, Professional Software Solutions      Reference
       Manual (Version 3.0)      Page 64



       UNIX on DOS Toolkiit (UNXIDOS)
               dd (Disk to Disk copy/conversion/extraction)


       dd (Disk to Disk copy/conversion/extraction)

       Syntax:

       dd [option=value] ...

       The following options are available:
       if={f}        = define input file (default is stdin)
       of={f}        = define output file (default is stdout)
       ibs={n}       = Input buffer size (default = 512 bytes)
       obs={n}       = Output buffer size (default = 512 bytes)
       cbs={n}       = Conversion buffer size
       bs={n}        = buffer size (overrides both ibs and obs)
       skip={n}      = skip {n} input blocks (will still read not jump)
       count={n}     = copy only {n} blocks from input to output
       iseek={n}     = start to read at offset {n} (jumps to {n})
       oseek={n}     = start to write at offset {n}
       keep          = keep output file if it exists (default creates new)
       conv={a,b..}  = define the conversion functions:
                       ascii     = EBCDIC to ASCII
                       ebcdic    = ASCII to EBCDIC
                       ibm       = ASCII to EBCDIC-IBM style
                       [l|u]case = to lower/upper case
                       swab      = swap every pair of bytes
                       noerror   = don't stop processing if error occures
                       sync      = pad every input block to ibs
                       inv       = invert/flip bits
       {n}           = numeric value:
       Numeric value defines by default the number of bytes.
       The following multipliers are available:
       w    word (2 bytes)      100w are 200 bytes
       b    block (512 bytes)   10b  are 5120 bytes
       k    kilobyte (1024)     2k   are 2048 bytes
       m    mega (1000000)      2m   are 2000000 bytes

       You can multiply several values using '*' or 'x':
       100w*10b are 1024000 bytes
       200*80   are 16000 bytes

       Description:

       DD will read the specified input, do some processing (if requested) and
       write the output to the output file. DD will report after completion
       the number of bloinput and output blocks with remaining bytes.
              25+        1 blocks in
              25+        1 blocks out








       OB. Eichberger, Professional Software Solutions      Reference
       Manual (Version 3.0)      Page 65



       UNIX on DOS Toolkiit (UNXIDOS)
               dd (Disk to Disk copy/conversion/extraction)

       Example1:

       To convert a the input file `in.dat' to upper case and write the result
       to output file `out.dat':
       dd if=in.dat of=out.dat conv=ucase

       Example2:

       To extract bytes 1001 thru 1500 from 'in.dat' into 'wrk.dat':
       dd if=in.dat of=wrk.dat bs=500 skip=2 count=1

       Example3:

       To extract bytes 2,000,000 thru 5,000,000 from 'in.dat' and write those
       3,000,000 bytes into output file 'out.dat' starting at offset 1,000,000
       (not 0!).
       dd if=in.dat of=out.dat keep bs=1m iseek=2 oseek=1 count=3

       First we prevent erasing of the output file `out.dat' when it is
       opened: keep
       Then we define the blocksize as one megabyte (1m = 1,000,000 bytes):
       bs=1m
       Then we skip the first 2,000,000 bytes in the input `in.dat': iseek=2
       Then we define out output offset in `out.dat': oseek=1
       Then we define the number of bytes to actually transfer: count=3
       The `iseek; option is a much faster way to start reading at a specific
       input offset than the "skip" method because it will not scan thru the
       unused area but directly jump there!

       Note:

       The UNIXDOS DD provides the iseek, oseek, keep and inv options which
       are not available under UNIX!

       Remarks:

       DD is a great tool to move data chunks around.
       But I always missed the ability to also write into not always to the
       beginning of the output file and so i added the new "iseek/oseek/keep"
       commands.
       I experienced also several situations where I had to `
                                                            `flip'
                                                                  ' or invert
       bits from backups on QIC tapes and so I also added the "inv" converting
       option.












       OB. Eichberger, Professional Software Solutions      Reference
       Manual (Version 3.0)      Page 66



       UNIX on DOS Toolkiit (UNXIDOS)
                   df  (Show free and total disk space)


       df  (Show free and total disk space)

       Syntax:

       df [-a] [-c] [-t] [-n{lst}] [-[drv1] [drv2] [drv3...]
       -a      = ALL    : display space on all disks starting from C:
       -c      = CHKDSK : use CHKDSK to determine the disk space
                 (instead of the '_dos_getdiskfree' function which doesnt
                  always report the correct value on large SCSI drives)
       -n{lst} = NETWORK: define the list of network drives (default F-Z)
                 (In 'lst' you can define letters or ranges:
                  Example: -nF-IOS-U  defines network drives: FGHIOSTU)
                 (you can also use the UDNETLST environment to specify 'lst')
                 (the default is equivalent to: set UDNETLST=F-Z)
                 To obtain the drive info for Network drives "NDIR /spa" is
       used
       -t       = TOTAL  : Don't show grand totals at the end
                  (default show if > 1 drives)
       drv     = display space for disk 'drv' (lower or upper case)
       (By default df will display the space on the current disk)

       Description:

       DF will show you the free and total space in bytes.
       DD will also show the volume label of the disk and the percentage of
       free space in relation to
       the total space available.

       The "-a" option will show the space of all available drives starting
       with C:

       Example1:

       Show the drive information of the durrent drive:
       df

       Might display:
       C:(MADHUR_C_1G         )   220,954,624 free ( 1,023,967,232 total)
       21.6% free

       Below are all the displayed elements listed:
       C:                  the drive displayed
       MADHUR_C_1G              the volume label or network directory
       220,954,624 free         the number of free space on this disk in bytes
       1,023,967,232 total the total space on this disk in bytes
       21.6% free               the percentage of free space in relation to
       the total space







       OB. Eichberger, Professional Software Solutions      Reference
       Manual (Version 3.0)      Page 67



       UNIX on DOS Toolkiit (UNXIDOS)
                   df  (Show free and total disk space)

       Example2:

       To show the drive information for drive D:
       df d:

       Might display:
       D:(DISKDRIVE_D         )     6,623,232 free (   129,931,264 total)
       5.1% free


       Example3:

       When there are more than one drive displaye DF will automatically show
       also a GRAND TOTAL.

       df -a

       Might display:
       C:(C_900MB             )     34,816,000 free (   901,857,280 total)
       3.9% free
       D:(D_512MB             )     55,508,992 free (   536,428,544 total)
       10.3% free
       E:(E_400MB             )     37,593,088 free (   433,258,496 total)
       8.7% free
       F:(F_512MB             )     25,018,368 free (   536,428,544 total)
       4.7% free
       G:(F_1GB_MUSIC         )    270,696,448 free ( 1,053,999,104 total)
       25.7% free
       L:(COREL_345           )              0 free (   526,319,616 total)
       0.0% free
       =======================================================================
       ========
         (*** GRAND TOTAL *** )    423,632,896 free ( 3,988,291,584 total)
       10.6% free

       Note: To switch of this GRAND TOTAL use the -t option.


       Example4:

       To show the drive information of all drives(-a) using CHKDSK(-c) for
       the non network drives and defining drive F thru Z as network drives(-
       nF-Z):
       df -a -c -nF-Z

       Might display:
       C:(MADHUR_C_2G         )   148,537,344 free ( 2,146,467,840 total)
       6.9% free
       E:(STASH               )             0 free (   284,114,944 total)
       0.0% free
       F:(DEV\SYS             ) 1,055,326,208 free ( 3,198,156,800 total)
       33.0% free
       G:(DEV\DEV             ) 1,684,013,056 free ( 6,442,450,944 total)
       26.1% free

       OB. Eichberger, Professional Software Solutions      Reference
       Manual (Version 3.0)      Page 68



       UNIX on DOS Toolkiit (UNXIDOS)
                   df  (Show free and total disk space)

       J:(DEV\DEV             ) 1,683,881,984 free ( 6,442,450,944 total)
       26.1% free
       L:(DEV\HOMER           ) 1,347,092,480 free ( 3,145,531,392 total)
       42.8% free
       M:(TAMARAC\VOL1        ) 1,311,965,184 free ( 4,718,592,000 total)
       27.8% free
       R:(DEV\DEV             ) 1,683,030,016 free ( 6,442,450,944 total)
       26.1% free
       S:(DEV\DEV             ) 1,683,095,552 free ( 6,442,450,944 total)
       26.1% free
       T:(DEV\DEV             ) 1,683,095,552 free ( 6,442,450,944 total)
       26.1% free
       U:(TAMARAC\KRUSTY      ) 1,553,465,344 free ( 6,494,683,136 total)
       23.9% free
       V:(DEV\DEV             ) 1,683,030,016 free ( 6,442,450,944 total)
       26.1% free
       X:(TAMARAC\KRUSTY      ) 1,553,465,344 free ( 6,494,683,136 total)
       23.9% free
       Y:(TAMARAC\VOL1        ) 1,311,965,184 free ( 4,718,592,000 total)
       27.8% free
       Z:(DEV\SYS             ) 1,055,326,208 free ( 3,198,156,800 total)
       33.0% free

       Notes:

       The UNIXDOS DF shows the space in use friendly bytes while the UNIX
       shows the space in clumsy blocks which might change from drive to drive
       (or kilobyte if you specify the -k option).
       The "-i" (i-nodes) option under UNIX does not apply to the DOS
       environment.

























       OB. Eichberger, Professional Software Solutions      Reference
       Manual (Version 3.0)      Page 69



       UNIX on DOS Toolkiit (UNXIDOS)
                   df  (Show free and total disk space)

       Remarks:

       I always wondered why the UNIX df shows blocks instead of bytes (the
       Berkeley shows at least kilobytes) so I switched to straight bytes
       which are never ambiguous like blocks!

       MKS/UNIX DF Failure:

       Here is one example from the DF utility from MKS which uses the UNIX
       style:
       \mks\bin\df -kP
       Filesystem   1024-blocks        Used  Available  Capacity Mounted on
       C:                999968      854720     145248       86% C:/
       df: couldn't stat file system for "": not a directory or path not found
       df: couldn't stat file system for "": not a directory or path not found
       df: couldn't stat file system for "": not a directory or path not found
       L:                999968           0     999968        0% L:/
       M:                999968           0     999968        0% M:/
       R:                999968           0     999968        0% R:/
       S:                999968           0     999968        0% S:/
       T:                999968           0     999968        0% T:/
       U:                999968           0     999968        0% U:/
       V:                999968           0     999968        0% V:/
       X:                999968           0     999968        0% X:/
       Y:                999968           0     999968        0% Y:/
       Z:                999968           0     999968        0% Z:/

       MKS gives you wrong information for all the drives:
       MKS claims the C: drive has only 999,968k total space but as you can
       see below it has 2GB(2,146,467,840 bytes) - the free space is correct
       (145,248k) or 148,537,344 bytes:
       chkdsk c:
       The type of the file system is FAT.
       Volume MADHUR_C_2G created 5/21/96 2:15 PM
       Volume Serial Number is 20A9-90EA

       2146467840 bytes total disk space.

        32014336 bytes in 27 hidden files.
        19267584 bytes in 584 directories.
       1946746880 bytes in 20485 user files.
       148537344 bytes available on disk.


           32768 bytes in each allocation unit.
           65505 total allocation units on disk.
            4530 allocation units available on disk.

       MKS claims the network drive X: has only 999,968k total space but as
       you can see below it has 6GB(6,342,464k) - the free space is also wrong
       (999,968k) instead of 1,517,056k:
       chkvol x:

       Statistics for fixed volume TAMARAC/KRUSTY:

       OB. Eichberger, Professional Software Solutions      Reference
       Manual (Version 3.0)      Page 70



       UNIX on DOS Toolkiit (UNXIDOS)
                   df  (Show free and total disk space)


       Total volume space:                        6,342,464  K Bytes

       Space used by files:                       4,825,408  K Bytes
       Space available to MADHUR:                 1,517,056  K Bytes



       MKS also claims that drives F:,G: and G: are not available:
       df: couldn't stat file system for "": not a directory or path not found













































       OB. Eichberger, Professional Software Solutions      Reference
       Manual (Version 3.0)      Page 71



       UNIX on DOS Toolkiit (UNXIDOS)
                   df  (Show free and total disk space)

       UNIXDOS DF Example:

       Here is in contract the output of the UNIXDOS DF: df -a -c -nF-Z
       which reports the correct values for all drives:
       C:(MADHUR_C_2G         )   148,537,344 free ( 2,146,467,840 total)
       6.9% free
       F:(DEV\SYS             ) 1,055,326,208 free ( 3,198,156,800 total)
       33.0% free
       G:(DEV\DEV             ) 1,684,013,056 free ( 6,442,450,944 total)
       26.1% free
       J:(DEV\DEV             ) 1,683,881,984 free ( 6,442,450,944 total)
       26.1% free
       L:(DEV\HOMER           ) 1,347,092,480 free ( 3,145,531,392 total)
       42.8% free
       M:(TAMARAC\VOL1        ) 1,311,965,184 free ( 4,718,592,000 total)
       27.8% free
       R:(DEV\DEV             ) 1,683,030,016 free ( 6,442,450,944 total)
       26.1% free
       S:(DEV\DEV             ) 1,683,095,552 free ( 6,442,450,944 total)
       26.1% free
       T:(DEV\DEV             ) 1,683,095,552 free ( 6,442,450,944 total)
       26.1% free
       U:(TAMARAC\KRUSTY      ) 1,553,465,344 free ( 6,494,683,136 total)
       23.9% free
       V:(DEV\DEV             ) 1,683,030,016 free ( 6,442,450,944 total)
       26.1% free
       X:(TAMARAC\KRUSTY      ) 1,553,465,344 free ( 6,494,683,136 total)
       23.9% free
       Y:(TAMARAC\VOL1        ) 1,311,965,184 free ( 4,718,592,000 total)
       27.8% free
       Z:(DEV\SYS             ) 1,055,326,208 free ( 3,198,156,800 total)
       33.0% free























       OB. Eichberger, Professional Software Solutions      Reference
       Manual (Version 3.0)      Page 72



       UNIX on DOS Toolkiit (UNXIDOS)
          diff (Compare two text files and show the differences)


       diff (Compare two text files and show the differences)

       Syntax:

       diff [-b] [-c{n}] [-d{n}] [-i] [-z] {file1} {file2}
       -b     = BLANK  : Ignore blanks and TAB's in the comparison
       -c{n}  = CONTEXT: Change the number of context lines (default = 3)
       -d{n}  = DEPTH  : Change the depth of scope
                         (default = 500 lines look ahead)
       -i     = IGNORE : Ignore upper/lower case during comparison
       -z     = SIZE   : Do not show the file size (default = show)
       (If file1 or file2 is a directory the other name will be appended)

       Description:

       DIFF will compare the two text files and show the differences.

       If both files are identical DIFF will not show the following message:
       file 'diff1a.txt' and 'diff1a.txt' are identical

       Context display (-c option):

       To make it easier for you to view the context where the change occured
       DIFF will display the unchanged lines before and after. By default DIFF
       will display the 3 lines before and 3 lines after the change.
       You can change the number of context lines: -c5 will show 5 lines
       before/after the change.
       You can also supress the context display all together: -c0

       White space discard (-b option):

       If you want to discard changes which only change the number of blanks
       of TAB's use the `-b' option.





















       OB. Eichberger, Professional Software Solutions      Reference
       Manual (Version 3.0)      Page 73



       UNIX on DOS Toolkiit (UNXIDOS)
          diff (Compare two text files and show the differences)

       Example1:

       If file 'diff1a.txt' contains      and file 'diff1b.txt' contains:
       A                        A
       NEW1-1                   B
       B                        NEW2-1
       NEW1-2                   NEW2-2
       C                        C

       Now to compare both these files enter:
       diff diff1a.txt diff1b.txt


       Will show:
       diff1a.txt (Wed Sep 18 10:15:00 1996, 25 bytes)
                diff1b.txt (Wed Sep 18 10:15:00 1996, 25 bytes)
       -----------------------------------------------------------------------
       -----
              1       1   |A
       +      2           |NEW1-1
              3       2   |B
              4       3   |NEW1-2
              5       4   |C
       -----------------------------------------------------------------------
       -----
              1       0   |A
              2       1   |NEW1-1
              3       2   |B
       +      4           |NEW1-2
       -              3   |NEW2-1
       -              4   |NEW2-2
              5       5   |C
       -----------------------------------------------------------------------
       -----
       DIFF detected two changes:
       . Insert line `
                      `      '
                              '
                       NEW1-1   between line `
                                             `A'
                                                ' and `
                                                       `B'
                                                          '.
         You can see the `+'  sign indicating and ADD, and the lines number
         `2' only in the column of file `diff1a.txt' where the new line
         occured.
       . Replace line '
                       'NEW1-2   
                              '
                               ' with lines `
                                            `NEW2-1'
                                                    ' and `
                                                           `NEW2-2'
                                                                   '.
         you can see the `+' and `-' signs indicating a replace and the lines
         numbers in the appropriate columns under `diff1a.txt' and
         `diff1b.txt'.












       OB. Eichberger, Professional Software Solutions      Reference
       Manual (Version 3.0)      Page 74



       UNIX on DOS Toolkiit (UNXIDOS)
          diff (Compare two text files and show the differences)

       Example2 (Show also the function names):

       If file 'diff3a.txt' contains           and file 'diff3b.txt' contains:
       #include <stdio.h>                 #include <stdio.h>

       int func()                         int func()
       {                             {
           return(18);                         printf("In function\n");
       }                                  return(18);
                                     }
       main(int ac,char *av[])
       {                             main(int ac,char *av[]))
           printf("func=%d\n",func());    {
           return(0);                          printf("Hello, func
       ret=%d\n",func());
       }                                  return(0);
                                     }
       Now to compare both these files enter:
       diff -f diff3a.txt diff3b.txt


       Will show:
       diff3a.txt (Thu Oct 17 17:46:40 1996, 146 bytes)
                diff3b.txt (Thu Oct 17 17:46:48 1996, 181 bytes)
       -----------------------------------------------------------------------
       -----
       FUNCTION: func()

              2       2   |
              3       3   |int func()
              4       4   |{
       +              5   |    printf("In function\n");
              5       6   |    return(18);
              6       7   |}
              7       8   |
       -----------------------------------------------------------------------
       -----
       FUNCTION: main(int ac, char *av[])

              7       8   |
              8       9   |main(int ac, char *av[])
              9      10   |{
       +     10           |    printf("Hello func=%d\n",func());
       -             11   |    printf("Hello, func ret=%d\n",func());
             11      12   |    return(0);
             12      13   |}
       -----------------------------------------------------------------------
       -----
       DIFF showed you also for each change in which function the change or
       insertion occured.
       DIFF also shows the arguments in case you use overloaded function names
       with different arguments in C++.
       Notes/Remarks:


       OB. Eichberger, Professional Software Solutions      Reference
       Manual (Version 3.0)      Page 75



       UNIX on DOS Toolkiit (UNXIDOS)
          diff (Compare two text files and show the differences)

       The output of the UNIX DIFF has not been designed to be easily readable
       by the user but by the ED editor - so the output is very cryptic.
       I never liked this type of output and so I redesigned the output to be
       user friendly:
       . showing the filename
       . showing the context
       . showing the lines numbers with each line
















































       OB. Eichberger, Professional Software Solutions      Reference
       Manual (Version 3.0)      Page 76



       UNIX on DOS Toolkiit (UNXIDOS)
                      dio (Direct Disk Input/Output)


       dio (Direct Disk Input/Output)

       Syntax

       dio {R|W} {Drv} {Start} {cnt} {data}
       R|W        = Read/Write
       Drv        = Drive (A-Z)
       Start      = Start Sector Number (0...)
       Cnt        = Number Sectors to transfer (1...)
       Data       = File for exchange
       Exit Code: 0=Exchange successfull, 1=Error, 10x=Unexpected error

       Description

       DIO will directly read or write from/to any disk.
       This allows you to make a disk image directly to a file.
       This can be very useful for example to save many different kind of boot
       discs to files instead of having to keep the actual original floppy
       discs, because then they are regular files from which you can recreate
       the boot discs!

       Example

       Read for disk image from a 1.44MB floppy to file `disc1.dat':

       dio A R 0 2880 disc1.dat

       Note

       Watch out!
       This can be a potential dangerous tool becasue if you WRITE the wrong
       image to your hard disc boot sector or FAT table you may loose files or
       the entire disc!





















       OB. Eichberger, Professional Software Solutions      Reference
       Manual (Version 3.0)      Page 77



       UNIX on DOS Toolkiit (UNXIDOS)
                       dirname (Extract directory)


       dirname (Extract directory)

       Syntax:

       dirname [-d] [-n] [file(s)]
       -d       = display in DOS style (default UNIX style)
       -n       = don't show the drive letter
       file(s)  = the filename(s) to be converted
       If no 'file(s)' are specified dirname will read STDIN and convert each
       line

       Description:

       DIRNAME will extract the directory name from the specified path(s).
       You can use the unix display style(default) or specify DOS style
       display (-d option).
       You can either specify one or more filenames on the command line or
       provide a list of filenames in STDIN if you dont specify any filename.

       Example1:

       dirname c:\tmp/save/src.zip dir1/file.c U:\PARK\file3

       Will show:
       c:/tmp/save
       dir1
       u:/park

       Example2:

       dirname -d c:\tmp/save/src.zip dir1/file.c U:\PARK\file3

       Will show:
       C:\TMP\SAVE
       DIR1
       U:\PARK

       Example3:

       Display directory without the drive letter:
       dirname -n -d c:\tmp/save/src.zip dir1/file.c U:\PARK\file3

       Will show:
       \TMP\SAVE
       DIR1
       \PARK

       Example4:

       Display all directories in DOS style:
       ufind / -type d -exec dirname -d {} ^



       OB. Eichberger, Professional Software Solutions      Reference
       Manual (Version 3.0)      Page 78



       UNIX on DOS Toolkiit (UNXIDOS)
                dos2unix (Convert DOS text files to UNIX)


       dos2unix (Convert DOS text files to UNIX)

       Syntax:

       usage: dos2unix {file(s)}
       file(s) = file(s) to convert

       Description:

       DOS2UNIX will convert each file from the DOS text format (Carriage
       Return(CR) and Line Feed(LF) at the end of each line) into the UNIX
       text format (only Line Feed(LF) at the end of each line).

       Example:
       To convert `
                  `list1.txt'
                             ' and `
                                    `list2.txt'
                                               ' into UNIX format enter:
       dos2unix list1.txt list2.txt

       It will just show you the processed filenames and replace the original
       file contents:
       list1.txt
       list2.txt

































       OB. Eichberger, Professional Software Solutions      Reference
       Manual (Version 3.0)      Page 79



       UNIX on DOS Toolkiit (UNXIDOS)
                     extname (Extract file extension)


       extname (Extract file extension)

       Syntax:

       extname [-d] [file(s)]
       -d       = display in DOS style (default UNIX style)
       file(s)  = the filename(s) to be converted
       If no 'file(s)' are specified extname will read STDIN and convert each
       line

       Description:

       EXTNAME will extract the file extension from the specified path(s).
       You can use the unix display style(default) or specify DOS style
       display (-d option).
       You can either specify one or more filenames on the command line or
       provide a list of filenames in STDIN if you dont specify any filename.

       Example1:

       extname c:\tmp/save/src.zip dir1/file.c U:\PARK\file3.txt

       Will show:
       zip
       c
       txt

       Example2:

       extname -d c:\tmp/save/src.zip dir1/file.c U:\PARK\file3.txt

       Will show:
       ZIP
       C
       TXT

       Example3:

       To find out all extensions used on your machine enter:
       ufind / -type d -exec extname -d {} `
                                           `^'
                                              ' > ext.lst
       usort -u ext.lst  > ext2.lst













       OB. Eichberger, Professional Software Solutions      Reference
       Manual (Version 3.0)      Page 80



       UNIX on DOS Toolkiit (UNXIDOS)
                           du (Show disk usage)


       du (Show disk usage)

       Syntax:

       du [-a] [-b] [-f] [-h{n}] [-o] [-p] [-r] [-s] [directory|file list ...]
       If no directory is specified the current directory one is used (.)
       -a      = All      : list each file
       -b      = Bytes    : display in number of bytes
       -f      = FilesCnt : list number of files
       -h{n}   = SpaceHogs: list the 'n' biggest files in the specified
       directories
       -H{n}   = SpaceHogs: like -h but show also permissions and date
       -o      = Overview : print only sum of main sub directories and root 
                            files
       -p      = Padding  : don't pad the size, show real size in bytes
       -r      = Reach    : print warning of unaccessible directories
       -s      = Sum      : print only sum total of each directory
       -c{n[k]}= cluster : set padding cluster size to {n} bytes (k=1024)
       (default: display in megabytes (megabyte = 1,000,000 bytes!)

       Description:

       DU  is an excellent tool to give you a quick overview of your space
       used on the disks across your directories.
       If you don't specify any arguments DU will show the totals space used
       of your current directory and of any subdirectories in megabytes
       (1,000,000 bytes!).

       You can specify individual directories or even entire drives:
       du c           will give the overview of the entire C drive
       du /windows    will only give the details of the `
                                                        `/windows'
                                                                  ' branch

       By default DU will list all the subdirectories; to show only the main
       subdirectories you can specify the -o option (Overview) which will give
       you only the initial directories and the size of all the files in the
       starting(or root) directory:
       du -s d: e:    will give you an overview of the entire D and E drive

















       OB. Eichberger, Professional Software Solutions      Reference
       Manual (Version 3.0)      Page 81



       UNIX on DOS Toolkiit (UNXIDOS)
                           du (Show disk usage)

       Example1:

       Show the 10 biggest files(hogs) on the E drive:
       du -h10 e:

       Might generate the following output:
       List of the  10 largest files sorted by size in descending order:
       -----------------------------------------------------------------
           20,322,482 e:/MSVC/HELP/VCBKS15.HLP
           16,610,031 e:/MSVC/HELP/VCSDK15.HLP
           15,581,184 e:/MSVC/HELP/VCBKS15.IND
           11,090,254 e:/WINDEV/WINDEV.ZIP
           10,919,006 e:/PMW/PMW.WRK
            7,245,478 e:/DRG/MSDNCD15.IDX
            4,325,728 e:/MSOFFICE/ACCESS/MSACC20.HLP
            4,246,784 e:/MSOFFICE/EXCEL/EXCEL.EXE
            3,490,816 e:/MSOFFICE/WINWORD/WINWORD.EXE
            3,390,373 e:/VB30/WINAPI/WIN31WH.HLP


       Example2:

       Give an overview of the main directories on the G drive:
       du -o g:

       Might generate the following output:
          Megabytes    (Cluster = 16384 bytes)
             0.9339    g:/DM
             0.4915    g:/DOS622
             1.6384    g:/digidemo
                ---    g:/DRV_C
             0.5898    g:/PARK
             0.1475    g:/Q
             1.8842    g:/S8_OLD
                ---    g:/SCSI
             0.9339    g:/SES
                ---    g:/TMP
             7.8479    g:/U
           767.7706    g:/WAV
             0.5407    g:/{Files}
           782.7784    g:/














       OB. Eichberger, Professional Software Solutions      Reference
       Manual (Version 3.0)      Page 82



       UNIX on DOS Toolkiit (UNXIDOS)
                           du (Show disk usage)

       Example3:

       Show the 15 directories with the most files on the C drive
       du -h15 -f c:

       Might generate the following output:
       List of the  20 largest files sorted by size in descending order:
       -----------------------------------------------------------------
                 1268  /WINDOWS/SYSTEM32
                  713  /WIN95/SYSTEM
                  688  /WINDOWS/SYSTEM
                  591  /U/SAVE
                  471  /WINDOWS
                  285  /U
                  283  /SRC/BIN
                  281  /SRC/DEF
                  258  /WIN95
                  227  /DOC
                  190  /Unixdos
                  180  /MUDA/BIN/BAT
                  146  /WIN95/INF
                  145  /
                  137  /NO8
































       OB. Eichberger, Professional Software Solutions      Reference
       Manual (Version 3.0)      Page 83



       UNIX on DOS Toolkiit (UNXIDOS)
                           du (Show disk usage)

       Example4:

       Show all subdirectories under the current directory:
       du

       Might generate the following output:
          Megabytes    (Cluster = 16384 bytes)
             0.9830    ./bigwin
             0.5243    ./bin
             0.3277    ./bwt
                ---    ./db_dos
             1.5401    ./db_dump
             0.2949    ./dbmadhur/dll
             0.8192    ./dbmadhur/save
             2.8180    ./dbmadhur
             3.3751    ./def
                ---    ./fp
            10.4858    .
       Note: Empty directories is actually shown as `---' instead of the

       cumbersome UNIX and MKS style still showing one block even if the
       directory is empty.
              226 ./bigwin
               85 ./bin
               71 ./dbmadhur/dll
              221 ./dbmadhur/save
             1810 ./dbmadhur
              799 ./def
       e       1 ./fp
              127 ./bwt
              620 ./db_dump
        e      1 ./db_dos
             4402 .
       Note: UNIX and MKS displays the directories in confusing random order

       instead of the alphabetically sorted DU output in UNIXDOS!



















       OB. Eichberger, Professional Software Solutions      Reference
       Manual (Version 3.0)      Page 84



       UNIX on DOS Toolkiit (UNXIDOS)
                           du (Show disk usage)

       Show Bytes (-b option):

       If you want to get a list only of specific directories and see the
       actual bytes enter:
       du -b /dos /windows

       Might show to following output:
       Bytes
           10289152    /dos
             196608    /windows/dcsi
             131072    /windows/fonts
             294912    /windows/msapps/artgalry
             655360    /windows/msapps/equation
             393216    /windows/msapps/wordart
           15925248    /windows/msapps
             393216    /windows/msmail/msmail
            1212416    /windows/msmail
             720896    /windows/nls/english
             851968    /windows/nls
           69369856    /windows/system
          222625792    /windows

       Show space WITHOUT padding (-p option):

       By default DU will show the space a file occupies on the disk NOT the
       actual number of bytes the file itself contains: for example If you
       have a file with 20 bytes in size it will still occupy on the hard disk
       on cluster (which is usually 16,384 under 1GB or 32,768 above 1GB
       drives). This extra space is called `
                                           `padding space'
                                                          ' and can eat up
       enormous space if you have a lot of files on your disk. To see how much
       ACTUAL space is used by your files enter:
       du -b -p                           du -b

       Might show to following output               Compare this to the padded
       statistics:
              Bytes
              Bytes                               Bytes
             106622    ./bigwin             983040    ./bigwin
              37536    ./bin                     524288    ./bin
              63321    ./bwt                     327680    ./bwt
                ---    ./db_dos                          ---    ./db_dos
             302475    ./db_dump                1540096    ./db_dump
              33852    ./dbmadhur/dll            294912    ./dbmadhur/dll
             105257    ./dbmadhur/save           819200    ./dbmadhur/save
             906448    ./dbmadhur               2818048    ./dbmadhur
             375975    ./def                    3375104    ./def
            2158505    .                       10485760    .

       Note the actual space used is 2.158MB but on the disk 10.486MB is
       occupied
       (79.4% is padding exists or in other words wasted space).
       The `-b' in conjunction with the `-p' option can be very useful if you
       want to make sure that an entire directory branch has been transferred
       (for example to CD-ROM or a floppy) because if the cluster sizes

       OB. Eichberger, Professional Software Solutions      Reference
       Manual (Version 3.0)      Page 85



       UNIX on DOS Toolkiit (UNXIDOS)
                           du (Show disk usage)

       between the two media or disks are different you will get different
       usages althought the files themself are identical. The UNIXDOS DU
       allows you to compare two directory branches on different media WITHOUT
       the padding!



















































       OB. Eichberger, Professional Software Solutions      Reference
       Manual (Version 3.0)      Page 86



       UNIX on DOS Toolkiit (UNXIDOS)
                           du (Show disk usage)

       Show all files in subdirectories (-a option):

       To get a list of all the files on yout entire disk into the file
       `all.lst' enter:
       cd /
       du -a / > all.lst

       Show number of files (-f option):

       In some cases you might want to check just the number of files in the
       directories.
       This option allows you to instruct DU to show the file counts.
       Includes in the file counts are also all the hidden files in each
       directory.
       In the following example you will see the number of files in each
       directory on your disk:
       du -f /

       Might display:
              Files
                169   /dos
                  5   /windows/dcsi
                  1   /windows/forms/_classad.000
                 48   /windows/forms/configs
                  2   /windows/forms/t_answer.000
                 54   /windows/forms
                  2   /windows/msapps/artgalry
                  3   /windows/msapps/equation
                 34   /windows/msapps/grphflt
                  2   /windows/msapps/msgraph
                  5   /windows/msapps/msgraph5
                 24   /windows/msapps/msimager
                  7   /windows/msapps/msinfo
                 18   /windows/msapps/msquery
                  3   /windows/msapps/orgchart
                 10   /windows/msapps/proof
                  1   /windows/msapps/sheetcnv
                 14   /windows/msapps/textconv
                  4   /windows/msapps/wordart
                127   /windows/msapps
                  4   /windows/msmail/msmail
                 13   /windows/msmail
                  5   /windows/nls/english
                  9   /windows/nls
                  8   /windows/repair
                816   /windows/system
                  5   /windows/temp
               1616   /windows


       Notes/Remarks:

       The UNIXDOS DU shows the size in megabytes and empty directories as '--
       -' instead of the number of block as under UNIX/MKS. The '-b' and '-p'

       OB. Eichberger, Professional Software Solutions      Reference
       Manual (Version 3.0)      Page 87



       UNIX on DOS Toolkiit (UNXIDOS)
                           du (Show disk usage)

       options are not available under UNIX to obtain the actual/unpadded
       filesizes.
       We never liked the cumbersome definition of a megabyte as 1,048,576 and
       so we are using the user-friendly 1,000,000 byte as the definition as
       one megabyte!


















































       OB. Eichberger, Professional Software Solutions      Reference
       Manual (Version 3.0)      Page 88



       UNIX on DOS Toolkiit (UNXIDOS)
                  drvname (Extract drive from filename)


       drvname (Extract drive from filename)

       Syntax:

       drvname [-d] [file(s)]
       -d       = display in DOS style (default UNIX style)
       file(s)  = the filename(s) to be converted
       If no 'file(s)' are specified drvname will read STDIN and
       convert each line


       Description:

       DRVNAME will extract the drive letter from the specified list of
       filenames.
       You can use the unix display style(default) or specify DOS style
       display (-d option).

       Example1:

       drvname c:\tmp/save/src.zip dir1/file.c U:\PARK\file3

       Will show:
       c:
       c:
       u:

       Example2:

       drvname -d c:\tmp/save/src.zip dir1/file.c U:\PARK\file3

       Will show:
       C:
       C:
       U:

       Example3:

       You can either specify one or more filenames on the command line or
       provide a list of filenames in STDIN if you dont specify any filename.
       Display all drives appearing in the list of files stored in `new.lst'
       in DOS style:
       dirname -d @new.lst











       OB. Eichberger, Professional Software Solutions      Reference
       Manual (Version 3.0)      Page 89



       UNIX on DOS Toolkiit (UNXIDOS)
                         (u)echo (Echo arguments)


       (u)echo (Echo arguments)

       Syntax:

       uecho [argument(s)|-e|-E|-s|-S]
       -e     = disable      the escape sequence translation
       -E     = enable again the escape sequence translation (default)
       -s     = disable      the space between arguments
       -S     = enable again the space between arguments (default)
       The following escape sequences can be used in the arguments:
       \b    = backspace
       \c    = exit immediatelly (default is LF at the end)
       \f    = form-feed
       \n    = newline
       \r    = carriage return
       \t    = tab
       \v    = vertical tab
       \\    = backslash
       \0n   = octal code
       \xn   = hex code
       If the argument starts with '%' or '$' the contents of that
       environent variable is echoed)

       $env replace with the contents of the environment variable
       (if existing) %env  same as above

       Description:

       UECHO is used to display text and environment variables to the screen
       (STDOUT).

       Example1:

       To display the current date with a lead text:
       uecho THE DATE IS: `udate`

       Might show:
       THE DATE IS: Tue Sep 24 09:19:12 1995
















       OB. Eichberger, Professional Software Solutions      Reference
       Manual (Version 3.0)      Page 90



       UNIX on DOS Toolkiit (UNXIDOS)
                         (u)echo (Echo arguments)

       Example2:

       You can also display environment variables and disable/enable the
       escape codes:
       uecho  "LIB: " -e %LIB -E "\nPATH:" -e %PATH

       Might show:
       LIB:  c:\v2deb\lib;c:\msvc\lib;c:\msvc\mfc\lib
       PATH: c:\unixdos;c:\msvc\bin;c:\windows\system32

       In this UECHO command is composed out of the following elements:
       . Display a straight text: `
                                   `LIB: `
                                          `
         (enclosed in quotes to append the trailing blank)
       . Disable the escape sequences because within the %LIB environment
         variable the backslash is used for the directories and would be
         misunderstood from UECHO as escape command: -d
       . Display the %LIB environment variable: %LIB
       . Enable the escape commands again - we need it for the new line: -e
       . Display straight text starting on the next line: `
                                                           `\nPATH:'
                                                                    '
       . Disable the escape command again (backslash is used also in %PATH):
         -d
       . Display the %PATH environment variable: %PATH


       Example3:

       You can also join arguments together which would otherwise be separated
       by a space:
       set FILENAME=file1
       uecho  -s $FILENAME `
                           `.ext'
                                 '

       Will show:
       file1.ext

       Without the space supression you will always get a space between the
       filename and extension:
       uecho  $FILENAME `
                        `.ext'
                              '

       Will show:
       file1  .ext



       Notes/Remarks:

       The UNIX/MKS UECHO does not have the capability to disable/enable the
       escape commands, which sometimes limits it - especially in the DOS
       environment where (unfortinatelly) the backslash is used for the
       directory names. This was in my mind a big mistake when DOS was cloned
       from UNIX!





       OB. Eichberger, Professional Software Solutions      Reference
       Manual (Version 3.0)      Page 91



       UNIX on DOS Toolkiit (UNXIDOS)
         egrep (Search files for one or more pattern/expression)


       egrep (Search files for one or more pattern/expression)

       Syntax:

       egrep [-abcdhilnpsvx] [-f {file}] [-e {p}] {p} {file(s)}
       -a      = always  : always show filename (even in a single file search)
       -b      = bytes   : show the byte offset in file of match
       -c      = count   : show only count of matches
       -d      = descend : search also descending subdirectories for 'file(s)
       -e {p}  = expr.   : search pattern {p} (can be repeated!)
                           (-e is only needed if the pattern starts with '-')
       -f {f}  = file    : file with more pattern (can be repeated!)
       -h      = hide    : dont show the filename
       -i      = ignore  : upper or lower case case
       -l      = list    : show only the filename on match
       -n      = number  : show line number of match
       -s      = suppress: dont show error messages
       -v      = inVert  : find all NON MATCHES
       -x      = eXact   : find only exact match on whole line
       {p}     = regular expression to be matched (up to 1000 total pattern)
       file(s) = file(s) to be searched for match

       NOTE: to disable the argument expansion always use single quotes:
       egrep '*text*' *.c
       If no files are specified STDIN is used.
       (Maximum line length is 10000 bytes)

       Description:

       This is a excellent tool for searching files for text matches.
       EGREP belongs to the following family of `
                                                `grep'
                                                      ' utilities:
       . EGREP: can search for several expressions in the specified files
       . FGREP: can search for several plain text items in the specified
         files
       . GREP: can search for one single expression in the specified files

       On the following pages all the options which are identical in all three
       grep utilities (EGREP/FGREP/GREP) will be described with examples.

       To learn how to create advanced search pattern see `
                                                          `Regular Expression
       for Text Searches'
                        ' in chapter `
                                      `AGRUMENT EXPANSION'
                                                          ' in the `
                                                                    `USER
       MANUAL'
             '.

       If you don't specify any input file(s) to examine the `
                                                             `grep'
                                                                   '
       utilities will read the standard input (STDIN) for any matches.

       Lines of up to 10,000 characters in length can be processed and also
       non-text files
       (like WORD *.doc documents) can be searched!

       On the reference pages for FGREP and GREP you will find a reference to
       the following pages instead of repeating all the shared options.


       OB. Eichberger, Professional Software Solutions      Reference
       Manual (Version 3.0)      Page 92



       UNIX on DOS Toolkiit (UNXIDOS)
         egrep (Search files for one or more pattern/expression)

       Exit Code:

       EGREP/FGREP/GREP will exit with the following exit status:
       0    Found match(es)
       1    Found no match
       2    Syntax error or inaccessible file

       Descend into Subdirectories (-d option)

       This option allows you to search not just for files in the current
       directory but also in ALL the subdirectories.
       Example1:

       Search for `
                  `PATH'
                        ' in all batch files (*.bat) on the entire drive:
       cd \
       grep -d PATH *.bat
       Might find:
       autoexec.bat: PATH C:\U;C:\WINDOWS;C:\DOS
       autoexec.bat: set LIBPATH=t:\pvcs\dos
       autoexec.bat: set DBPATH=c:\v2deb\mhss
       madhur/src/install.bat: echo INSERT \UNIXDOS INTO THE PATH IN
       AUTOEXEC.BAT
       madhur/u/autoexec.bat: PATH c:\q\;C:\DOS;c:\u;c:\brief;
       madhur/u/old/muda.bat: set DBPATH=c:\muda\bin

       Example2:

       Search for `
                  `PATH'
                        ' and `
                               `INCLUDE'
                                        ' in all batch files (*.bat) on the
       entire drive:
       cd \
       egrep -d -e PATH -e INCLUDE *.bat
       Might find:
       autoexec.bat: PATH C:\U;C:\WINDOWS;C:\DOS
       autoexec.bat: set LIBPATH=t:\pvcs\dos
       autoexec.bat: set
       INCLUDE=c:\msvc\include;c:\msvc\mfc\include;c:\windev\include
       autoexec.bat: set DBPATH=c:\v2deb\mhss
       madhur/src/install.bat: echo INSERT \UNIXDOS INTO THE PATH IN
       AUTOEXEC.BAT
       madhur/src/set_ud.bat: set INCLUDE=\madhur\src\ud\def;c:\msvc\include
       madhur/u/old/do_icm.bat: set INCLUDE=\msc\def
       madhur/u/old/muda.bat: set DBPATH=c:\muda\bin
       madhur/u/old/set_ec.bat: set INCLUDE=\msc\def
       madhur/u/old/set_ec.bat: set CD2PATH=l:\cd2

       Ignore Case (-i option)

       This option allows you to search for text no matter if the text found
       is in upper or lower case:
       egrep -i c: /*.bat
       fgrep -i c: /*.bat
       grep -i c: /*.bat
       Might find:


       OB. Eichberger, Professional Software Solutions      Reference
       Manual (Version 3.0)      Page 93



       UNIX on DOS Toolkiit (UNXIDOS)
         egrep (Search files for one or more pattern/expression)

       autoexec.bat: set PVCSFILE=c:/put.txt

       autoexec.bat: set PVCSLOG=c:/pvcs.log

       autoexec.bat: rem C:\MADHUR\NO8\NDD C:/Q

       tmp_bat.bat: sh show_arg.sh c:/roma
















































       OB. Eichberger, Professional Software Solutions      Reference
       Manual (Version 3.0)      Page 94



       UNIX on DOS Toolkiit (UNXIDOS)
         egrep (Search files for one or more pattern/expression)

       List Filenames only (-l option)

       This option allows you to produce a list of files which contain the
       search text:
       Example1:

       cd \
       egrep -d -e PATH -e INCLUDE *.bat
       Might find:
       autoexec.bat
       madhur/src/install.bat
       madhur/src/set_ud.bat
       madhur/u/autoexec.bat
       madhur/u/install.bat
       madhur/u/old/do_icm.bat
       madhur/u/old/muda.bat
       madhur/u/old/set.bat
       madhur/u/old/set_ec.bat

       Example2:

       To get a list of all your batch (*.bat) and command (*.com) files on
       your hard disk enter:
       cd \
       grep -d -l . *.bat *.com
       Might find:
       autoexec.bat
       makeall.bat
       command.com
       ntdetect.com
       cvision/cvcopy.bat
       cvision/cvset.bat
       dos/assign.com
       dos/command.com
       dos/diskcomp.com
       dos/diskcopy.com
       dos/doskey.com
       dos/dosshell.com
       ...
       In this example I used the descending option (-d) and the file list-
       only option (-l). The expression is `
                                           `.'
                                              ' which means search for any
       character in a line - so it basically will reliably always trigger a
       `
       `file find'
                  ' for the files specified (*.bat) and (*.com).

       Hide Filenames (-h option)

       In some cases you might NOT want to see any filename in front of the
       matches.
       This option allows you to suppress the default filename prefix:
       cd \
       egrep -d -h -e PATH -e INCLUDE *.bat
       Might find:
       PATH C:\U;C:\WINDOWS;C:\DOS
       set LIBPATH=t:\pvcs\dos

       OB. Eichberger, Professional Software Solutions      Reference
       Manual (Version 3.0)      Page 95



       UNIX on DOS Toolkiit (UNXIDOS)
         egrep (Search files for one or more pattern/expression)

       set INCLUDE=c:\msvc\include;c:\msvc\mfc\include;c:\windev\include
       set DBPATH=c:\v2deb\mhss
       echo INSERT \UNIXDOS INTO THE PATH IN AUTOEXEC.BAT
       set INCLUDE=\madhur\src\ud\def;c:\msvc\include
       set INCLUDE=\msc\def
       set DBPATH=c:\muda\bin
       set INCLUDE=\msc\def
       set CD2PATH=l:\cd2















































       OB. Eichberger, Professional Software Solutions      Reference
       Manual (Version 3.0)      Page 96



       UNIX on DOS Toolkiit (UNXIDOS)
         egrep (Search files for one or more pattern/expression)

       Show also the Line number (-n option)

       In some cases you might want to know also the line number where the
       matches occured.
       This option allows you to add this information after the filename
       prefix:
       cd \
       egrep -d -n -e PATH -e INCLUDE *.bat
       Might find:
       autoexec.bat:    9:PATH C:\U;C:\WINDOWS;C:\DOS
       autoexec.bat:   28:set LIBPATH=t:\pvcs\dos
       autoexec.bat:   48:set
       INCLUDE=c:\msvc\include;c:\msvc\mfc\include;c:\windev\include
       autoexec.bat:   62:set DBPATH=c:\v2deb\mhss
       madhur/src/install.bat:   17:echo INSERT \UNIXDOS INTO THE PATH IN
       AUTOEXEC.BAT
       madhur/src/set_ud.bat:   11:set
       INCLUDE=\madhur\src\ud\def;c:\msvc\include
       madhur/u/install.bat:   77:echo 30 more bytes. One possible way to
       shorten your PATH
       madhur/u/old/do_icm.bat:    2:set INCLUDE=\msc\def
       madhur/u/old/muda.bat:    2:set DBPATH=c:\muda\bin
       madhur/u/old/set.bat:    8:set INCLUDE=\msc\def
       madhur/u/old/set_ec.bat:    9:set INCLUDE=\msc\def
       madhur/u/old/set_ec.bat:   14:set CD2PATH=l:\cd2

       Always show the filename (-a option)

       If grep is istructed to search only one single file it by default not
       displaying the filename (since it is obvious in which file the match
       occured!).
       This option allows you to force always to display the filename prefix:
       cd \
       grep -a PATH autoexec.bat
       Might find:
       autoexec.bat: PATH C:\U;C:\WINDOWS;C:\DOS
       autoexec.bat: set LIBPATH=t:\pvcs\dos
       autoexec.bat: set DBPATH=c:\v2deb\mhss

       Show binary file offset (-b option)

       If you want to know specifically where in a file a pattern occured you
       will need the actual byte offset (the line number does not point you to
       the specific place within the file).
       This option allows you to get also the byte offset after the filename
       prefix:
       grep -b PATH /*.bat
       Might find:
       /autoexec.bat:      247:PATH C:\U;C:\WINDOWS;C:\DOS
       /autoexec.bat:      768:set LIBPATH=t:\pvcs\dos
       /autoexec.bat:     1564:set DBPATH=c:\v2deb\mhss

       Show the matches per file (-c option)


       OB. Eichberger, Professional Software Solutions      Reference
       Manual (Version 3.0)      Page 97



       UNIX on DOS Toolkiit (UNXIDOS)
         egrep (Search files for one or more pattern/expression)

       If you only want to know specifically how many matches occured within
       each file, but not actually see all the matches this option allows you
       instruct EGREP/FGREP/GREP to provide this information after the
       filename prefix:
       cd \
       grep -d -b PATH *.bat
       Might find:
       autoexec.bat:4
       makeall.bat:0
       cvision/cvcopy.bat:0
       cwright/mak2pjt/mak2pjt.bat:0
       acc/save.bat:0











































       OB. Eichberger, Professional Software Solutions      Reference
       Manual (Version 3.0)      Page 98



       UNIX on DOS Toolkiit (UNXIDOS)
         egrep (Search files for one or more pattern/expression)


       Show all lines which do NOT match (-v option)

       In some cases you might want to find all the lines in a file which are
       not matching the search criteria. This option allows you invert the
       search logic.
       This example will search for all lines in `
                                                 `autoexec.bat'
                                                               ' which are
       NOT starting with the `
                             `set'
                                  ' command:
       grep -v ^set autoexec.bat
       Might find:
       @ECHO OFF
       SET NWLANGUAGE=ENGLISH
       LH /L:0 C:\DOS\SMARTDRV.EXE C+ /V
       PROMPT $t $p$g
       PATH C:\U;C:\WINDOWS;C:\DOS
       SET TEMP=C:\TMP
       Rem LH /L:1,27984 MSCDEX /D:MSCD001 /V /L:E
       f:
       login name.dev.mcgraw_co
       CALL C:\MSVC\BIN\MSVCVARS
       ...

       Show only lines with match completely (-x option)

       In some cases you might want to find all the lines which match only the
       entire line instead only a pattern. This option allows you change the
       search logic in this way.

       If `
          `grep1.txt'
                     ' contains:
       just text
       text with number 18
       18
       before 18 after
       1818

       This example will search for all lines which contain exactly number
       `
       `18'
           ' in file `
                      `grep1.txt'
                                 ':
       grep -x 18 /unixdos/grep1.txt

       Will find only the line with just contains `
                                                  `18'
                                                      ':
       18


       Searching binary files

       You can also search binary files (like Microsoft Word documents *.doc).
       To search for EGREP in all word documents enter:
       cd \
       grep -d EGREP *.doc
       Might find:
       /unixdos/ud_ref.doc: The UNIX EGREP cannot handle lines longer than
       1024 bytes
       /unixdos/ud_ref.doc: UNIXDOS EGREP limit is 10,000 bytes.
       /unixdos/ud_ref.doc: EGREP *.doc

       OB. Eichberger, Professional Software Solutions      Reference
       Manual (Version 3.0)      Page 99



       UNIX on DOS Toolkiit (UNXIDOS)
         egrep (Search files for one or more pattern/expression)

       /unixdos/pub/ud_usr.doc: egrep             Search text file(s) for one
       or several pattern (search expression)
       /unixdos/ud_usr.doc: The following UNIXDOS utilities use text searches:
        grep, egrep, fgrep, sed, ufind, umore, which.



















































       OB. Eichberger, Professional Software Solutions      Reference
       Manual (Version 3.0)      Page 100



       UNIX on DOS Toolkiit (UNXIDOS)
         egrep (Search files for one or more pattern/expression)

       Text Search Expression:

       For advanced text searches some special commands are available so you
       can tailor the expression to your particular needs.

       The following special character can be used in an expression:
       ^         beginning of the line
       $         end of the line
       .         any single character
       *         any number of characters
       [list]         any character in the class
                      (e.g. [a-z0123456789] all lower case letters and
       numbers)
       [^list]        any character NOT matching this class
       \c        escape  the special meaning of character 'c' and use as is
                      (e.g. \$ looks for '$')
       To learn how to create advanced search pattern see `
                                                          `Regular Expression
       for Text Searches'
                        ' in chapter `
                                      `AGRUMENT EXPANSION'
                                                          ' in the `
                                                                    `USER
       MANUAL'
             '.

       Notes:

       The UNIX GREP utilities do not have the capability to descend into
       subdirectories, while the UNIXDOS GREP make this powerful feature
       available.

       The UNIX GREP utilities cannot handle lines longer than 1024 bytes
       while the UNIXDOS GREP utilities can handle lines up to 10,000 bytes.

       The UNIX/MKS GREP utilities don't work well with binary files (like
       Microsoft Word Documents):
       ud_ref.doc: grep: input lines truncated - result questionable
       ud_usr.doc: grep: input lines truncated - result questionable
       The UNIXDOS GREP utilities can handle also those binary files (since
       they break up the lines on CarriageReturn's(CR) and null characters
       (NULL).

       The UNIX GREP utilities will show the filename only when you specify at
       least two filenames. If you want to see the filename with only one file
       you have to append '/dev/null' to fool them into thinking it is
       processing two files to display the filename. This seemed rather akward
       to me an so I added the `-a' and `-h' option.













       OB. Eichberger, Professional Software Solutions      Reference
       Manual (Version 3.0)      Page 101



       UNIX on DOS Toolkiit (UNXIDOS)
                env (Show/change environment/run command)


       env (Show/change environment/run command)

       Syntax:

       env [-] [NAME=value...] [cmd [argument(s)]]
       -      = start from scratch (default uses existing environment)
       NAME=  = update/insert new variable to environment
       cmd    = command/program to be executed under the new environment
       arg    = optional arguments for the command

       To avoid expansion of arguments enclose in single quotes:
       env LIB=newlib uecho '$LIB'

       Description:

       ENV works with the process environment in the following ways:
       . display all environment variables
       . run a new process with a few changes to the existing environment
       . run a new process with an environment which starts from scratch
       . run a non-UNIXDOS program using UNIXDOS argument expansion feature

       Display current Environment

       To see all the currently defined environment variables enter:
       env

       Might display:
       COMSPEC=C:\WINDOWS\SYSTEM32\COMMAND.COM
       COMPUTERNAME=MADHUR
       DBPATH=c:\v2deb\mhss
       DEBUG=ON
       HOMEDRIVE=C:
       HOMEPATH=\users\default
       INCLUDE=\madhur\src\ud\def;c:\msvc\include
       INIT=C:\MSVC
       LIB=c:\madhur\lib;c:\msvc\lib
       LIBPATH=t:\pvcs\dos
       OS=Windows_NT
       PATH=c:\u;c:\dos;c:\windows
       PROMPT=$t $p$g
       TEMP=c:\temp
       TMP=c:\temp












       OB. Eichberger, Professional Software Solutions      Reference
       Manual (Version 3.0)      Page 102



       UNIX on DOS Toolkiit (UNXIDOS)
                env (Show/change environment/run command)

       Change the existing set of environment variables

       ENV allows you to run a program(or process) with an altered set of
       environment variables.
       You just redefine all the new or changed environment variable names on
       the command line and then ENV will call the program based on the
       altered environment.
       In our example we will use the `
                                      `$LIB'
                                            ' environment variable.
       To see the contents of a single environment variable enter:
       uecho -d $LIB
       The result might be:
       c:\madhur\lib;c:\msvc\lib

       Now we will call the UECHO program again, but with an altered LIB
       variable:
       env LIB=newlib uecho -d '$LIB'
       The result will be:
       newlib
       (Note the single quotes around `$LIB' to avoid too early argument
       expansion)
       If you would not use the single quotes the $LIB environment would
       already be expanded BEFORE env is started:
       env LIB=newlib uecho -d $LIB
       The result will be:
       c:\madhur\lib;c:\msvc\lib

       Starting a new set of environment variables

       ENV allows you also to run a program(or process) with a completly new
       environment.
       In the following example we instruct ENV to start a new environment
       from scratch with the `
                             `-'
                                ' sign. The we define the two variables
       `
       `LIB'
            ' and `
                   `PATH'
                         ' and call env again to now `
                                                     `see'
                                                          ' the new
       environment:
       env - LIB=newlib PATH=c:\dos env
       The result will be:
       LIB=newlib
       PATH=c:\dos

       Using the UNIXDOS argument expansion feature for non-UNIXDOS programs

       Since ENV will expand the arguments before your program is called. This
       allows you to use the powerful UNIXDOS argument expansion even for non-
       UNIXDOS programs (like pkzip).
       In the following example we will create an archive containing text
       files(*.txt)  files starting with `
                                         `a'
                                            ' thru `
                                                    `c'
                                                       ' and all documents
       (*.doc) NOT starting will `
                                 `a'
                                    ' thru `
                                            `s'
                                               ':
       env pkzip archive [a-c]*.txt ![a-s]*.doc!*.doc
       Might show:
       Creating ZIP: ARCHIVE.ZIP
         Adding: ABC.TXT     Deflating ( 5%), done.
         Adding: COMM1.TXT   Storing   ( 0%), done.
         Adding: COMM2.TXT   Storing   ( 0%), done.
         Adding: TMAP.DOC    Deflating (64%), done.

       OB. Eichberger, Professional Software Solutions      Reference
       Manual (Version 3.0)      Page 103



       UNIX on DOS Toolkiit (UNXIDOS)
                env (Show/change environment/run command)

         Adding: UD_REF.DOC  Deflating (70%), done.
         Adding: UD_USR.DOC  Deflating (71%), done.

       Note: Unfortunately the primitive DOS operating system still allows
       only 128 bytes for all the
       command and the program name. If ENV is hitting this limit it will
       display the following message:
       env: Cannot run 'your program' (Arg list too long)
       In this case try to reduce the number of arguments: [a-m]*.c instead of
       *.c













































       OB. Eichberger, Professional Software Solutions      Reference
       Manual (Version 3.0)      Page 104



       UNIX on DOS Toolkiit (UNXIDOS)
                (u)exit (Exit with specified return code)



       (u)exit (Exit with specified return code)

       Syntax:

       usage: uexit {return value}

       Description:

       UEXIT allows you to generate a specific program exit code.

       Example:

       To exit with error level 18 enter:
       uexit 18

       To permanently save this exit value enter:
       saveexit

       To show (and test) the error level enter (see TEST):
       test -e? 0

       Will display:
       LAST EXIT VALUE WAS: 18






























       OB. Eichberger, Professional Software Solutions      Reference
       Manual (Version 3.0)      Page 105



       UNIX on DOS Toolkiit (UNXIDOS)
                       expr (Compute an expression)


       expr (Compute an expression)

       Syntax:

       expr [-f|-b|-o|-h] {ex1 op ex1}
       -f   floating point:
            EXPR will use floating point arithmetic instead of the default
            32 bit integer arithmentic    and display the result with 7 places
            after the decimal point
       -b   binary:
            Display the integer result as 32 bits (0 or 1) with a `
                                                                  `,'
                                                                     '
       between bytes
       -o   octal:
            Display the integer result as octal value with leading '0'
       -x   hexadecimal:
            Display the integer result as hexadecimal with leading '0x'
       ex1,ex2   value or expression:
            A numeric value (48) or a text string ("abc").
            EXPR will use the following conversions:
            0xNN=hexadecimal number (e.g. 0xF1B5), 0NN=ocatl (e.g 0174),
            0bNN=binary number (0b1010011)  otherwise decimal number
       op   operand:
            One of the following arithmetic operands:
            +         add
            -         substract
            '*' or x       multiply (remember to enclose * in quotes)
            /         divide
            %         remainder
            or one of the following conditional operands:
            =    or '-eq'  equal
            >=   or '-ge'  greater than or equal
            >    or '-gt'  greater than
            =    or '-ne'  not equal
            test if regular expression matches or one of the following
            logical operands:
            ^    logical OR
            &    logical AND
       EXPR returns: 0 if expression is true or the numeric result is not 0
                     1 if untrue or the numeric result is 0, 2 if error
       Note:
       To avoid file expansion for multiplication use '*' or the x operand


       Description:

       EXPR allows you to enter an expression on the command line like a
       calculator:
       expr 100 + 200 / 5
       Will show:
       140
       Note the automatic prioritizing to first calculate 200/5 (40) and then
       add 100: 100+40=140


       OB. Eichberger, Professional Software Solutions      Reference
       Manual (Version 3.0)      Page 106



       UNIX on DOS Toolkiit (UNXIDOS)
                       expr (Compute an expression)

       Parenthesis:

       You can also use parenthesis to specify a specific evaluation order:
       expr ( 100 + 200 ) / 5
       Will show (300/5):
       60
       Note the blanks around the parenthesis `
                                              `(`
                                                 ` and `
                                                        `)'
                                                           ' to make then a
       separate argument!


       Floating point display:

       In some cases you might want to get a non-integer result. The `
                                                                     `-f'
                                                                         '
       option will switch to the floating point logic:
       expr -f 100 / 7
       Will display:
       14.285714
       Otherwise if you would enter: expr 100 / 7 you would get:
       14

       Hexadecimal display:

       In some cases you might want to display the integer result as a
       hexadecimal value.
       The `
           `-x'
               ' option will switch to the hexadecimal display:
       expr -x 100
       Will display:
       0x64
       This way you can easily convert from decimal to hex.

       Binary display:

       In some cases you might want to actually see the individual bits of an
       integer result.
       The `
           `-b'
               ' option will switch to the binary display:
       expr -b 256  + 8
       Will display:
       00000000,00000000,00000001,00001000
       This way you can easily `
                               `see'
                                    ' the bits (in this case bit 3 and 8).
       The result is separated by commas into 4 groups of 8 bits each, making
       up the full 32-bit value.

       Octal display:

       In some cases you might want to display the integer result as a octal
       value.
       The `
           `-o'
               ' option will switch to the octal display:
       expr -o 100
       Will display:
       0144
       This way you can easily convert from decimal to octal.




       OB. Eichberger, Professional Software Solutions      Reference
       Manual (Version 3.0)      Page 107



       UNIX on DOS Toolkiit (UNXIDOS)
                       expr (Compute an expression)

       Non decimal input

       In the previous example we always used decimal value input. EXPR allows
       you also to enter each value in hex/decimal or octal:
       expr 100 + 0x64 + 0144 + 0b1100100
       Will display:
       400
       In this example we entered the same value (100) in the 4 possible
       forms:
       . 100          decimal
       . 0x64         hexadecimal
       . 0144         octal
       . 0b1100100    binary


       Arithmentic:

       So far we use always used just simple addition (+), but EXPR can also
       do the following arithmetic operations:
       . addition          +
       . substraction -
       . multiplication    *   (or `
                                   `x'
                                      ' to avoid expansion)
       . division          /
       . remainder    %

       Examples:
       expr 1 + 2     = 3
       expr 10 - 8    = 2
       expr 3 `*' 5   = 15  (we need the single quotes to escape argument
       expansion!)
       expr 3 x 5     = 15  (alternative multiplication which does not need
       single quotes)
       expr 100 / 5   = 20  (no rounding is done: expr 4 / 5 = 0)
       expr 12 `%' 5  = 2   (we need the single quotes to escape argument
       expansion!)




















       OB. Eichberger, Professional Software Solutions      Reference
       Manual (Version 3.0)      Page 108



       UNIX on DOS Toolkiit (UNXIDOS)
                       expr (Compute an expression)

       Comparison:

       EXPR allows you also to compare two values (is 100 less than 5?):
       expr 100 -lt 5
       Will show:
       0
       The result `
                  `0'
                     ' means NOT true.

       expr 100 -gt 5
       Will show:
       1
       The result `
                  `1'
                     ' means true (100 is greater than 5)

       The following comparisons are available:
       . less than         -lt  or `
                                   `<`
                                      `        (escape `
                                                       `<`
                                                          ` from operation
         system)
       . less or equal     -le  or `
                                   `<=`
                                       `  (escape `
                                                  `<=`
                                                      ` from operation
         system)
       . equal        -eq  or =
       . not equal         -ne  or `!=`   (the `!' needs to be escaped from
         argument expansion)
       . greater or equal  -ge  or `
                                   `>=`
                                       `  (escape `
                                                  `>=`
                                                      ` from operation
         system)
       . greater than -gt  or  `
                               `>`
                                  `       (escape `
                                                  `>`
                                                     ` from operation system)

       Example:
       To check if you have more than 10 C source files in your current
       directory enter:
       ls *.c* | wc | grep TOTAL | cut -f1 > x1.tmp
       expr 10 -gt @x1.tmp
       If you see `
                  `0'
                     ' you have NOT, if you see `
                                                 `1'
                                                    ' you have more than 10 C
       source files.
       To execute a command based on this criteria enter:
       ls *.c* | wc | grep TOTAL | cut -f1 > x1.tmp
       test ` expr 10 -gt @x1.tmp` -eq 1 run: banner `
                                                     `10 or more'
                                                                 '




















       OB. Eichberger, Professional Software Solutions      Reference
       Manual (Version 3.0)      Page 109



       UNIX on DOS Toolkiit (UNXIDOS)
                       expr (Compute an expression)

       Joining conditions:

       EXPR allows you also to join several conditions:
       . logical AND  `
                      `&'
                         '
       . logical OR   `
                      `^'
                         '

       Example:
       To test if 100 is greater than 80 AND 20 is less than 40 enter:
       expr 100 -gt 80 "&" 20 "<" 40
       Will show:
       1

       Exit Code:

       EXPR use the following exit code depending on the result:
       0    TRUE (condition was true or arithmentic computation yielded not 0
       result)
       1    UNTRUE (condition failed or arithmetic computation result is 0)
       2    ERROR

       Notes/Remarks:

       The following features of UNIXDOS EPXR are not available in the
       UNIX/MKS EXPR:
       . floating point arithmetic (-f option)
       . Numeric input conversion (hex 0xNN, octal 0NN, binary 0bNN)
       . Numeric output conversion (-x hex, -o octal, -b binary)
       . comparison mnemonics (-gt,-ge,-eq,-ne,-lt,le)
       . using the 'x' as an alternative for the '*' which always has to be
         escaped with quotes!

       The string functions (substr, index, index) found in the Berkeley UNIX
       EXPR are not supported under UNIXDOS.






















       OB. Eichberger, Professional Software Solutions      Reference
       Manual (Version 3.0)      Page 110



       UNIX on DOS Toolkiit (UNXIDOS)
            fgrep (Search files for one or more plain pattern)


       fgrep (Search files for one or more plain pattern)

       Syntax:

       fgrep [-abcdhilnpsvx] [-f {file}] [-e {p}] {pat} {file(s)}
       -a      = always  : always show filename (even in a single file search)
       -b      = bytes   : show the byte offset in file of match
       -c      = count   : show only count of matches
       -d      = descend : search also descending subdirectories for 'file(s)
       -e {p}  = expr.   : search pattern {p} (can be repeated!)
       -f {f}  = file    : file with more pattern (can be repeated!)
       -h      = hide    : dont show the filename
       -i      = ignore  : upper or lower case case
       -l      = list    : show only the filename on match
       -n      = number  : show line number of match
       -s      = suppress: dont show error messages
       -v      = inVert  : find all NON MATCHES
       -x      = eXact   : find only exact match on whole line
       {p}     = pattern : text to be matched (up to 1000 total pattern)
                 (only needed if neither '-e' not -f' is specified
       file(s) = file(s) to be searched for match

       (Maximum line length is 10000 bytes)

       Description:

       This is a excellent tool for searching files for text matches.
       EGREP belongs to the following family of `
                                                `grep'
                                                      ' utilities:
       . EGREP: can search for several expressions in the specified files
       . FGREP: can search for several plain text items in the specified
         files
       . GREP: can search for one single expression in the specified files

       See the EGREP pages for more details.
       FGREP is identical ti EGREP except it does NOT allow regular expression
       for your search criteria.

       Example:

       Search all C files (*.c) for the lines matching '1044','1039', '1080'
       and '1099':
       The file 'num.lst.' contains:
       1044
       1039
       1080

       To find these lines enter:
       fgrep -f num.lst *.c

       Notes:

       See Notes under EGREP.


       OB. Eichberger, Professional Software Solutions      Reference
       Manual (Version 3.0)      Page 111



       UNIX on DOS Toolkiit (UNXIDOS)
            fgrep (Search files for one or more plain pattern)
























































       OB. Eichberger, Professional Software Solutions      Reference
       Manual (Version 3.0)      Page 112



       UNIX on DOS Toolkiit (UNXIDOS)
                        file (Determine file type)


       file (Determine file type)

       Syntax:

       file [-f {fl}] {file(s)}
       -f {fl}   = use filelist in file 'fl


       Description:

       FILE will determine the file type based on the file extension and
       display the result on the screen.
       FILE `
            `knows'
                   ' more than 100 different file types.

       Example:

       List all the file types of the files in the current directory:
       file *
       The result can look like this:
                 /windows/archdll.dll: WINDOWS Dynamic Link Library file
                  /windows/arches.bmp: WINDOWS bitmap file
                  /windows/argyle.bmp: WINDOWS bitmap file
                /windows/artgalry.ini: WINDOWS initialization file
                 /windows/artview.ini: WINDOWS initialization file
                 /windows/artview.scr: WINDOWS Screen Saver file
                  /windows/atikey.dll: WINDOWS Dynamic Link Library file
                  /windows/atikey.exe: Executable program file
                /windows/atomtime.ini: WINDOWS initialization file
                  /windows/attend.ini: WINDOWS initialization file
                /windows/audiosta.ini: WINDOWS initialization file
                /windows/autotext.sig: General Data file
                   /windows/awcas.dll: WINDOWS Dynamic Link Library file
                /windows/awclass1.dll: WINDOWS Dynamic Link Library file
                /windows/awclass2.dll: WINDOWS Dynamic Link Library file
                 /windows/awfaxio.dll: WINDOWS Dynamic Link Library file
                /windows/awfxprot.dll: WINDOWS Dynamic Link Library file
                   /windows/awt30.dll: WINDOWS Dynamic Link Library file
                       /windows/b.pif: WINDOWS program information file
                           bosada.txt: General text file
                           bosbis.txt: General text file
                           UNIXDOS.bak: General Backup file
                           dosnix.eps: Encapsulated postscript file
                           dosnix.img: WINDOWS image file
                             grab.exe: Executable program file
                               hs.cfg: General configuration file
                               hs.dat: General data file
                             menu.eps: Encapsulated postscript file
                               vp.bat: DOS Batch file

       Notes:

       The UNIX FILE does not use the file extension - instead it actually
       scans the file contents to make a guess about the file type which will

       OB. Eichberger, Professional Software Solutions      Reference
       Manual (Version 3.0)      Page 113



       UNIX on DOS Toolkiit (UNXIDOS)
                        file (Determine file type)

       always remain a guess.
       That's why the UNIXDOS  FILE uses the extension which is faster and
       more reliable.




















































       OB. Eichberger, Professional Software Solutions      Reference
       Manual (Version 3.0)      Page 114



       UNIX on DOS Toolkiit (UNXIDOS)
              filename (Extract file name without extension)


       filename (Extract file name without extension)

       Syntax:

       filename [-d] [file(s)]
       -d       = display in DOS style (default UNIX style)
       file(s)  = the filename(s) to be converted
       If no 'file(s)' are specified filename will read STDIN and convert each
       line

       Description:

       FILENAME will extract the file name without the extension from the
       specified path(s).
       You can use the unix display style(default) or specify DOS style
       display (-d option).
       You can either specify one or more filenames on the command line or
       provide a list of filenames in STDIN if you dont specify any filename.

       Example1:

       filename c:\tmp/save/src.zip dir1/file.c U:\PARK\file3.txt

       Will show:
       src
       file
       file3

       Example2:

       filename -d c:\tmp/save/src.zip dir1/file.c U:\PARK\file3.txt

       Will show:
       SRC
       FILE
       FILE3

       Example3:

       To find out all filenames used on your machine enter:
       ufind / -type d -exec filename -d {} `
                                            `^'
                                               ' > file_.lst
       usort -u file_.lst  > file.lst












       OB. Eichberger, Professional Software Solutions      Reference
       Manual (Version 3.0)      Page 115



       UNIX on DOS Toolkiit (UNXIDOS)
                           (u)find (Find files)


       (u)find (Find files)
       Syntax:

       usage: ufind [directory or file(s)] [options]
       -name {regexp} = match files by expression: -name `*.c' (C source
       files)
       -newer/-older {ref} = match if newer/older than reference file {ref}
       -perm {perm}   = match files by permission: 444 read-only, 666:
       read/write)
       -size {[+|-]n[c|m]}  = match by file size:
                          +/-  = equal or larger/smaller than specified
                          n    = size in kilobytes (1024 bytes)
                          c/m  = size in bytes/megabytes
       -[a|c|m]time {n[m|h|y]} = match if modified within time frame
                          n    = number of 24 hour intervals (days)
                          m/h/y= minutes/hour/year intervals
       -type {d|f}     = match d=directory, f=plain file
       -exec {cmd}     = run 'cmd' for matches '{}' is replaced with filename
                         end with ';' or "^": -exec cp -l {} \dir ^ (copy
       files)
       -grep {regexp}  = match file contents by expresion
       -ls             = print full info of matching file or directory
       -ok {cmd}       = confirm operation for each file (if 'y' then like -
       exec)
       -print          = print just name of matching file or directory
       -level {l}      = files up to directory level {l} (root=0, main
       dir=1...)
       -o=OR,-a=AND,!=NOT: ( -name '*.c' -o -name '*.h ) show '*.c OR *.h
       find / -print (prints all files on your current drive)
       find / -exec cp -lv {} \dir; (calls 'cp -lv' for all files)

       Description:

       UFIND is an excellent tool to produce lists of filenames based an a
       certain criteria or run a program for each file found.
       Note that the filename search (-name) is case insensitive, but pattern
       searches (-grep ) are case sensitive!


       Name Search (-name), Show Filename (-print)

       To find all Batch(*.bat) files on your hard disk enter:
       ufind / -name `*.bat' -print

       Might show:
       /autoexec.bat
       /cvision/cvcopy.bat
       /cvision/cvset.bat
       /makeall.bat
       /msvc/bin/fsample.bat
       /msvc/bin/ftime.bat
       /msvc/bin/hc.bat
       /msvc/bin/lcount.bat

       OB. Eichberger, Professional Software Solutions      Reference
       Manual (Version 3.0)      Page 116



       UNIX on DOS Toolkiit (UNXIDOS)
                           (u)find (Find files)

       /msvc/bin/ltime.bat
       /msvc/bin/msvcvars.bat
       /msvc/mfc/samples/hiersvr/makehelp.bat
       /msvc/mfc/samples/mksample.bat
       /msvc/mfc/samples/oclient/makehelp.bat
       /msvc/mfc/samples/scribble/step6/makehelp.bat
       /msvc/mfc/samples/scribble/step7/makehelp.bat
       In this example we instructed UFIND to use only the root directory (/)
       and descend down from there, use the regular expression (*.bat) to
       select files based on the name (-name) and print the just filename (-
       print) - the (-ls) option allows to also show the file details (size,
       date, etc.)











































       OB. Eichberger, Professional Software Solutions      Reference
       Manual (Version 3.0)      Page 117



       UNIX on DOS Toolkiit (UNXIDOS)
                           (u)find (Find files)

       Advanced Name Search (-name) with regular expression

       To find all `*.cpp' files with have the letter `m' in their filename:
       Example: `
                `/mydir/aamaa.cpp'
                                  ' but not `
                                             `/mydir/aabb.cpp'
                                                              '


       ufind / -name '*/*m[^/]\*.cpp' -print

       Note the escaped `*' after [^/] to enforce repetition of that pattern
       instead of default `.'

       Show all file details (-list)

       To show find files in your /WINDOWS and /DOS direcpries enter:
       ufind /dos /windows -ls

       Might show:
       -rw-rw-rw-     6404 Nov 11  1991 /dos/4201.cpi
       -rw-rw-rw-      720 Nov 11  1991 /dos/4208.cpi
       -rw-rw-rw-      395 Nov 11  1991 /dos/5202.cpi
       -rw-rw-rw-     9065 May 31  1994 /dos/ansi.sys
       -rwxrwxrwx    10774 May 31  1994 /dos/append.exe
       -rw-rw-rw-     8369 Nov 11  1991 /dos/appnotes.txt
       -rwxrwxrwx     6399 Nov 11  1991 /dos/assign.com
       -rwxrwxrwx    11208 May 31  1994 /dos/attrib.exe
       -rwxrwxrwx    12241 May 31  1994 /dos/chkdsk.exe
       ...
       -rw-rw-rw-      545 Apr 19  1993 /windows/_default.pif
       -rw-rw-rw-    14867 Sep 30 17:54 /windows/accessor.grp
       -rw-rw-rw-     5408 Sep 04 17:18 /windows/apstudio.ini
       ...
       -rw-rw-rw-     1312 Jan 07  1994 /windows/system/alger.fot
       -rw-rw-rw-    69496 Apr 21  1993 /windows/system/alger.ttf
       -rw-rw-rw-    99888 Mar 25  1994 /windows/system/anibuton.vbx
       -rw-rw-rw-      440 May 15  1993 /windows/system/antqua.fif
       -rw-rw-rw-     1320 May 13 16:58 /windows/system/antqua.fot
       -rw-rw-rw-    59776 Aug 16  1994 /windows/system/antqua.ttf
       ...
       -rw-rw-rw-     3679 Sep 30 17:44 /windows/system.ini
       -rwxrwxrwx    10774 May 26  1995 /windows/system32/append.exe
       -rwxrwxrwx    24640 May 26  1995 /windows/system32/attrib.exe
       -rw-rw-rw-     1453 Aug 19 09:43 /windows/system32/autoexec.nt
       -rwxrwxrwx    36092 May 26  1995 /windows/system32/backup.exe
       -rw-rw-rw-    43520 May 26  1995 /windows/system32/backup.fts
       -rw-rw-rw-    59555 May 26  1995 /windows/system32/backup.hlp
       -rw-rw-rw-    11904 May 26  1995 /windows/system32/banana.ani
       ...
       -rw-rw-rw-   338208 Jun 03  1980
       /windows/system32/spool/drivers/w32x86/hppcl5ms.dll
       -rw-rw-rw-    72976 Jun 03  1980
       /windows/system32/spool/drivers/w32x86/rasdd.dll
       ...
       drwxrwxrwx        0 May 10 16:23 /windows


       OB. Eichberger, Professional Software Solutions      Reference
       Manual (Version 3.0)      Page 118



       UNIX on DOS Toolkiit (UNXIDOS)
                           (u)find (Find files)

       In this example you can see how UFIND only uses the specified
       directories (/DOS) and (/WINDOWS) and then descends into all
       subdirectories in alphabetic order (unlike UNIX/MKS!).
       The (-ls) option show the file details in LS style (see `
                                                               `LS'
                                                                   ').



















































       OB. Eichberger, Professional Software Solutions      Reference
       Manual (Version 3.0)      Page 119



       UNIX on DOS Toolkiit (UNXIDOS)
                           (u)find (Find files)

       Find files after/before a certain date and time point (-newer/-older/-

       NEWER/-OLDER)

       This option allows you to search for files based on a certain time
       point.
       You need one `
                    `reference file'
                                    ' as a time reference.
       The following options are available:
       . -newer       after reference file
       . -NEWER       after of equal to reference file
       . -older       before reference file
       . -OLDER       before of equal to reference file

       In this example we first create a `
                                         `reference file'
                                                         ' named `
                                                                  `/ref'
                                                                        ' with
       a time stamp for Sept 18, of the current year with a time of 12:00
       noon:
       touch 09181200 /ref

       Just to verify that this new files exists we enter:
       ls -l /ref
       And should see:
       -rw-rw-rw-      0 Sep 18 12:00 /ref

       Now we can instruct UFIND to use your `
                                             `reference file'
                                                             ' (/ref) and
       find all files which are newer (or have the same time) and show all
       file details (-ls):
       ufind / -NEWER /ref -ls


       Find files/directories up to a specified level/depth (-level)

       This option allows you to limit the search to a particular depth of
       files and directories.
       The root directory has level 0, the main directories and files  in the
       root directory have level 1 and so forth.

       To find all the main directories in your root directory enter:
       ufind / -type d -level 1 -print

       Might display:
       /dos
       /msoffice
       /msvc
       /windows
       ...










       OB. Eichberger, Professional Software Solutions      Reference
       Manual (Version 3.0)      Page 120



       UNIX on DOS Toolkiit (UNXIDOS)
                           (u)find (Find files)

       Find files within a time frame from now (-time)

       This option allows you to search for files based on a specified age
       relative to the current time.
       The following specify the interval in the following units:
       . years        {n}y
       . days         {n}  (default)
       . hours        {n}h
       . minutes      {n}m

       In the following example we show all files created or changed within
       the last 10 hours:
       ufind / -time 10h -ls

       You can use the negation to invert the time frame.
       In this example we show all files which are older than 3 years :
       ufind / '!' -time 3y -ls
       Note the single quotes around ! to avoid argument expansion.

       Copy all files with confirmation which have been modified in the last
       week (7 days):
       ufind / -time 7 -ok cp -lv {} \week ;

       Find files of a certain size (-size)

       This option allows you to search for files based on their file size.
       You can specify larger `
                              `+{val}'
                                      ' or smaller than `
                                                         `-{val}'
                                                                 '.
       You can specify the threshold file size in the following increments:
       . 1k blocks (1,024 bytes) (default)     -50       = less than 51,200
         bytes
       . megabytes                   +2m       = more than 2,000,000 bytes
       . bytes                       -180000c  = less than 180,000 bytes

       In this example we look for all files on your entire hard disk which
       are larger than one megabyte (1,000,000 bytes):
       ufind / -size +1m -ls

       Might show:
       -rw-rw-rw-  1281701 Oct 07 15:37 /all.lst
       -rw-rw-rw-  4325728 Aug 16  1994 /msoffice/access/msacc20.hlp
       -rw-rw-rw-  1326516 Aug 16  1994 /msoffice/access/msaccess.cue
       -rwxrwxrwx  1909024 Aug 16  1994 /msoffice/access/msaccess.exe
       -rw-rw-rw-  2097152 Oct 07 14:17 /msoffice/access/wzfrmrpt.mda
       -rwxrwxrwx  4246784 Aug 16  1994 /msoffice/excel/excel.exe
       -rw-rw-rw-  2992100 Aug 16  1994 /msoffice/excel/mainxl.hlp
       -rwxrwxrwx  3490816 Aug 16  1994 /msoffice/winword/winword.exe
       -rw-rw-rw-  2006714 Aug 16  1994 /msoffice/winword/winword.hlp
       -rw-rw-rw-  1895620 Sep 16  1994 /msvc/bin/vb.hlp
       -rw-rw-rw-  2738544 Jan 13  1995 /msvc/help/mfc.hlp
       -rw-rw-rw-  1578988 Sep 16  1994 /msvc/help/vcbks15.hdx
       -rw-rw-rw- 20322482 Sep 16  1994 /msvc/help/vcbks15.hlp
       -rw-rw-rw- 15581184 Sep 16  1994 /msvc/help/vcbks15.ind
       -rw-rw-rw- 16610031 Sep 16  1994 /msvc/help/vcsdk15.hlp
       -rw-rw-rw-  3386753 Sep 16  1994 /msvc/help/win31wh.hlp

       OB. Eichberger, Professional Software Solutions      Reference
       Manual (Version 3.0)      Page 121



       UNIX on DOS Toolkiit (UNXIDOS)
                           (u)find (Find files)

       -rw-rw-rw-  1505064 Feb 08  1993 /windows/system/mfc200d.dll
       -r--r--r--  1914140 Sep 09 04:57 /windows/system/mfc250d.dll
       -rw-rw-rw- 20971520 Sep 30 17:46 /windows/win386.swp




















































       OB. Eichberger, Professional Software Solutions      Reference
       Manual (Version 3.0)      Page 122



       UNIX on DOS Toolkiit (UNXIDOS)
                           (u)find (Find files)

       Execute a program for each file found (-exec and -ok)

       This option allows you to run a program on each file found in the
       search.
       The filename is refered to by the symbol: `
                                                 `{}'
                                                     '
       The `
           `-exec'
                  ' option will execute without prompting, while the `
                                                                      `-ok'
                                                                           '
       will prompt you before executing the program for each file.

       In this example we will produce a cleanup procedure which removes all
       temporary files (*.tmp) from the system. We search for all files with
       the extension `
                     `*.tmp'
                            ' and execute the UNIXDOS RM utility `
                                                                  `rm'
                                                                      ' with
       the force and list options `
                                  `-lf'
                                       '. The current filename is refered to
       by `
          `{}'
              '. The constructed command line has to be terminated with the
       `
       `;'
          ' (or `
                 `^'
                    ') character:
       ufind / -name '*.tmp' -exec rm -lf {} ;

       Might show:
       /src/x1.tmp
       /roma/rfapps/x1.tmp
       /roma/rmbase/x1.tmp
       /roma/rmmgr/x1.tmp
       /roma/src.tmp
       /src/mail.tmp
       /stdtools/mail.tmp
       /temp/mail.tmp
       /temp/pwd.tmp
       /temp/src_get.tmp
       /temp/~df148a.tmp
       /temp/~df148c.tmp
       /temp/~df148d.tmp
       /temp/~df148e.tmp
       /temp/~df1529.tmp
       /temp/~wrf0000.tmp
       /temp/~wrs0004.tmp

       To run the same program but with confirmation prompts enter:
       ufind / -name '*.tmp' -ok rm -lf {} ;

       Might show:
       < rm -lf /madhur/doc/~wrl0003.tmp  >? n
       < rm -lf /temp/~df148a.tmp  >? y
       /temp/~df148a.tmp
       < rm -lf /temp/~df148c.tmp  >? n
       < rm -lf /temp/~df148d.tmp  >? n
       < rm -lf /temp/~df148e.tmp  >? y
       /temp/~df148e.tmp
       < rm -lf /temp/~df1529.tmp  >? n
       < rm -lf /temp/~wrf0000.tmp  >? n
       < rm -lf /temp/~wrf0001.tmp  >? n
       < rm -lf /temp/~wrs0004.tmp  >? n





       OB. Eichberger, Professional Software Solutions      Reference
       Manual (Version 3.0)      Page 123



       UNIX on DOS Toolkiit (UNXIDOS)
                           (u)find (Find files)

       Find files with specified pattern/regular expression (-grep)

       This option allows you to search for a specific pattern within each
       selected file and display hits. You could also run UNIXDOS GREP using
       the `
           `-exec'
                  ' option, but the internal grep facility withing UFIND is
       obviously much faster!

       In this example we will search for the pattern `
                                                      `EGREP'
                                                             ' in all
       documents (*.doc) in the machine:
       ufind / -name `*.doc' -grep EGREP

       Might show:
       /madhur/doc/ud_ref.doc: EGREP: can search for several expressions in
       the specified
       /madhur/doc/ud_ref.doc: EGREP/FGREP/GREP will exit with the following
       exit status:
       /madhur/doc/ud_ref.doc: To search for EGREP in all word documents
       enter:
       /madhur/doc/ud_ref.doc: grep -d EGREP *.doc
       /madhur/doc/ud_ref.doc: ufind / -name `
                                             `*.doc'
                                                    ' -grep EGREP
       /madhur/doc/~wrl0390.tmp: EGREP belongs to the following family of
       ogrepo utilities:
       /madhur/doc/~wrl0390.tmp: EGREP/FGREP/GREP will exit with the following
       exit status:
       /madhur/doc/~wrl0390.tmp: If you only want to know specifically how
       many matches occured within each file, but not actually see all the
       matches this option allows you instruct EGREP/FGREP/GREP to provide
       this information
       /madhur/doc/~wrl0390.tmp: The UNIX EGREP cannot handle lines longer
       than 1024 bytes
       /madhur/doc/~wrl0390.tmp: See the EGREP pages for more details.
       /madhur/src/src_ud.zip: UD/UNIX/EGREP.LST
       /madhur/src/src_ud.zip: UD/UNIX/EGREP.CP^A^B^T
       /madhur/src/ud/pub/ud_ref.doc: See EGREP.
       /madhur/src/ud/unix/egrep.mak: CEGREP = cl
       /madhur/src/ud/unix/egrep.mak: FIRSTC = EGREP.C
       /temp/~df152c.tmp: ufind / -name "*.doc" -grep EGREP

       Find only directories or plain files (-type)

       This option allows you to search for directories or only for plain
       files.

       In this example we will search for the directories in the `
                                                                 `/DOS'
                                                                       ' and
       `
       `/WINDOWS'
                 ' directories:
       ufind /dos /windwos -type -d -print

       Might show:
       /dos
       /windows/msapps/msgraph
       /windows/msapps/msquery
       /windows/msapps
       /windows/msmail/msmail
       /windows/msmail

       OB. Eichberger, Professional Software Solutions      Reference
       Manual (Version 3.0)      Page 124



       UNIX on DOS Toolkiit (UNXIDOS)
                           (u)find (Find files)

       /windows/repair
       /windows/system
       /windows/system32/config
       /windows/system32/drivers/etc
       /windows/system32/drivers
       /windows/system32/spool/drivers/w32x86/1
       /windows/system32/spool/drivers/w32x86
       /windows/system32/spool/drivers
       /windows/system32/spool/printers
       /windows/system32/spool/tmp
       /windows/system32/spool
       /windows/system32
       /windows/temp
       /windows

       Find all read-only or read-write files (-perm)

       This option allows you to search for files with a particular permision
       value:
       . read-only files   -perm 444
       . read/write files  -perm 666

       This might be helpful if you work in an environment where you are
       checking out individual work files from a central archive depository.
       Once you have `
                     `checked out'
                                  ' a file it becomes read/writable so that
       you can make changes - otherwise the files are read/only.

       In this example we will search for all C files which are read-only
       ufind /src ( -name `*.cpp' -o -name `*.hpp' ) -perm 444 -ls

       Might show:
       -r--r--r--    14099 Oct 04 10:37 /src/dbapps/cfuncs.cpp
       -r--r--r--     2346 Aug 13 15:58 /src/dbapps/cfuncs.hpp
       -r--r--r--     3348 Jun 19 15:26 /src/dbapps/dbapinit.cpp
       -r--r--r--      293 Aug 15  1994 /src/dbapps/dbapinit.hpp
       -r--r--r--    42901 Apr 10  1996 /src/dbapps/dbexpedt.cpp
       -r--r--r--    21007 Jan 08  1996 /src/dbapps/dbexpedt.hpp
       -r--r--r--      520 Jul 14  1994 /src/dbapps/gendefs.h
       -r--r--r--    11195 Feb 09  1996 /src/rfapps/tangrsrl.cpp
       -r--r--r--     3053 Feb 09  1996 /src/rfapps/tangrsrl.hpp
       -r--r--r--    29929 Jul 13 11:03 /src/rmbase/dbcalc.cpp
       -r--r--r--    13068 Jul 13 11:05 /src/rmbase/dbcalc.hpp
       -r--r--r--     2340 Jul 13 11:02 /src/rmbase/dbcavg.cpp
       -r--r--r--     3326 Jul 13 11:05 /src/rmbase/dbcavg.hpp
       -r--r--r--     1584 Jul 13 11:03 /src/rmbase/dbccount.cpp
       -r--r--r--     2628 Jul 08 11:48 /src/rmbase/dbccount.hpp
       -r--r--r--     4360 Oct 04 12:02 /src/rmmgr/sax_main.hpp
       -r--r--r--      465 Mar 30  1995 /src/rmmgr/stdafx.h







       OB. Eichberger, Professional Software Solutions      Reference
       Manual (Version 3.0)      Page 125



       UNIX on DOS Toolkiit (UNXIDOS)
                           (u)find (Find files)

       Nesting search criteria (-a and -o and `
                                              `
                                               
                                               
                                                `
                                                 `
                                                 
                                                  
                                               (   and `
                                                        `
                                                        
                                                         
                                                         ))

       This option allows you to combine and nest several individual search
       items.
       The following two operators are available:
       . AND               -a
       . OR           -o
       . Start Group       (
       . End Group         )
       . Negate            `!'  (single quotes to avoid early argument
         expansion)

       In the following example we are searching for all C source files (*.c)
       or C header files (*.h) starting from the root directory `
                                                                `/'
                                                                   '. Then we
       start a group with the open parenthesis `
                                               `(`
                                                  ` and specify the first
       search criteria: -name `*.c', followed by the OR operator `
                                                                 `-o'
                                                                     ' and
       the second search criteria: -name `*.h'. Then we have to close the
       group with `
                  `)'
                     ' and to see the results we use the `
                                                          `-ls'
                                                               ' show all file
       details command:
       ufind / ( -name '*.c' -o -name '*.h' ) -ls

       (Note the single quotation marks in `*.c' and `*.h' to let UFIND doing
       the expansion instead of the default argument expasion process!)

       Might show:
       -rw-rw-rw-     8694 Oct 18  1994 /bchkw/demo/animate.c
       -rw-rw-rw-    22106 Oct 18  1994 /bchkw/demo/bitmap.c
       -rw-rw-rw-    15801 Oct 18  1994 /bchkw/demo/demo.c
       -rw-rw-rw-     3437 Oct 18  1994 /bchkw/demo/pre.c
       -rw-rw-rw-    17569 May 02  1995 /bchkw/test.c
       -rw-rw-rw-     1473 May 02  1995 /bchkw/test.h
       -rw-rw-rw-      260 Jun 06  1994 /cvision/demo.c
       -rw-rw-rw-    15116 May 25  1995 /cvision/hreport.c
       -rw-rw-rw-      169 Jan 09  1995 /cvision/lib-bcl.h
       -rw-rw-rw-     1824 Nov 04  1994 /cvision/show.c
       -rw-rw-rw-    32778 Mar 29  1994 /cwright/brief/brief.c
       -rw-rw-rw-     3076 Mar 29  1994 /cwright/brief/brief.h
       -rw-rw-rw-    14861 Mar 29  1994 /cwright/brief/briefini.c
       -rw-rw-rw-    28856 Mar 29  1994 /cwright/cua/cua.c
       -rw-rw-rw-    17783 Mar 29  1994 /cwright/cua/cuaini.c
       -rw-rw-rw-    36920 Mar 29  1994 /cwright/cwhelp/cwdata1.c
       -rw-rw-rw-    26027 Mar 29  1994 /cwright/cwhelp/cwdata2.c
       -rw-rw-rw-    10584 Mar 29  1994 /cwright/cwhelp/cwdata3.c
       -rw-rw-rw-    24431 Mar 29  1994 /cwright/cwhelp/cwhelp.c
       -rw-rw-rw-     2782 Mar 29  1994 /cwright/cwhelp/cwhelp.h
       -rw-rw-rw-    11307 Mar 29  1994 /cwright/cwhelp/cwhelpid.h

       To invert the last seach (all files except `*.c' and `*.h' files)
       enter:
       ufind / `!' ( -name '*.c' -o -name '*.h' ) -ls

       (Note the single quotation marks in `!', `*.c' and `*.h' to let UFIND
       doing the expansion instead of the default argument expasion process!)


       OB. Eichberger, Professional Software Solutions      Reference
       Manual (Version 3.0)      Page 126



       UNIX on DOS Toolkiit (UNXIDOS)
                getlines (Get range of lines from a file)

       Notes/Remarks:

       The following UNIXDOS UFIND features are not available under UNIX/MKS:
       . Search file contents for pattern (-grep option)
       . file  LS style display (-ls option) (only in Berkeley UNIX)
       . the megabyte qualifier for filesize search (-size option)
       the minute(m), hour(h) and year(y) qualifier for time searches (-time
       option)

       The following UNIX options do not apply to DOS:
       -type b/c/p/l/s, -links, -[no]user, -[no]group, -inum, -xdev



       getlines (Get range of lines from a file)

       Syntax:

       getlines {start} {end} {file}
       {start} = starting line number
       {end}   = ending   line number
       {file}  = file to read
       The errorlevel is 0 if lines are read, 1=if line out of range, 2=error

       Description:

       GETLINES allows you to extract the specified range of lines from a text
       file. This might be usefull when you have a very big file and want to
       extract a particular subset.
       To find specific line numbers use `
                                         `grep -n'
                                                  '.
       The exit code depdends on:
       . 0  lines(s) are in range
       . 1  line(s) are out of range
       . 2  other errors


       Example:

       In the following example we extract one line at a time from the list of
       files `
             `test_lst.txt'
                           ':
       x1.bat
       x2.bat
       x3.bat
       x4.bat
       cc.bat
       go.bat
       Here is the batch file performing this task using GETLINES to extract
       one lines and also to detemine if all lines have been read via the exit
       code 1 of EOF (see `
                          `test_lst.bat'
                                        '):
       @echo off
       set LINE=1
       set LST=test_lst.txt
       :LOOP


       OB. Eichberger, Professional Software Solutions      Reference
       Manual (Version 3.0)      Page 127



       UNIX on DOS Toolkiit (UNXIDOS)
                getlines (Get range of lines from a file)

           getlines %LINE% %LINE% %LST% > name.tmp

           if errorlevel 1 goto END

           call setenv "NAME=@name.tmp
           echo %LST% LINE %LINE% = %NAME%
           call setenv "LINE=`expr $LINE + 1`"
           goto LOOP

       :END
       del name.tmp

       Will show:
       test_lst.txt LINE 1 = x1.bat
       test_lst.txt LINE 2 = x2.bat
       test_lst.txt LINE 3 = x3.bat
       test_lst.txt LINE 4 = x4.bat
       test_lst.txt LINE 5 = cc.bat
       test_lst.txt LINE 6 = go.bat




































       OB. Eichberger, Professional Software Solutions      Reference
       Manual (Version 3.0)      Page 128



       UNIX on DOS Toolkiit (UNXIDOS)
              grep (Search files for one pattern/expression)


       grep (Search files for one pattern/expression)

       Syntax:

       grep [-abcdilnpsvwx] [-e {pattern}|{pattern}] {file(s)}
       -a      = always  : always show filename (even in a single file search)
       -b      = bytes   : show the byte offset in file of match
       -c      = count   : show only count of matches
       -d      = descend : search also descending subdirectories for 'file(s)
       -h      = hide    : dont show the filename
       -i      = ignore  : upper or lower case case
       -l      = list    : show only the filename on match
       -n      = number  : show line number of match
       -s      = suppress: dont show error messages
       -v      = inVert  : find all NON MATCHES
       -w      = Word    : find pattern as a word (no alphanumeric around
       match)
       -x      = eXact   : find only exact match on whole line
       -e {p}  = expr.   : search pattern {p} (only if {p} start with '-')
       pattern = text or regular expression to be matched
       NOTE: to disable the argument expansion use single quotes: grep '*.c'
       *.c
       file(s) = file(s) to be searched for match
       grep -d bak *.bat :search for 'bak' in all batch files also in sub
       directories
       grep -n -i abc *.c:search for 'abc' in '*.c' files, show line# and
       ignore case
       (Maximum line length is 10000 bytes)

       Description:

       This is a excellent tool for searching files for text matches.
       EGREP belongs to the following family of `
                                                `grep'
                                                      ' utilities:
       . EGREP: can search for several expressions in the specified files
       . FGREP: can search for several plain text items in the specified
         files
       . GREP: can search for one single expression in the specified files

       See the EGREP pages for more details.
       GREP is identical to EGREP except it can only search for one single
       expression.

       GREP will exit with the following exit status:

       0    Found match(es)
       1    Found no match
       2    Syntax error or inaccessible file







       OB. Eichberger, Professional Software Solutions      Reference
       Manual (Version 3.0)      Page 129



       UNIX on DOS Toolkiit (UNXIDOS)
              grep (Search files for one pattern/expression)

       Example1:

       Search for the pattern 'main' in all C source files in the current
       directory:
       grep main *.c

       Example2:

       Show only how many lines match the pattern '1044':
       grep -c 1044 numbers.lst

       Example3:

       Show only lines which start with 'main':
       grep  '^main' *.c

       Example4:

       Show the line number and ignore the case of pattern 'main' (can be
       Main,MAIN,main):
       grep -ni 'main' *.c

       Example5:

       Look for any line with a capital letter followed by a lower case
       letter:
       grep '[A-Z][a-z]*' *.c

       Example6:

       Show all lines which don't contain `
                                          `main'
                                                ':
       grep -v main *

       Example7:

       Look for all lines containing a '*' (escape special meaning of '*'):
       grep '\*' *.c

       Notes/Remarks:

       The UNIXDOS GREP will always display the filename with the '-a' while
       the UNIX GREP will show the filename only when you specify at least two
       filenames. If you want to see the filename with only one file you have
       to append '/dev/null' to fool GREP into thinking it is processing two
       files to display the filename which seems rather akward.

       The UNIX GREP cannot handle lines longer than 1024 bytes while the
       UNIXDOS GREP limit is 10,000 bytes.







       OB. Eichberger, Professional Software Solutions      Reference
       Manual (Version 3.0)      Page 130



       UNIX on DOS Toolkiit (UNXIDOS)
                    head (Display top lines of a file)


       head (Display top lines of a file)

       Syntax:

       head [-l] [-{n}] [file(s)]
       -{n}   = number of lines to be displayed (default is 10)
       -l     = list: preceed line with filename
       if no files are specified stdin is used
       (Maximum line length is 10000)

       Description:

       HEAD will show the first lines of all specified files (default is the
       first 10 lines).
       If no files are specified HEAD will use STDIN.
       Lines can be up to 10,000 bytes long.

       Examples:

       Display the first 4 lines of all C source files in the current
       directory:
       head -4 *.c

       Display also  the filenames:
       head -l -4 *.c

       Notes:

       The UNIX HEAD does not provide the list option (-l).

























       OB. Eichberger, Professional Software Solutions      Reference
       Manual (Version 3.0)      Page 131



       UNIX on DOS Toolkiit (UNXIDOS)
                       io (Input/output file areas)


       io (Input/output file areas)

       Syntax:

       io (Input/Output copy)
       usage: io {input} {output} {start} {length} [offset]
       input     = input file
       output    = output file
       start     = offset in input file (in bytes)
       length    = number of bytes to copy (in bytes)
       offset    = offset within output file before copying (in bytes)


       Description:

       IO allows you the extract from any file a particular area and "move" it
       to a new file to any position.

       Example:

       Extract the third megabyte from 'big1' and write to the output file
       'out' starting at offset 500,000:
       io big1 out 2000000 1000000 500000

       Remarks:

       This utility is a little easier to use than the "dd" "iseek/oseek/keep"
       command set.


























       OB. Eichberger, Professional Software Solutions      Reference
       Manual (Version 3.0)      Page 132



       UNIX on DOS Toolkiit (UNXIDOS)
         (u)join (Join two sorted text files via matching field)


       (u)join (Join two sorted text files via matching field)

       Syntax:

       ujoin [-a{f}] [-e{s}] [-j{f} {n}] [-t{c}] [-o {l}] {f1} {f2}
       -a{f}    = add   : show also lines of unpaired line in file {f}
                          f=1: in file1, f=2: in file2, f=3: in both files
       -e{s}    = empty : replace empty output fields with {s}
       -j{f}{n} = join  : Specify the joining field
                          (default is first field in both files):
                           -j1 f#    Set joining field in file1 to field 'f#'
                                     (1 is the first field)
                           -j2 f#    Set joining field in file2 to field 'f#'
                           -j fld    Set joining field in both files to 'f#'
       -t{c}    = tab   : use {c} as field separator (default is blank/tab)
                  (You can also specify the hex value of the character: -t\7C)
       -o {l}   = output: specify output fields and their sequence in {l}
                          {l} = {f}.{n} [{f}.{n}....]
                           f    file reference (1=file1, 2=file2)
                           n    field number (1 is the first field)
                          (first argument without leading number ends list)
       f1       = input file1 (if '-' use stdin)
       f2       = input file2
       {f}      = file number, 1=first file or 2=second file
       {n}      = field number, starting with 1

       Description:

       UJOIN will compare two sorted text files and join lines with the same
       "key". Each line contains one or more fields which are separated by the
       field separator. The '-t' option allows you to change this field
       separator from blank/TAB to any other character.

       UJOIN will use the first field in both files by default to determine if
       the line in the files match. You can specify different join fields with
       the '-j' option.

       UJOIN will print the common field, then the remaining fields in file1
       and then the remaining fields in file2. You can specify a different
       output field sequence using the '-o' option.

       If an output field is blank UJOIN will usually also print nothing for
       that field unless you specify a replacement string using the '-e'
       option.










       OB. Eichberger, Professional Software Solutions      Reference
       Manual (Version 3.0)      Page 133



       UNIX on DOS Toolkiit (UNXIDOS)
         (u)join (Join two sorted text files via matching field)

       Examples:

       File 'join1.txt' contains the sequence number, customer number and the
       name:
       1|101|SIM SMITH
       2|213|JOAN LEAPER
       3|224|TERRY COUPER
       4|224|

       File 'join2.txt' contains the customer number and the city:
       101|DENVER
       213|LOS ANGELES
       224|NEW YORK

       The following command will join the two files based on the customer
       number:
       ujoin -e (name) -o 1.2 1.3 1.1 2.2 -j1 2 -j2 1 -t\7c join1.txt
       join2.txt

       Will produce the following output:
       101|SIM SMITH|1|DENVER
       213|JOAN LEAPER|2|LOS ANGELES
       224|TERRY COUPER|3|NEW YORK
       224|(name)|4|NEW YORK

       The arguments in the example:
       -e (name)
       The 4th line in 'join1.txt' has no customer name - this option will
       insert '(name)' instead.

       -o 1.2 1.3 1.1 2.2
       Specifies the output fields:
       1.2  field2 in file1
       1.2  field3 in file1
       1.1  field1 in file1
       2.2  field2 in file2

       -j1 2
       specifies that field2 is the joining field in file1
       -j2 1
       specifies that field1 is the the joining field in file1
       -t\7c
       Replaces the field separator with the pipe '|'
       (Older DOS versions don't allow you to escape the pipe character, so
       here is an example of the hex character notation: 0x7C = '|')

       Example2:

       ujoin  -j1 2 -j2 1 -t\7c \u\join1.txt \u\join2.txt

       Will produce:
       101|1|SIM SMITH|DENVER
       213|2|JOAN LEAPER|LOS ANGELES
       224|3|TERRY COUPER|NEW YORK

       OB. Eichberger, Professional Software Solutions      Reference
       Manual (Version 3.0)      Page 134



       UNIX on DOS Toolkiit (UNXIDOS)
         (u)join (Join two sorted text files via matching field)

       224|4||NEW YORK
       Notice  the different field sequence and the missing name on line four.





















































       OB. Eichberger, Professional Software Solutions      Reference
       Manual (Version 3.0)      Page 135



       UNIX on DOS Toolkiit (UNXIDOS)
                 line (Read one line from user/keyboard)


       line (Read one line from user/keyboard)

       Syntax:

       line [-{l|u}]
       -l   = convert input to lower case
       -u   = convert input to upper case

       Description:

       LINE will read one line from the keyboard. By default it will display
       the input as it was entered on the screen and write it to STDOUT.

       The '-u' and '-l' will convert the letters accordingly.

       Example:

       Confirm deletion of all files in /tmp directory:
       ucd /tmp
       uecho "Delete all file in /tmp? (Y/N): \c"
       test "`line -u` ~= "Y" run: "rm -rfl *"

































       OB. Eichberger, Professional Software Solutions      Reference
       Manual (Version 3.0)      Page 136



       UNIX on DOS Toolkiit (UNXIDOS)
                             ls (List files)


       ls (List files)

       Syntax:

       ls [-CFRdelrstxy] [files]
       -C = COLUMN   : suppress multi column output
       -F =          : suppress '/' for diretories, '*' for programs
       -R = RECURSIVE: list also all subdirectories
       -d = DIRECTORY: show only directory detail NOT all files in it
       -e = EXTEND   : show filesize in extended format (30,764,678)
       -l = LONG     : show all file details:
                       {d|-}rwxrwxrwx {size} {date/time} name
                        d  directory
                        -  plain file
                        r  read permission
                        w  write permission
                        x  execute permission (only programs)
       -r = REVERSE  : reverse the current sort order
       -s = SIZE     : sort by file size (show 1k increments)
       -t = TIME     : sort by time
       -x = ACCROSS  : sort across lines instead of down the column
       -y = TYPE     : sort by file type/extension
       (If the output is redirected to a file LS automatically prints each
       file
       on a separate line: ls > lst.tmp
       (default sort is by filename)

       Description:

       LS will display details about the specified files or directories.
       LS will list all the files for specified directories.
       LS without any options will list all the files in the current directory
       sorted by name.

       Example1:

       List entire disk:
       ls -lR /

       Example2:

       Display files in current directory sorted by size:
       ls -s

       Example3:

       Display in reverse time order with long list:
       ls -ltr






       OB. Eichberger, Professional Software Solutions      Reference
       Manual (Version 3.0)      Page 137



       UNIX on DOS Toolkiit (UNXIDOS)
          mak2mk (Convert Visual C Makefile to UNIXDOS makefile)


       mak2mk (Convert Visual C Makefile to UNIXDOS makefile)

       Syntax:

       mak2mk (Convert Visual C makefile (*.mak) to UNIXDOS makefile (*.mk))
       usage: mak2mk [-c] {mak file}
       -c    = CLEANUP: remove also the error files (*.er*)

       Description:

       MAK2MK will convert the automatically generated Visual C makefile into
       the UNIXDOS makefile. The UNIXDOS makefile will use the CC front end
       (cc.bat/cc1/cc3) to compile your modules and catch the errors and
       warning into a separate error file.

       (see `
            `CC'
                ' documentation for details)

       Example:

       To convert a makefile (in this example `
                                              `llib.mak) enter:
       mak2mk llib.mak > llib.mk

       Now we use this UNIXDOS makefile (llib.mk) to compile the modules.
       It will use the UNIXDOS  CC front end so that the screen/output is not
       cluttered with compiler options intersperced with the disgnostics:
       nmake /nologo DEBUG=1 -f llib.mk

       The screen would now show something like:
               cc -c add_func.c                                 # LLIB
               cc -c bgetl.c                                    # LLIB
               cc -c bname_t.c                                  # LLIB
               cc -c bread.c                                    # LLIB
               cc -c bwrite.c                                   # LLIB
               cc -c chrchk.c                                   # LLIB
               cc -c cmp_file.c                                 # LLIB
               cc -c cntdel.c                                   # LLIB
               cc -c cntdeler.c                                 # LLIB
               cc -c crbe.c                                     # LLIB
               cc -c ctyp.c                                     # LLIB
               cc -c debfun.c                                   # LLIB
               cc -c dir.c                                      # LLIB
               cc -c do_arg.c                                   # LLIB
               cc -c dx_chdir.c                                 # LLIB
               cc -c dx_getdi.c                                 # LLIB
               cc -c fclose_.c                                  # LLIB
               cc -c fgetl.c                                    # LLIB
               cc -c fldcmp.c                                   # LLIB
               cc -c fn_cp.c                                    # LLIB
               cc -c fopen_.c                                   # LLIB
               cc -c get_fram.c                                 # LLIB
               cc -c get_free.c                                 # LLIB
               cc -c getopt.c                                   # LLIB


       OB. Eichberger, Professional Software Solutions      Reference
       Manual (Version 3.0)      Page 138



       UNIX on DOS Toolkiit (UNXIDOS)
          mak2mk (Convert Visual C Makefile to UNIXDOS makefile)

               cc -c get_fram.c                                 # LLIB
               cc -c get_free.c                                 # LLIB
               cc -c getopt.c                                   # LLIB
               cc -c getsize.c                                  # LLIB
       getsize.c(34) : warning C4101: 'NotUsed' : unreferenced local variable
       getsize.c(29) : error C2065: 'Error' : undeclared identifier
       getsize.c(29) : error C2146: syntax error : missing ';' before
       identifier 'here'
       getsize.c(30) : error C2065: 'here' : undeclared identifier
       getsize.c(30) : error C2143: syntax error : missing ';' before 'type'
       getsize.c(33) : error C2065: 'statbuf' : undeclared identifier
       getsize.c(33) : warning C4049: 'argument' : indirection to different
       types
       getsize.c(33) : error C2224: left of '.st_size' must have
       class/struct/union type
               cc -c htoi.c                                     # LLIB
               cc -c htol.c                                     # LLIB
               cc -c llib.c                                     # LLIB
               cc -c mem.c                                      # LLIB
               cc -c otol.c                                     # LLIB
               cc -c pk.c                                       # LLIB
               cc -c prin.c                                     # LLIB
       prin.c(50) : warning C4013: 'system' undefined; assuming extern
       returning int
               cc -c qsort_.c                                   # LLIB
               cc -c read.c                                     # LLIB
               cc -c regexp.c                                   # LLIB....

       Now you can easily spot diagnostics and see the module name.
       All diagnostics are also captured in the `
                                                `error C files'
                                                               ' (in this
       case `getsize.erc' and `prin.erc').
       To detect all the modules which compiled with errors or warnings enter:
       wc -nl *.erc

       The screen would now show something like:
             8 getsize.erc
             1 prin.erc
             9 TOTAL

















       OB. Eichberger, Professional Software Solutions      Reference
       Manual (Version 3.0)      Page 139



       UNIX on DOS Toolkiit (UNXIDOS)
                       M4 (Advanced Text Generator)


       M4 (Advanced Text Generator)

       Syntax:

       usage: m4 [-Bn] [-Dn=v] [-Hn] [-Sn] [-s] [-Tn] [-Un] [fn1 [fn2]...]
       fn    = input filename(s) (if none specified 'm4' will use STDIN)
       -Bn   = BLOCKSIZE: specify the block size (default = 4096)
       -Dn=v = DEFINE: define symbol 'n' to value 'v'
       -Hn   = HASH: set hash size to 'n' (default = 199)
       -Sn   = STACK: set stacksize to 'n' (default = 100)
       -s    = SOURCE: genrate '#line' directives to sync line to input
       -Tn   = TOKEN: set tokensize to 'n' (default = 512)
       -Un   = UNDEFINE: undefine symbol 'n'
       (If no files are specified M4 will use STDIN)

       Description:

       M4 is a hidden gem from the UNIX world and unfortunatelly often
       overlooked because the documentation is VERY sparse. I hope the
       following pages will open the world of M4 to you and making available
       to you one of the most powerfull command line text generators. M4 is
       very sophisticated text generator which allows you to generate any kind
       of structured text: You can create C source, C++ source, HTML scripts,
       serial letter, plain text files etc.

       You can enter M4 instructions from the command line but usually you
       will create a M4 script file first and then call M4 with the name(s) of
       all the script files. You could create a library of several set of you
       standard M4 function and then just pull them in on demand.
       First I will present a few examples and then you will find each M4
       command described in detail:

       Example1:

       Here is s small script defining a macro `
                                               `mymacro'
                                                        ' which just writes a
       fixed text and inserts a name (see `
                                          `ex1.m4'
                                                  '):
       define(mymacro,Now getting name: $1)
       mymacro
       mymacro(Name)
       mymacro(The Name)
       mymacro(First,Middle,Last)

       To run it enter:
       m4 ex1.m4

       The result is:
       Now getting name:
       Now getting name: Name
       Now getting name: The Name
       Now getting name: First




       OB. Eichberger, Professional Software Solutions      Reference
       Manual (Version 3.0)      Page 140



       UNIX on DOS Toolkiit (UNXIDOS)
                       M4 (Advanced Text Generator)

       You can see how M4 inserted at the `
                                          `$1'
                                              ' placeholder the first
       argument supplied when the `
                                  `mymacro'
                                           ' is called. The extra arguments
       on the last call mymacro(First,Middle,Last)
       are ignored.



















































       OB. Eichberger, Professional Software Solutions      Reference
       Manual (Version 3.0)      Page 141



       UNIX on DOS Toolkiit (UNXIDOS)
                       M4 (Advanced Text Generator)

       Example2:

       In the following script we introduce the argument counter `
                                                                 `$#'
                                                                     '. It
       has to be enclosed in the left and right single quotes so that it is
       not used as a literal text.
       I also introduce the use of an internal function
       `
       `substr(text,start,len)'
                               ' which extracts a sub-string `
                                                              `text'
                                                                    ' (the
       second name) starting at `
                                `start'
                                       ' (0 = first column) and extracting up
       to `
          `len'
               ' characters. In effect this script will print the supplied
       names with the only the initial extracted from the middle name.
       define(mymacro,Now I got `$#' names: $1 `substr($2,0,1)' $3)
       mymacro
       mymacro(Name)
       mymacro(The Name)
       mymacro(First,Middle,Last)
       mymacro(John,Fitzgerald,Kennedy)
       To run it enter:
       m4 ex2.m4

       The result is:
       Now I got 0 names:
       Now I got 1 names: Name
       Now I got 1 names: The Name
       Now I got 3 names: First M Last
       Now I got 3 names: John F Kennedy

       Example3:

       Now we will separate the previous script into the following two
       sections:
       . the macro definition section or library (file `
                                                        `ex3_lib.m4'
                                                                    ')
       define(mymacro,Now I got `$#' names: $1 `substr($2,0,1)' $3)
       . the application file (ex3_use.m4)
       mymacro
       mymacro(Name)
       mymacro(The Name)
       mymacro(First,Middle,Last)
       mymacro(John,Fitzgerald,Kennedy)
       To run it enter:
       m4 ex3_lib.m4 ex3_use.m4

       The result is again:
       Now I got 0 names:
       Now I got 1 names: Name
       Now I got 1 names: The Name
       Now I got 3 names: First M Last
       Now I got 3 names: John F Kennedy

       If you reverse the order M4 will not interpret the `
                                                          `mymacro'
                                                                   ' calls
       since they are not yet defined:
       m4 ex3_use.m4 ex3_lib.m4

       The result is again:
       mymacro

       OB. Eichberger, Professional Software Solutions      Reference
       Manual (Version 3.0)      Page 142



       UNIX on DOS Toolkiit (UNXIDOS)
                       M4 (Advanced Text Generator)

       mymacro(Name)
       mymacro(The Name)
       mymacro(First,Middle,Last)
       mymacro(John,Fitzgerald,Kennedy)



















































       OB. Eichberger, Professional Software Solutions      Reference
       Manual (Version 3.0)      Page 143



       UNIX on DOS Toolkiit (UNXIDOS)
                       M4 (Advanced Text Generator)

       Example4:

       Now we will re-use the name macro calls in `
                                                  `ex3_use.m4'
                                                              ' and introduce
       another internal macro:
       ifelse(expr,val,true,false).
       expr expression to test
       val  value is the value to compare the result egainst
       true result to return if `
                                `expr = val'
                                            '
       false     result to return if `
                                     `expr != val'
                                                  '
       This demonstrates that to can NEST the macros. In this example the
       `
       `getmiddle'
                  ' macro is either returning nothing if the middle name does
       not exist or extracts the first character and appends a dot. This
       `
       `getmiddle'
                  ' macro is the called from out original `
                                                           `mymacro'
                                                                    ' (see
       `
       `ex4_lib.m4):
       define(getmiddle,`ifelse(len($1),0,,substr($1,0,1).)')
       define(mymacro,Now I got `$#' names: $1 `getmiddle($2)' $3)

       To run it enter:
       m4 ex4_lib.m4 ex3_use.m4

       The result is now:
       Now I got 0 names:
       Now I got 1 names: Name
       Now I got 1 names: The Name
       Now I got 3 names: First M. Last
       Now I got 3 names: John F. Kennedy





























       OB. Eichberger, Professional Software Solutions      Reference
       Manual (Version 3.0)      Page 144



       UNIX on DOS Toolkiit (UNXIDOS)
                       M4 (Advanced Text Generator)

       Example5 (Serial Letter):

       The following file (see `
                               `let_lib.m4'
                                           ') contains the framework for your
       serial letter:
       define(date,Aug 12th 1990)
       define(letter,
       $1
       $2
       $3
       $4
                                                                 date()
       Dear $5`,'

       Please find enclosed our new product line presentation.
       (your text...)

       Sincerely`,'

       Marketing Director
       (NEWPAGE)
       )
       The following file (see `
                               `let_use.m4'
                                           ') makes use of the frame work and
       creates two example serail letters:
       letter(XYZ Inc.,Attn: Mr. Green,PO BOX 12345,CITY CA 90010,John)
       letter(ABC Inc.,Attn: Mr. Blue,PO BOX 7890,CITY NY 10010,Jack)
       To generate the letter text enter:
       m4 let_lib.m4 let_use.m4
       Here is the output:
       XYZ Inc.
       Attn: Mr. Green
       PO BOX 12345
       CITY CA 90010
                                                                 Aug 12th 1990
       Dear John,

       Please find enclosed our new product line presentation.
       (your text...)

       Sincerely,

       Marketing Director
       (NEWPAGE)

       ABC Inc.
       Attn: Mr. Blue
       PO BOX 7890
       CITY NY 10010
                                                                 Aug 12th 1990
       Dear Jack,

       Please find enclosed our new product line presentation.
       (your text...)

       Sincerely,

       OB. Eichberger, Professional Software Solutions      Reference
       Manual (Version 3.0)      Page 145



       UNIX on DOS Toolkiit (UNXIDOS)
                       M4 (Advanced Text Generator)


       Marketing Director
       (NEWPAGE)




















































       OB. Eichberger, Professional Software Solutions      Reference
       Manual (Version 3.0)      Page 146



       UNIX on DOS Toolkiit (UNXIDOS)
                       M4 (Advanced Text Generator)

       changequote    (change the `
                                  `
                                   
                                   
                                   quote'
                                         '
                                         
                                          
                                           characters)

       Syntax: changequote([start,end])
       M4 allows you to `
                        `escape'
                                ' or `
                                      `quote'
                                             ' any text and prevent the normal
       interpretation.
       By default M4 will use the single left quote (`) to start the escaping
       and the single right quote (`) to end the escaping.
       The `
           `changequote'
                        ' command allows you to redefine these defaults with
       up to 5 character patterns each. If no arguments are given M4 will
       return to the default setting.

       In the following example (see `
                                     `changequ.m4'
                                                  ') we first escape the
       interpretation of the internal  `
                                       `len()'
                                              ' command by using the default
       single quotes:
       `len(abcd)'
       Then we redefine the quotes to `
                                      `~1~'
                                           ' to start and `
                                                           `~2~'
                                                                ' to end a
       quote:
       changequote(~1~,~2~)
       Then we call the internal `
                                 `len()'
                                        ' command again which will now be
       interpreted returning 4 (`
                                `abcd'
                                      ' is 4 characters long):
       `len(abcd)'
       Then we use the new quote patterns to esacape again the `
                                                               `len()'
                                                                      '
       command:
       ~1~len(abcd)~2~
       Here is the output:
       len(abcd)
       `4'
       len(abcd)

       changecom (change the `
                             `
                              
                              
                              comment'
                                      '
                                      
                                       
                                        character)

       Syntax: changecom([start[,end]])
       M4 allows you to include comments in the code and prevent the normal
       interpretation.
       By default M4 will use the hash (#) to start the comment and the new
       line (NL) to end the comment.
       The `
           `changecom'
                      ' command allows you to redefine these defaults with up
       to 5 character patterns each. If no arguments are given M4 will disable
       the commnet facility. If only one argument is given it will redefine
       the start pattern but leave the new line end pattern.
       In the following example (see `
                                     `changeco.m4'
                                                  ') we have the `
                                                                  `len()'
                                                                         '
       command with a comment. Then we change the comment pattern and so when
       we use the same line again we will see the comment in the output unless
       we use the new comment pattern:
       len(abcd) # this is just a comment
       changecom(~3~)
       len(abcd) # this is just a comment
       len(abcd) ~3~ this is just a comment
       Here is the output:
       4
       4 # this is just a comment
       4



       OB. Eichberger, Professional Software Solutions      Reference
       Manual (Version 3.0)      Page 147



       UNIX on DOS Toolkiit (UNXIDOS)
                       M4 (Advanced Text Generator)

       decr (decrement by 1)

       Syntax: decr(val)
       The `
           `decr()'
                   ' command will decrement the specified value by one (see
       `
       `decr.m4'
                '):
       decr(10)
       decr(decr(18))
       Here is the output:
       9
       16

       define (define a new macro)

       Syntax: define(name,value)
       The `
           `define()'
                     ' command is on of the essential commands and allows you
       to define new macros in M4. The `
                                       `name'
                                             ' argument is the new name for
       the macro and `
                     `value'
                            ' is the replacement text whenever the `
                                                                    `name'
                                                                          '
       macro is called. The following items have special meaning:
       $0   the name of the macro itself
       $1   the first argument
       $2   the second argument
       ..
       $9   the ninth argument (the arguments after 9 have to be accessed
       using shift)
       $*   all given arguments separated by commas
       $@   all given arguments separated by commas and enclosed in the
       current quotes
       $#   the number of given arguments

       In the following example we will define `
                                               `mymacro'
                                                        ' - call it a few
       times with different arguments , then `
                                             `undefine()'
                                                         ' it and define a
       new `
           `mymacro'
                    ' and call it once (see `
                                             `define.m4'
                                                        '):
       define(mymacro,macro value (name=``$0'', cnt=``$#'', 1=$1, 2=$2,
       all=$*))
       mymacro()
       mymacro(one)
       mymacro(1,2,3,4,5,6,7,8,9,10)
       mymacro(a,b,c,d,e,f,g,h,i,j)
       undefine(`mymacro')
       define(mymacro,something else(all=``$@''))
       mymacro(a,b,c,d,e,f,g,h,i,j)
       Here is the output:
       macro value (name=mymacro, cnt=1, 1=, 2=, all=)
       macro value (name=mymacro, cnt=1, 1=one, 2=, all=one)
       macro value (name=mymacro, cnt=10, 1=1, 2=2, all=1,2,3,4,5,6,7,8,9,10)
       macro value (name=mymacro, cnt=10, 1=a, 2=b, all=a,b,c,d,e,f,g,h,i,j)
       something else(all=`a',`b',`c',`d',`e',`f',`g',`h',`i',`j')








       OB. Eichberger, Professional Software Solutions      Reference
       Manual (Version 3.0)      Page 148



       UNIX on DOS Toolkiit (UNXIDOS)
                       M4 (Advanced Text Generator)

       defn (generate a quoted definition)

       Syntax: defn(name)
       The `
           `defn()'
                   ' command allows you to generate a quoted macro name.
       You might want to use this command to redefine the M4 macros if you
       need those words (like `
                              `len'
                                   ', or `
                                          `index'
                                                 ') in the generated text (see
       `
       `defn.m4'
                '):
       define(m4len,defn(`len'))
       define(m4dnl,defn(`dnl'))
       define(m4incr,defn(`incr'))
       define(m4decr,defn(`decr'))
       define(m4eval,defn(`eval'))
       define(m4index,defn(`index'))
       undefine(`len')
       undefine(`dnl')
       undefine(`incr')
       undefine(`decr')
       undefine(`eval')
       undefine(`index')
       len(abc)
       m4len(abc)
       Here is the output:
       len(abc)
       3
       divert (change from output stream)

       Syntax: divert([stream-number])
       The `
           `divert()'
                     ' command allows you to write your output to one of the
       10 output stream M4 maintains (numbered 0-9). By default M4 will write
       to output stream 0. Once the M4 script files is finished M4 will write
       the result in the following order: stream0, stream1... stream9.
       This allows you to enforce a certain sequence of output.
       In the following example (see `
                                     `divert.m4'
                                                ') we write to output 0, 2
       and 3 to demonstrate how M4 will re-arrange the output based on the
       output stream numbers:
       this is the regular output stream 0
       divert(3)
       this goes to stream 3
       divert(2)
       this goes to stream 2
       divert
       this is again the regular output
       Here is the output:
       this is the regular output stream 0
       this is again the regular output
       this goes to stream 2
       this goes to stream 3








       OB. Eichberger, Professional Software Solutions      Reference
       Manual (Version 3.0)      Page 149



       UNIX on DOS Toolkiit (UNXIDOS)
                       M4 (Advanced Text Generator)

       divnum (return current output stream number)

       Syntax: divnum
       The `
           `divnum()'
                     ' command returns the current output stream number (0-
       9).
       By default M4 will write to output stream 0. Once the M4 script files
       is finished M4 will write the result in the following order: stream0,
       stream1... stream9.
       In the following example (see `
                                     `divnum.m4'
                                                ') we change streams and call
       `
       `divnum()'
                 ':
       divnum
       this is the regular output stream 0
       divert(3)
       divnum
       this goes to stream 3
       divert(2)
       divnum
       this goes to stream 2
       divert
       divnum
       this is again the regular output
       Here is the output:
       0
       this is the regular output stream 0
       0
       this is again the regular output
       2
       this goes to stream 2
       3
       this goes to stream 3

       dumpdef (print current definitions)

       Syntax: dumpdef([macro])
       The `
           `dumpdef()'
                      ' command will show you all or the specified currently
       defined macros.
       Note that the output from `
                                 `dumpdef()'
                                            ' is written to the diagnostic
       output (stderr).
       To capture this output use the UNIXDOS utitily STDERR:
       stderr m4 dumpdef.m4 > diag.txt
       In the following example (see `
                                     `dumpdef.m4'
                                                 ') we define a macro and
       call `
            `dumpdef()'
                       ':
       Before:
       dumpdef(`testfunc')
       define(testfunc,this is a text)
       After:
       dumpdef(`testfunc')
       Here is the output:
       Before:
       After:
       testfunc:       this is a text




       OB. Eichberger, Professional Software Solutions      Reference
       Manual (Version 3.0)      Page 150



       UNIX on DOS Toolkiit (UNXIDOS)
                       M4 (Advanced Text Generator)

       errprint (print to the diagnostic output)

       Syntax: errprint(message)
       The `
           `errprint()'
                       ' command allows you to write to the the diagnostic
       output (stderr).
       To capture this output use the UNIXDOS unitily STDERR:
       stderr m4 errprint.m4 > diag.txt
       In the following example (see `
                                     `errprint.m4'
                                                  ') we write to call
       `
       `errprint()'
                   ':
       this is regular output
       errprint(this is an error message)
       To run this script enter:
       m4 errprint.m4 > out.txt
       Here is the output:
       this is an error message
       The regular output is in `
                                `out.txt'
                                         '

       eval (evaluate the arithmetic expression)t

       Syntax: eval(expression[,base[,length]])
       The `
           `eval()'
                   ' command allows you to calculate an integer arithmetic
       expression.
       `
       `base'
             ' defines the output base to be used (by default 10=decimal,
       8=octal, 16=hex, 2=binary).
       `
       `length'
               ' defines the minium number of digits to be used for the
       output.
       The following operators are available:
       +         add            -         substract
       *         multiply       /         divide
       %         modulo         ()        parenthesis
       |         bitwise OR          &         bitwise AND
       0xN       hex number          0N        octal number
       N         decimal number

       In the following example (see `
                                     `eval.m4'
                                              ') we call `
                                                          `eval()'
                                                                  ' to
       demonstate several operands:
       1 : CALCULATION eval(10*20 - 4*5)
       2 : NESTING     eval(incr(eval(10*20 - 4*5)) * 2)
       3 : MODULO      eval(10 % 4)
       4 : BITWISE AND eval(0xFF & 0x05)
       5 : BITWISE OR  eval(0x0F | 0x10)
       6 : OCTAL       eval(052)
       7 : HEX OUT     eval(100,16)
       8 : OCTAL OUT   eval(100,8)
       9 : BIT OUT     eval(100,2)
       10: OUT LENGTH  eval(100,10,6)

       Here is the output:
       1 : CALCULATION 180
       2 : NESTING     362
       3 : MODULO      2
       4 : BITWISE AND 5
       5 : BITWISE OR  31
       6 : OCTAL       42

       OB. Eichberger, Professional Software Solutions      Reference
       Manual (Version 3.0)      Page 151



       UNIX on DOS Toolkiit (UNXIDOS)
                       M4 (Advanced Text Generator)

       7 : HEX OUT     64
       8 : OCTAL OUT   144
       9 : BIT OUT     1100100
       10: OUT LENGTH  000100



















































       OB. Eichberger, Professional Software Solutions      Reference
       Manual (Version 3.0)      Page 152



       UNIX on DOS Toolkiit (UNXIDOS)
                       M4 (Advanced Text Generator)

       ifdef (check if macro defined)

       Syntax: ifdef(macro,yes[,no])
       The `
           `ifdef()'
                    ' command allows you check if a specified macro has bee
       defined.
       If it is defined the `
                            `yes'
                                 ' result is returned, otherwise `
                                                                  `no'
                                                                      ' (or
       nothing if `
                  `no'
                      ' not specified).
       The following example (see `
                                  `ifdef.m4'
                                            ') illustartes the point:
       ifdef(`mymacro',YES,NO)
       define(mymacro,macro value (name=``$0'', cnt=``$#'', 1=$1, 2=$2,
       all=$*))
       ifdef(`mymacro',YES,NO)
       mymacro()
       mymacro(one)
       mymacro(1,2,3,4,5,6,7,8,9,10)
       mymacro(a,b,c,d,e,f,g,h,i,j)
       undefine(`mymacro')
       ifdef(`mymacro',YES,NO)
       Here is the output:
       NO
       YES
       macro value (name=mymacro, cnt=1, 1=, 2=, all=)
       macro value (name=mymacro, cnt=1, 1=one, 2=, all=one)
       macro value (name=mymacro, cnt=10, 1=1, 2=2, all=1,2,3,4,5,6,7,8,9,10)
       macro value (name=mymacro, cnt=10, 1=a, 2=b, all=a,b,c,d,e,f,g,h,i,j)
       NO





























       OB. Eichberger, Professional Software Solutions      Reference
       Manual (Version 3.0)      Page 153



       UNIX on DOS Toolkiit (UNXIDOS)
                       M4 (Advanced Text Generator)

       ifelse (check for a condition)

       Syntax1: ifelse(string1,string2,same[,notsame])
       Syntax2: ifelse(string1,string2,same,string3,string4,same[,...])
       The `
           `ifelse()'
                     ' command allows you compare two string to check if they
       are equal.
       If they are equal the next argument is returned. If not then either the
       following argument is returned - or the next comparison starts
       (straing3 = string4) and so on...
       To check numeric values use the `
                                       `eval()'
                                               ' command.
       In the following example (see `
                                     `ifelse.m4'
                                                ') we define three macros:
       morethan10          check if the supplied argument is larger or equal
       10
       checkfora      checks if the starting letter of the given argument is
       an `
          `a'
             '
       mymacro        will check if the supplied argument is either equal to
       `
       `match'
              ' or
                      `
                      `alternative'
                                   '. If it is neither it return `
                                                                  `unknown'
                                                                           ':
       define(morethan10,$1 is `ifelse(substr(eval($1-10),0,1),-,smaller than
       10,10 or larger)')
       morethan10(9)
       morethan10(10)
       morethan10(11)
       define(checkfora,'$1' `ifelse(substr($1,0,1),a,starts with a,no
       starting a)')
       checkfora(a begin)
       checkfora(begin)
       checkfora()
       define(mymacro,`ifelse($1,match,found first match,$1,alternative,an
       alternative,
       unknown)')
       mymacro(match)
       mymacro(alternative)
       mymacro(blabla)

       Here is the output:
       9 is smaller than 10
       10 is 10 or larger
       11 is 10 or larger
       'a begin' starts with a
       'begin' no starting a
       '' no starting a
       found first match
       an alternative
       unknown










       OB. Eichberger, Professional Software Solutions      Reference
       Manual (Version 3.0)      Page 154



       UNIX on DOS Toolkiit (UNXIDOS)
                       M4 (Advanced Text Generator)

       include (include the contents of the specified file)

       Syntax: include(filename)
       The `
           `include()'
                      ' command allows you to include the entire contents of
       another file.
       You can use this to include files depending on other conditions.
       If the specified file does not exist `
                                            `include()'
                                                       ' will display an
       error message.
       The first file included contains the macro to check if the argument is
       a number (`
                 `isnum.m4'
                           '):
       define(ISNUM,`ifelse(substr(translit($1,-
       0123456789,~~~~~~~~~~~),0,1),~,1,0)')
       The other files being conditionally included are (`
                                                         `number.m4'
                                                                    '):
       handling numbers
       and (`
            `alpha.m4'
                      '):
       handling text
       In the following script (see `
                                    `include.m4'
                                                ') we first confirm that the
       ISNUM macro works and then
       include one of the files `
                                `number.m4'
                                           ' or `
                                                 `alpha.m4'
                                                           ' depending on the
       type of argument given:
       include(isnum.m4)
       ISNUM(18)
       ISNUM(abc)
       define(handleany,`ifelse(ISNUM($1),1,include(number.m4),include(alpha.m
       4))')
       handleany(18)
       handleany(abc)
       Here is the output:
       1
       0
       handling numbers

       handling text

       incr (increment by 1)

       Syntax: incr(val)
       The `
           `incr()'
                   ' command will increment the specified value by one (see
       `
       `incr.m4'
                '):
       incr(10)
       incr(incr(18))
       Here is the output:
       11
       20

       index (search for text)

       Syntax: index(text,search)
       The `
           `index()'
                    ' command allows you to search for a specific text.
       `
       `text'
             ' is the text to be scanned while `
                                                `search'
                                                        ' is the pattern to be
       found within `
                    `text'
                          '. If `
                                 `search'
                                         ' is found M4 will return a zero-
       based index of the position (otherwise -1).
       In the following example (see `
                                     `index.m4'
                                               ') we demonstrate a few cases:
       index(this is a text,is)

       OB. Eichberger, Professional Software Solutions      Reference
       Manual (Version 3.0)      Page 155



       UNIX on DOS Toolkiit (UNXIDOS)
                       M4 (Advanced Text Generator)

       index(this is a text,` is')
       index(this is a text,xxx)
       Here is the output:
       2
       4
       -1

















































       OB. Eichberger, Professional Software Solutions      Reference
       Manual (Version 3.0)      Page 156



       UNIX on DOS Toolkiit (UNXIDOS)
                       M4 (Advanced Text Generator)

       len (return the length)

       Syntax: len(text)
       The `
           `len()'
                  ' command will return the number of character in `
                                                                    `text'
                                                                          '.
       In the following example (see `
                                     `len.m4'
                                             ') we demonstrate a few cases:
       len()
       len(abc)

       Here is the output:
       0
       3

       maketemp (generate a unique temporary filename)

       Syntax: maketemp(name)
       The `
           `maketemp()'
                       ' command allows you to create unique filenames. The
       name has to contain a trailing pattern `
                                              `XXXXXX'
                                                      ' which will be
       replaced by the unique mark.
       In the following example (see `
                                     `maketemp.m4'
                                                  ') we add `
                                                             `aa'
                                                                 ' in front
       and the extension `
                         `.tmp'
                               ':
       write to: maketemp(aaXXXXXX).tmp
       Here is a possible output:
       write to: aa023330.tmp

       m4exit (immediate exit)

       Syntax: m4exit([exit code])
       The `
           `m4exit()'
                     ' command allows you immediatelly exit - for example on
       a fatal condition.
       In the following example (see `
                                     `m4exit.m4'
                                                ') we exit in the middle of
       the script'
                 ':
       this
       is
       m4exit(3)
       regular
       output

       Here is the output:
       this
       is

       m4wrap (specified macro will be executed on exit)

       Syntax: m4wrap(macro)
       The `
           `m4wrap()'
                     ' command allows you define a macro which will always be
       called before M4 terminates. This gives you an easy way to implement a
       cleanup macro:
       In the following example (see `
                                     `m4wrap.m4'
                                                ') we can see the cleanup
       kicking in automatically:
       define(cleanup,Now it is cleaning time)
       m4wrap(`cleanup')
       Regular output here

       Here is the output:

       OB. Eichberger, Professional Software Solutions      Reference
       Manual (Version 3.0)      Page 157



       UNIX on DOS Toolkiit (UNXIDOS)
                       M4 (Advanced Text Generator)

       Regular output here
       Now it is cleaning time





















































       OB. Eichberger, Professional Software Solutions      Reference
       Manual (Version 3.0)      Page 158



       UNIX on DOS Toolkiit (UNXIDOS)
                       M4 (Advanced Text Generator)

       popdef (remove the current `
                                  `
                                   
                                   
                                   define'
                                          '
                                          
                                           
                                            and make the previous one

       current)

       Syntax: popdef(macro)
       The `
           `popdef()'
                     ' command allows you make a previous definition of the
       specified macro again curremnt.
       In the following example (see `
                                     `popdef.m4'
                                                ') we push two definitions
       for `
           `mymacro'
                    ' on the stack and the call `
                                                 `popdef()'
                                                           ' to re-activate
       the first one:
       pushdef(mymacro,This is the first)
       mymacro
       pushdef(`mymacro',This is my second)
       mymacro
       popdef(`mymacro')
       mymacro
       (Note the quotes in the second `
                                      `pushdef()'
                                                 ' to escape the execution of
       `
       `mymacro()'
                  ')

       Here is the output:
       This is the first
       This is my second
       This is the first

       pushdef (push a new definition a new macro)

       Syntax: pushdef(macro,value)
       The `
           `pushdef()'
                      ' command allows you define a macro like `
                                                                `define()'
                                                                          ',
       but the previous macro definition is kept on a stack.
       In the following example (see `
                                     `pushdef.m4'
                                                 ') we push two definitions
       for `
           `mymacro'
                    ' on the stack and the call `
                                                 `popdef()'
                                                           ' to re-activate
       the first one:
       pushdef(mymacro,This is the first)
       mymacro
       pushdef(`mymacro',This is my second)
       mymacro
       popdef(`mymacro')
       mymacro
       (Note the quotes in the second `
                                      `pushdef()'
                                                 ' to escape the execution of
       `
       `mymacro()'
                  ')

       Here is the output:
       This is the first
       This is my second
       This is the first










       OB. Eichberger, Professional Software Solutions      Reference
       Manual (Version 3.0)      Page 159



       UNIX on DOS Toolkiit (UNXIDOS)
                       M4 (Advanced Text Generator)

       shift (shift arguments and quote them with comma separation)

       Syntax: shift(arguments)
       The `
           `shift()'
                    ' command allows you to extract all arguments shifted by
       one.
       In the following example (see `
                                     `shift.m4'
                                               ') we demonstrate `
                                                                  `shift()'
                                                                           ':
       shift(`a',`b',`c',`d')

       Here is the output:
       b,c,d



       sinclude (include the contents of the specified file)

       Syntax: sinclude(filename)
       The `
           `sinclude()'
                       ' command is identical to `
                                                  `include()'
                                                             ' except that is
       does NOT display an error message if the file is not found.

       substr (extract a substring)

       Syntax: substr(text,start[,len])
       The `
           `substr()'
                     ' command allows you to extract a sub string. The
       `
       `'
         'start'
                ' argument defines the begining column (zero-based) while
       `
       `len'
            ' defines the number of characters to extract from that point
       onwards. If `
                   `len'
                        ' is not specified `
                                            `substr()'
                                                      ' will extract until the
       end if the text.
       In the following example (see `
                                     `substr.m4'
                                                ') we demonstrate
       `
       `substr()'
                 ':
       substr(This is a text,5)
       substr(This is a text,5,4)

       Here is the output:
       is a text
       is a




















       OB. Eichberger, Professional Software Solutions      Reference
       Manual (Version 3.0)      Page 160



       UNIX on DOS Toolkiit (UNXIDOS)
                       M4 (Advanced Text Generator)

       syscmd (execute a system command)

       Syntax: syscmd(command)
       The `
           `syscmd()'
                     ' command allows you execute programs of batch files
       while in M4.
       In the following example (see `
                                     `syscmd.m4'
                                                ') we first define a `
                                                                      `runit'
                                                                             '
       macro which just executes the specified argument. Then we just run it
       on UNIXDOS utility `
                          `udate'
                                 '.
       Then we define the `
                          `getfiles()'
                                      ' macro which finds out how many files
       you have in the currenmt directory and writes the result into
       `
       `getfiles.tmp'
                     '.
       Then we just display a text with the result:
       define(cleanup,syscmd(rm -s x1.tmp x2.tmp x3.tmp getfiles.tmp))
       m4wrap(`cleanup')
       define(runit,`syscmd($1)')
       runit(udate)
       define(getfiles,
       runit(ls > x1.tmp)
       runit(wc -lt x1.tmp > x2.tmp)
       runit(cut -f1 x2.tmp > x3.tmp)
       runit(`uecho -s @x3.tmp '\c'' > getfiles.tmp)
       runit(rm x1.tmp x2.tmp))
       getfiles()
       This directory contains include(`getfiles'.tmp) files

       Here is a possible output:
       Tue Oct 29 18:16:17 1996
       This directory contains 53 files



























       OB. Eichberger, Professional Software Solutions      Reference
       Manual (Version 3.0)      Page 161



       UNIX on DOS Toolkiit (UNXIDOS)
                       M4 (Advanced Text Generator)

       traceon/traceoff (switch tracing on/off)

       Syntax: traceon|traceoff
       The `
           `traceon/traceoff()'
                               ' commands allow you to monitor the internal
       steps M4 is taking in processing your script. It is an excellent
       debugging tools to see how macros are expanded
       In the following example (see `
                                     `trace.m4'
                                               ') we first switch the trace
       facility on `
                   `traceon'
                            ' and then define a `
                                                 `cleanup'
                                                          ' macro. Then we
       define `
              `aamacro1()'
                          ' which calls in turn the lower level macros
       `
       `aamacro2/3'
                   '. Then we call macro `
                                          `aamacro1()'
                                                      '.
       Then we do the same process but first switch the trace of `
                                                                 `traceoff'
                                                                           '.
       Before we exit we switch the trace back on to demonstrate the automatic
       call to `
               `cleanup()'
                          ':
       traceon
       define(cleanup,doing the cleaning)
       m4wrap(`cleanup')
       define(aamacro3,bottom reached arg=$1)
       define(aamacro2,$1)
       define(aamacro1,aamacro2(aamacro3($1)))
       aamacro1(Trace is on)
       traceoff
       define(bbmacro3,bottom reached arg=$1)
       define(bbmacro2,$1)
       define(bbmacro1,bbmacro2(bbmacro3($1)))
       bbmacro1(Trace is off)
       traceon

       Here is the output:
       Trace(0): define(cleanup,doing the cleaning)
       Trace(0): m4wrap(cleanup)
       Trace(0): define(aamacro3,bottom reached arg=$1)
       Trace(0): define(aamacro2,$1)
       eTrace(2): aamacro3($1)
       eTrace(1): aamacro2(bottom reached arg=$1)
       eTrace(0): define(aamacro1,bottom reached arg=$1)
       Trace(0): aamacro1(Trace is on)
       bottom reached arg=Trace is on
       Trace(0): traceoff
       bottom reached arg=Trace is off
       Trace(0): cleanup
       doing the cleaning

       Note that the M4 trace facility is always showing you the level
       (0=base, 1=nesting level 1...) as it expands your definition.











       OB. Eichberger, Professional Software Solutions      Reference
       Manual (Version 3.0)      Page 162



       UNIX on DOS Toolkiit (UNXIDOS)
                       M4 (Advanced Text Generator)

       translit (translate characters)

       Syntax: translit(string,from-list,to-list)
       The `
           `translit()'
                       ' commands allows you to translate or convert a
       specific set of characters into another set. You can for example
       convert lower case letters to upper case.
       The `
           `string'
                   ' will be scanned and any character matching the `
                                                                     `from-
       list'
           ' will be translated into the corresponding character in the `
                                                                         `to-
       list'
           ' atthe same position. Any characters not found in the `
                                                                   `from-
       list'
           ' will be passed unchanged.

       In the following example (see `
                                     `translit.m4'
                                                  ') we first define a few
       macros:
       CAT       to concatinate up to three arguments into one text
       UP        to convert any text to upper case
       LOW       to convert any text to lower case
       FIRST          to extract the first letter in a text
       REST      to extract the text after the first letter
       NAME      to generate a name with the first letter in upper case, the
       rest in lower case
       ISNUM     to check if the input is a number(returns1) or a text
       (returns 0)
       ISNUMTXT  to give feedback about the type of input in text form

       Then we run a few examples:
       #-------------- concatinate function
       define(CAT,$1$2$3)
       #-------------- convert to upper case function
       define(UP,`translit($1,abcdefghijklmnopqrstuvwxyz,ABCDEFGHIJKLMNOPQRSTU
       VWXYZ)')
       #-------------- convert to lower case function
       define(LOW,`translit($1,ABCDEFGHIJKLMNOPQRSTUVWXYZ,abcdefghijklmnopqrst
       uvwxyz)')
       #-------------- extract first letter function
       define(FIRST,`substr($1,0,1)')
       #-------------- extract rest after the first letter function
       define(REST,`substr($1,1)')
       #-------------- Generate name with first letter capital rest lower case
       define(NAME,`CAT(UP(FIRST($1)),LOW(REST($1)))')
       #-------------- check if input is a number function
       define(ISNUM,`ifelse(substr(translit($1,-
       0123456789,~~~~~~~~~~~),0,1),~,1,0)')
       define(ISNUMTXT,'$1' is a `ifelse(ISNUM($1),1,number,text)')
       #-------------- applications
       ISNUMTXT(18)
       ISNUMTXT(text)
       UP(YourNameHere)
       LOW(YourNameHere)
       FIRST(YourNameHere)
       REST(YourNameHere)
       NAME(YourNameHere)

       Here is the output:
       '18' is a number

       OB. Eichberger, Professional Software Solutions      Reference
       Manual (Version 3.0)      Page 163



       UNIX on DOS Toolkiit (UNXIDOS)
                       M4 (Advanced Text Generator)

       'text' is a text
       YOURNAMEHERE
       yournamehere
       Y
       ourNameHere
       Yournamehere

















































       OB. Eichberger, Professional Software Solutions      Reference
       Manual (Version 3.0)      Page 164



       UNIX on DOS Toolkiit (UNXIDOS)
                       M4 (Advanced Text Generator)

       undefine (remove macro)

       Syntax: undefine(macro)
       The `
           `undefine()'
                       ' commands allows you to remove a macro definition
       permanently.
       This might be useful before you want to change the definition of an
       existing macro.
       In the following example (see `
                                     `undef.m4'
                                               ') we first define
       `
       `mymacro()'
                  ' and call it a few times. Then we remove the first
       definition and create second one:
       define(mymacro,first definition args=$*)
       mymacro()
       mymacro(one)
       mymacro(a,b,c,d,e,f,g,h,i,j)
       undefine(`mymacro')
       define(mymacro,second definition cnt=`$#')
       mymacro()
       mymacro(one)
       mymacro(a,b,c,d,e,f,g,h,i,j)

       Here is the output:
       first definition args=
       first definition args=one
       first definition args=a,b,c,d,e,f,g,h,i,j
       second definition cnt=1
       second definition cnt=1
       second definition cnt=10




























       OB. Eichberger, Professional Software Solutions      Reference
       Manual (Version 3.0)      Page 165



       UNIX on DOS Toolkiit (UNXIDOS)
                       M4 (Advanced Text Generator)

       Possible M4 Problems:

       If M4 find an error it will show you the file name where the error
       occured and the corresponding line number: m4: {filename}:{line number}
       {error message}
       m4: loop.m4:2 pushed back more than 4096 chars


       Infinite recursion:

       If you use the macro name within its definition M4 will go in an
       infinite loop.
       In the foolowing example (see `
                                     `loop.m4'
                                              ') we define the macro
       `
       `cleanup()'
                  ' but use the word cleanup within its definition:
       define(cleanup,Now it is cleanup time)
       cleanup()
       Here is the result:
       Now it is Now it is Now it is Now it is Now it is Now it is Now it is
       Now it is
       .....
       Now it is Now it is Now it is Now it is Now it is Now it is Now it is
       Now it is
       Now it is Now it is Now it is Now it is Now it is Now it is Now it is
       m4: loop.m4:2 pushed back more than 4096 chars
       cleanup()

       Missing escape:

       If you call a macro you might have to divert the expansion using the
       quote mechanism.
       In the following example (see `
                                     `quote.m4'
                                               ') we will define macro
       `
       `mymacro()'
                  ' and then undefine it and then try to define a new
       definition of it:
       define(mymacro,First definition)
       mymacro
       undefine(mymacro)
       define(mymacro,Second definition)
       mymacro

       Here is the result:
       First definition

       m4: quote.m4:5 bad macro name
       define(First definition,Second definition)

       The `
           `undefine()'
                       ' was not actually getting the macroname `
                                                                 `mymacro'
                                                                          '
       but its result (`
                       `First definition'
                                         '). To actually undefine the
       `
       `mymacro()'
                  ' use the quotes:
       undefine(`mymacro')

       Here is the result:
       First definition
       Second definition


       OB. Eichberger, Professional Software Solutions      Reference
       Manual (Version 3.0)      Page 166



       UNIX on DOS Toolkiit (UNXIDOS)
                       M4 (Advanced Text Generator)
























































       OB. Eichberger, Professional Software Solutions      Reference
       Manual (Version 3.0)      Page 167



       UNIX on DOS Toolkiit (UNXIDOS)
                       M4 (Advanced Text Generator)

       Using an existing macro name by mistake:

       In some cases you might need to use words which are already defined as
       internal or our own M4 macros.
       In the following example (see `
                                     `sysname.m4'
                                                 ') we will define macro
       `
       `mymacro()'
                  ' with system command names in it:
       define(mymacro,There is a shift in the DowJones index)
       mymacro
       Here is the (maybe surprizing) result:
       There has been a  in the DowJones -1

       To actually use those macro names place the double quotes around the
       names:
       define(mymacro,There has been a ``shift'' in the DowJones ``index'')
       Here is the result:
       There has been a shift in the DowJones index

       Using a comma within the definition:

       If you use a comma within your definition of the value M4 will stop
       processing and ignore the remaining text. To avoid this just enclose
       the comma in quotes.
       In the following example (see `
                                     `comma.m4'
                                               ') we will define macro
       `
       `date()'
               ':
       define(date,The date is Aug 12,1996)
       mymacro
       Here is the (maybe surprizing) result:
       The date is Aug 12

       To actually use commas within the definition place the quotes around
       the comma:
       define(mymacro,The date is Aug 12`,'1996)
       Here is the result:
       The date is Aug 12,1996





















       OB. Eichberger, Professional Software Solutions      Reference
       Manual (Version 3.0)      Page 168



       UNIX on DOS Toolkiit (UNXIDOS)
                          mf (Show free memory)


       mf (Show free memory)

       Syntax:

       mf

       Description:

       MF will display the free memory available in bytes.

       Example:

       mf

       Might show:
       542576 bytes free






































       OB. Eichberger, Professional Software Solutions      Reference
       Manual (Version 3.0)      Page 169



       UNIX on DOS Toolkiit (UNXIDOS)
                         mkdir (Make a directory)


       mkdir (Make a directory)

       Syntax:

       mkdir [-c] [-l] {directory name(s)}
       -c     : CHANGE: change to the last new directory
       -l     : LIST: show newly created directories

       Description:

       MKDIR  will create one or more directories specified on the command
       line.

       It is very similar to the DOS equivalent MD except that it can create
       several directories and that MKDIR can accept backward and forward
       slashes (e.g. \USR\SRC or /USR/SRC)

       If the directory name starts with '/' or '\' MKDIR will create a new
       directory in the root directory - independent of your current position.
       Otherwise MKDIR will create new subdirectories from your current
       position.

       Example1:

       Create a new directory and change directly to it:
       mkdir /mynewdir

       Will show:
       c:\MYNEWDIR

       Example2:

       Create a several new directories and list them:
       mkdir -l /tmp1 /tmp2 /tmp3

       Will show:
       Created directory: /tmp1
       Created directory: /tmp2
       Created directory: /tmp3















       OB. Eichberger, Professional Software Solutions      Reference
       Manual (Version 3.0)      Page 170



       UNIX on DOS Toolkiit (UNXIDOS)
                     (u)more (Browse thru text file)


       (u)more (Browse thru text file)

       Syntax:

       umore [-c{n}] [-t{n}] [-w] [file{s} ...]n
       -c{n}    = column: set column offset to 'n' (default is 0)
       -t{n}    = tab   : set tab increment to 'n' (default is 8)
       -w       = wrap  : don't wrap lines


       Description:

       UMORE will display the contents of a text file one screenful at a time.

       If a line is longer than the screen width UMORE will wrap onto the next
       line until the full line is displayed. You can switch the wrapping off
       (-w option) in which case UMORE will only display the first 80
       characters of a line. You can specify a different line offset with the
       -c{n} option in which case UMORE will display the next 80 characters
       from that offset onwards.

       Any TAB character is expanded to the next multiple of 8 columns unless
       you define a different TAB stop with the -t{n} option.

       If no file has been specified UMORE will use STDIN.

       Once a screen is displayed UMORE will display the following prompt:
       -- more -- (per = help) (17%)
       (where `
              `per'
                   ' is the percentage of the last line on the screen in
       relation to the entire file)
























       OB. Eichberger, Professional Software Solutions      Reference
       Manual (Version 3.0)      Page 171



       UNIX on DOS Toolkiit (UNXIDOS)
                     (u)more (Browse thru text file)

       Once the prompt is displayed UMORE will accept the following commands:
       SPACE BAR Display next screen
       -         Goto previous file (if several files specified)
       +         Goto  next file file (if several files specified)
       =         Display the current filename, line and total bytes
       /{pat}         Search for the next pattern or regular expression
                 (Example: /^[a-m] search for line starting with 'a' thru 'm')
       b         Backup to previous page displayed
       g{n}[c|l] Goto line 'n' in current file (trailing 'c' specifies byte
       offset)
                 After you hit the 'g' key UMORE will display the prompt:
                 Enter location: '
                 Example:
                 g100      goes to line number 100
                 g1010c    goes to byte offset 1010
                 If you specify a negative number UMORE will count from the
       end of the file:
                 g-50      goes to line which is 50 lines before the end
                 g-200c    goes to 200 bytes before the end of file
       h or ?         Display this help
       l         Display all the current files list in process and point to
       the current filename
       n         Repeat the pattern search and find the "next" hit
       q or CTRL-C    Quit
       v         Call the editor specified with the 'EDITOR' environment for
       the current file.
                 (If the 'EDITOR' environment is not set UMORE will call VI)
       !{cmd}         Run the command'{cmd}' (DOS gateway)
                 (Example: !udate   shows the current date/time)

       Examples:

       Display all C source file (one at a time):
       umore *.c

       Display only column 81 thru 160 without wrapping:
       umore -w -c80

       Notes:

       There are many variations of the MORE command since it is not part of
       the UNIX V standard.













       OB. Eichberger, Professional Software Solutions      Reference
       Manual (Version 3.0)      Page 172



       UNIX on DOS Toolkiit (UNXIDOS)
                        mv (Move or rename files)


       mv (Move or rename files)

       Syntax:

       mv (Move files: copy and remove)
       usage: mv [-{l|f|v}] {src} {dest}
       -f     = force : always remove old files (even if read-only)
       -l     = list  : show which file is currently copied
       -v     = verify: verify that input is identical to output
             (this only applies when the file had to be copied between drives)
       src    = source file(s)
       dest   = destination
                (has to be directory if several source files specified)

       Description:

       MV will move one or several files to the specified destination.

       The modification time and file modes are preserved.

       MV will first check if the source file exists and then remove the
       destination file. If that fails and the '-f' option has not been
       specified MV will abort the move of that file and continue with the
       next one (if any).
       MV will then use the rename function of DOS. If that fails (e.g. move
       between different drives) MV will copy the file and then remove the
       source file.

       Example:

       mv file1 file2
       Will move file1 to file2. If file2 exists already it will be
       overwritten.
       If file2 is read-only protected MV will show an error message.

       mv *.c \tmp
       Will move all C source files (extension '.c') into the directory '\tmp'
       and preserve all modification times and file modes. If '\tmp' is not a
       directory and there are several C source files MV will print an error
       message and not copy.

       mv file1 file1
       MV will print an error message because you tried to move a file onto
       itself.

       Notes/Remarks:

       The UNIX MV does not offer the '-l' list option and will not warn you
       when you move several files into one file instead of a directory.





       OB. Eichberger, Professional Software Solutions      Reference
       Manual (Version 3.0)      Page 173



       UNIX on DOS Toolkiit (UNXIDOS)
                        mvdir (Rename a directory)


       mvdir (Rename a directory)

       Syntax:

       usage: mvdir [-l] {old} {new}
       -l     = LIST: show which directory is currently moved
       old    = old directory (can be realtive or with leading \)
       new    = new directory (can be realtive or with leading \)


       Description:

       MVDIR will allow you to "rename" a directory. MVDIR will create the new
       directory and then descend thru the old directory and "move" all files
       and sub-directories.







































       OB. Eichberger, Professional Software Solutions      Reference
       Manual (Version 3.0)      Page 174



       UNIX on DOS Toolkiit (UNXIDOS)
                           nl (Line numbering)


       nl (Line numbering)

       Syntax:

       nl [-f] [-i{n}] [-n{f}] [-p] [-s{c}] [-v{n}] [-w{n}] {file(s)}
       List file with line numbers (separates files with a form-feed lines)
       -f     = filename  : Preceede the line with the filename
       -i {n} = increment : Set increment to 'n' (default is 1)
       -n {f} = number fmt: Set line number format:
                            rn    = right justified (default)     : '   1016'
                            ln    = left  justified               : '1016   '
                            rz    = right justified with leading 0: '0001016'
       -p     = no reset  : Do not reset the counter between files
       -s {c} = separator : Set separator after line number (deafault is TAB)
       -v {n} = start     : Set first line number to 'n' (default is 1)
       -w {n} = width     : Set witdh of line number to 'n' (default is 6)

       Description:

       NL will read lines from each specified file, attach a line number to
       the beginning and send the output to STDOUT. NL will reset the counters
       for each new file. NL will insert a blank line between each new file.

       Example:

       Print all C source files with '.   ' after the line number and include
       the filename:
       nl "-s. " -f *.c

       Print file 'fn' with a 10 digit counter starting at 1000 and leading
       zeros, increment is 10:
       nl -w10 -v1000 -nrz -i10 fn

       Notes:

       The following differences exist:
       UNIX NL can process only one file
       UNIX NL -s option accepts only a single character
       UNIX NL does not provide the -f option (print filename)
       UNIXDOS NL does not provide the special formating options:
       -b/-h/-f/-l/-d













       OB. Eichberger, Professional Software Solutions      Reference
       Manual (Version 3.0)      Page 175



       UNIX on DOS Toolkiit (UNXIDOS)
                od (Octal, hex, decimal, ascii file dump)


       od (Octal, hex, decimal, ascii file dump)

       Syntax:

       od [-cCbhmodxfsODXFS] [-v] [file] [+{o}[.[b]]]
       -b   octal byte display (3 digits per single byte)
       -m   decimal byte display (3 digits per single byte)
       -h   hex byte display ('x' and 2 digits per byte)
       -c   ASCII character display
            (all non-printable chars as '\ooo' octal code except: null=\0, 
            backspace=\b, formfeed=\f, newline=\n, return=\r, tab=\t,
       0377=\FF)
       -C   Extended ASCII character display
            (all non-printable chars as IBM graphics chars, rest as above)

       2 Byte Values (short):
       -o   2 byte octal value (always 6 digits with leading zeros)
       -d   2 byte unsigned decimal (up to 5 digits)
       -s   2 byte signed decimal (up to 5 digits with leading '-' if
       negative)
       -x   2 byte hex value ('0x' and 4 hex digits)

       4 Byte Values (long):
       -O   4 byte octal value (always 10 digits with leading zeros)
       -D   4 byte unsigned decimal (up to 9 digits)
       -S   4 byte signed decimal (up to 9 digits with leading '-' if
       negative)
       -X   4 byte hex value ('0x' and 8 hex digits)

       Floating point Values:
       -f   4 byte floating point value (6 digit precision: [-]n.nnnnnE[+|-
       ]ee)
       -F   8 byte floating point value (19 digit precision: [-
       ]n.nnnnnnnnnnnnnnnnnnE[+|-]eee)

       Other options:
       -v   Do not skip identical lines (default will skip)

       file
       specify the input file (if omitted use STDIN)

       +off[.[b|B]    offset:
                 Specify the offset within the 'file' and set the offset
       display type
                 (default is 7 digit octal display).
                 off. decimal offset and display (800. = offset at byte 800)
                 0xoff     hex offset display (0x1FF = offset at byte 511)
                 b    multiply 'off' by 512 bytes (small block)
                 B    multiply 'off' by 1024 bytes (large block)





       OB. Eichberger, Professional Software Solutions      Reference
       Manual (Version 3.0)      Page 176



       UNIX on DOS Toolkiit (UNXIDOS)
                od (Octal, hex, decimal, ascii file dump)

       Description:

       OD will display the contents of the specified 'file'. The first
       argument specifies the display format(s). If no format is given OD will
       use '-o' (2 byte octal display). If no file is given OD will use STDIN.
       OD will skip identical lines unless you specify the '-v' option.
       OD will start the display from the beginning of the file and display
       the offset value in 7 digit octal value at the beginning of the line
       unless you specify an offset. You can change the offset display type to
       decimal ('.' after the offset) or hex display ('0x' an front of the
       offset). To just change the offset display type but still start from
       the beginning of the file enter '+0.' for decimal or '+0x0' for hex

       If you specify more than one display format in the first argument OD
       will display the file contents always in the following sequence:
       Single Bytes first: b, m, x, c, C
       2 Bytes second:     o, d, s, x
       4 bytes third:      O, D, S, X
       Floating point last:     f, F
       (So it doesn't matter in which sequence you specify the formats!)

       Example:

       Display all formats of input file 'od.exe':
       od -bmxcCodsxODSXfF od.exe
       Will print:
       00000 115 132 200 000 147 000 016 000 040 000 274 001 377 377 250 015
       (byte octal)

             77  90 128   0 103   0  14   0  32   0 188   1 255 255 168  13
       (byte decimal)

            x4D x5A x80 x00 x67 x00 x0E x00 x20 x00 xBC x01 xFF xFF xA8 x0D
       (byte hex)

              M   Z 200  \0   g  \0 016  \0      \0 274 001 377 377 250  \r
       (byte ASCII)

              M   Z     \0   g  \0     \0      \0       \FF \FF   (  \r
       (byte Ext ASCII)

             055115  000200  000147  000016  000040  000674  177777  006650
       (2byte octal)

              23117     128     103      14      32     444   65535    3496
       (2byte uint)

              23117     128     103      14      32     444      -1    3496
       (2byte int)

             0x5A4D  0x0080  0x0067  0x000E  0x0020  0x01BC  0xFFFF  0x0DA8
       (2byte hex)



       OB. Eichberger, Professional Software Solutions      Reference
       Manual (Version 3.0)      Page 177



       UNIX on DOS Toolkiit (UNXIDOS)
                od (Octal, hex, decimal, ascii file dump)

                    8411725          917607        29098016       229179391 (4

       byte uint)

                    8411725          917607        29098016       229179391 (4

       byte int)

                   0x805A4D         0xE0067       0x1BC0020       0xDA8FFFF (4

       byte hex)

               1.17873E-038    1.28584E-039    6.90605E-038    1.04154E-030 (4

       byte float)

                  1.947158195916215000E-308       7.322733909935053000E-243 (8

       byte float)


       00020 270 013 261 241 252 105 000 000 036 000 000 000 001 000 205 105
            184  11 177 161 170  69   0   0  30   0   0   0   1   0 133  69
            xB8 x0B xB1 xA1 xAA x45 x00 x00 x1E x00 x00 x00 x01 x00 x85 x45
            270 013 261 241 252   E  \0  \0 036  \0  \0  \0 001  \0 205   E
              8      1   !   *   E  \0  \0     \0  \0  \0     \0      E
             005670  120661  042652  000000  000036  000000  000001  042605
               3000   41393   17834       0      30       0       1   17797
               3000  -24143   17834       0      30       0       1   17797
             0x0BB8  0xA1B1  0x45AA  0x0000  0x001E  0x0000  0x0001  0x4585
                 2712734648           17834              30      1166344193
                -1582232648           17834              30      1166344193
                 0xA1B10BB8          0x45AA            0x1E      0x45850001
              -1.19971E-018    2.49908E-041    4.20390E-044    4.25600E+003
                  3.784501320507053000E-310       8.123987410768453000E+026




















       OB. Eichberger, Professional Software Solutions      Reference
       Manual (Version 3.0)      Page 178



       UNIX on DOS Toolkiit (UNXIDOS)
                       paste (Merge lines of files)


       paste (Merge lines of files)

       Syntax:

       List files parallel (max 18 files):
       paste [-d{list}] file(s)
       -d{list} = delimiter list: define delimiter list (default TAB)
                  Once the list is used up paste will start again from
       beginning
                  The following special characters are available:
                  null=\0, backspace=\b, formfeed=\f, newline=\n,
                  return=\r, TAB=\t, \xNN=hex code NN

       List files fixed serial:
       paste -d{list}] - [- ...] < file

       List lines serial:
       usage: paste [-s] [-d{list}] [file(s)]
       -s    = serial: serial merging - all line on one new line

       Description:

       PASTE  will combine lines of several files.

       PASTE will use TAB character to separate each line unless you specify a
       new separating character with the '-d' option. If you specify several
       characters PASTE will cycle thru them and start again from the
       beginning once the last one is reached.


























       OB. Eichberger, Professional Software Solutions      Reference
       Manual (Version 3.0)      Page 179



       UNIX on DOS Toolkiit (UNXIDOS)
                       paste (Merge lines of files)

       The following modes are available:
       Parallel:

       Read all input files (up to 15) at the same time and paste each line of
       each file next to each other:
       line1/file1,line1/file2, line1/file3...
       line2/file1,line2/file2, line3/file3...
       ...

       Fixed serial:

       Read from STDIN and substitute each '-' on the command line with the
       next line read. Once all specified '-' are substituted PASTE will start
       a new line and start again substituting '-'.

       Serial:

       Read the specified file(s) and display all lines separated
       with the separation character. Once all lines are displayed PASTE
       will start a new line and read the next specified file until all files
       are read.

       Examples:

       File 'paste1.txt' contains:
       line1-file1
       line2-file2
       line3-file1

       File 'paste2.txt' contains:
       line1-file1
       line2-file2

       Merge files parallel:
       paste paste1.txt paste2.txt

       Output:
       line1-file1\tline1-file2
       line2-file1\tline2-file2
       line3-file1

       Merge serial with delimiter list (' ' and '\n') to combine line pairs:
       paste -s -d\x20\n paste1.txt paste2.txt

       Output:
       line1-file1   line2-file1
       line3-file1
       line1-file2   line2-file2

       List files in two columns separated by ',':
       ls | paste -d, - -

       Notes:


       OB. Eichberger, Professional Software Solutions      Reference
       Manual (Version 3.0)      Page 180



       UNIX on DOS Toolkiit (UNXIDOS)
                       paste (Merge lines of files)

       The UNIX PASTE is limited to max 12 parallel files and 511 bytes per
       output line while
       the UNIXDOS PASTE can handle 18 parallel files and 10,000 bytes per
       output line.



















































       OB. Eichberger, Professional Software Solutions      Reference
       Manual (Version 3.0)      Page 181



       UNIX on DOS Toolkiit (UNXIDOS)
                             pr (Print files)


       pr (Print files)

       Syntax:

       pr [options] {files}
       +{n}           begin page: Start printing at page 'n'
       -{n}      multi column: Print in 'n' column output:
                 Example:
                 The  of   text
                 lines     a    file
       -a        across: Switch to horizontal multi column style (with -{n}
       option):
                 The  lines     of
                 a    text file
       -d        double: double-space the output
       -e[c]{n}  expand: Set tab char to 'c' and spacing to 'n' (default TAB
       and 8)
       -f        form-feed: use form-feeds for new page instead of line-feeds
       -h  {h}        header: Use 'h' instead of filename for the page header
       -i[c]{n}       implode: Substitute blanks with 'c' and spacing set to
       'n'
                 (default  is TAB and spacing 8)
       -l{n}          page length: Set the page length (default is 66 lines)
       -m        merge: Print all files parallel (overwrites '-{n}' option):
                 lines     lines     lines
                 of   of   of
                 file1     file2     file3
       -n[c]{n}  number: Preceed each line with the line number of width 'n'
                      and insert 'c' after the number (default is width 5 and
       TAB)
       -o{n}          offset: Indent all lines with 'n' blank positions
       (default none)
       -p        pause: Pause after each printed page
       -r        report: Don't print error message if file does not exist or
       is empty
       -s{c}          separator: Separate columns by one single char 'c'
       instead of blanks
       -t        text: Just print the file text (no header, footer, trailer or
       form-feed)
       -w{n}          width: Set the line width to 'n' (deafult is 72 columns)
       [file(s)] File(s) to be used as input (if none are specified STDIN is
       used)

       Description:

       PR will print one or more files according to the 'options' on the
       comamnd line. By default the file is separated into pages. Each page
       contains  a header containing the date, filename and page name. If no
       files are given PR will use STDIN. If the input file contains the form-
       feed character '\f' PR will start a new page.

       PR writes the output to STDOUT. Use the redirection to send the output
       to the printer.

       OB. Eichberger, Professional Software Solutions      Reference
       Manual (Version 3.0)      Page 182



       UNIX on DOS Toolkiit (UNXIDOS)
                             pr (Print files)
























































       OB. Eichberger, Professional Software Solutions      Reference
       Manual (Version 3.0)      Page 183



       UNIX on DOS Toolkiit (UNXIDOS)
                             pr (Print files)

       Examples:

       Print all C source files on the printer:
       pr *.c >> prn

       Print  filelist one screen at a time:
       ls -l | pr -l24 -h "DIRECTORY LIST" | umore

       Print a condensed file list (6 rows) for the output 6x14 columns wide
       without header and sorted horizontally:
       ls | pr -6 -w `expr 6 x 14` -at | umore

       ls             Generate short list of files in current directory
       `expr 6 x 14`  run calculation 6 x 14 and take the result (78) as the
       width
                      argument for PR (6 columns and 14 characters wide,
                      filename is 8 characters long + '.' + file extension 3
       letters)
       pr -6 w 78 -at Print 6 columns '-6' with width 78 '-w 78' sorted
                      horizontally '-a' without header '-t'.
       umore          Display result one screen full at a time.

       Print alphabetical list of files (not directories) with file
       attribute/size/time
       and name horizontally sorted but no page header:
       ls -l | grep -h ^-|cut -c1-4,11-42|pr -2 -at|umore

       ls -l          generate the long filelist in alphabetical order
       grep -h ^-     select only files: lines starting with '-' (directories
       start with 'drwx...')
       cut -c1-4,11-42 Extract only columns 1 thru 4 (file attributes) and
                      11 thru 42 (file size, date, time and name)
       pr -2 -at      Print in 2 column format '-2', display horizontally '-a'
       and no page header  '-t'
       umore          display the result one screen at a time

       Notes:

       The UNIX PR expects all arguments to be followed directly by the
       parameter (e.g.  '-w{width}') while the UNIXDOS PR allows also space(s)
       (e.g. '-w78' and '-w    78' is valid)














       OB. Eichberger, Professional Software Solutions      Reference
       Manual (Version 3.0)      Page 184



       UNIX on DOS Toolkiit (UNXIDOS)
                      pwd (Print working directory)


        pwd (Print working directory)

       Syntax:

       pwd [-d]
       -d   Display the directory in DOS style:
            capital letters and '\' between files and directories
            The default is UNIX style:
            small letters and '/' between files and directories

       Description:

       PWD will display the drive and directory name you are currently in.

       PWD will display the directory name in UNIX style unless you specify
       the '-d' for the DOS style display.

       Example:

       pwd

       Might show:
       c:/src/unix

       pwd -d

       Might show:
       C:\SRC\UNIX


























       OB. Eichberger, Professional Software Solutions      Reference
       Manual (Version 3.0)      Page 185



       UNIX on DOS Toolkiit (UNXIDOS)
                      rm (Remove files/directories)


       rm (Remove files/directories)

       Syntax:

       rm [-filr] {file/directory}
       -f     = FORCE    : remove also read/only files
       -i     = INQUIRE  : confirm each file removal
       -l     = LIST     : show removed files
       -r     = RECURSIVE: remove also files in all subdirectories
       -s     = SILENT   : don't display not found error messages

       Description:

       RM will remove files or entire directories. The file contents will be
       lost!

       If a file is protected (read-only) RM will confirm if you realy want to
       remove the file. RM will display the file with attributes, size, date
       and name and wait for your response: 'y' will remove, enter or any
       other key will NOT remove.

       Example:

       Remove all files not starting with 'a-m' and prompt for confirmation:
       rm -i [^a-m]*

       Might show:
       -rw-rw-rw-    11267  Nov 04 1988 old.txt: ? y
       -rw-rw-rw-    10563  Dec 03 1989 old.zip: ?
       -rw-rw-rw-     9004  Nov 16 1989 old2.zip: ? y

       All lines where you enter 'y' RM will remove the file.
       If you just hit enter or any other key RM will not remove that file.

       Remove the entire '/src' directory including all subdirectories, remove
       also read-only files and list each file as it is removed:
       rm -rlf /src

       Notes/Remarks:

       The UNIX RM does not provide the '-l' (list) option and will not show
       the size or date/time in the confirmation prompt.












       OB. Eichberger, Professional Software Solutions      Reference
       Manual (Version 3.0)      Page 186



       UNIX on DOS Toolkiit (UNXIDOS)
              saveexit (Save errorlevel of previous command)


       saveexit (Save errorlevel of previous command)

       Syntax:

       saveexit

       Description:

       SAVEEXIT will save the errorlevel/exit status of the previous program
       into the file:
       c:\udexit.txt
       It will set the environment variable UDEXIT to `
                                                      `c:\udexit.txt'
                                                                     ' which
       is used by the UNIXDOS TEST utility to retrieve the last exit value
       asynchronous. SAVEEXIT is a batch file, because there is no reliable
       way to access the exit code of the previous program from within a
       program.

       Example:

       cf file1 file2
       call saveexit
       ... more commands...
       rem ****** NOW TEST THE LAST EXIT CODE ****
       test `!' -e 0 run: uecho file1 and file2 are different






























       OB. Eichberger, Professional Software Solutions      Reference
       Manual (Version 3.0)      Page 187



       UNIX on DOS Toolkiit (UNXIDOS)
                           sed (Stream editor)


       sed (Stream editor)

       Syntax:

       sed [-n {B,E}p] [-e {expr}] [-f {script}] [file(s)]
       -e {expr}   = EXPRESSION: replace according to expression 'expr'
                                (see regular expressions)
       -f {script} = FILE      : process expressions from script file 'script'
       -n {B,E}p   = NUMEIRC   : print lines from line begin 'B' to end 'E'
                     For the last line use '$' (enclose in single quotes)
       Examples:
       sed -e 's/^/NEW/' xyz (places 'NEW' in front of each line in file
       'xyz')
       sed -n '1000,$p' ab.i (print lines 1000 till the end of file ab.i)
       (Maximum line length = 10000)

       Description:

       SED will read the input from each file (or STDIN if none are specified)
       and apply the editing commands. The output is written to STDOUT.


































       OB. Eichberger, Professional Software Solutions      Reference
       Manual (Version 3.0)      Page 188



       UNIX on DOS Toolkiit (UNXIDOS)
                           sed (Stream editor)

       SED script commands:

       Some commands can be applied only to specific lines by defining an
       address:
       [a] = small address:     single line number or '$' for last line
       [A] = large address:     start line,end line

       You can insert a special character or escape the special meaning of a
       character using '\':
       \xNN in text will be translated to the hex ASCII code NN except:
       \b=backspace, \f=formfeed, \n=line feed, \r=return, \t=TAB

       [a]a\     append: append 'text' after each line text

       b[label]  branch: goto to the label (or end of script if no label
       specified)

       [a]c\     change: replace output with 'text' text

       [A]d delete: delete lines

       [a]i\     insert: insert 'text' before each line text

       l    list: display text and convert non printable characters to \xHH
       (HH=hex code)

       [A]p print: print line

       q    quit: exit script

       r {f}     read: insert the file 'f'

       [A]s:exp:new:flags
            substitute: replace any occurrence of regular expression 'exp'
       with
       'new'
            flags:    g=global (replace all in each line, default is only the
       first)
                 p=print if replacement has been made
                 w {f} = append to file 'f' if replacement has been made
            The first character after the 's' becomes the delimiter (here ':')

       t[label]  test: goto 'label' (or end of file if omited) if replacement
       took place

       w {f}     write: append output to file

       y:lst1:lst2:   transform: convert any occurence in character list
       'lst1' to the
                 corresponding character in list 'lst2'. Both lists must have
       equal length!

       :label    label: Only for 'b' and 't' command


       OB. Eichberger, Professional Software Solutions      Reference
       Manual (Version 3.0)      Page 189



       UNIX on DOS Toolkiit (UNXIDOS)
                           sed (Stream editor)

       =    line: print current line number (counted across files!)






















































       OB. Eichberger, Professional Software Solutions      Reference
       Manual (Version 3.0)      Page 190



       UNIX on DOS Toolkiit (UNXIDOS)
                           sed (Stream editor)

       Examples:

       Select line 10 thru 20 and 100 thru 105 of file:
       sed -n -e 10,20p -e 100,105p file

       Sustitute commas with LineFeeds:
       sed `
           `s:,:\n:g'
                     ' file

       Delete lines 2 thru 8 and 12 thru 14 from file:
       sed -e 2,8d -e 12,14d file

       Insert 'NEW: ' in front of each line in file:
       sed -e "s:^:NEW\: :" file

       Append  ',END' after each line in file:
       sed -e "s:$:,END:" file

       Substitute '1' by 'ONE' and '2' by 'TWO' in file:
       sed -e "s:1:ONE:g" -e "s:2:TWO:g" file

       Append ',END' only in line 2 thri 10 in file:
       sed -e "2,10s:$:,END:" file

       Append '(new text)' after each line but remove lines 2 thru 8 and 10
       thru 14 first:
       using script file 'app.sed':
       2,8d
       10,14d
       a\
       (new text)

       sed -f app.sed file

       Append the file 'more.txt' after line 10 thru 20 from file: using
       script file 'add.sed':
       1,9d
       21,$d
       r more.txt

       sed -f add.sed file

       Notes:

       The UNIXDOS  SED can process lines up to 10,000 bytes long while the
       UNIX SED can handle only up to 1024 bytes and does not provide the hex
       character substitution.
       The UNIX "sed" cannot substitute text for LineFeeds (\n) etc.
       UNIXDOS allows you to substitute also with control codes (\n or \hex
       code).






       OB. Eichberger, Professional Software Solutions      Reference
       Manual (Version 3.0)      Page 191



       UNIX on DOS Toolkiit (UNXIDOS)
                   setenv (Set environment variable(s))


       setenv (Set environment variable(s))

       Syntax:

       usage: setenv {VAR}={value} [VAR=value ...]
       VAR    = Variable name
       value  = New value for variable (cannot contain '=')
       Output should be redirected into a temporary batch file:
       setenv VAR=value ... > tmpenv.bat
       call tmpenv.bat

       Description:

       SETENV change or set environment variables.
       The functionality is identical to the DOS `
                                                 `SET'
                                                      ' internal command
       except for:
       . SETENV allows you to set several variable at once
       . SETENV allows make the powerful UNIXDOS argument expansion available
         to set values

       Unfortunatelly each argument for SETENV has to be enclosed in double
       quotes, because funny DOS will break up arguments containing `=` into
       separate arguments:
       setenv `
              `LIB=c:\msvc\lib'
                               '

       Since there is no way to set or change the environment for the parent
       process I had to create SETENV.BAT as a batch file which internally
       calls `
             `SETENV_.EXE'
                          '. This utility creates a temporary batch file to
       set the variable(s) and is removed after its duty is done.

       Example1:

       Set FILECNT to the number of files in the current directory:
       call setenv `
                   `FILECNT=`ls | wc -lt | cut -f1`'
                                                    '

       Example3:

       Multiply variable VAR by two:
       setenv VAR=`expr $VAR x 2`















       OB. Eichberger, Professional Software Solutions      Reference
       Manual (Version 3.0)      Page 192



       UNIX on DOS Toolkiit (UNXIDOS)
                   setenv (Set environment variable(s))

       Example3:

       Below is an elaborate example of a full script prompt the user for
       files to copy using SETENV:
       @echo off
       rem ****** CHECK IF COPY WANTED **************************
       usrchar Do you want to copy a file? (Y/N)\c yn
       IF ERRORLEVEL 2 GOTO END

       rem ****** GET THE INPUT FILENAME ************************
       usrprmpt Enter the source filename:\c -r
       call setenv "IN=@usrprmpt.tmp"

       rem ****** CHECK IF THIS FILE EXISTS *********************
       test -r "$IN" runneg: echo FILE %IN% DOES NOT EXIST
       IF ERRORLEVEL 1 GOTO END

       rem ****** GET THE OUTPUT FILENAME ***********************
       echo Enter the destination filename:
       call setenv "OUT=`line`"

       rem ****** CHECK IF IT IS WRITABLE IF IT EXISTS **********
       test -r $OUT
       IF ERRORLEVEL 1 GOTO DO_COPY
       test -w $OUT runneg: echo CANNOT WRITE TO FILE %OUT%
       IF ERRORLEVEL 1 GOTO END

       rem ****** EXECUTE THE ACTUAL COPY ***********************
       :DO_COPY
       cp -l %IN% %OUT%
       goto END

       :END

       Notes:

       The UNIX SETENV is and internal command in the C-Shell and not a
       standalone program and does not allow you to set several variables.

















       OB. Eichberger, Professional Software Solutions      Reference
       Manual (Version 3.0)      Page 193



       UNIX on DOS Toolkiit (UNXIDOS)
                 show_exp (Show UNIX argument expansion)


       show_exp (Show UNIX argument expansion)
       Syntax:

       usage: show_exp {arguments to expand}

       Description:

       SHOW_EXP will expand the arguments you specify and display their
       expanded results:
       The very powerful UNIXDOS argument expansion can get a bit confusing,
       so I created a small test utility (SHOW_EXP), which just expands the
       arguments and and shows you the final arguments which would be passed
       into your program.

       Example:

       set UDSHOW_EXP=au*.bat;*.sys
       show_exp $LIB `udate`

       Adding default environment: $UDSHOW_EXP=au*.bat;*.sys
       Arguments before expansion:
       --------------------------------------------------------
       IN:  argv[ 0] = c:\put\SHOW_EXP.EXE
       IN:  argv[ 1] = $LIB
       IN:  argv[ 2] = `udate


       Arguments after expansion:
       --------------------------------------------------------
       OUT: argv[ 0] = c:/put/show_exp.exe
       OUT: argv[ 1] = autoexec.bat
       OUT: argv[ 2] = config.sys
       OUT: argv[ 3] = io.sys
       OUT: argv[ 4] = msdos.sys
       OUT: argv[ 5] = pagefile.sys
       OUT: argv[ 6] = c:\lib;c:\msvc\lib
       OUT: argv[ 7] = Thu Aug 29 16:00:06 1996

       Notice how the following expansions take place:
       First the automatic environment for SHOW_EXP is pulled in and expanded,
       I used the separator `;' to specify two regular expressions `
                                                                   `au*.bat'
                                                                            '
       and `
           `*.sys'
                  ':
       UDSHOW_EXP     ->   OUT: argv[ 1] = autoexec.bat
                      OUT: argv[ 2] = config.sys
                      OUT: argv[ 3] = io.sys
                      OUT: argv[ 4] = msdos.sys
                      OUT: argv[ 5] = pagefile.sys

       Then the general environment variable `
                                             `LIB'
                                                  ' is expanded:
       $LIB      ->   OUT: argv[ 6] = c:\lib;c:\msvc\lib

       And finally the UDATE utility is called and the result becomes the last
       argument:

       OB. Eichberger, Professional Software Solutions      Reference
       Manual (Version 3.0)      Page 194



       UNIX on DOS Toolkiit (UNXIDOS)
                 show_exp (Show UNIX argument expansion)

       `udate`   ->   OUT: argv[7] = Thu Aug 29 16:00:06 1996






















































       OB. Eichberger, Professional Software Solutions      Reference
       Manual (Version 3.0)      Page 195



       UNIX on DOS Toolkiit (UNXIDOS)
                       slash (Convert file slashes)


       slash (Convert file slashes)
       Syntax:

       slash [-d] [file(s)]
       -d       = display in DOS style (default UNIX style)
       file(s)  = the filename(s) to be converted
       If no 'file(s)' are specified slash will read STDIN and convert each
       line

       Description:

       SLASH will convert the file separator '/' in UNIX or '\' in DOS.

       You can either specify one or more filenames on the command line or
       provide a list of filenames in STDIN if you dont specify any filename.

       This conversion might be needed for programs which need the DOS style
       for filenames
       (e.g. PKZIP).

       Example:

       Display all files in DOS style:
       ufind / -exec slash -d {} ^

       Build filelist for PKZIP:
       ufind / -print | slash -d >> x.lst
       pkzip all @x.lst


























       OB. Eichberger, Professional Software Solutions      Reference
       Manual (Version 3.0)      Page 196



       UNIX on DOS Toolkiit (UNXIDOS)
                      sleep (Wait for specific time)


       sleep (Wait for specific time)

       Syntax:

       sleep {number of seconds to sleep}

       Description:

       SLEEP will wait for the specified number of seconds and then return
       back.

       Example:

       Wait for 10 minutes and then print a banner:
       sleep  `expr 10 x 60`
       banner done






































       OB. Eichberger, Professional Software Solutions      Reference
       Manual (Version 3.0)      Page 197



       UNIX on DOS Toolkiit (UNXIDOS)
                     (u)sort (Sort/merge text files)


       (u)sort (Sort/merge text files)

       Syntax:

       usort   [-bcdfimMnru]   [-t{c}]   [-T{d}]   [F]   [-o{f}]   [I]

       -b   blank: ignore leading blanks
       -c   check: check the sort sequence (Create output only if unsorted)
       -d   dictionary: use dictionary order (only A-Z,a-z,0-9 are relevant)
       -f   fold: fold lower case letters to upper case letters
       -I   ignore: ignore non-printable characters (outside ASCII range 0x20-
       0x7f)
       -m   merge: only merge the specified input files (sorted already)
       -M   month: compare as months (JAN,...DEC) non-month default to JAN
       -n   numeric: use numeric sort sequence (convert text to binary value)
       -r   reverse: sort in descending order (default ascending)
       -u   unique: make the output unique (supress all duplicate sort keys)
       -t{c}     field separator: use character 'c' as separator (default is
       blank)
            You can specify also hex codes: -t\7C defines the '|' character
       -T{d}     temporary directory: define directory 'd' for temporary files
            (Example: '-Td:' will use the ram disk 'D:' for work files)
       F    field(s): {+|-}f[.c[o]]
            +    start of sort key
            -    end of sort key
            f    field number (0=first, 1=2nd...)
            c    column offset within field (0=first, 1=2nd...)
            o    options for field: b=blank, d=dictionary, f=fold,i=ignore
            M=month, n=numeric, r=reverse(descending)
       -o{f}     output: set the output field (if not specified STDOUT is
       used)
       I    input file(s): specify one or more input files (if non STDIN is
       used)
       -y{n}     work ram: set size to 'n'*1024 bytes (-y0=use min, -y=use
       max)
       -z{n}     record length: set to 'n' (default is 1024)
            (only used with '-c' or '-m' since USORT does not scan lines)

       Description:

       USORT  will read all lines from all input files, sort them according to
       the specifications and write the output to STDOUT (unless the '-o'
       option specifies an output file). If no input files are specified USORT
       will read from STDIN.

       USORT will sort based on the specified sort key(s): pairs of '+f' and
       '-f' options. If no keys are specified USORT will use the entire line
       for comparisons. The second sort  key is only used if the first sort
       keys are identical (and so on).





       OB. Eichberger, Professional Software Solutions      Reference
       Manual (Version 3.0)      Page 198



       UNIX on DOS Toolkiit (UNXIDOS)
                     (u)sort (Sort/merge text files)

       Sort keys:

       Sort keys are defined with pairs of '+f' and '-f' options. If no '-f'
       is specified USORT will assume the end of line. Each field is separated
       by the separator character (default is white space: blank or TAB). You
       can redefine the separator with the '-t{c}' option:
       field1  field2    field3 filed4    field5 (default)
       field1,field2  ,field3,field4,  field5 (-t,)

       To use field3 as the sort key (field numbers are zero based 0=first):
       usort +2 -3

       You can skip a certain number of columns within the field.
       To use column 3 thru 5 of field3:
       usort +2.2 -3.5

       You can associate various options to the sort key.
       To  sort on field3 using column 3 thru 5 and convert to upper case and
       dictionary order:
       usort +2.2fd -3.5

       Examples:

       Sort   file  'in' based on field2 and 3 (deparated by ','), write to
       'out' and use ram disk D:
       usort +1 -3 -t, -TD: in -o out

       Sort entire line based on colum 10 thru 20 in descending order:
       usort +0.9 -1.20 -r

       Sort  current directory by file extension and filename:
       dir | usort +0.9 -0.12 +0.0 -0.9 | umore

       Sort current directory by file extension and file size (descending
       order):
       dir | usort +0.9 -0.12 +2rn -3 | umore



















       OB. Eichberger, Professional Software Solutions      Reference
       Manual (Version 3.0)      Page 199



       UNIX on DOS Toolkiit (UNXIDOS)
                   split (Split text file into chunks)


       split (Split text file into chunks)

       Syntax:

       split [-l] [-{n}] [file  [name]]
       -l    : list   : show new files as they are created
       -{n}  : number : set the number of lines per piece (default is 1000)
       file  : input  : input filename (default is stdin)
       name  : output : output name prefix (default is 'x')
       (Maximum line length is 10000)

       Description:

       SPLIT will read the input file 'in' (STDIN if none or '-' given) and
       writes this file in chunks of 1000 lines (unless changed with '-n'
       option) into the a set of output files until the entire input file
       has been read. The first output file has the name 'xaa', the second
       'xab' and so on until 'xzz'. You can change the output prefix from 'x'
       to any letter sequence up to 6 character.

       Example:

       File 'long.txt' contains 11093 lines.
       You want to split it in 2000 line chunks with prefix 'long':
       split -l -2000 long.txt long

       Might show:
       split: Starting 'longaa' ...
       split: Starting 'longab' ...
       split: Starting 'longac' ...
       split: Starting 'longad' ...
       split: Starting 'longae' ...
       split: Starting 'longaf' ...
       split: Read 11093 lines, split into  6 files

       Check lines per file with:
       wc long*

       Might show:
         11093   110930    long.txt
          2000    18000    longaa
          2000    18000    longab
          2000    18000    longac
          2000    18000    longad
          2000    18000    longae
          1093     9837    longaf
         22186   210767    TOTAL

       Note that the last chunk 'longal' contains no exactly 2000 lines but
       just the remainder of 1093 lines.

       Note:


       OB. Eichberger, Professional Software Solutions      Reference
       Manual (Version 3.0)      Page 200



       UNIX on DOS Toolkiit (UNXIDOS)
                   split (Split text file into chunks)

       UNIXDOS SPLIT line length limit is 10,000 bytes which exceeds the UNIX
       limit.





















































       OB. Eichberger, Professional Software Solutions      Reference
       Manual (Version 3.0)      Page 201



       UNIX on DOS Toolkiit (UNXIDOS)
                    stderr (redirect stderr to stdout)


       stderr (redirect stderr to stdout)

       Syntax:

       stderr [cmd [argument(s)]]
       cmd    = command/program to be executed under the new environment
       arg    = optional arguments for the command
       To avoid expansion of arguments enclose in single quotes:
       stderr uecho '`cat x`'

       Description:

       STDERR can be used to redirect output from programs which is written to
       STDERR.
       STDERR will merge the STDERR with STDERR so that then you can redirect
       the output into a file.

       Example:

       Capture the usage of USORT:
       stderr usort >> x

































       OB. Eichberger, Professional Software Solutions      Reference
       Manual (Version 3.0)      Page 202



       UNIX on DOS Toolkiit (UNXIDOS)
             strings (Extract text strings from binary files)


       strings (Extract text strings from binary files)

       Syntax:

       strings [-d] [-o] [-x] {file(s)}
       -d     = decimal : print offset in decimal
       -e     = extended: include foreign characters
       -o     = decimal : print offset in octal
       -x     = decimal : print offset in hexadecimal
       -{n}   = length  : set minimum text length (default is 4)

       Description:

       STRINGS will scan the input file(s) for ASCII strings. A string a
       sequence with at least 4 printable ASCII character. You can include
       also foreign character with the '-e' option. To increase the
       requirement of 4 characters use the '-{n}' option.

       Example:

       Find strings in file '\command.com' with minimum length of 10
       characters and display the file offset in decimal:
       strings -12 -d \command.com

       Might show:
          2172  %1 drive %2
          2211  %1 device %2
          2230 &Please insert volume %1 serial %2-%3
          2277 %File allocation table bad, drive %1
          2346 Invalid COMMAND.COM
          2373 !Insert disk with %1 in drive %2
          2435 !Press any key to continue . . .
          2502 Terminate batch job (Y/N)?
          2535 Cannot execute %1
          2561 Error in EXE file
          2604 "Program too big to fit in memory
          2652 No free file handles
          2677 Bad Command or file name
          2732 Access denied
          2753 Memory allocation error&
          3005 Cannot load COMMAND, system halted
          3054 Cannot start COMMAND, exiting
          3116 Top level process aborted, cannot continue
          3222 Write protect errorInvalid unit
          3275 Invalid device request
          3324 Data error!Invalid device request parameters
          3414 Invalid media type
          3437 Sector not found
          3460 Printer out of paper error
          3513 Write fault error
          3535 Read fault error
          3556 General failure
          3576 Sharing violation

       OB. Eichberger, Professional Software Solutions      Reference
       Manual (Version 3.0)      Page 203



       UNIX on DOS Toolkiit (UNXIDOS)
             strings (Extract text strings from binary files)

          3620 Lock violation
          3637 Invalid disk change
          3663 FCB unavailable




















































       OB. Eichberger, Professional Software Solutions      Reference
       Manual (Version 3.0)      Page 204



       UNIX on DOS Toolkiit (UNXIDOS)
            sum (Display checksum and block count of file(s))


       sum (Display checksum and block count of file(s))

       Syntax:

       sum [-r] {file(s)}
       -r = use alternate algorithm

       Description:

       SUM will read each specified file and print a 16 bit checksum with the
       file size in 1024 byte blocks to STDOUT.

       SUM is an excellent tool to confirm the correct file transmission
       - any lost or changed characters will chage the checksum.

       Example:

       Print checksums of system files and '.com' files in the root directory:
       sum  /*.sys /*.com

       Might show:
       3939 47 /command.com
       6224 9 /ansi.sys
       54960 1 /config.sys
       9010 11 /himem.sys
       12951 33 /io.sys
       58891 37 /msdos.sys
       7519 9 /smartdrv.sys


























       OB. Eichberger, Professional Software Solutions      Reference
       Manual (Version 3.0)      Page 205



       UNIX on DOS Toolkiit (UNXIDOS)
                  tail (Print last part of a text file)


       tail (Print last part of a text file)

       Syntax:

       tail [{+|-}[n][blc]] [-f] [file]
       +n     = begin : count from beginning of file
       -n     = end   : count from end of file
       b      = block : count in blocks (1024 bytes)
       c      = char  : count in characters
       l      = lines : count in lines (default)
       -f     = follow: wait and print lines with are appended
       Example: tail -200 text (print the last 200 lines of file 'text')
       (Maximum backup 20,000 bytes)

       Description:

       TAIL will display the input file starting at the specified location.
       If no input file is given TAIL will use STDIN.

       If the '-f' option is specified TAIL will display the text and then
       wait for new text appedned to the input and display. This option
       applies only in an multi user environment to "watch" files for new
       input.

       Example:

       To  display the last 20 lines of a file:
       tail -20 file

       To view the 15 most recent files in your current directory:
       ls -lt | tail -15

       To view the file starting at line 1000:
       tail +1000 file

       Notes:

       UNIXDOS TAIL will allow to "back up" of to 20,000 bytes while the UNIX
       TAIL uses only a 4096 byte buffer.















       OB. Eichberger, Professional Software Solutions      Reference
       Manual (Version 3.0)      Page 206



       UNIX on DOS Toolkiit (UNXIDOS)
                 tee (Display STDIN and copy to file(s))


       tee (Display STDIN and copy to file(s))

       Syntax:

       tee [-i] [-a] [file(s)...] [-w] [file(s)...]
       -a      = append: append output to the next specified file(s)
       -w      = write : write(don't append) output to the next specified
       file(s)
       -i      = ignore: ignore CTRL-C
       file(s) = output file(s) to write to
       You can output in parallel to up to 20 files

       Description:

       TEE will read STDIN and write it to the screen AND the listed output
       file(s).
       By default TEE will remove any old contents in output file(s) and write
       the input (-w option).
       With the append option (-a) you can appedn to an existing file.

       Example:

       Display information from all text files (*.txt) and append to
       `
       `big.log'
                ' and write to `
                                `small.log'
                                           ':
       ls *.txt | tee -a big.log -w small.log

       Produce the checksum of file 'large.dat', display and store in file
       'large.chk':
       sum large.dat | tee large.chk

























       OB. Eichberger, Professional Software Solutions      Reference
       Manual (Version 3.0)      Page 207



       UNIX on DOS Toolkiit (UNXIDOS)
                          test (Test expression)


       test (Test expression)

       Syntax:

       test [-l] {expr} [run[neg]: prog1 [arg..] [`
                                                  `^'
                                                     ' prog2 [arg...]]...]
       (returns errorlevel 0 if all condition are true otherwise returns 1)
       SINGLE FILE CONDITIONS:            | STRING CONDITIONS:
       -d   {fn} = file is a directory    | -n {s}      = string length > 0
       -f   {fn} = file is a regular file | -z {s}      = string length is 0
       -r   {fn} = file is readable       | {s1} = {s2} = strings are equal
       -s[n] {fn}= size is larger than 'n'| {s1} != {s2}= strings unequal
             (if fn=D: then free bytes)   | {s1} ~= {p} = pattern 'p' appears
       in s1
       -t   {h}  = handle'h' is a terminal|
       -w   {fn} = file is writable       | INTEGER CONDITIONS:
       -x   {fn} = file is program        | {n1} -gt {n2} = greater than
       SPECIAL:                           | {n1} -ge {n2} = greater equal
       -e[=nlg?] {l} = check errorlevel   | {n1} -eq {n2} = equal
        = equal(default) n not equal      | {n1} -ne {n2} = not equal
        l less than      g = greater than | {n1} -le {n2} = less equal
        ? display level and test equal    | {n1} -lt {n2} = less than
       COMBINING CONDITIONS:
       -a  = and        as in "-r file1 -a -f file2"
       -o  = or         as in "-r file1 -o -f file2"
       -!  = negate     as in "'!' -r file1" (Note single quotes for non-
       expansion)
       ()  = grouping   as in "'(-r file1 -o -f file2) -a -d directory"
       NOTE: Always enclose the '!' with single quotes to avoid expansion

       DOUBLE FILE CONDITIONS:
       (f1} -Tn {f2} = file 'f1' newer than file 'f2'
       (f1} -TN {f2} = file 'f1' newer or equal than file 'f2'
       (f1} -To {f2} = file 'f1' older than file 'f2'
       (f1} -TO {f2} = file 'f1' older or equal than file 'f2'
       (f1} -Te {f2} = file 'f1' has same time as file 'f2'

       UNIX SPECIFIC (included just for compatibility - always untrue):
       -b {fn} = block special device
       -c {fn} = character special device
       -g {fn} = file has group-id set
       -h {fn} = file has symbolic link
       -k {fn} = file has sticky bit
       -p {fn} = file is pipe
       -u {fn} = file has user-id set

       if {expr} is TRUE test will run all the specified program(s)
       -l   = list: show the exit level







       OB. Eichberger, Professional Software Solutions      Reference
       Manual (Version 3.0)      Page 208



       UNIX on DOS Toolkiit (UNXIDOS)
                          test (Test expression)

       Special conditions:

       -e[=|n|l|g|?]  {l}

       errorlevel: checking the errorlevel of previous program
       -e=  {l}  true if previous errorlevel is equal to 'l' (default)
       -en  {l}  true if previous errorlevel is not equal to 'l'
       -el  {l}  true if previous errorlevel is less than 'l'
       -eg  {l}  true if previous errorlevel is greater than 'l'
       -e?  {l}  true if previous errorlevel is equal to 'l'
            (display the errorlevel before the comparison)
       (run 'SAVEEXIT' before calling test under DOS 4 or earlier!)

       Run program(s):

       run: prog1 [arg..] [`
                           `^'
                              ' prog2 [arg..] [`
                                                `^'
                                                   ' prog3 [arg...]]
       (runs the specified programs if '{expr}' is true)
       runneg: prog1 [arg..] [`
                              `^'
                                 ' prog2 [arg..] [`
                                                   `^'
                                                      ' prog3 [arg...]]
       (runs the specified programs if '{expr}' is NOT true)

       Description:

       TEST will evaluate the expression formed out of one or several
       conditions and exit with errorlevel 0 if the expression or TRUE -
       otherwise errorlevel 1.
       So you can easily integrate the test in your batch files:

       test {condition}
       if errorlevel 1 goto ERROR
       rem *** condition is true
       ...
       goto END

       :ERROR
       condition is not true

       :END

       TEST will also run the specified programs if you specify the 'run:'
       switch on the command line.

       Conditions can be combined with AND '-a' or OR '-o'. Conditions can be
       inverted with the '!' operand in front of the condition (remember to
       enclose the ! operand in single quotes to avoid argument expansion).

       Examples:

       Chek if file 'log' is writable and append file 'newlog' to 'log' if
       true:
       test -w log run: cat newlog >> log

       Check  if directory '/usr/tmp' exists and run MKDIR to create it:
       test -d /usr/tmp run: mkdir /usr `
                                        `^'
                                           ' mkdir /usr/tmp


       OB. Eichberger, Professional Software Solutions      Reference
       Manual (Version 3.0)      Page 209



       UNIX on DOS Toolkiit (UNXIDOS)
                          test (Test expression)

       Check if there is 800,000 bytes left on drive D: and copy file
       'data1.zip' if true:
       test -s800000 d: run: cp -l data1.zip d:

       Check if filesize of logfile 'my.log' is below 50,000 bytes and 'l' is
       writable,
       append 'newlog' to 'l' if these conditions are true:
       test -w my.log  -a '!' -s50000 my.log  run: "cat   newlog >> my.log"















































       OB. Eichberger, Professional Software Solutions      Reference
       Manual (Version 3.0)      Page 210



       UNIX on DOS Toolkiit (UNXIDOS)
                          test (Test expression)

       Show the last saved exit value:
       cp blabla x1
       cp: Cannot find 'blabla'

       call saveexit
       uecho do something else... here
       do something else...

       test -e? 0
       LAST EXIT VALUE WAS: 1

       Check if the environment variable OUT is set - if not set OUT to
       \default.out:
       test -z $OUT
       IF NOT ERRORLEVEL 1 SET OUT=\default.txt

       Check if environment DEBUG is set to ON and set DEBFLAG to '-Zi' if
       true:
       test `
            `%DEBUG%'
                     ' `!=` `
                             `ON'
                                 '
       IF NOT ERRORLEVEL 1 SET CCFLAG=-Zi

       Check if directory 'UNIXDOS' is not found in the PATH environment
       variable and print banner:
       test '!' $PATH ~= UNIXDOS run: banner NO UNIXDOS PATH

       Check if there are at least 500,000 bytes free in conventional memory,
       print a banner if not:
       test "`chkdsk | grep -h free | cut -f1`" -lt 500000 run: banner low ram

       Check if the current directory contains the same number of C source
       files as make files and print a message if not:
       test "`ls *.c | wc -l`" -ne "`ls *.mk | wc -l`"
       IF NOT ERRORLEVEL 1 banner "mk/c" mismatch

       Check if file 'x.c' is newer the 'x.obj' and print message if true:
       test x.c -Tn x.obj run: uecho x.obj is older

       Check  if two files 'dat1' and 'dat2' are identical and print banner if
       not and copy dat1 to dat2:
       cmp dat1 dat2
       test -e= 0 run: banner copy ^ cp -lv dat1 dat2

       Check if  the either file 'm1.err' or 'm2.err' contain more than 0
       bytes and the file '\showerr' exists and display the errors:
       test ( -s m1.err -o -s m2.err ) -a -r \showerr run:
       cat m1.err m2.err









       OB. Eichberger, Professional Software Solutions      Reference
       Manual (Version 3.0)      Page 211



       UNIX on DOS Toolkiit (UNXIDOS)
                          test (Test expression)

       User Prompt Example:

       Prompt the user for the files to copy with checks (test_cp.bat):
       @echo off
       rem ****** CHECK IF COPY WANTED **************************
       usrchar Do you want to copy a file? (Y/N)\c yn
       IF ERRORLEVEL 2 GOTO END

       rem ****** GET THE INPUT FILENAME ************************
       usrprmpt Enter the source filename:\c -r
       call setenv "IN=@usrprmpt.tmp"

       rem ****** CHECK IF THIS FILE EXISTS *********************
       test -r "$IN" runneg: echo FILE %IN% DOES NOT EXIST

       IF ERRORLEVEL 1 GOTO END

       rem ****** GET THE OUTPUT FILENAME ***********************
       echo Enter the destination filename:
       call setenv "OUT=`line`"

       rem ****** CHECK IF IT IS WRITABLE IF IT EXISTS **********
       test -r $OUT

       IF ERRORLEVEL 1 GOTO DO_COPY
       test -w $OUT runneg: echo CANNOT WRITE TO FILE %OUT%

       IF ERRORLEVEL 1 GOTO END

       rem ****** EXECUTE THE ACTUAL COPY ***********************
       :DO_COPY
       cp -l %IN% %OUT%
       goto END

       :END

       Output example1:

       Do you want to copy a file? (Y/N) Y
       Enter the source filename: blabla
       FILE blabla DOES NOT EXIST


       Output example2:

       Do you want to copy a file? (Y/N) Y
       Enter the source filename: x1.bat
       Enter the destination filename:
       xnew
       CANNOT WRITE TO FILE xnew

       Output example3:

       Do you want to copy a file? (Y/N) Y

       OB. Eichberger, Professional Software Solutions      Reference
       Manual (Version 3.0)      Page 212



       UNIX on DOS Toolkiit (UNXIDOS)
                          test (Test expression)

       Enter the source filename: x1.bat
       Enter the destination filename:
       newfile
       x1.bat               -> newfile
       1 files written succesfully


















































       OB. Eichberger, Professional Software Solutions      Reference
       Manual (Version 3.0)      Page 213



       UNIX on DOS Toolkiit (UNXIDOS)

        (u)time (time a command)

       Loop Example:

       Print  a table of the powers of two (test_exp.bat):
       @echo off
       set EXP=1
       set BASE=2
       :LOOP
           echo 2 power %EXP% = %BASE%
           call setenv "EXP=`expr $EXP + 1`"
           call setenv "BASE=`expr $BASE x 2`"
           test $EXP -le 16

       IF NOT ERRORLEVEL 1 GOTO LOOP

       Will print:
       2 power 1 = 2
       2 power 2 = 4
       2 power 3 = 8
       2 power 4 = 16
       2 power 5 = 32
       2 power 6 = 64
       2 power 7 = 128
       2 power 8 = 256
       2 power 9 = 512
       2 power 10 = 1024
       2 power 11 = 2048
       2 power 12 = 4096
       2 power 13 = 8192
       2 power 14 = 16384
       2 power 15 = 32768
       2 power 16 = 65536

       Notes:

       The UNIX TEST misses the following options found in the UNIXDOS TEST:
       -s{n}          (you can only check if the filesize is larger than 0)
       {s1} ~= {s2}   (string search for pattern)
       -n  {s}        tring non-zero length check)
       -T[n|N|o|O|e]  (file modification time comparison)
       -e[=|n|l|g|?] {l} (Check errorlevel/exit status of previous program)














       OB. Eichberger, Professional Software Solutions      Reference
       Manual (Version 3.0)      Page 214



       UNIX on DOS Toolkiit (UNXIDOS)

        (u)time (time a command)

       (u)time (time a command)

       Syntax:

       utime program [arg...]

       Description:

       UTIME will run the program with the specified arguments and display the
       elapsed time in seconds.


       Example:

       Call 'sleep' with 10 seconds delay:
       utime sleep 10

       Might show:
          10.76 seconds


       Notes:

       The UNIX TIME will also display other time periods which relate to the
       multi user environment.





























       OB. Eichberger, Professional Software Solutions      Reference
       Manual (Version 3.0)      Page 215



       UNIX on DOS Toolkiit (UNXIDOS)
                     touch (Update date/time of file)


       touch (Update date/time of file)

       Syntax:

       touch [-cl] [MMDDhhmm[YY]] {file(s)}
       -c           = create: don't create file if it does not yet exist
                              (this is the default)
       -l           = list  : show file(s) being update
        (UNIX a, m flag does not apply, because DOS does not maintain them!)
       MMDDhhmm[YY] = time stamp:
                      MM   Month (01-12)
                      DD   Day (01-31)
                      hh   Hour (00-23)
                      mm   Minute (00-59)
                      YY   Year (00-99 = 1900 - 1999)
                           (defaults is the current year)

       Description:

       TOUCH will set the modification time of all specified files to the
       current time or the time specified.

       If the file does not exist TOUCH will create it with the current time
       stamp (unless the '-c' option is specified).

       Examples:

       Set all text files to Jan 15, 17:00, 1990 - list each file as it is
       changed:
       touch -l 0115170090 *.txt

       Set all C cource files to the current time:
       touch *.c

       Find all files updated or created after Jan 15, 17:00, 1991:
       touch 0115170091 \ref
       ufind / -newer ref -ls

       Notes:

       Since DOS does not maintain separate access/creation times the '-a' and
       '-m' option is not provided in the UNIXDOS TOUCH.












       OB. Eichberger, Professional Software Solutions      Reference
       Manual (Version 3.0)      Page 216



       UNIX on DOS Toolkiit (UNXIDOS)
                        tr (Translate characters)


       tr (Translate characters)

       Syntax:

       tr [-cds] [set1 [set2]] [file(s)]
       -c   complement: invert the characters defined in 'set1'
       -d   delete: remove any characters matching 'set1' from the file(s)
       -s   squeeze: reduce multiple occurances of 'set2' to single occurance
       set1 source character set: list of single characters or character
       ranges
                 [{c1}-{c2}] will be expanded to the full range from c1 to c2
                 Example: '[a-z]' is the same as 'abcdefghijklmnopqrstuvwxyz'
                 You can combine single character and range(s):
                 Example: '[a-z]_[0-9]' for lower case letter, underbar and
       numbers.
                 (Always enclose in single quotes to avoid the argument
       expansion).
       set2 destination character set: (not required with '-d' option)
                 [{c}*[n]] expands to the character 'c' repeated 'n' times.
                 If 'n' starts with '0' it is interpreted as octal otherwise
       decimal.
                 If n is omitted character 'c' will be repeated until set1 is
       matched.
                 Always enclose in single quotes to avoid the argument
       expansion)
       file(s)   input : list of input file(s) - if non specified STDIN is
       used

       Description:

       TR will read the input files, translate characters according to the
       specifications and write the output to STDOUT. If no input file is
       given tr will use STDIN.

       Examples:

       Translate lower case letter to upper case of file 'in':
       tr '[a-z]' '[A-Z]' in

       Translate the UNIX forward slash to DOS backward slash:
       tr '/' '\\' in

       Translate the DOS backward slash to UNIX forward slash:
       tr '\\' '\/' in

       Squeeze all multiple spaces to a single space:
       chkdsk | tr -s ""  " " in

       Print a list of all words in a file:
       tr -cs '[A-Z][a-z][0-9]' '[\012*]' file

       Convert any text to: l(small letter), L(big letter), n(numbers) and x
       for rest::

       OB. Eichberger, Professional Software Solutions      Reference
       Manual (Version 3.0)      Page 217



       UNIX on DOS Toolkiit (UNXIDOS)
                        tr (Translate characters)

       tr "'[ -~][A-Z][a-z][0-9]'" '[x*96][L*26][l*26][n*10]'






















































       OB. Eichberger, Professional Software Solutions      Reference
       Manual (Version 3.0)      Page 218



       UNIX on DOS Toolkiit (UNXIDOS)
                      uniq (Find unique lines/keys)


       uniq (Find unique lines/keys)

       Syntax:

       uniq [-cdu] [-t{c|\xx}] [-n[.m]] [+n] [input [output]]
       (default find unique line and display each once)
       -c     = count    : display counter in front
       -d     = duplicate: display only duplicate items
       -u     = unique   : display only unique items
       -n[.m] = field    : skip {n} fields (include up to 'm')
       +{n}   = char     : skip {n} char in field
       -t{c}  = delimiter: define new delimiter (only with +/-n)
                           (default is tab, \xx = specify as hex value)
       Example: uniq -t\7c -1.3 +2 -u x1
       (Will use field 2,3,4 based in delimter | (hex 7c) skipping the
        first 2 character and print only single occurances)

       Description:

       UNIQ will read the sorted input from 'in' (STDIN if omitted) and write
       each unique line to the output file 'out' (STDOUT if omitted). The
       input has to be already sorted in ascending order.

       If the '-d' option is given UNIQ will only display keys which occur at
       least twice.

       If the '-u' option is given UNIQ will only display keys which appear
       only once.

       If the '-c' option is given UNIQ will display all keys with a counter
       of their respective repetitions in front.

       If you specify a key (default is the entire line) UNIQ will check only
       the specified key area.

       Example:

       Display all file extensions with counter in the current directory:
       ls | cut -d. -f2 | usort | uniq -c















       OB. Eichberger, Professional Software Solutions      Reference
       Manual (Version 3.0)      Page 219



       UNIX on DOS Toolkiit (UNXIDOS)
                unix2dos (Convert UNIX text files to DOS)


       unix2dos (Convert UNIX text files to DOS)

       Syntax:

       usage: unix2dos {file(s)}
       file(s) = file(s) to convert

       Description:

       UNIX2DOS will convert each file from the UNIX text format (only Line
       Feed(LF) at the end of each line) to the DOS text format (Carriage
       Return(CR) and Line Feed(LF) at the end of each line).

       Example:
       To convert `
                  `list1.txt'
                             ' and `
                                    `list2.txt'
                                               ' into DOS format enter:
       unix2dos list1.txt list2.txt

       It will just show you the processed filenames and replace the original
       file contents:
       list1.txt
       list2.txt

































       OB. Eichberger, Professional Software Solutions      Reference
       Manual (Version 3.0)      Page 220



       UNIX on DOS Toolkiit (UNXIDOS)
                 uptime (Show elapsed time since reboot)


       uptime (Show elapsed time since reboot)

       Syntax:

       uptime [-i]

       -I   init: initialize a reboot
       'uptime -i' should be in 'AUTOEXEC.BAT'


       Description:

       UPTIME will report the time elapsed since the last reboot.

       When your computer reboots 'uptime -i' should be called (from
       AUTOEXEC.BAT)
       to mark the reboot.

       Example:

       uptime

       May show:
       1 day and 06:14:34 elapsed since reboot at:

           Wed Aug 05 07:18:00 1991




























       OB. Eichberger, Professional Software Solutions      Reference
       Manual (Version 3.0)      Page 221



       UNIX on DOS Toolkiit (UNXIDOS)
                usrchar (Prompt user for single character)


       usrchar (Prompt user for single character)

       Syntax:

       usrchar [argument(s)|-d|-e] {lst}
       {lst}        = list of answer codes (case insensitive)
       -d     = disable      the escape sequence translation
       -e     = enable again the escape sequence translation
       The following escape sequences can be used in the arguments:
       \b    = backspace
       \c    = no new line (default is line feed at the end)
       \f    = form-feed
       \n    = newline
       \r    = carriage return
       \t    = tab
       \v    = vertical tab
       \\    = backslash
       \0n   = octal code
       \xn   = hex code
       If the argument starts with '%' or '$' the contents of that
       environent variable is echoed)
       The errorlevel depends in the column in the {lst}:
       usrchar "Type 1/2/3 or X:\c" 123X (exit code is 1=1, 2=2, 3=3, X=4)


       Description:

       USRCHAR allows you to prompt the user for a single character.
       It is not neccessary to hit the return key - the keyboard input is
       processed directly.
       You specify a list of all valid characters.
       Depending on the position in the list USRCHAR will exit with the
       position (1=first, ...)
       The case is not significant.
       Wrong answers are responded to with a beep.

       You can use special characters like tne UNIXDOS UECHO command (see
       there for details)

       Example:

       usrchar  Do you want to copy (Y/N):\c yn

       If the user types Y the exit value is 1, if N the exit value is 2.










       OB. Eichberger, Professional Software Solutions      Reference
       Manual (Version 3.0)      Page 222



       UNIX on DOS Toolkiit (UNXIDOS)
                     usrprmpt (Prompt user for text)


       usrprmpt (Prompt user for text)

       Syntax:

       usage: usrprmpt [argument(s)|-d|-e]
       (The user input is written to 'usrprmpt.tmp')
       -d     = disable      the escape sequence translation
       -e     = enable again the escape sequence translation
       -r     = the anser is required
       The following escape sequences can be used in the arguments:
       \b    = backspace
       \c    = no new line (default is line feed at the end)
       \f    = form-feed
       \n    = newline
       \r    = carriage return
       \t    = tab
       \v    = vertical tab
       \\    = backslash
       \0n   = octal code
       \xn   = hex code
       If the argument starts with '%' or '$' the contents of that
       environent variable is echoed)
       The errorlevel is the number of bytes the user entered


       Description:

       USRPRMPT allows you to prompt the user for a text.
       The user can enter any length of characters. If you need a responds and
       want to supress a non-answer (when the user hits just ENTER) you can
       specify the `
                   `-r'
                       ' option on the command line to enforce an answer.
       Wrong answers are responded to with a beep.

       The user input is written to the file `
                                             `usrprmpt.tmp'
                                                           '.

       USRPRMPT will return the number of characters entered as the exit
       value, so you can test for no response.

       You can use special characters like tne UNIXDOS UECHO command (see
       there for details)

       Example:

       usrprompt  Enter the filename:\c
       if not errorlevel 1 goto END
       uecho You entered @usrprmpt.tmp

       If the user enters no name the exit value is 0, otherwise the number of
       characters





       OB. Eichberger, Professional Software Solutions      Reference
       Manual (Version 3.0)      Page 223



       UNIX on DOS Toolkiit (UNXIDOS)
               uudecode (decode a transmitted binary file)


       uudecode (decode a transmitted binary file)

       Syntax:

       uudecode [input]

       input     input file name (if ommitted STDIN is used)
            This file has to be created by UUENCODE!


       Description:

       UUDECODE will decode a file prepared by UUENCODE.
       The input file contains only printable ASCII character.

       The filename of the original file is embedded in the input file and
       will automatically be used for the decoded data.

       The UUENCODE/UUDECODE programs are an excellent tool for data
       transmission where only ASCII character can be sent/received.

        Example:

       Encode a binary file:
       uuencode uudecode.exe temp.txt
       ...(transmission)...
       uudecode temp.txt



























       OB. Eichberger, Professional Software Solutions      Reference
       Manual (Version 3.0)      Page 224



       UNIX on DOS Toolkiit (UNXIDOS)
             uuenode (encode a binary file for transmission)


       uuenode (encode a binary file for transmission)

       Syntax:

       uuencode [input] {output|-}

       input          input: binary file to be encoded (if ommitted STDIN is
       used)
       output         output: ASCII test output file (if '-' STDOUT is used)



       Description:

       UUENCODE will convert a binary file into a text file which contains
       only printable ASCII character.

       The filename of the input file is embedded in the output file.
       If STDIN is used UUENCODE will use 'stdin'.

       The UUENCODE/UUDECODE programs are an excellent tool for data
       transmission where only ASCII character can be sent/received.

        Example:

       Encode a binary file:
       uuencode uudecode.exe temp.txt
       ...(transmission)...
       uudecode temp.txt

























       OB. Eichberger, Professional Software Solutions      Reference
       Manual (Version 3.0)      Page 225



       UNIX on DOS Toolkiit (UNXIDOS)
                          wc (Word/Line counter)


       wc (Word/Line counter)

       Syntax:

       wc [-clntw] {file(s)}
       -c      = CHARS   : count only characters
       -l      = LINES   : count only lines
       -n      = NOT NULL: display only files with more than 0 lines
       -t      = TOTAL   : display only the total line
       -w      = WORDS   :  count only words
       default is -lc
       (if no files are given it will read from stdin)

       Description:

       WC will report the number of lines and characters for each specified
       file.
       If no file is given WC will use STDIN.

       If there is more than one input file specified WC will append the
       totals at the end with 'TOTAL' in place of the filename.

       You can switch individual counter on with the options.

       Example:

       Count the number of text files in the current directory:
       ls *.txt | wc -l

       Display the lines and bytes of all C cource files starting with a and b
       in the current directory:
       wc  [ab]*.c

       Might show:
           181     6094    ar.c
           300    14254    banner.c
            97     2626    basename.c
          2142   123655    bbanner.c
           394     9254    bdiff.c
            28     1027    bname_t.c
          3142   156910    TOTAL

       Display omly the total lines of all C cource files starting with a and
       b in the current directory:
       wc  -lt [ab]*.c

       Might show:
           3142   TOTAL






       OB. Eichberger, Professional Software Solutions      Reference
       Manual (Version 3.0)      Page 226



       UNIX on DOS Toolkiit (UNXIDOS)
                         which (Locate a program)


       which (Locate a program)

       Syntax:

       which {program name1 [,name2...]}
       names can be also a regular expression:
       which make*     will find all programs starting with 'make'
       which make.bat  will find only specifically 'make.bat' files
       which *make*    will find all programs containing 'make'
       which make      will find all programs with the name 'make'
       Programs are all files with extensions: .exe, .com, .bat or
       any extension listed in the PATHEXT environment:
       set PATHEXT=.exe;.com;.bat;.sh;.cmd
       (which does not use the UNIXDOS argument expansion)

       Description:

       WHICH will search in all directories given in the PATH environment and
       list any match  for the program(s) specified.
       You can do the following search types:
       . detailed name:         which myprog.exe
       . just name:        which myprog
            ere WHICH will look for any program with excatly the name
         `
          `myprog'
                  ' which has the         extension `
                                                    `.bat'
                                                          ', `
                                                              `.exe'
                                                                    ' or
         `
          `.com'
                '. To sepcify your custom list define PATHEXT:
            et PATHEXT=.bat;.exe;.com;.cmd;.sh
       . name expression:  which my*
         Here WHICH will search for any program starting with `
                                                               `my'
                                                                   ' using the
         program extensions as specified above.

       You can be very specific (filename with extension) or just the filename
       (WC will find any extension) or do a file exprssion match (all files
       containing sort).

       Since you will always enter search expressions on the command line the
       automatic UNIXDOS argument expansion is disabled for the WHICH command.

       Example:

       Display all files containing 'sort':
       which *sort*

       Might show:
       C:/U/sort.txt
       C:/UNIXDOS/usort.exe
       C:/DOS/sort.exe
       C:/UNIFY/BIN/usort.exe

       Find the 'which.exe' command:
       which which.exe

       Might show:
       C:/UNIXDOS/which.exe

       OB. Eichberger, Professional Software Solutions      Reference
       Manual (Version 3.0)      Page 227



       UNIX on DOS Toolkiit (UNXIDOS)
                         which (Locate a program)
























































       OB. Eichberger, Professional Software Solutions      Reference
       Manual (Version 3.0)      Page 228
