Go to the first, previous, next, last section, table of contents.

SDir

What's That?

Sdir is a CMD.EXE's DIR command replacement. It is (supposed to be) 100% compatible with it. It adds custom coloration to outputs. It also fixes a minor but annoying misalignment when the /W option is used as well as an incorrect size display when using the /V option with large files (> 1GB). Finally, if the WPTOOLS library is present, it can display objects and links (also known as shadows).

sdir01.gif

In this typical sample, you can see that the alignment bug is fixed (REXXvio.zip is just under REXXvio.INF). Some coloration has been made, too. The outputs are otherwise identical.

(Files that have been modified in the last 30 days are highlighted. Directories are colored in green, .CMD files in cyan and .ZIP archives in yellow. If more than one coloration apply, and if they can be mixed, it is done so -- for example, REXXvio.test is a directory, and has been created less than 30 days ago, so it is both green and highlighted.)

The coloration is completely directed by environment variables.

Installation

Installing SDir is very simple: just copy SDIR.CMD somewhere along your PATH and REXXVIO.DLL somewhere along your LIBPATH.

If REXXVIO.DLL is currently in use, close ALL your OS/2 windowed or fullscreen sessions, and open a bare OS/2 windowed session (that is, one not starting CmdShl or Fl). You can then replace REXXVIO.DLL from this session.

If you were using a previous version of MLRXSHL, execute the following code from an OS/2 command prompt, to allow the new functions defined in REXXVIO to be registered:

   rexxtry call VioDropFuncs

If you want to automatically use SDIR instead of DIR, you can add an alias, if your command shell processor recognizes them. For example, with CmdShl, use:

   ALIAS dir=SDIR %*

You can also add your preferred coloration settings in your CONFIG.SYS. For example, mine contains:

   REM Sdir Settings
   SET DIRCLR.ATTRIB=D:GREEN;H,S:ON RED;R:BLINK;L:BRIGHT BLUE
   SET DIRCLR.DATE=-30:BRIGHT
   SET DIRCLR.EXT=BAT,EXE,COM,CMD:CYAN;ZIP,JAR:YELLOW;INI:MAGENTA
   SET DIRCLR.NAME=PROFILE:MAGENTA

If you want to be able to display Workplace Shell objects, you have to install the WPTOOLS library somewhere along your LIBPATH. You can obtain this library in the wptool??.zip package by Henk Kelder. If you use an old OS/2 release that has no support for long files (i.e., files that are bigger than 2GB), overwrite REXXVIO.DLL with REXXVIO.OLD beforehand.

Starting SDir

See the DIR command in the online reference manual.

Attributes

Each element in a directory has a set of attributes attached to it:

By default, hidden and system elements are not displayed. To override this behavior, you can use the /a switch when calling SDir.

If the WPTOOLS library is present, SDir recognize two new attributes:

Real files and directories do not have those attributes set. Workplace Shell objects (and hence links too) are not displayed by default.

When in wide mode (i.e., when the /w switch is specified), directories are enclosed in square brackets and Workplace Shell objects in curly braces.

If you want to filter elements according to their attributes, use the /a option. To display the elements attributes, use the /v option. If you want to override the defaults, set the DIRCMD environment variable with the desired value.

Environment variables

Sdir recognizes the following environment variables:

   DIRCLR.ATTRIB
   DIRCLR.DATE
   DIRCLR.EASIZE
   DIRCLR.EXT
   DIRCLR.NAME
   DIRCLR.NORMAL
   DIRCLR.SIZE
   DIRCLR.USEREXIT

   DIRCMD

   HELP.COMMAND
   HELP.SWITCHES

If one or more of those environment variables are not defined, the missing ones are silently ignored.

The last two environment variables are used to define an optional external help subsystem.

The order in which coloration is applied is the following:

  1. User exit;
  2. Directory attribute;
  3. Other attributes : Archive, Read only, System, Hidden, Objects, Links;
  4. File extension (if any);
  5. File name;
  6. File date;
  7. File size;
  8. Extended attributes size.

An element of higher priority takes precedence over an element of lower priority. For example, if you specify a green background for directories and red background for recent entries, a directory will always have a green background, regardless of its last modification date.

The color specification is of the form:

    [NORMAL] [BRIGHT] [BLINK] [color] [ON color]

color being one of: BLACK, RED, GREEN, YELLOW, BLUE, MAGENTA, CYAN or WHITE.

The case is not significant. Depending on your display type, specifying BLINK may result in either a blinking character or a high intensity background color.

NORMAL means neither BLINK nor BRIGHT white on black.

DIRCLR.ATTRIB

This environment variable specifies the coloration to be used if an entry attribute has been set.

   SET DIRCLR.ATTRIB=attrib[,...]:color[;...]

attrib can be one of D, A, R, S, H, O or L. (Case is not significant.)

If an attribute is defined more than once, the last definition is used.

Example

   SET DIRCLR.ATTRIB=D:green;H,S:ON RED;R:BLINK

Directories will be displayed in green, Hidden or System entries will be displayed on a red background, and read-only ones will be blinking (or, in a VIO Window, the background will be intensified).

The O and L attributes (Object and Link) are ignored if the WPTOOLS library is missing.

DIRCLR.DATE

This environment variable specifies the coloration to be used depending of the entry's last modification date.

   SET DIRCLR.DATE=[-+=]date:color[;...]

If date is a number, it specifies a number of day. Otherwise, it is a date in ISO format (yyyy/mm/dd).

If you have specified a number of day, a leading "-" selects files modified in the last date days. A leading "+" selects files that have not been modified in the last date days. A leading "=" only selects files modified exactly date days ago (it is not that useful :-) ).

If you have specified a date, a leading "-" selects files that have not been modified since date. A leading "+" selects files that have been modified since date. A leading "=" only selects files modified on date.

The first matching value is used. The evaluation order is from left to right.

Example

   SET DIRCLR.DATE=-30:bright

A bright color will be used for files modified in the last 30 days.

DIRCLR.EASIZE

Not implemented yet.

DIRCLR.EXT

This environment variable specifies the color to be used depending on the entry extension.

   SET DIRCLR.EXT=ext[,...]:color[;...]

ext is the extension (without the leading dot) to be colored. It is case insensitive. Jocker symbols ("*" and "?") are not allowed.

If an extension is specified more than once, the last specification is used.

Example

   SET DIRCLR.EXT=BAT,EXE,COM,CMD:CYAN;ZIP:YELLOW

Files ending with either .BAT, .EXE, .COM or .CMD will be displayed in cyan while archive files ending with .ZIP will be in yellow.

DIRCLR.NAME

This environment variable specifies the color to be used depending on the entry name.

   SET DIRCLR.NAME=name[,...]:color[;...]

name is the name to be colored. It is case insensitive. Jocker symbols ("*" and "?") are not allowed. Neither are null ("") names.

If a name is specified more than once, the last specification is used.

The name of an entry is the part preceding the extension. For example:

  foo              --> foo
  bar.baz          --> bar
  foo.bar.baz      --> foo.bar

Example

   SET DIRCLR.NAME=PROFILE:magenta

Files whose name is PROFILE will be in magenta.

DIRCLR.NORMAL

This environment variable specifies the default color to be used for non-defined areas.

It defaults to NORMAL if not defined.

DIRCLR.SIZE

Not implemented yet.

DIRCLR.USEREXIT

Not implemented yet.

DIRCMD

See the (inexistant :-) description of it in the online reference manual.

HELP.COMMAND

If this environment variable is defined, SDir will not use its build-in help messages. Instead, it will call the script/application defined by this variable.

For example, if HELP.COMMAND is defined as:

   SET HELP.COMMAND=ECHO Help for

Issuing "SDIR /?" will give:

   Help for SDIR /?

(In other words, the command is displayed back to the user.)

The syntax of the call is the following:

   call %HELP.COMMAND% SDIR <args>

where <args> being the argument(s) given to the command by the user.

HELP.SWITCHES

If this environment variable is defined, it contains a space-delimited list of switches used to obtain help from the command.

For example:

   SET HELP.SWITCHES=/? -h

If this environment variable is not defined, SDir assumes "/?" as its value.

Known Limitations

History

1.03.000    Mar 06 2002

 --- New feature:
     o added a new DIRCLR.NORMAL environment variable, for use if
       the VIO session default color is not white on black.

1.02.000    Sep 14 2000

 --- Bug fix:
     o added a missing END statement in emit procedure.

1.01.000    Mar 02 2000

 --- Bug fix:
     o Huge sizes (>1E10) no longer uses scientific notation.  Sizes
       up to 2^64 now handled correctly.
     o /w now displays file names when used in conjunction with /s.

1.00.000    Sep 13 1998

 --- New feature:
     o l and o option added for /a switch, to support WPS shadows
       and objects.  Those objets are handled as files with new
       attributes (O and L for shadows, and O for objects).

0.99.000    May 11 1998

 --- Bug fix:
     o Incorrect display of disk label if it contains a space.

0.98.000    Dec 15 1997

 --- Bug fix:
     o lineCount, pause and height were not always exposed when
       needed.

0.97.000    Dec 09 1997

 --- New feature:
     o Optional external help subsystem added (use HELP.COMMAND and
       HELP.SWITCHES if defined).

0.96.000    Nov 26 1997

 --- Bug fix:
     o /o works like CMD.EXE's DIR when used in conjunction with /s.

0.95.000    Nov 23 1997

 --- New feature:
     o /p option added.

0.94.000    Nov 21 1997

 --- Bug fixes:
     o total size no longer displayed if /s is not specified.
     o partial size correctly displayed when using more than one
       specification in a given directory.
     o abend when /w was used with multiple specifications in
       different directories.
 --- New feature:
     o DIRCMD environment variable used if defined.

0.93.000    Jun 17 1997

 --- Bug fix:
     o /s now completely implemented.

0.92.000    May 31 1997

 --- New feature:
     o /v option added.

0.91.000    Mar 14 1997

 --- Bug fix:
     o full path is displayed when /b is used in conjunction with /s.

0.90.000    Sep 24 1996

 --- First public release

Go to the first, previous, next, last section, table of contents.