═══ 1. Introduction ═══ OS/2 Command Line Utilities Users' Guide. Version 2.0.0 Copyright (c) 1991-1999 Jonathan de Boyne Pollard. All rights reserved worldwide. This is the users' guide for the OS/2 Command Line Utilities version 2.0, a set of useful command-line tools for OS/2 users. These tools are designed to be "pure 32-bit", with no 16-bit code whatsoever (most of the utilities supplied with OS/2 that are duplicated and enhanced herein, such as ATTRIB, are 16-bit programs), and as such should work on OS/2 version 2.0.1 or later. Software licence This software is copyright in order to protect the good name of the author and in order to prevent other people from passing it off as their own and making money from it. The author wants this software to enjoy as wide an audience as possible, and also wants you to receive this software as it was originally released. Therefore: You may archive, store, copy, and distribute this software (which means the utilities, and any accompanying electronic documentation, helptext, and message or data files) in its entire original, unmodified, form for any purpose, commercial or otherwise. In fact you are encouraged to give copies of this software to your friends so that they can enjoy it too. You may make limited modifications to the original distribution archive before passing it on to others, to convert it to another archive format (extended attributes and long filenames must be preserved, however), or to add archive comments in order to advertise BBSes and the like (a FILE_ID.DIZ description file is already supplied in the distribution archive, however). You may not pass this software off as your own, attempt to modify it, or obscure or remove the copyright notices or this software licence in any way. Nor may you attempt to make money from distributing it to others apart from media costs. You may not (and this part is especially true for those madly litigious Americans) sue the author or anybody else in respect of any supposed guarantee. You receive this software exactly "as is". There's no guarantee whatsoever. The author takes pride in his work, and naturally wants the software to behave well and do its job; but he isn't prepared (certainly not for software that you are getting entirely for free) to make any sort of guarantee of merchantability or fitness for any purpose. Bug fixes and enhancements to the software will occur entirely at the whim of the author, as and when he has spare time to write them. If you want a specific modification to the software, please remember that the author is a professional programmer. You can always pay him to write it! The source code for the software is the product of a lot of time, skill, and effort. It is not given away for free. If you need to have access to the source code, approach the author about paying for a source code licence. Technical support for the installation or use of the software consumes time and effort. If you need such support, approach the author about paying for a support contract. ═══ 2. Features ═══ Here are some of the main features of the OS/2 Command Line Utilities.  All of the utilities will operate beyond the year 2000 and beyond the year 2038 (the "drop dead" date for many other 32-bit programs written in C and C++), up to the year 2107.  All of the utilities are purely 32-bit, and contain no 16-bit code and no 64KiB limitations.  All of the utilities support long filenames, deep directory trees with many levels (up to the limit imposed by OS/2 itself), and large directories. For example, XDIR can sort directories containing at least 100,000 files, whereas the DIR command built in to 4OS2 fails when there are more than 20,000 files in a single directory, and the DIR command built in to CMD fails when asked to sort a directory containing more than 2073 files.  All of the utilities also retain the original case of files, rather than converting them to all-uppercase or all-lowercase as some other applications do, and have no problems with filenames containing embedded spaces or multiple full stops.  All of the utilities support the Universal Naming Convention for filenames, used by LANs and by OS/2 Warp Server 5 ("Aurora"). So one doesn't need to use drive letters in order to access and manipulate files and directories with the utilities, since one can use UNC names instead.  All of the utilities extend the normal OS/2 wildcards with an extended wildcard syntax that is much more versatile, allowing, for example, multiple extensions to be specified by a single wildcard: [c:\]xdir *.{exe,com,cmd,btm,bat}  The command-line interface of all of the utilities is logical and consistent. Several standard options are the same across many commands. Wherever possible, the same option will have the same meaning across all command line utilities that support it. One only, therefore, has to learn one set of option letters, rather than individual options for each command.  All of the utilities support the /? standard option, which provides a short summary of the options and arguments that the command accepts.  All of the utilities that operate upon multiple files allow files to be excluded and included according to their attributes, with the /A standard option.  All of the utilities access the system message files for the text of system error messages, meaning that error messages will be displayed in the current national language for the system.  Date and time support is fully internationalised. All of the utilities that display dates and times do so by default using the date and time formats appropriate to the current country , but they can also be told to display them in the standard format specified by ISO standard number 8601, which uses a full 4-digit year and a fixed descending order of fields to avoid the ambiguity that the country-specific formats have for the first 31 years of each century (e.g. 01/02/03).  Full timezone support is provided using the TZ environment variable, which is in the standard POSIX 1003.1 (ISO/IEC 9445-1:1990) format, allowing multiple utilities to operate simultaneously in different timezones with different daylight savings time rules, which are applied automatically at exactly the right point without need for user intervention. The local time, required by the ANACLOCK, DIGCLOCK, SAYDATE, SETDATE, and TOUCH commands, can be configured to be in any arbitrary timezone and use any daylight savings time rules.  The DUMP, FIND, GREP, SORT, STRINGS, SUM, TEE, TEXTCONV, WC, WHAT, and Y commands can be used as filter commands, for use in a command pipeline, acting upon what they receive from their standard input, and producing results on their standard output.  All of the text-mode utilities that do not deal with the Workplace Shell or Presentation Manager (i.e. all except RESETINI and TASKLIST) can be used when OS/2 is booted to a command line. ═══ 3. What is new and what has changed since version 1.0 ═══ All of the programs in the toolset are now fully 32-bit and are targetted at 32-bit OS/2 (i.e. OS/2 version 2.01 and later). Several of the utilities that were in previous releases only applied to DOS or to 16-bit OS/2 version 1.0, such as the CMOS command and the KEYLOCKS and LINES commands. They have been dropped from this release. Several new commands have been added: ANACLOCK, ARCDIR, BCOMP, CALCTZ, COMP, CPUIDG, CPUIDT, DELTREE, DIGCLOCK, DIRSIZE, FIND, FINDDUPS, FITSIZE, HELP, PARTLIST, RESETINI, SAYDATE, SETDATE, SORT, STRINGS, SUM, TASKLIST, TEE, TEXTCONV, TREE, WINSIGHT, and Y. The option syntax has been entirely revised, and some options that were inconsistent or superfluous, such as the /R switch to FF, have been modified or removed. Several new standard options, such as /U, have been added. The problem with using commands as filters has been fixed, and now many of the utilities really can be used as filters, acting upon their standard inputs. All commands issue error messages to the standard error stream, allowing errors to be directed to a different place to where the normal output of the command is directed. All commands that involve dates now accept and display four-digit years, avoiding the Year 2000 problem. Similarly, all commands will properly handle years beyond 2080 and 2100 (which much other "year 2000 compliant" software will not), and will cope properly with dates beyond the "binary millenium" in the year 2038, when some software will start to use negative dates. (Note: There are several bugs in the FAT and HPFS drivers for OS/2 itself, that, ironically, these utilities reveal. See the documentation for the TOUCH command for details. ) ═══ 3.1. Why the CMOS command is no more ═══ 32-bit OS/2 does not let application programs directly address the hardware, so the CMOS command is impossible in 32-bit OS/2. This is no great loss, however, since the variation in CMOS RAM contents has become even more diverse, and even less well documented. To be fair, the contents of the CMOS RAM are entirely the province of the system firmware, and firmware manufacturers are under no obligation to document any but the "traditional" fields. Most of the latter have no meaning any longer anyway. The drive type fields, displayed by the CMOS program, have no useful meaning on a modern machine, since the BIOS firmware queries ATA and ATAPI hardware directly during the POST for its size and capabilities, and has no need for a non-volatile storage area for a "drive type". ═══ 3.2. Why the KEYLOCKS and LINES commands are no more ═══ 32-bit OS/2 does not have facilities for text-mode programs to access the console. 32-bit OS/2 programs have to make use of the 16-bit OS/2 VIO, MOU, and KBD subsystems in order to do so. The KEYLOCKS and LINES commands have been dropped from the suite because it is thus impossible to implement them using pure 32-bit code, the same as all of the other commands have been. It is hoped that one day IBM will see the light, and will provide an official 32-bit API for 32-bit text-mode programs to access the console. ═══ 4. The command line ═══ The command line that is given to a command comprises a series of words, which are either option strings or arguments. Whitespace (e.g. the space or tab character) separates one word from the next. To include whitespace as part of a word, it is enclosed by quotation marks. To use quotation marks themselves in a word, the backslash is used to prevent a quotation mark, or another backslash, from having any special meaning. Quotation marks do not separate words, so multiple quoted strings without intervening whitespace will be treated as a single word. For example, [c:\]xdir "READ""ME" is the same as [c:\]xdir README ═══ 5. The syntax of command options ═══ In all commands, an option string is denoted by a word beginning with the option character, which is either the forward slash, /, or the dash, - (except for the ATTRIB command, which only allows the forward slash). The first option string encountered determines which of the two option characters will be recognised for that and all subsequent option strings. An option string comprises a sequence of options, separated by the option character. For example [c:\]wc /s/e *.txt Some options are toggles, which are either on or off. They may be followed by a plus sign, +, in order to force them to be toggled on, by a minus sign, -, in order to force them to be toggled off, or be used on their own, in which case the state of the toggle is flipped from on to off or from off to on. Some options take arguments. The argument immediately follows the option (for backwards compatibility, a colon is often allowed to separate the option from its argument, although it is not recommended that this practice be used), as in [c:\]touch /d1-1-80 * and [c:\]touch /d:1-1-80 * Options apply to all arguments that follow them on the command line, until countermanded. So, for example, in order to count the words in all *.TXT files in the current and all subdirectories, but only *.DOC files in the current directory, the command is [c:\]wc /s+ *.txt /s- *.doc In order to work with files whose names may begin with the option character, a word comprising a double option character (i.e. the double dash, --, or double forward slash, //) can be used to prevent all further words following it from being recognised as options. So, for example, in order to count the words in all files whose names begin with a dash, when the option character being used is itself a dash, the command is [c:\]wc -s -- -* ═══ 6. Standard options ═══ Several options have the same meaning in all commands that support them, for consistency and to make the commands easier to remember. /? Display command syntax information. /A Select files by attribute. /E Do not display non-fatal error messages. /N Simulate execution. /Q Operate quietly. /S Recurse into subdirectories. /U Do not display summary information. /Z Override the read-only attribute on files. /ISO8601 Display date and time in the standard format. ═══ 6.1. /? option ═══ The /? option displays syntax information for a command. This option, when used, must be the first option, and may not be combined with any other options. All other options and arguments to the command will be ignored. ═══ 6.2. /A option ═══ The /A option allows files to be included in and excluded from processing according to their attributes. It is used with commands that accept wildcard specifications. It takes an argument, which comprises a list of attributes to include, to exclude, and to require. An attribute preceded by a minus sign, '-', excludes all files with that attribute from processing. An attribute preceded by a plus sign, '+', includes all files with that attribute in processing (i.e. a file "may have" the attribute). An attribute on its own excludes all files without that attribute from processing (i.e. a file "must have" the attribute). For example, [c:\]xdir /a-rsh displays only those writable files that have the hidden and system attributes, whereas [c:\]xdir /a-r+s+h displays all writable files, including any that may have the hidden or system attributes. When used on its own with an empty argument (i.e. /A: or /A), all files are included. The default if the /A option is not present varies from command to command (e.g. XDIR includes files and directories by default; whereas TOUCH includes only files.). ═══ 6.3. /E option ═══ The /E option prevents non-fatal error messages from being displayed. Non-fatal errors include any errors reporting that a subdirectory contains no files during a recursive scan. ═══ 6.4. /ISO8601 option ═══ The /ISO8601 option causes a command to display dates and times in the ISO 8601 format. By default, commands will display dates and times in the format appropriate to the current country, which on OS/2 Warp is determined by the COUNTRY.SYS file and the COUNTRY directive in CONFIG.SYS. ═══ 6.5. /N option ═══ The /N option causes a command to simulate operation without actually making any changes to files or to the directory structure. ═══ 6.6. /Q option ═══ The /Q option causes a command to operate quietly, without displaying information about what it is doing as it proceeds. ═══ 6.7. /S option ═══ The /S option causes a command to operate recursively upon subdirectories. It is used with commands that accept wildcard specifications. The command operates on the directory given in the wildcard specification and on all subdirectories beneath that directory, using the same wildcard in each directory. ═══ 6.8. /U option ═══ The /U option prevents a command from displaying summary information after it has processed all files and directories, listing the total numbers of filenames scanned to match against the wildcard specifications, and the total number of files that were processed. ═══ 6.9. /Z option ═══ The /Z option causes a command to override read-only protection on files. This command is used with commands that modify or destroy files, such as TOUCH and XDEL. It forces the command to override the read-only attribute on a file that would normally prevent such operations. ═══ 7. Wildcards ═══ There are two difference sorts of wildcards. A wildcard filename specification denotes a set of files whose names match a given pattern. A substitution specification controls how a given filename is transformed into a different name. ═══ 7.1. Wildcard filenames ═══ Some commands allow multiple files to be specified using wildcard specifications. A wildcard specification comprises two parts: a directory prefix and a basename. The directory prefix is optional, and specifies the top-level directory (and drive) that is to be scanned for matching filenames. The drive letter prefix (followed by a colon) and everything up to and including the last slash in the wildcard specification is taken to be the directory prefix. If no directory prefix is supplied, the default is the current drive and directory. The basename specifies the pattern that filenames must match. If it is omitted, i.e. there is nothing after the final slash in the wildcard specification and the basename is blank, the default basename is "*". Examples: ┌────────────────────┬───────────────┬───────────────┐ │Wildcard │Directory │Basename │ ├────────────────────┼───────────────┼───────────────┤ │E:\SUBDIR\*.BAK │E:\SUBDIR\ │*.BAK │ ├────────────────────┼───────────────┼───────────────┤ │E:\*.BAK │E:\ │*.BAK │ ├────────────────────┼───────────────┼───────────────┤ │E:\SUBDIR\ │E:\SUBDIR\ │* │ ├────────────────────┼───────────────┼───────────────┤ │E:\SUBDIR │E:\ │SUBDIR │ └────────────────────┴───────────────┴───────────────┘ A basename comprises a mixture of literal characters and metacharacters. Literal characters in the basename must match the filename exactly. The metacharacters are as follows: * An asterisk matches zero or more characters. ? A question mark matches a single character. . A full stop matches another full stop '.' or the end of the filename. [abcd] Character sets delimited with brackets match exactly one character from that set. [0-9] Character ranges delimited with brackets match exactly one character within the range. {} Braces enclose a comma-delimited list of strings, any one of which may match that part of the name character within the range. It should be noted that both * and ? will match full stops ('.') in filenames. Full stops are not regarded as special in OS/2, and on HPFS volumes filenames can contain many full stops. This means that "*.exe" will match all files that end in the four characters '.', 'E', 'X', and 'E', irrespective of what occurs before. This is useful for processing files where one extension has been appended to another. The wildcard "*.gz", for example, will match all GZIP files, including any *.TAR.GZ files. Examples * All files. *.* All files. (This is for backwards compatibility only, and is highly discouraged. The behaviour of the full stop '.' character has had to be made inconsistent in order to allow this usage. Strictly speaking, "*.*" should match only those files that have at least one full stop '.' character in their name. "*" should be used instead of "*.*" to mean all files.) c*s All filenames starting with the letter 'C' and ending with the letter 'S'. *on* All filenames containing the two-letter sequence 'ON' somewhere. ??? All filenames that are exactly three characters long. [a-z]* All filenames beginning with a letter. *[0-9]* All filenames containing a digit somewhere. *.{htm,html,gif,jpg,jpeg} All HTML, GIF, and JPEG files. *.{su,mo,tu,we,th,fr,sa}[0-9] All Fidonet compressed ARCmail packets. ═══ 7.2. Wildcard substitutions ═══ Some commands allow "destination" filenames to be constructed from "source" filenames according to a given pattern. A substitution specification comprises an optoinal directory prefix, which is used as it stands, and a base filename that contains the pattern to apply to the "source" base name, comprising literal characters and metacharacters. The following metacharacters are defined: * An asterisk substitutes all characters from the source up until the first character that matches the next part of the pattern. ? A question mark substitutes a single character from the source to the destination, unless that character is a full stop. . A full stop substitutes a full stop into the destination and skips all characters in the source from the current position until either the next full stop or the end of the string. Literal characters in the pattern are substituted into the destination directly, and a single character from the source is skipped, unless that character is a full stop. Examples ┌─────────────────────────┬────────────────────┬─────────────────────────┐ │SOURCE │PATTERN │RESULT │ ├─────────────────────────┼────────────────────┼─────────────────────────┤ │attrib.exe │*.com │attrib.com │ ├─────────────────────────┼────────────────────┼─────────────────────────┤ │attrib.exe │*com │attrib.execom │ ├─────────────────────────┼────────────────────┼─────────────────────────┤ │comp.exe │*com │com │ ├─────────────────────────┼────────────────────┼─────────────────────────┤ │comp.exe │attrib.* │attrib.exe │ ├─────────────────────────┼────────────────────┼─────────────────────────┤ │comp.exe │attrib* │attrib.exe │ ├─────────────────────────┼────────────────────┼─────────────────────────┤ │sendmail.8.6.9.tar.gz │*.8.6.10.* │sendmail.8.6.10.tar.gz │ ├─────────────────────────┼────────────────────┼─────────────────────────┤ │sendmail.8.6.9.tar.gz │*8.6.10* │sendmail.8.6.10.tar.gz │ ├─────────────────────────┼────────────────────┼─────────────────────────┤ │sendmail.8.6.9.tar.gz │zmailer.* │zmailer.8.6.9.tar.gz │ ├─────────────────────────┼────────────────────┼─────────────────────────┤ │sendmail.8.6.9.tar.gz │*.*.*.*.F* │sendmail.8.6.9.Far.gz │ ├─────────────────────────┼────────────────────┼─────────────────────────┤ │sendmail.8.6.9.tar.gz │*.*.*.*.F.* │sendmail.8.6.9.F.gz │ └─────────────────────────┴────────────────────┴─────────────────────────┘ ═══ 8. Dates and times ═══ All utilities which display dates, or accept date input, such as DIGCLOCK, SAYDATE, SETDATE, TOUCH, and XDIR, will by default use the date and time formats appropriate to the current country . This can be overridden by the use of the /ISO8601 standard option. Commands, such as DIGCLOCK, SAYDATE, and TOUCH, which obtain the current time from the system clock require the hardware real-time clock to be set to UTC and the TZ environment variable to be set correctly. Commands, such as DIGCLOCK, FF, SAYDATE, TOUCH, and XDIR, which display dates and times, can be given format strings to determine what format they use to display them. Commands, such as SAYDATE and SETDATE, where dates and times can be passed as arguments on the command line, accept date and time strings in one of several input formats. ═══ 8.1. Country-dependent date and time formats ═══ The default date and time formats are determined by the COUNTRY setting for OS/2. The separator characters may vary from those given here, but the formats for various countries are ┌──────────┬──────────┐ │U.S. │MM/DD/YYYY│ ├──────────┼──────────┤ │Japanese │YYYY.MM.DD│ ├──────────┼──────────┤ │European │DD-MM-YYYY│ └──────────┴──────────┘ for the date and ┌──────────┬──────────────────────────────┐ │British │HH:MM:SS am or HH:MM:SS pm │ ├──────────┼──────────────────────────────┤ │Other │HH:MM:SS │ └──────────┴──────────────────────────────┘ for the time. ═══ 8.2. Setting the hardware RTC correctly ═══ Commands such as DIGCLOCK, SAYDATE, and TOUCH obtain the current date and time from the OS/2 kernel using its DosQuerySysInfo API function, which yields a number giving the number of seconds since the start of the year 1970. This is a 64-bit number that can potentially last up to the year 584 thousand million. (The OS/2 kernel has no Year 2038 problem in this area.) The OS/2 kernel requires that the PC hardware real-time clock (RTC) be set to Universal Time (UTC) for this to operate correctly. The hardware RTC must not be set to local time, and daylight savings time changes must not be applied to it. Note: Many OS/2 users set the hardware RTC to local time, and the OS/2 kernel calculates UTC time incorrectly as a result. Many OS/2 programs read the RTC directly and assume that it runs in local time with daylight savings changes applied, rather than calling DosQuerySysInfo for the time as they should. (Such programs are generally poor, however, since they also all too often ignore timezones and the TZ environment variable as well. All too often this is a result of programmers thinking that they are still writing DOS programs.) But the correct configuration for OS/2, nonetheless, is for the hardware RTC to run in UTC, the same as for PC UNIX, and linux, systems. There are various OS/2 utilities available to synchronise the hardware RTC with time sources available via radio broadcasts or dial-up links in various countries, and across the Internet. If used, these must be configured to maintain the hardware RTC in UTC, not in local time. Note: The hardware RTC only supports 60 seconds per minute, and so must be adjusted every time a leap second is inserted or deleted from UTC. If the aforementioned utities are used, this will happen automatically. All commands will calculate the local time from the UTC time by applying the timezone offsets and daylight savings time rules supplied in the TZ environment variable. ═══ 8.3. The TZ environment variable ═══ The TZ environment variable determines the names for standard and daylight sayings time in the current timezone, the offsets from UTC for each, and the rules to apply to determine when each is in effect. Since this information is stored in an environment variable, one can potentially run commands like DIGCLOCK, SAYDATE, and TOUCH with different TZ environment variables on the same machine, allowing multiple timezones to be used simultaneously. The contents of the TZ environment variable are in the standard POSIX 1003.1 (ISO/IEC 9445-1:1990) format: sss[hh[:mm]]ddd[hh[:mm]][,start[/hh[:mm[:ss]]][,end[/hh[:mm[:ss]]]]] The first part of the TZ environment variable determines the names for standard and daylight savings time, and their offset from UTC in hours and (optionally) minutes west of of the Prime Meridian (i.e. the amount to subtract from UTC to obtain local standard/daylight savings time). If no offset is given for daylight savings time, the default is for it to be exactly one hour east of standard time. The second part gives rules for calculating the exact time for the start and end of daylight savings time, specifying the day of the year, and optionally the hour, minute, and second (in standard time), at which daylight savings time starts and ends. The "start" and "end" portions specify the day of the year, and can be in one of three forms: Mm.w.d The letter 'M' followed by three numbers, separated by dots, indicates the first day of week 'w' of month 'm', where weeks are considered to start on day 'd' (Sunday = 0). Jn The letter 'J' followed by a number, indicating the Nth day of the year (1-365), where February the 29th has no number. n A number, indicating the Nth day of the year (1-366). If the "start" day is earlier in the year than the "end" day, as it will be for the Northern Hemisphere, daylight savings time will apply between those days, and standard time otherwise. Otherwise, standard time will apply between the two days, and daylight savings time otherwise. The "time" portion specifies the hour, minute, and second, standard time, at which the change occurs. If it is omitted, the default is 02:00:00. The default start and end rules mandated by ISO/IEC 9445-1:1990, if none are supplied, are ",M4.1.0/02:00:00,M10.5.0/02:00:00", which is the rule that has applied in the United States of America since 1987. ("First Sunday in April, at 02:00:00 standard time, and last Sunday in October, at 02:00:00 standard time."). European users should note that this default rule is incorrect for many EU countries. This rule is also incorrect for all countries in the Southern Hemisphere. U.K. users should note that this scheme cannot encode the daylight savings time rules laid out in the Summer Time Act 1972. Luckily, the U.K. is part of the EU, and EU harmonisation directives override the Summer Time Act each year with simpler daylight savings time rules that can be encoded. Examples GMT0BST1,M3.5.0/01:00:00,M10.5.0/01:00:00 The full string for the U.K. including the correct rule for the years 1998 to 2001. GMT0BST,M3.5/1,M10.5/1 A shorter, but functionally identical, form of the above. CET-1CEST The string for Germany and other central European countries. The DST rule for the years 1998 to 2001 just happens to be identical to the POSIX default, and so can be omitted. EST-10EDT,M10.5.0,M3.5.0 Australian Eastern Standard/Daylight time. CST-9:30CDT,M10.5.0,M3.5.0 Australian Central Standard/Daylight time. EST5EDT U.S. Eastern Standard/Daylight time. PST8PDT U.S. Pacific Standard/Daylight time. NST3:30NDT1:30 Newfoundland Standard/Daylight time. ═══ 8.4. Date output formats ═══ The format string used to format a date and time for output is a superset of the format string used by the ISO Standard C function strftime() that includes several extensions from POSIX. All characters apart from any format specifiers are written as they stand. The following format specifiers are defined: ┌──────────┬─────────────────────────────────────────────────────────────────┐ │%% │A single % character │ ├──────────┼─────────────────────────────────────────────────────────────────┤ │%a │The current abbreviated weekday name │ ├──────────┼─────────────────────────────────────────────────────────────────┤ │%A │The current full weekday name │ ├──────────┼─────────────────────────────────────────────────────────────────┤ │%b │The current abbreviated month name │ ├──────────┼─────────────────────────────────────────────────────────────────┤ │%B │The current full month name │ ├──────────┼─────────────────────────────────────────────────────────────────┤ │%C │The current century prefix (i.e. "19" for the years 1900 to 1999)│ ├──────────┼─────────────────────────────────────────────────────────────────┤ │%c │The full date and time in a format appropriate to the current │ │ │country. │ ├──────────┼─────────────────────────────────────────────────────────────────┤ │%D │The date in MM/DD/YY format. This U.S. date format is ambiguous, │ │ │since it is easily confused with the DD/MM/YY format used by │ │ │other countries on 12 days per month. Also, in the first 31 │ │ │years of every century it can be confused with the YY/MM/DD │ │ │format (beginning with the 1st of January, 2001). This format │ │ │specifier is provided for compatibility with older, POSIX, │ │ │softwares and U.S. users. Its use is discouraged. Use %F. │ ├──────────┼─────────────────────────────────────────────────────────────────┤ │%d │The day of the month as a two digit number 01-31 │ ├──────────┼─────────────────────────────────────────────────────────────────┤ │%e │The day of the month as a two character, space padded, number │ │ │1-31 │ ├──────────┼─────────────────────────────────────────────────────────────────┤ │%F │The date in ISO 8601 format YYYY-MM-DD │ ├──────────┼─────────────────────────────────────────────────────────────────┤ │%G │The ISO 8601 "week year". │ ├──────────┼─────────────────────────────────────────────────────────────────┤ │%g │The last two digits of the ISO 8601 "week year" 00-99. │ ├──────────┼─────────────────────────────────────────────────────────────────┤ │%h │The same as %b. This format specifier is provided for │ │ │compatibility with older, POSIX, softwares. Use %b. │ ├──────────┼─────────────────────────────────────────────────────────────────┤ │%H │The hour as a two digit number 00-23 │ ├──────────┼─────────────────────────────────────────────────────────────────┤ │%I │The hour as a two digit number 00-11 │ ├──────────┼─────────────────────────────────────────────────────────────────┤ │%j │The day of the year as a three digit number 001-366 │ ├──────────┼─────────────────────────────────────────────────────────────────┤ │%m │The month of the year as a two digit number 01-12 │ ├──────────┼─────────────────────────────────────────────────────────────────┤ │%M │The minute as a two digit number 00-59 │ ├──────────┼─────────────────────────────────────────────────────────────────┤ │%n │A newline sequence (CRLF) │ ├──────────┼─────────────────────────────────────────────────────────────────┤ │%p │The string "AM" or "PM", as appropriate │ ├──────────┼─────────────────────────────────────────────────────────────────┤ │%r │The time in 12-hour HH:MM:SS form followed by "AM" or "PM" as │ │ │appropriate This format specifier is provided for compatibility │ │ │with older, POSIX, softwares and British users. Use %T. │ ├──────────┼─────────────────────────────────────────────────────────────────┤ │%R │The time in HH:MM form. │ ├──────────┼─────────────────────────────────────────────────────────────────┤ │%S │The second as a two digit number 00-60 │ ├──────────┼─────────────────────────────────────────────────────────────────┤ │%t │A tab character (TAB) │ ├──────────┼─────────────────────────────────────────────────────────────────┤ │%T │The time in ISO 8601 format HH:MM:SS │ ├──────────┼─────────────────────────────────────────────────────────────────┤ │%u │The day of the week as a two digit number 01-07 (Monday=01) │ ├──────────┼─────────────────────────────────────────────────────────────────┤ │%U │The week number of the year 00-52 (weeks start on Sunday) │ ├──────────┼─────────────────────────────────────────────────────────────────┤ │%V │The ISO 8601 week number of the year 01-53 │ ├──────────┼─────────────────────────────────────────────────────────────────┤ │%w │The day of the week as a two digit number 00-06 (Sunday=00) │ ├──────────┼─────────────────────────────────────────────────────────────────┤ │%W │The week number of the year 00-52 (weeks start on Monday) │ ├──────────┼─────────────────────────────────────────────────────────────────┤ │%x │The date in a format appropriate to the current country. │ ├──────────┼─────────────────────────────────────────────────────────────────┤ │%X │The time in a format appropriate to the current country. │ ├──────────┼─────────────────────────────────────────────────────────────────┤ │%y │The last two digits of the year 00-99 │ ├──────────┼─────────────────────────────────────────────────────────────────┤ │%Y │The full year number │ ├──────────┼─────────────────────────────────────────────────────────────────┤ │%z │The time zone expressed as an +HHMM offset from UTC │ ├──────────┼─────────────────────────────────────────────────────────────────┤ │%Z │The current time zone abbreviation │ └──────────┴─────────────────────────────────────────────────────────────────┘ ═══ 8.5. Date input formats ═══ The arguments to SAYDATE or SETDATE can be in any of the following formats: ┌──────────────────────────────┬──────────────────────────────┐ │Full ISO 8601 │2001-2-3 16:50:04 │ ├──────────────────────────────┼──────────────────────────────┤ │Full ISO 8601 with timezone │2001-2-3 16:50:04 -0900 │ ├──────────────────────────────┼──────────────────────────────┤ │ISO 8601 date only │2001-2-3 │ ├──────────────────────────────┼──────────────────────────────┤ │ISO 8601 time only │16:50:04 │ ├──────────────────────────────┼──────────────────────────────┤ │HH:MM │16:50 │ ├──────────────────────────────┼──────────────────────────────┤ │Mon DD, YYYY HH:MM:SS │Feb 03, 2001 16:50:04 │ ├──────────────────────────────┼──────────────────────────────┤ │Mon DD, YYYY HH:MM │Feb 03, 2001 16:50 │ ├──────────────────────────────┼──────────────────────────────┤ │Mon DD, YYYY │Feb 03, 2001 │ ├──────────────────────────────┼──────────────────────────────┤ │Mon DD HH:MM:SS │Feb 03 16:50:04 │ ├──────────────────────────────┼──────────────────────────────┤ │Mon DD HH:MM │Feb 03 16:50 │ ├──────────────────────────────┼──────────────────────────────┤ │Mon DD │Feb 03 │ ├──────────────────────────────┼──────────────────────────────┤ │Day HH:MM:SS │Wed 16:50:04 │ ├──────────────────────────────┼──────────────────────────────┤ │Day HH:MM │Wed 16:50 │ ├──────────────────────────────┼──────────────────────────────┤ │Day │Wed │ └──────────────────────────────┴──────────────────────────────┘ ═══ 9. Redirecting input and output ═══ Although the DUMP, FIND, GREP, SORT, STRINGS, SUM, TEE, TEXTCONV, WC, WHAT, and Y commands can be used as filter commands, all commands use their standard input, standard output, and standard error for input and output. No command accesses the keyboard or screen directly. Commands send their error messages to standard error, rather than to standard output, to allow error messages to be separated from the normal output of the command, if necessary. The command [c:\]xdir /s * >outfile.txt merely redirects the standard output to the file OUTFILE.TXT. The standard error is not redirected, and error messages will still be displayed on the screen. To combine error messages with the normal output of the command, the command interpreter must be told to combine the standard output and standard error. The syntax in most command interpreters, including 4OS2 and CMD, to do this is [c:\]xdir /s * >outfile.txt 2>&1 Notice that the "2>&1" redirects standard error (handle 2) to whatever standard output (handle 1) is at the time, and so must follow the redirection for standard output. ═══ 10. Use with 4OS2 and Take Command for OS/2 ═══ The following sections cover some topics that apply only to users of JP Software's 4OS2 and Take Command for OS/2 command interpreters. ═══ 10.1. Descriptions ═══ The distribution archive contains, in the extended attributes for the executables, descriptions for each of the executables (which are also listed in the Manifest). These descriptions can be seen on your Workplace Shell desktop by looking in the "Subject" field on the "File" page of the properties notebook for each *.EXE file. 4OS2 and Take Command users can configure their command interpreters to use the same extended attributes for their file descriptions (instead of ugly DESCRIPT.ION files), by ensuring that the directive DescriptionName=EA is in the 4OS2.INI and TCMDOS2.INI files. ═══ 10.2. Use as "TTY" commands in Take Command ═══ All of the text-mode OS2CLU commands can be used as "tty" commands in Take Command for OS/2, because they all use their standard input, standard output, and standard error for input and output. No command accesses the keyboard or screen directly. To use the OS2CLU commands as "tty" commands in TCOS2, either 1. use the START command: [c:\]start /tty ff /s/e *.txt or 2. choose the "Configuring TTY Apps..." menu item off the "Setup" menu and add the OS2CLU commands to the list of TTY applications. ═══ 10.3. Disabling built-in commands ═══ In the 4OS2 and Take Command for OS/2 command interpreters, the ATTRIB, HELP, TOUCH, TEE, TREE, and Y commands are built in to the command interpreters themselves. By default, therefore, whenever the TOUCH command is invoked, the built-in version of TOUCH in 4OS2/TCOS2 is executed by the command interpreter, not the OS2CLU one. ( CMD, the default command interpreter that comes with OS/2, has no built-in ATTRIB command, by comparison, and so always executes the external ATTRIB.EXE utility when the ATTRIB command is invoked, whether the 16-bit one that comes with OS/2 or the 32-bit OS2CLU one. ) To prevent 4OS2 and TCOS2 from executing their built-in commands, either 1. disable the built-in versions of these commands by using the SETDOS utility in each instance of the command interpreter: [c:\]setdos /i-attrib /i-help /i-touch /i-tee /i-tree /i-y or 2. invoke the OS2CLU commands using their full pathnames: [c:\]c:\clu\tree c:\ ═══ 11. ANACLOCK - Display an analogue clock in a window ═══ Synopsis ANACLOCK [/?] [/ISO8601] [/ONTOP] [/CONFIRMCLOSE] [/WIDGETS] [/Iinstancename] [/Ntitle] [/TZtzstring] [/U[+|-]] Options /? Display command syntax information. /N Specify the title text for the window. /I Specify the "instance" name used for saving and restoring the window position to and from the OS/2 User Profile file. /TZ Specify a timezone string to use. This overrides whatever TZ environment variable ANACLOCK may have inherited from its parent process. /U Force ANACLOCK to use UTC time rather than local time. (default:OFF) If this toggle is ON, ANACLOCK displays UTC time. If this toggle is OFF, ANACLOCK displays local time. /ISO8601 Display date and time in the standard format. /WIDGETSHide the window "widgets", i.e. the system menu, the hide and close buttons, and the title bar. (default:OFF) /ONTOP Force ANACLOCK to place itself at the top of the z-order every second. (default:OFF) /CONFIRMCLOSERequire confirmation before closing the program. (default:OFF) Description The ANACLOCK command displays an analogue clock in a Presentation Manager window, updating it once per second. Note: For correct operation, the hardware real-time clock must be set to UTC and the TZ environment variable must be properly set. The purpose of the /TZ option is to provide a means for setting the TZ environment variable when ANACLOCK is invoked from the Workplace Shell. When ANACLOCK is invoked from the command line or a command script file, the TZ environment variable to use can be specified by using the SET command, since ANACLOCK will inherit it from the command interpreter. Commands run from Workplace Shell, however, inherit their environment variables from the Workplace Shell process, which has no means for altering its environment variables (apart from editing CONFIG.SYS and rebooting). So in order to run different instances of ANACLOCK with different environment variables, use the /TZ option to specify the timezone string by placing it in the program parameters field of the properties notebook for the program object(s) that starts ANACLOCK. Note: ANACLOCK writes its current window position, whenever it exits, to the "OS2CLU Analogue Clock:Position" section of the OS/2 User Profile file (usually C:\OS2\OS2.INI), which it then reads and uses when it next starts up. The name of the key used is determined by the /I option. Examples The following command script starts six instances of ANACLOCK, each running in a different timezone: @echo off setlocal set TZ=PST9PDT start /n anaclock /n"U.S. Pacific Time" set TZ=MST7MDT start /n anaclock /n"U.S. Mountain Time" set TZ=EST5EDT start /n anaclock /n"U.S. Eastern Time" set TZ=GMT0BST,M3.5/1,M10.5/1 start /n anaclock /n"United Kingdom Time" set TZ=EST-10EDT,M10.5,M3.5 start /n anaclock /n"Australian Eastern Time" set TZ=NZST-11NZDT,M10.5,M3.3 start /n anaclock /n"New Zealand Time" Each instance will change between the standard and the daylight savings time for its timezone automatically, and independently of all of the others (and also on different dates, since the DST rules for the U.K., Australia, and New Zealand do not match those for the U.S.). ═══ 12. ARCDIR - Display archive directory ═══ Synopsis ARCDIR [/?] [/A[[-|+]drash]] [/SEBUFC[-|+]] [/O[fmt]] Archive [Filespecs ...] Options /? Display command syntax information. /A Select files by attribute. /E Do not display non-fatal error messages. /S Recurse into subdirectories. /U Do not display summary information. /T Specify, or override, the archive type: ARC Treat as an ARC or PAK archive ARJ Treat as an ARJ archive LZH Treat as an LZH or LHA archive RAR Treat as a RAR archive ZIP Treat as a ZIP archive ZOO Treat as a ZOO archive /O Specify a sort string that determines how the output should be sorted, comprising zero or more of the following characters (optionally preceded by '-' to reverse the sense): A Sort by name, treating digits as numbers. D Sort by date stamp (according to the /T option). E Sort by extension (the part of the name following the final full stop). G Sort by attribute (directories, then hidden and system files, then all other files). N Sort by name. S Sort by size. /B Display "brief" output, which doesn't include the sizes or space allocated. /C Display the name of the containing archive file. (Default:ON) /ISO8601 Display date and time in the standard format. Description The ARCDIR command displays the names of all of the files that match the wildcard specifications that are in archives that match the archive name wildcard specification. ARCDIR understands ARC, ARJ, LZH, RAR, ZIP, and ZOO archive files. The /T option allows the output format to be specified, overriding the choice of format which would otherwise be based on the extension portion of the name of the file being dumped. For example, the command [c:\]arcdir file.zip *.txt displays the names of all *.TXT files in FILE.ZIP, deducing that the file is a ZIP archive from its extension, whereas [c:\]arcdir /t:rar file.exe *.txt displays the names of all *.TXT files in FILE.EXE, as if it were a RAR archive. This is useful for dumping self-extracting archives where normally the archive type cannot be deduced from the name. The /O option causes files to be sorted in memory, and displayed in sorted order once all files have been found. There may thus be a delay between the command being invoked and it producing any output. If the internal sort buffer overflows (if the system is low on available virtual memory), files are displayed in unsorted order. If no sort options are specified, the sort order is the order that files were found. ( There is no 'U' for "Unsorted" option. It makes no sense to have a sort option letter that specifies that there are no sort option letters! For unsorted output, simply don't use the /O option at all. ) The 'A' sort option performs an "alphanumeric" sort by filename, whereas the 'N' sort option is a plain lexical sort. When 'A' is used, sequences of digits in the name are treated as numbers. So "FILE3.TXT" will precede "FILE0012.TXT" because 3 is less than 12, even though "3" is lexically greater than "0012". Examples [C:\CLU]arcdir /iso8601 os2clu02.{RAR,ZIP} *.txt 1999-08-13 18:12:12 2058 5719 _____A (OS2CLU02.RAR) readme.txt 1999-08-18 10:45:50 6299 20423 _____A (OS2CLU02.RAR) blurb.txt 1999-08-18 10:45:50 6674 20423 ______ (OS2CLU02.ZIP) blurb.txt 1999-08-13 18:12:12 2048 5719 ______ (OS2CLU02.ZIP) readme.txt 4 files found, 104 files scanned. 2 archives found, 7 (potential) archives scanned. [C:\CLU]arcdir /iso8601 /od os2clu02.{RAR,ZIP} *.txt 1999-08-13 18:12:12 2058 5719 _____A (OS2CLU02.RAR) readme.txt 1999-08-13 18:12:12 2048 5719 ______ (OS2CLU02.ZIP) readme.txt 1999-08-18 10:45:50 6299 20423 _____A (OS2CLU02.RAR) blurb.txt 1999-08-18 10:45:50 6674 20423 ______ (OS2CLU02.ZIP) blurb.txt 4 files found, 104 files scanned. 2 archives found, 7 (potential) archives scanned. ═══ 13. ATTRIB - Change file attributes ═══ Synopsis ATTRIB [/?] [/A[[+|-]drash]] [/ENPQSU] [-|+RASH] [Filespecs ...] Options /? Display command syntax information. /A Select files by attribute. /E Do not display non-fatal error messages. /N Simulate execution. /Q Operate quietly. /S Recurse into subdirectories. /U Do not display summary information. Description The ATTRIB command displays, and optionally changes, the file attributes of the files specified in the wildcard specifications. If no filenames are supplied, ATTRIB will display the attributes of all files in the current directory. Unlike the ATTRIB command supplied with OS/2, ATTRIB supports extended wildcards, selection of files by attribute, and allows multiple operations upon files. It is also a 32-bit program. (The OS/2 ATTRIB program is a 16-bit program.) If no changes are specified, ATTRIB just displays the attributes of the selected files. Changes are specified using '+' and '-' followed by one or more attribute letters, and apply to all filenames that follow them on the command line. Examples To remove the read only attributes from all *.ZIP files, but remove the system, hidden, and read-only attributes from all *.TXT files: [c:\CLU]attrib -R *.zip -S-H *.txt R____A -> _____A OS2CLU02.ZIP _HS__A -> _____A blurb.txt _HS__A -> _____A readme.txt 3 files changed of 3 files found, 3 files scanned. To add the read-only attribute to all GIF and JPEG files, in all subdirectories off the current directory, that aren't already read-only: [c:\]attrib +R /s/a:-r *.{gif,jpg,jpeg} ═══ 14. BCOMP - Binary compare two files ═══ Synopsis BCOMP [/?] [/U[-|+]] File1 File2 Options /? Display command syntax information. /U Do not display summary information. Note The BCOMP command is retained for backwards compatibility only, and may well be removed in a future release. It is highly recommended to use the COMP command instead of the BCOMP command. (COMP supports wildcards, and allows limits to be placed on the number of matches to report.) Description The BCOMP command compares the first file with the second, using a plain "binary" byte-for-byte comparison. All differences between the two files are displayed in hexadecimal and ASCII, 16 bytes at a time, with the first file's data immediately above the second for ease of comparison. Examples [C:\CLU]bcomp OS2CLU02.hlp OS2CLU02.INF 00000000: 48 53 50 10 9b 00 02 02 4e 00 0b 01 00 00 0f 0a : HSPЫ·N····· 00000000: "" "" "" 01 "" "" "" "" "" "" "" "" "" "" "" "" : HSPЫ·N····· 1 differences. ═══ 15. CALCTZ - Calculate the TZ environment variable ═══ Synopsis CALCTZ [/?] [/CONFIRMCLOSE] [/TZtzstring] Options /? Display command syntax information. /TZ Specify a timezone string to use. This overrides whatever TZ environment variable CALCTZ may have inherited from its parent process. /CONFIRMCLOSERequire confirmation before closing the program. (default:OFF) Description The CALCTZ command is used to calculate the value to use for the TZ environment variable. It presents a dialogue box allowing one to specify the daylight savings time rules, and the standard and daylight savings time abbreviations and offsets from UTC, from which it calculates and presents the TZ environment variable to use. CALCTZ initialises its display from the value of the TZ environment variable that it inherits when it is started, and can thus be used to test whether a TZ environment variable string conforms to the ISO/IEC 9445-1:1990 (POSIX) standard. The purpose of the /TZ option is to provide a means for setting the TZ environment variable when CALCTZ is invoked from the Workplace Shell. When CALCTZ is invoked from the command line or a command script file, the TZ environment variable to use can be specified by using the SET command, since CALCTZ will inherit it from the command interpreter. CALCTZ does not alter any system files, or change the value of the TZ environment variable in any process. Instead, it presents the value to use in an entryfield at the bottom of the dialogue. This value can be used in one of three ways:  It can be copied and pasted from the entry field, via a text editor, to the CONFIG.SYS file. The new value for TZ will then be used when the operating system is next started.  It can be copied and pasted from the entry field, via a text editor, to a command script that sets the TZ environment variable with the SET command. Running the command script will set the TZ environment variable to the new value in the command interpreter, which will be inherited by all processes that are subsequently started from the command interpreter.  It can be copied and pasted from the entry field to the "Parameters" field of the Properties notebook for a Program object on the Workplace Shell desktop that starts the DIGCLOCK program, for use with DIGCLOCK's /TZ option. ═══ 16. COMP - Binary compare files ═══ Synopsis COMP [/?] [/A[[-|+]drash]] [/SEQU[-|+]] [/M[n]] File1 File2 Options /? Display command syntax information. /A Select files by attribute. /E Do not display non-fatal error messages. /Q Operate quietly. /S Recurse into subdirectories. /U Do not display summary information. /M Specify the maximum number of differences to report for each pair of files. (default:4294967295) Description The COMP command compares the files that match the first wildcard specification with the files indicated by the second substitution specification, using a plain "binary" byte-for-byte comparison. All differences between the two files are displayed in hexadecimal and ASCII, 16 bytes at a time, with the first file's data immediately above the second for ease of comparison. "Ditto" marks in the hexadecimal values indicate bytes that have the same value in the second file as in the first. The /M option controls how many such sets of differences are reported for each pair of files being compared. Examples [C:\CLU]comp *.HLP *.INF Differences between OS2CLU02.hlp and OS2CLU02.INF: 00000000: 48 53 50 10 9b 00 02 02 4e 00 0b 01 00 00 0f 0a : HSPЫ·N····· 00000000: "" "" "" 01 "" "" "" "" "" "" "" "" "" "" "" "" : HSPЫ·N····· 0 files matched of 1 files found, 1 files scanned. [C:\CLU]comp /m0 OS2CLU02.* *.zip OS2CLU02.dll differs from OS2CLU02.zip OS2CLU02.hlp differs from OS2CLU02.zip OS2CLU02.INF differs from OS2CLU02.zip OS2CLU02.RAR differs from OS2CLU02.zip OS2CLU02.TAR.bz2 differs from OS2CLU02.zip OS2CLU02.TAR.gz differs from OS2CLU02.zip OS2CLU02.ZIP matches OS2CLU02.zip 1 files matched of 7 files found, 7 files scanned. ═══ 17. CONVCASE - Convert the case of file and directory names ═══ Synopsis CONVCASE [/?] [/A[[+|-]drash]] [/SEQU[+|-]] [/METHOD] Filespecs ... Options /? Display command syntax information. /A Select files by attribute. /E Do not display non-fatal error messages. /N Simulate execution. /Q Operate quietly. /S Recurse into subdirectories. /U Do not display summary information. /UPPER Convert filenames to all uppercase. /MIXED Convert filenames to mixed case, with the start of each "word" capitalised. /LOWER Convert filenames to all lowercase. Note The FAT filesystem, in all filename operations, silently converts lower case characters to upper case. The CONVCASE command will therefore have no effect on FAT volumes. The behaviour of the filesystem driver is not within the control of the CONVCASE command. Description The CONVCASE command changes the case of the filenames specified by the wildcard specifications. The /UPPER, /LOWER, and /MIXED options control whether the target filename will be in upper, lower, or mixed case. Unlike other case conversion utilities, CONVCASE does not use intermediate names for files, and so will not encounter name conflicts, and cannot be forcibly terminated such that a filename is left in an intermediate state. Examples [C:\CLU]convcase /upper w*.exe WC.exe -> WC.EXE What.exe -> WHAT.EXE Which.exe -> WHICH.EXE WinSight.exe -> WINSIGHT.EXE 4 files converted of 4 files found, 4 files scanned. [C:\CLU]convcase /mixed w*.exe WC.EXE -> Wc.Exe WHAT.EXE -> What.Exe WHICH.EXE -> Which.Exe WINSIGHT.EXE -> Winsight.Exe 4 files converted of 4 files found, 4 files scanned. ═══ 18. CPUIDG - Graphical display of CPU ID information ═══ Synopsis CPUIDG [/?] [/CONFIRMCLOSE] [/Iinstancename] Options /? Display command syntax information. /I Specify the "instance" name used for saving and restoring the window position to and from the OS/2 User Profile file. /CONFIRMCLOSERequire confirmation before closing the program. (default:OFF) Description The CPUIDG command displays, in a dialogue box, all of the information about the CPU that may be obtained from the CPUID instruction. Note: CPUIDG writes its current window position, whenever it exits, to the "OS2CLU CPU Information:Position" section of the OS/2 User Profile file (usually C:\OS2\OS2.INI), which it then reads and uses when it next starts up. The name of the key used is determined by the /I option. ═══ 19. CPUIDT - Display CPU ID information ═══ Synopsis CPUIDT [/?] Options /? Display command syntax information. Description The CPUIDT command displays, as text, all of the information about the CPU that may be obtained from the CPUID instruction. ═══ 20. DELTREE - Delete an entire subtree ═══ Synopsis DELTREE [/?] [/A[[-|+]drash]] [/EQNUWF[-|+]] Filespecs ... Options /? Display command syntax information. /A Select files by attribute. /E Do not display non-fatal error messages. /N Simulate execution. /Q Operate quietly. /U Do not display summary information. /F Prevent undelete information from being saved. (default:OFF) /W Zero the contents of each file before deleting it. (default:OFF) ( Note on wiping files) Use this option with caution. The contents of all files deleted in this manner are unrecoverable. Even if undeleted with the UNDELETE command, the original contents of the files will have been lost. /ISO8601 Display date and time in the standard format. Description The DELTREE command is a wrapper around the XDEL command that provides functionality similar to the DELTREE command supplied with MS-DOS and DR-DOS (whose DELTREE command is also a wrapper around its XDEL command, incidentally). It prefixes the /S, /X, and /Z options to its command line before passing it to XDEL, and thus deletes the files specified by the wildcard specifications, recursing into subdirectories, deleting empty directories, and overriding read-only protection on files. Unlike the DELTREE command supplied with DR-DOS and MS-DOS, DELTREE supports extended wildcards and selection of files by attribute. Examples [c:\]deltree c:\subdir1\ deletes the entire tree rooted at the directory C:\SUBDIR1\, including read-only files and removing all empty subdirectories as well. Notice the trailing slash. [c:\]deltree c:\subdir1 recursively scans the entire directory tree on drive C:, starting from the root, deleting all files named SUBDIR1 and removing all empty subdirectories. Directories in the Workplace Shell Desktop are usually empty, and will be deleted by this command if your WPS desktop happens to be on drive C:. This will cause your system to become unbootable. [c:\]deltree /w *.txt deletes all *.TXT files from the current directory and all directories below it, including read-only files, overwriting them entirely with zeroes first, and removes all empty subdirectories found along the way. ═══ 21. DIGCLOCK - Display the date and time in a window ═══ Synopsis DIGCLOCK [/?] [/ISO8601] [/BROKENWPS] [/ONTOP] [/CONFIRMCLOSE] [/WIDGETS] [/FONTfontstr] [/Fformat] [/Iinstancename] [/Ntitle] [/TZtzstring] [/U[+|-]] Options /? Display command syntax information. /F Specify a format string to use for displaying the date. If this option is not specified, the default string is either "%c %Z" (display the date in a format determined by the country settings) or, if the the /ISO8601 option is given, "%F %T %z". /N Specify the title text for the window. /I Specify the "instance" name used for saving and restoring the window position to and from the OS/2 User Profile file. /TZ Specify a timezone string to use. This overrides whatever TZ environment variable DIGCLOCK may have inherited from its parent process. /U Force DIGCLOCK to use UTC time rather than local time. (default:OFF) If this toggle is ON, DIGCLOCK displays UTC time. If this toggle is OFF, DIGCLOCK displays local time. /ISO8601 Display date and time in the standard format. /BROKENWPSIf a format string is supplied with the /F option, convert all '$' symbols in the string to '%' symbols. This allows a format string to be specified in the "Parameters" field of a Workplace Shell Desktop program object. The Workplace Shell handles '%' characters in the Parameters field of a program object, and (alas!) provides no means for passing a literal '%' character to a program. /ONTOP Force DIGCLOCK to place itself at the top of the z-order every second. (default:OFF) /CONFIRMCLOSERequire confirmation before closing the program. (default:OFF) /WIDGETSHide the window "widgets", i.e. the system menu, the hide and close buttons, and the title bar. (default:OFF) /FONT Specify the font to use. The name must be in the format used for font names (i.e.including size) in the Font Palette in the OS/2 System Setup folder. Description The DIGCLOCK command displays the date and time in a Presentation Manager window, updating it once per second. Note: For correct operation, the hardware real-time clock must be set to UTC and the TZ environment variable must be properly set. The purpose of the /TZ option is to provide a means for setting the TZ environment variable when DIGCLOCK is invoked from the Workplace Shell. When DIGCLOCK is invoked from the command line or a command script file, the TZ environment variable to use can be specified by using the SET command, since DIGCLOCK will inherit it from the command interpreter. Commands run from Workplace Shell, however, inherit their environment variables from the Workplace Shell process, which has no means for altering its environment variables (apart from editing CONFIG.SYS and rebooting). So in order to run different instances of DIGCLOCK with different environment variables, use the /TZ option to specify the timezone string by placing it in the program parameters field of the properties notebook for the program object(s) that starts DIGCLOCK. The % character is a metacharacter in the various command-line interpreters. This means that in order to pass it to the DIGCLOCK command it must be doubled (i.e. four % characters if a literal % character is required in the display). Alternatively, either use the ^ character to "escape" the % character, such as in the command [c:\]digclock /f"The year is "^%Y. or (4OS2 and Take Command only) use the backquote character to prevent metacharacter recognition, such as in the command [c:\]digclock /f`"%G week %V, %a %T %Z"` Note: DIGCLOCK writes its current window position, whenever it exits, to the "OS2CLU Digital Clock:Position" section of the OS/2 User Profile file (usually C:\OS2\OS2.INI), which it then reads and uses when it next starts up. The name of the key used is determined by the /I option. Examples The following command script starts six instances of DIGCLOCK, each running in a different timezone: @echo off setlocal set TZ=PST9PDT start /n digclock /n"U.S. Pacific Time" set TZ=MST7MDT start /n digclock /n"U.S. Mountain Time" set TZ=EST5EDT start /n digclock /n"U.S. Eastern Time" set TZ=GMT0BST,M3.5/1,M10.5/1 start /n digclock /n"United Kingdom Time" set TZ=EST-10EDT,M10.5,M3.5 start /n digclock /n"Australian Eastern Time" set TZ=NZST-11NZDT,M10.5,M3.3 start /n digclock /n"New Zealand Time" Each instance will change between the standard and the daylight savings time for its timezone automatically, and independently of all of the others (and also on different dates, since the DST rules for the U.K., Australia, and New Zealand do not match those for the U.S.). ═══ 22. DIRSIZE - Display directory sizes ═══ Synopsis DIRSIZE [/?] [/A[[-|+]drash]] [/SEXCQUB[-|+]] [Filespecs ...] Options /? Display command syntax information. /A Select files by attribute. /E Do not display non-fatal error messages. /Q Operate quietly. /S Recurse into subdirectories. /U Do not display summary information. /B Display "brief" output, which doesn't include the sizes or space allocated. /C Do not display column headings. /X Do not display directories where no files match the wildcard specifiction. Description The DIRSIZE command displays the total size, total space allocated for, and the total number of all files that match the wildcard specifications, and the name of the directory containing them. Unlike the GNU DU command, the DIRSIZE command reports on the total number of matching files found and the space actually allocated to them, as well as the total size; also unlike the DNU DU command, it allows wildcard specifications. Note The sizes of directories, i.e. the number of bytes on disc that are consumed by the directories themselves, are not reported by OS/2 to applications. OS/2 always returns 0 for the length and allocation size of a directory. (This is the reason that the DIR command built into the command interpreter displays "" in the length field for directories.) DIRSIZE therefore cannot include, in the total for any given directory, the sizes of the directories that it contains, and can only include the sizes of the files that it contains. If this behaviour of OS/2 is ever fixed, DIRSIZE will automatically display the correct size information, however. Examples To report the sizes per directory of all executable files in all subdirectories below the current directory: [C:\UTILS]dirsize /sec *.{exe,com,btm,cmd,bat} 2020668 2032128 49 bin\*.{exe,com,btm,cmd,bat} 0 0 0 Book\*.{exe,com,btm,cmd,bat} 0 0 0 data\*.{exe,com,btm,cmd,bat} 0 0 0 dll\*.{exe,com,btm,cmd,bat} 0 0 0 help\*.{exe,com,btm,cmd,bat} 2418414 2427392 29 *.{exe,com,btm,cmd,bat} 4439082 bytes in 78 files found, 119 files scanned. 4459520 bytes allocated. To report the total size of all ZIP, BZ2, and RAR files in all subdirectories below the current directory: [C:\CLU]dirsize /s/e/c/q *.{rar,zip,bz2} 1377764 bytes in 3 files found, 56 files scanned. 1378304 bytes allocated. ═══ 23. DUMP - Dump executable, object, library, and archive files ═══ Synopsis DUMP [/?] [/A[[-|+]drash]] [/SEU[-|+]] [/T[fmt]] [Filespecs ...] Options /? Display command syntax information. /A Select files by attribute. /E Do not display non-fatal error messages. /S Recurse into subdirectories. /U Do not display summary information. /T Specify, or override, the output format to use: HEX A plain hex dump EXE Dump as an executable file ARC Dump as an ARC or PAK archive ARJ Dump as an ARJ archive LZH Dump as an LZH or LHA archive RAR Dump as a RAR archive ZIP Dump as a ZIP archive ZOO Dump as a ZOO archive OMF Dump as an Intel OMF file (*.OBJ or *.LIB file) PKT Dump as a Fidonet *.PKT file /ISO8601 Display date and time in the standard format. Description The DUMP command displays the contents of the files that match the wildcard specifications. For executable files, it displays the contents of the executable's header and section information. For object and library files it decodes and displays Intel OMF object records. And for archive files it lists all of the files contained within the archive. All other file types are displayed as raw hexadecimal data. DUMP understands the 'MZ', 'LX', and 'PE' executable formats, Intel OMF format OBJ and LIB files, Fidonet PKT files, and ARC, ARJ, LZH, RAR, ZIP, and ZOO archive files. Tip: Users with Vernon Buerg's (16-bit) LIST for OS/2 program may wish to copy DUMP.EXE to FV.EXE (or set up the alias alias DUMP=FV in 4OS2), so that they can make use of the Archive [V]iew option in LIST. Other, better, list programs for OS/2, such as John Allen's (32-bit) OnScreen, do not require a separate "file view" program. If no wildcard specifications are supplied, DUMP acts as a filter, dumping its standard input. In the absence of any options to the contrary, this is in hexadecimal and ASCII. For example, the command [c:\]cls | dump shows what ANSI escape sequence the CLS command uses to clear the screen. The /T option allows the output format to be specified when DUMP is being used as a filter. This allows an archive file to be piped into DUMP, and still be dumped properly. If wildcard specifications are supplied, /O overrides the choice of output format, which would otherwise be based on the extension portion of the name of the file being dumped. To revert to the default behaviour, use /T without any format specification following it. For example, the command [c:\]dump /t:rar file.exe /t file.exe dumps FILE.EXE twice, the first time as if it were a RAR archive, and the second time as an executable (since its name ends in the extension ".EXE"). This is useful for dumping self-extracting archives. Notes When dumping ZIP archives, the note NN bytes of junk at the end of the archive. indicates that there are extra bytes in the archive after the end of the ZIP archive comment. Some "zipcomment" utilities, often used by large FTP sites and subscription BBSes to insert advertisements, cause this problem because they do not truncate the archive file properly when the archive comment that they are adding is shorter than the one that was previously there. This message does not indicate a problem with the archive (PKZIP for OS/2 can handle such archives), and is for informational purposes only. ═══ 24. FF - Find files ═══ Synopsis FF [/?] [/A[[-|+]drash]] [/SEBFQU[-|+]] Filespecs ... Options /? Display command syntax information. /A Select files by attribute. /E Do not display non-fatal error messages. /Q Operate quietly. /S Recurse into subdirectories. /U Do not display summary information. /B Display "bare" filenames, without attribute, size, or date information. (default:OFF) /F Display full pathnames (default:ON). /T Specify which of the last access (/TA), last write (/TW, the default), or creation times (/TC) to display. Note: This only applies to ordinary files, since none of the supported archive formats store the creation or last access dates for files. /ISO8601 Display date and time in the standard format. /ARC Search inside ARC format archives. /ARJ Search inside ARJ format archives (not multi-volume). /LZH Search inside LZH format archives. /PAK Search inside PZK format archives. /RAR Search inside RAR format archives (not multi-volume). /ZIP Search inside ZIP format archives (not multi-volume). /ZOO Search inside ZOO format archives. /DIR Search directories. /C Display the name of the containing archive file. (Default:ON) Description The FF command locates files that match the wildcard specifications. In addition to looking for ordinary files, it also scans the contents of any ARC, ARJ, LZH, PAK, RAR, ZIP, or ZOO archive files found in the given directories looking for files that match. FF does not process extended attribute data contained in any archive format, and leaves the EA size column blank for files found in archives. The ARC format does not store file attributes, so FF leaves the attribute column blank for files found in ARC or PAK archives. The ZOO format does not store OS/2-style file attributes, but instead stores POSIX file permissions. Unfortunately, there is no definitive mapping from one to the other (especially for the System, Hidden, and Archive attributes). FF therefore leaves the attribute column blank for files found in ZOO archives. Examples To report the total number of *.CMD files in all subdirectories and all archives below the current directory: [C:\CLU]ff /s/q *.cmd 3542 bytes in 3 files found, 5 files scanned. 0 bytes in 0 files found in 0 ARC archives. 0 bytes in 0 files found in 0 ARJ archives. 0 bytes in 0 files found in 0 LZH archives. 3542 bytes in 3 files found in 1 RAR archives. 3542 bytes in 3 files found in 1 ZIP archives. 0 bytes in 0 files found in 0 ZOO archives. To locate all OS2CLU02.*.BZ2 files in all subdirectories on the current drive, starting from the root directory, without displaying any non-fatal error messages and without searching any archives: [C:\CLU]ff /iso8601 /se/arc-/arj-/lzh-/pak-/rar-/zip-/zoo- \os2clu02.*.bz2 1999-08-26 08:51:24 414939 92 _____A \CLU\OS2CLU02.TAR.bz2 1999-08-26 08:51:24 414939 92 _____A \Develop\OS2CLU02\Release\OS2CLU02.TAR.bz2 829878 bytes in 2 files found, 2 files scanned. To locate any *.TXT files in all subdirectories of the current directory, without searching in ARC, ARJ, PAK, ZIP, or ZOO archives and without displaying non-fatal error messages: [C:\CLU]ff /iso8601 /se/arc-/arj-/pak-/zip-/zoo- *.txt 1999-08-26 11:06:08 20980 70 _____A blurb.txt 1999-08-26 11:31:48 6274 88 _____A readme.txt 1999-08-13 18:12:12 5719 _____A (OS2CLU02.RAR) readme.txt 1999-08-18 10:45:50 20423 _____A (OS2CLU02.RAR) blurb.txt 27254 bytes in 2 files found, 3 files scanned. 0 bytes in 0 files found in 0 LZH archives. 26142 bytes in 2 files found in 1 RAR archives. ═══ 25. FIND - Search files for text ═══ Synopsis FIND [/A[[+|-]drash]] [/SEBICQUV[+|-]] [/O[num[,num]]] Pattern [Filespecs ...] Options /? Display command syntax information. /A Select files by attribute. /E Do not display non-fatal error messages. /Q Operate quietly. /S Recurse into subdirectories. /U Do not display summary information. /B Display "bare" lines, without the filename and line number. (default:OFF) /I Ignore case in comparisons. (default:ON) /C Display the count of lines that match for each file where one or more lines have matched. (default:OFF) /V Invert the sense of the match (i.e. display lines that do not match the pattern). (default:OFF) /O Specify the number of lines of context to print before and after every match. The default, if either number (or both) is omitted, is zero lines. Note: Specifying anything other than zero lines of context to be displayed before each match significantly affects performance. Description The FIND command is a wrapper around the GREP command that provides functionality similar to the 16-bit FIND command supplied with OS/2. It prefixes the /R option to its command line before passing it to GREP. This turns regular expressions off by default. Unlike the 16-bit FIND command supplied with OS/2, FIND supports extended wildcards, recursion into subdirectories, and selection of files by attribute. It also numbers lines by default, unless brief mode is selected by the /B option. Examples [c:\]find "IBM" README searches for the string "IBM" in the file README. [c:\]find /s "OS/2 Warp" c:\*.txt recursively scans the entire directory tree on drive C:, starting from the root, looking for files whose names match the pattern *.TXT, and searching any found for lines that contain the string "OS/2 Warp" in any combination of upper and lower case. [c:\]find /s/e/c/q "CMD" c:\os2\*.cmd recursively scans the entire directory tree beneath C:\OS2, looking for files whose names match the pattern *.CMD, and searching any found for lines that contain the string "CMD" in any combination of upper and lower case. Lines that match are not printed (/Q), but a count is printed of the total number of lines that matched for each file where one or more matches occur. ═══ 26. FINDDUPS - Find duplicate files ═══ Synopsis FINDDUPS [/?] [/A[[-|+]drash]] [/T[acw]] [/SEBFUCQ[-|+]] [/NZ] [Filespecs ...] Options /? Display command syntax information. /A Select files by attribute. /E Do not display non-fatal error messages. /Q Operate quietly. /S Recurse into subdirectories. /U Do not display summary information. /B Display "bare" filenames, without attribute, size, or date information. (default:OFF) /F Display full filenames, rather than simply basenames. (default:ON) /C Display only the name of the "copy" file, without the name of the original file. (default:OFF) /T Specify which of the last access (/TA), last write (/TW, the default), or creation times (/TC) to display. /NZ Skip any files that have zero length. (default:OFF) /ISO8601 Display date and time in the standard format. Description The FINDDUPS command reads all of the files specified by the wildcard specifications, listing the details of any files whose contents are exactly the same as the contents of files that it has already scanned, along with the name of the original file (the first one found) that they are duplicates of. Examples [c:\]finddups /se *.{jpg,gif,bmp} will display the details of all JPEG, GIF, or bitmap files in the current directory or any of its subdirectories that happen to be duplicates of other JPEG, GIF, or bitmap files. [c:\]finddups /b *.txt will display, in brief format, all TXT files in the current directory that happen to be duplicates of other TXT files. [c:\]finddups c:\downloads\ d:\archives\ will display all duplicate files in the two directories C:\DOWNLOADS and D:\ARCHIVES. Note that, as explained in the section on wildcard filenames, the trailing slash without an explicit wildcard filename implies the wildcard "*". ═══ 27. FITSIZE - Order a set of files into groups with a given maximum size ═══ Synopsis FITSIZE [/?] [/A[[-|+]drash]] [/T[acw]] [/SEUBF[-|+]] [/MAXsize[KkMmGg]] Filespecs ... Options /? Display command syntax information. /A Select files by attribute. /E Do not display non-fatal error messages. /S Recurse into subdirectories. /U Do not display summary information. /B Display "bare" filenames, without attribute, size, or date information. (default:OFF) /F Display full filenames, rather than simply basenames. (default:ON) /T Specify which of the last access (/TA), last write (/TW, the default), or creation times (/TC) to display. /ISO8601 Display date and time in the standard format. /MAX Specify the maximum size for the groups of files. (default:1440k) The size figure may be followed by one of the following suffixes: Ki 1,024s of bytes (kibibytes) K 1,000s of bytes (kilobytes) Me 1,048,576s of bytes (mebibytes) M 1,000,000s of bytes (megabytes) Gi 1,073,741,824s of bytes (gibibytes) G 1,000,000,000s of bytes (gigabytes) Note: The k, M, and G suffixes are the official SI abbreviations for kilo-, mega-, and giga-, which are always powers of 10. The Ki, Me, and Gi suffixes, abbreviations for kibi-, mebi-, and gibi- respectively, are the standard suffixes for powers of 2 proposed by the IEEE and the IEC. If no suffix is present, the size is in bytes. Description The FITSIZE command sorts the files specified by the wildcard specifications into groups that do not exceed a given maximum size. FITSIZE is useful for deciding how to arrange a set of files onto multiple discs. Note on the algorithm used The problem that FITSIZE solves is commonly called The Knapsack Problem, and is one of a set of mathematical problems where the optimum solution cannot be obtained in polynomial time (i.e. the time taken is proportional to the exponential of the number of items to be packed, or worse). FITSIZE uses an algorithm that operates in polynomial time, but that does not always produce the optimum packing configuration for any given set of files. The FITSIZE command operates by first sorting all files that it finds into descending order of size. It then repeatedly picks the largest file available that will fit into the current group, and adds it to the group, starting a new group every time that the remaining available space in the current group is smaller than any file that remains. Examples [c:\]fitsize /max=1440k *.txt list all *.TXT files, in groups that will fit onto a 1.4MB floppy disc. [c:\]fitsize /max=120M list all files, in groups that will fit onto a 120MB floppy disc. ═══ 28. GREP - Search files for patterns ═══ Synopsis GREP [/?] [/A[[-|+]drash]] [/RSELICQBUV[-|+]] [/O[num[,num]]] Pattern [Filespecs ...] Options /? Display command syntax information. /A Select files by attribute. /E Do not display non-fatal error messages. /Q Operate quietly. /S Recurse into subdirectories. /U Do not display summary information. /R Use regular expressions in the pattern. (default:ON) /B Display "bare" lines, without the filename and line number. (default:OFF) /I Ignore case in comparisons. (default:ON) /C Display the count of lines that match for each file where one or more lines have matched. (default:OFF) /V Invert the sense of the match (i.e. display lines that do not match the pattern). (default:OFF) /O Specify the number of lines of context to print before and after every match. The default, if either number (or both) is omitted, is zero lines. Note: Specifying anything other than zero lines of context to be displayed before each match significantly affects performance. /L List the filename of each file where one or more lines have matched. (default:OFF) Description The GREP command searches the files specified by the wildcard specifications for the given pattern. If no filenames are specified, GREP will act as a filter command, scanning its standard input. It writes those lines that do or that do not (according to the state of the /V toggle) contain the pattern to its standard output. When the /R toggle is OFF, the pattern is a literal text string, and the GREP command behaves like the UNIX "fgrep" program. When the /R toggle is ON, as it is by default, the pattern is a regular expression, and the GREP command behaves like the UNIX "egrep" program. GREP fully supports the so-called "basic" regular expression syntax, and almost all of the "extended" regular expression syntax. Several of the metacharacters used in regular expressions also have meanings for various command-line interpreters. It is thus necessary to quote the pattern, or at least the metacharacters within it. For example, when using | to separate branches, the | character (which signifies a pipeline to CMD, 4OS2, and Take Command) must be "escaped", using the ^ character, yielding the command [c:\]grep BASEDEV^|DEVICE \config.* The ^ character is a regular expression metacharacter, but is also the (default) "escape" character for command interpreters, used to quote other special characters so that the command interpreter does not act upon them. To use a ^ character in a regular expression, it must be escaped: [c:\]grep [^^;]$ *.cpp *.h and [c:\]grep ^^Chapter *.txt When the regular expression contains so many metacharacters that it becomes inconvenient to "escape" every single one with a caret, a better alternative is to surround the whole pattern with quotation marks. For example [c:\]grep "^REM|\" \config.* Examples [c:\]grep .I..I.G dict.txt searches the file "dict.txt" for lines containing 7 characters, of which the second is 'I', the fifth 'I', and the seventh 'G'. This is useful for searching word lists for the answers to crossword puzzles. [c:\]grep "\" file.txt searches the file "file.txt" for lines containing any word beginning with "base", such as "basement", "basename", and "baseball". [c:\]grep "ltd\.|inc\." file.txt searches the file "file.txt" for lines containing either "ltd." or "inc.". [c:\]grep "<[A-Za-z0-9.]+@[A-Za-z0-9.]+>" mail.txt searches the file "mail.txt" for lines that might contain SMTP e-mail addresses. ═══ 28.1. Regular expressions ═══ The regular expression syntax is a subset of the regular expression syntax specified in the POSIX standards: . Any character ? Zero or one repetition. + One or more repetitions. * Zero or more repetitions. [] Encloses a character set. () Encloses a subexpression. | Separates alternatives. \ Quote the next character. This is used to turn metacharacters into literals. ^ Match the beginning of the line. $ Match the end of the line. \< Match the beginning of a word. \> Match the end of a word. A pattern comprises a list of branches, separated by | if there is more than one. Each branch comprises a series of consecutive pieces, all of which must match in the given order for the branch as a whole to match. Each piece comprises an ^, $, or an atom followed by an optional suffix operator *, ?, or +. An atom is a character set, a subexpression enclosed in parentheses, ., or a literal character. Character sets comprise a list of characters, character ranges, and character classes, enclosed within '[' and ']'. A match occurs if the target character is in the set, unless the entire set is prefixed by the '^' character (which is not part of the set itself) in which case a match occurs if the target character is not in the set. A character range is two characters separated by a '-', and includes all characters lexically from the first to the second. A character class is a class name ("alpha", "digit", "alnum", "xdigit", "graph", "space", "print", "upper", "lower", "cntrl", or "punct") enclosed within "[:" and ":]", and denotes all characters in that class. To include the ']' character as part of the set, list it before all other characters. To include the '-' character as part of the set, list it before all other characters except ']'. Examples .* Zero or more characters, i.e. any string. .+ One or more characters, i.e. any non-empty string. c.. Three characters, the first of which is 'c'. .a...n. 7 characters, the second of which is 'a' and the sixth of which is 'n' (useful for solving crosswords!) [0-9]+ A sequence of digits that is at least one character long. [[:alpha:]][[:alnum:]]* Any single alphabetic character, followed by zero or more alphanumeric characters. [[:alnum:][:space:]$] An alphanumeric character, a whitespace character, or the '$' character. ^REM(ARK)? Any line beginning with REM or REMARK. [^;]$ Any line not ending with a semi-colon. \<(their|they're|there)\> One of the three words "their", "they're", or "there". \+[0-9]+[- ][- 0-9]+ A telephone number in standard internationalised form (with either spaces or dashes). \<[A-Za-z][A-Za-z] [0-9]+\> A U.S.-style "zip" (i.e. postal) code. ([0-9]+:)?[0-9]+/[0-9]+(\.[0-9]+)? A Fidonet address, with optional zone number and point number. ═══ 29. HELP - Obtain on-line help ═══ Synopsis HELP HELP [/?] HELP [ON|OFF] HELP ErrorNumber HELP [Book] Topic Options /? Display command syntax information. Note This command is a REXX script. It requires that either Classic REXX or Object REXX be installed. Tip for Take Command for OS/2 users The built-in HELP command in Take Command for OS/2 up to at least version 2.01 contains several bugs (most notably that the text for an error message is displayed in a separate session that then immediately closes!). This HELP command operates correctly in Take Command. Take Command users can disable the built-in HELP command, in order to use this one, by issuing the command [c:\]setdos /i-help Description The HELP command is a drop-in replacement for the HELP command supplied with OS/2. Unlike the latter, however, it does not require HELPMSG.EXE, and does not obliterate customised prompt strings. When used on its own, HELP displays some useful information about how to switch windows, obtain help, and exit the command interpreter. The ON and OFF options will prepend and delete the string "$i" from the PROMPT environment variable. This controls whether or not the command interpreter displays the help banner whenever the prompt is displayed. The PROMPT environment variable is not otherwise altered. Error numbers are either plain numbers, in which case the error message text is read from the system error files, or may be prefixed by 3 alphabetic characters denoting the message file to search for the error message text. If the argument is not recognised as an error number, then HELP assumes that help about a specific topic is being requested. If no book is specified in which to look up the topic, HELP will use the value of the CMDREF environment variable. If the CMDREF environment variable is empty, or does not exist, HELP will use the OS/2 Warp Command Reference. The on-line reference for the OS2CLU utilities is os2clu02.inf, so [c:\]help os2clu02 grep will obtain on-line help about the OS2CLU GREP utility. ═══ 30. PARTLIST - Display the partition tables ═══ Synopsis PARTLIST [/?] [/FIX] [Disc numbers ...] Options /? Display command syntax information. /FIX Fix any errors found. Caution Be extremely careful when using the /FIX option to the PARTLIST command if you use DOS, DOS+Windows 95, or DOS+Windows 98. Unlike Linux, UNIX, OS/2 Warp, and Windows NT, all three DOS-based systems use the "CHS" fields in the partition table rather than the "LBA" fields. PARTLIST /FIX adjusts those fields, which will alter DOS', DOS+Windows 95's, and DOS+Windows 98's perceptions of where partitions are located on the disc. This is, of course, one of the useful functions of PARTLIST (being able to fix the partition table from OS/2 Warp so that DOS can function after a geometry change). Nevertheless, great care should be exercised. Description The PARTLIST command displays the contents of the partition table on the specified physical discs, or on all detected physical discs if no disc numbers are specified. It also detects many common errors that can occur in the partition table, and fixes them if the /FIX option is used. Although the same information can be obtained from the FDISK command using the /QUERY option, FDISK "cooks" the data that it reads before displaying it, which can result in confusion. PARTLIST displays the partition table contents in "raw" form, displaying the contents of all four entries from every partition table sector, and displaying all values in sectors rather than converting them to kilobytes. (See how the partition table works.) PARTLIST is also more informative than FDISK about the BIOS 1024 cylinder problem (often misconstrued and misdocumented by many people as a "504MB problem", "528MB problem", or "7.87GB problem"). It will report when a partition is either partially or wholly beyond the 1024th cylinder of the disc, making it either partially or wholly inaccessible to the BIOS at boot time. The /FIX option is useful if, for example, a disc has been moved from one system, with one type of translating main BIOS (or SCSI BIOS) ROM, to another system with a different type of BIOS ROM. Because the "geometry" of the disc changes (with SCSI discs, this geometry is entirely fictional anyway, being an artifact of the SCSI BIOS, and nothing to do with SCSI itself), the "CHS" fields in the partition table, which DOS, and DOS-based systems such as DOS+Windows 95 and DOS+Windows 98, use to locate the partitions on the disc, point to the wrong places. When this happens, the OS/2 FDISK command often complains that "the partition table is corrupt", and refuses to operate. DOS, and DOS-based systems, also tend to crash on bootup. The "fix" that is given by most authorities is to clean the contents of the partition table by low-level formatting the drive! This is, quite obviously, overkill, since it results in the loss of all data on the drive, and has resulted in the popular, and untrue, myth that changing discs between BIOSes, or between SCSI host adapters, requires a low-level format. The /FIX option to PARTLIST will fix problems caused by changes in BIOS geometry without requiring a low-level format, and makes no other modifications to the data on the disc apart from altering the partition table, so does not destroy data. When diagnosing and fixing errors in the partition table, PARTLIST assumes that the "LBA" fields in the partition table entries are definitive, since these are purely "linear" values, that are unaffected by the choice of disc geometry made by the BIOS. PARTLIST always adjusts the "CHS" fields in the partition table to match the values in the "LBA" fields, never the other way around. ═══ 30.1. How the partition table works ═══ The partition table on a partitionable disc is a linked list of MBRs. Each MBR contains within it a fixed-size table that describes exactly four partitions. Each entry in the table lists the type of the entry, the start and end cylinder/head/sector position (as the BIOS INT 13h function would see it) and the start and length of the partition in logical blocks. Type 00 entries in the table are unused, and do not describe anything. The first block on the disc, logical block number 0, is the primary MBR. Entries in this MBR's table describe primary partitions (which is why there can never be more four primary partitions per disc). A type 05 or type 0F entry describes an "extended partition" (which is why having an extended partition reduces the maximum number of primary partitions to three). The extended partition entries are what forms the linking of items in the linked list. At the start of the partition described by a type 05 or type 0F entry in one MBR is another MBR, a secondary MBR. This contains a further four entries. By convention, and because some operating systems actually don't work if this is not the case, each secondary MBR's table has no more than two entries with types other than 00. One entry describes a partition, contained wholly within the extended partition, that is the "logical drive in the extended partition", and the other entry is optional, and is a type 05 or type 0F entry that links to the next secondary MBR in the partition table if there is one. Free space on the disc, not occupied by any partitions, is not listed in the partition table. A type 00 entry in an MBR merely means that the entry is available for use. Most, if not all, current BIOSes are pretty simple, and are unable to follow the links from the primary MBR to the secondary MBRs, which is why only primary partitions may be bootable. The BIOSes do not care about partition types, and simply boot the first entry in the primary MBR that is marked "active". OS/2's Boot Manager is a primary partition, type 0A, containing code that is smart enough to be able to traverse the whole partition table and thus boot from any partition on the disc. It is also not limited to booting active partitions (obviously enough, since it has to be the active primary partition itself). By convention, partitions occupy whole numbers of tracks. Thus Boot Manager, whose code and data only actually occupies a handful of blocks, and indeed any partition, occupies a minimum of 7.87MB (63 sectors per track multiplied by 512 bytes per sector and 256 heads) on many large drives (often 504KB on smaller drives). Also, any logical drive in an extended partition, and any primary partition, starts at least one track (31.5KB on a large disc) after the MBR that describes it. The slack space after the primary MBR is used by various disk manager softwares (such as OnTrack), various third-party boot managers, and MBR viruses. The slack space after secondary MBRs is generally not used. ═══ 31. PLAYTUNE - Play a tune through the PC speaker ═══ Synopsis PLAYTUNE [/?] [/I[+|-]] Notes ... Options /? Display command syntax information. /I Ignore any syntax errors in the tune string(s). (Default:OFF) Description The PLAYTUNE command plays the tunes specified by each of its argument strings by beeping the PC speaker. A tune is a sequence of ASCII characters that specify the notes to play and their duration. Each tune specified on the command line is played in sequence, with no pauses between successive tunes. How notes are encoded R Play a rest. A rest may optionally be followed up to two dots to increase its length. A-G Play the specified note. A note may optionally be followed by '#' (or '+') to indicate a sharp or '-' to indicate a flat ("B+" is the same as "C".), and then up to two dots to increase its length. 'A' is the lowest note in each octave. On Switch to octave number n, which must be in the range 0 to 9. < Decrease the octave by one. > Increase the octave by one. Tn Specify the tempo as n breves per minute. Example: 4:4 time at 120 beats per minute is 15 breves per minute. Ln Set the length of subsequent notes to n, where 1 = breve, 2 = semibreve, 4 = minim, 8 = crotchet, 16 = quaver, 32 = semiquaver, 64 = demisemiquaver, etc.. Pn Pause for length n (the same as for L). Nn Play the note n, where 0 is 'A' in the lowest octave, 12 is the 'A' one octave above, 24 is the 'A' one octave above that, and so forth up to 119. Mx Set the mode to x, where N is "normal", L is "legato", and S is "staccato". A single '.' denotes a "dotted" note or rest, 3/2 of its original length. Two dots denote a "double dotted" note or rest, 7/4 of its original length. Example 1 [c:\]playtune "T80 L2C>L4CAL4CAAAL4AAL2AL4BCDBAL4CAA" [c:\]playtune "T80 L4ABL2C.L4 L2C.L4 CBAL2A.B.L2C" Example 2 [c:\]playtune "t41 mn l16 o2b4 p8 ms bb mn b4 p8 ms bbb8 b8b8 e8 b8b8b8 e8 mn b4 p8 ms bb mn b4 p8 ms bb mn b4 p8 ms bb mn b4 p8 ms bbb8bbb8b8b8bbb8b8b8bbb8b8b8bbb8b8 l2b" ═══ 32. RESETINI - Reset the system *.INI files ═══ Synopsis RESETINI [/?] [/Q[-|+]] Options /? Display command syntax information. Caution If applications that are Workplace Shell extensions (i.e. parts of the PMSHELL process rather than separate processes of their own) are currently running, this command will cause them to be terminated and possibly restarted. You will lose all unsaved data in such applications. Description The RESETINI command removes the read-only attribute from the user INI and system INI files, and then "resets" them, by calling the PrfReset() function of Presentation Manager. This causes the Workplace Shell, and any other applications that monitor the state of the user and system INI files, to reprocess them. RESETINI does not modify the contents of the user INI or system INI files in any way. ═══ 33. SAYDATE - Display the date and time ═══ Synopsis SAYDATE [/?] [/F[str]] [/U[+|-]] [/TZ[zone]] [Dates ...] Options /? Display command syntax information. /F Specify a format string to use for displaying the date. If this option is not specified, the default string is either "%c" (display the date in a format determined by the country settings) or, if the /ISO8601 option is given, "%F %T". /U Force SAYDATE to use UTC time rather than local time. (default:OFF) If this toggle is ON, all times, both input and output, are assumed to be in UTC time. If this toggle is OFF, input and output are assumed to be in local time. (Input dates can include a specific timezone in order to override this.) /TZ Specify a timezone string to use. This overrides whatever TZ environment variable SAYDATE may have inherited from its parent process. /ISO8601 Display date and time in the standard format. Description The SAYDATE command displays the date and time. If no arguments are given, it displays the current date and time. Otherwise it parses each individual argument in turn (which is a date/time in one of several formats) and displays the result. Note: SAYDATE defaults to using local time. For correct operation, the hardware real-time clock must be set to UTC and the TZ environment variable must be properly set. Unlike the DATE command built in to CMD, the default command interpreter in OS/2, SAYDATE is designed to be useful in batch files. It doesn't prompt the user to enter a new date or time, and its output can be customised to suit various needs by the optional format string given with the /F option, rather than just using a fixed format. It also allows dates and times other than the current ones to be displayed. Unlike the OS/2 port of the GNU DATE command (v1.12), SAYDATE supports the ISO 8601 date and weekday numbering format specifiers %F, %V, %G, %g, %u, and %z used by business and industry, and can handle input years greater than 1999. ( GNU DATE 1.12 fails on the year 2000.) The % character is a metacharacter in the various command-line interpreters. This means that in order to pass it to the SAYDATE command it must be doubled (i.e. four % characters if a literal % character is required in the display). Alternatively, either use the ^ character to "escape" the % character, such as in the command [c:\]saydate /f"The year is "^%Y. or (4OS2 and Take Command only) use the backquote character to prevent metacharacter recognition, such as in the command [c:\]saydate /f`"%G week %V, %a %T"` Examples [c:\]saydate /iso8601 1998-11-05 14:51:23 [c:\]saydate /f"It is day %%u in week %%V." It is day 4 in week 45. [c:\]saydate /f"It is %%I:%%M %%p on %%A, the %%dth of %%B %%Y." It is 02:51 pm on Thursday, the 05th of November 1998. [c:\]saydate /f"Date: %%F %%T %%z." Date: 1998-11-05 14:51:29 +0000. [c:\]saydate /f"%%F is day %%u in week %%V of %%G" 1999-1-2 1999-1-3 1999-1-4 1999-01-02 is day 6 in week 53 of 1998 1999-01-03 is day 7 in week 53 of 1998 1999-01-04 is day 1 in week 01 of 1999 [c:\]saydate /iso8601 "2001-02-03 16:50:04" 2001-02-03 2001-02-03 16:50:04 2001-02-03 14:51:32 [c:\]saydate /iso8601 "Feb 03, 2001" "Feb 03, 2001 16:50:04" 2001-02-03 14:51:34 2001-02-03 16:50:04 [c:\]saydate /iso8601 "Wed 16:50:04" "Wed 16:50" Wed 1998-11-11 16:50:04 1998-11-11 16:50:00 1998-11-11 14:51:35 [c:\]saydate /iso8601 16:50:04 16:50 1998-11-05 16:50:04 1998-11-05 16:50:00 ═══ 34. SETDATE - Set the hardware real-time clock ═══ Synopsis SETDATE [/?] [/QU[+|-]] [/TZ[zone]] Dates ... Options /? Display command syntax information. /Q Operate quietly. /ISO8601 Display date and time in the standard format. /U Force SAYDATE to use UTC time rather than local time. (default:OFF) If this toggle is ON, the input time is assumed to be in UTC time. If this toggle is OFF, the input time is assumed to be in local time. (Input times can include a specific timezone in order to override this.) /TZ Specify a timezone string to use. This overrides whatever TZ environment variable SETDATE may have inherited from its parent process. Description The SETDATE command allows the hardware real-time clock to be set from a date and time passed as an argument (which can be in one of several formats). Batch files that use the DATE and TIME commands built into CMD and 4OS2 are subject to race conditions at midnight, since the two commands do not execute simultaneously (and, indeed, on a heavily loaded system can execute seconds apart). The SETDATE command can set date and time in one operation. For each successive argument, SETDATE adjusts the hardware real-time clock to the appropriate UTC time. If the /Q toggle is not ON, it then displays the UTC time that it has set. Examples [c:\]setdate 1999-10-2 will set the date to the 2nd of October 1999, but will not alter the time of day. [c:\]setdate 16:45:00 will set the time to the UTC equivalent of 16:45:00, local time, but will not alter the date. [c:\]setdate /u 16:45:00 will set the time to 16:45:00, UTC, but will not alter the date. [c:\]setdate "1999-10-2 16:45:00" will set the date and time to the UTC equivalent of 16:45:00 on the 2nd of October 1999, local time, in one operation. [c:\]setdate "1999-10-2 16:45:00 +0200" will set the date and time to 14:45:00 on the 2nd of October 1999, UTC (since the local timezone specified is two hours ahead of UTC), in one operation. [c:\]setdate "1999-10-2 16:45:00 +0200" "14:47:00" will first set the date and time to the same as the previous example, and then will set the time to the UTC equivalent of 14:47:00, local time, without further altering the date. ═══ 35. SORT - Sort file contents ═══ Synopsis SORT [/?] [/A[[-|+]drash]] [/RSEI[-|+]] [/+n] [Filespecs ...] Options /? Display command syntax information. /A Select files by attribute. /E Do not display non-fatal error messages. /S Recurse into subdirectories. /R Reverse the sort order. (default:OFF) /I Ignore case in comparisons. (default:OFF) /+ Specify the starting column number to use when sorting. (default:1) Description The SORT command displays, in sorted order, the contents of the files denoted by the wildcard specifications. If no filenames are specified, SORT will act as a filter command, reading and sorting its standard input. Unlike the SORT command supplied with OS/2, SORT can sort files named on the command line and can sort files of any size, subject to available virtual memory. SORT also supports extended wildcards and selection of files by attribute, and is a 32-bit program. (The OS/2 SORT program is a 16-bit program.) And since SORT reads all of its input before writing any output, its output can be safely redirected to the same place as its input without risking an infinite loop. Note: Where the total size of all files to be sorted is large, SORT may take some time to sort the contents before displaying anything. SORT uses a combination of the Quicker Sort and Insertion Sort algorithms. Examples To display the contents of all *.TXT files, concatenated together, in sorted order: [c:\]sort *.txt To display the contents of all *.TXT files, concatenated together, in sorted order, ignoring case: [c:\]sort /i *.txt To display the output of the GREP command in reverse sorted order: [c:\]grep /b "tiger" *.txt | sort /r ═══ 36. STRINGS - Search files for strings ═══ Synopsis STRINGS [/?] [/A[[-|+]drash]] [/SEBU[-|+]] [/Mn] [Filespecs ...] Options /? Display command syntax information. /A Select files by attribute. /E Do not display non-fatal error messages. /S Recurse into subdirectories. /U Do not display summary information. /B Display "bare" lines, without the filename and position within the file. (default:OFF) /M Specify the minimum length for a string. (default:4) Description The STRINGS command searches the files denoted by the wildcard specifications for strings of printable characters, terminated either by a non-printable character or the end of the file, and displays them. If no filenames are specified, STRINGS will act as a filter command, scanning its standard input. Examples [C:\CLU]strings strings.exe | grep /b Usage Strings.exe(9270):Usage: STRINGS [/?] [/A[[+|-]drash]] [/SEBU[+|-]] [/Mn] [Filespecs ...] ═══ 37. SUM - Checksum and CRC file contents ═══ Synopsis SUM [/?] [/A[[-|+]drash]] [/SEUFB[-|+]] [Filespecs ...] Options /? Display command syntax information. /A Select files by attribute. /E Do not display non-fatal error messages. /S Recurse into subdirectories. /U Do not display summary information. /B Display in "Bare" format, without header or footer lines. (default:OFF) /F Display full filenames, rather than simply basenames. (default:ON) Description The SUM command calculates various CRCs and checksums for the files denoted by the wildcard specifications. If no filenames are specified, SUM will act as a filter command, reading its standard input. Unlike the ESUM command supplied with OS/2, SUM supports extended wildcards, selection of files by attribute, and several checksums and CRCs superior to the BSD UNIX one. It is also a 32-bit program. (The OS/2 ESUM program is a 16-bit program.) The CRCs and checksums are as follows: CRC CRC-16, as used by most archive utilities. CRC-32 CRC-32, as used by ZIP archives and BSD UNIX, polynomial x^32 + x^26 + x^23 + x^22 + x^16 + x^12 + x^11 + x^10 + x^8 + x^7 + x^5 + x^4 + x^2 + x + 1. Sum1 The 16-bit checksum provided by the "sum" command in BSD UNIX (right rotation before each addition, discard overflow), and by the ESUM command supplied in OS/2 Warp. Sum2 The 16-bit checksum provided by the "sum" command in System V UNIX (32-bit total divided by 0xFFFF). MD5 MD5 Message Digest from RSA Data Security. Note: The UNIX "sum" commands, and the ESUM utility supplied with OS/2, display their checksums in decimal. The SUM command displays them in hexadecimal, since that is how they are displayed by many popular PC utilities, including the ARC, ARJ, and ZIP archive tools. SUM also makes no attempt to display the number of disk blocks (which is a fiction in most non-UNIX implementations of the UNIX "sum" command anyway). To obtain allocation information about files, use the XDIR command. Examples [C:\CLU]sum ???.exe CRC CRC32 Sum1 Sum2 MD5 (name) ---- -------- ---- ---- -------------------------------- 3287 18c9796c 3c59 ea35 0585423faa7511c77b37546b85781314 Mem.exe f404 d428edfb 8695 a2b4 da3e1013b13521a5d4c15a9074c0e126 Sum.exe 00d4 4c18f9c1 b3b2 b499 aa12029b6072ac0218528f89381affb5 Tee.exe ---- -------- ---- ---- -------------------------------- 3 files found, 6 files scanned. ═══ 38. TASKLIST - Display the contents of the PM Window List ═══ Synopsis TASKLIST [/?] [/B[-|+]] Options /? Display command syntax information. /B Display in "Bare" format, without header or footer lines. (default:OFF) Note Although it is a text-mode program, TASKLIST will not work when booted to a command line via the OS/2 "Multiboot" menu, or when booted from the OS/2 installation/repair floppies, because it requires the Presentation Manager DLLs. Description The TASKLIST command displays the contents of the "Window List" maintained by Presentation Manager. For each task in the list, it displays the information contained in the list entry, including the window handle, the process and session IDs, the program type, and the title. Note: The "Window List" maintained by PM is a collaborative effort of all of the applications that want to be listed in it. It is not a list of all of the processes running on the system. ═══ 39. TEE - T-shaped pipe fitting ═══ Synopsis TEE [/?] [/A] [Filenames ...] Options /? Display command syntax information. /A Append the data to the files, instead of ovewriting them. (default:OFF) Description The TEE command is a "T shaped fitting" for use in command pipelines. It copies whatever it receives from its standard intput to its standard output, also sending a copy to each of the files named as its arguments. The /A option is useful for appending the output of a command to a logfile, for example. Examples To display the output of the SAYDATE command, sending a copy to the file DATE.OUT, which will be truncated to zero and overwritten with the new data: [c:\]saydate | tee date.out To display the output of the SAYDATE command, sending a copy to the file DATE.OUT, appending it to the original contents of the file: [c:\]saydate | tee /a date.out ═══ 40. TEXTCONV - Convert text file formats ═══ Synopsis TEXTCONV [/?] [/A[[-|+]drash]] [/SE[-|+]] [/ICP|OCP[cp]] [/INL|ONL[nl]] [Filespecs ...] Options /? Display command syntax information. /A Select files by attribute. /E Do not display non-fatal error messages. /S Recurse into subdirectories. /ICP Specify input code page. (default:850) /OCP Specify output code page. (default:850) /INL Specify input newline convention. (default:CRLF) The options are CRLF, CR, or LF . /ONL Specify output newline convention. (default:CRLF) The options are CRLF, CR, or LF . Description The TEXTCONV command reads the files specified by the wildcard specifications and writes their converted contents to its standard output. If no filenames are specified, TEXTCONV will act as a filter command, reading and converting its standard input. Conversion proceeds by reading the input, a line at a time, using the newline convention specified by the /INL option, converting it, and writing it to the standard output using the newline convention specified by the /ONL option. The conversion between the input code page and the output code page uses Unicode as an intermediate form. Input characters are converted from the input code page to Unicode, and then from Unicode to the output code page. TEXTCONV is designed to make it easy to interchange text files between PCs (which usually use code pages 437 and 850) and other systems. For example, a PC user using code page 437 can read a text file generated on a Macintosh (CR newline convention) in ISO 8859 Latin-1 (code page 1004) using the command: [c:\]textconv /icp:1004 /inl:cr /ocp:437 macfile.txt | more For another example, a PC user can make a text file, created locally in code page 437, suitable for transfer to a UNIX system that uses ISO 8859 Latin-1 with the command: [c:\]textconv /icp:437 /ocp:1004 /onl:lf file.txt > outfile.txt For a third example, a PC user can convert a text file from code page 437 to code page 850 with the command: [c:\]textconv /icp:437 /ocp:850 file437.txt > file850.txt ═══ 41. TOUCH - Update last modification times ═══ Synopsis TOUCH [/?] [/A[[-|+]drash]] [/SEPZQNU[-|+]] [/M[acw]] [/Ttime] [/Ddate] Filespecs ... Options /? Display command syntax information. /A Select files by attribute. /E Do not display non-fatal error messages. /N Simulate execution. /Q Operate quietly. /S Recurse into subdirectories. /U Do not display summary information. /Z Override the read-only attribute on files. /D Use the given date instead of today's date. /T Use the given time instead of the current time. /M Specify which date and time stamp will be modified: A Date and time that the file was last accessed C Date and time that the file was created W Date and time that the file was last modified (default) /ISO8601 Display date and time in the standard format. Note The FAT and HPFS filesystems, and OS/2 itself, only support file dates between 1980 and 2107, and have a granularity of two seconds for file times. OS/2 allows files to have nonsense dates like the 30th of February. The TOUCH command passes the date given to the /D option directly to the operating system without attempting to validate or renormalise it. The target date displayed by the TOUCH command is the date that it is passing to the operating system. The actual date set on the file varies from filesystem driver to filesystem driver. The FAT filesystem driver will substitute the year 2099 for the years 2100 to 2107 but will otherwise use the date as given. The HPFS filesystem driver will renormalise invalid dates to the nearest valid date, but doesn't know that the year 2100 is not a leap year. The behaviour of the filesystem driver is not within the control of the TOUCH command. Description The TOUCH command updates the date and time stamps of the files specified by the wildcard specifications to the current date and time, or to the specified date and time if the /D and /T options are used. The modifiers 'A', 'C', and 'W' for the /M option control which date and time stamp is affected. The formats of the date and time strings accepted vary according to the current country code configured into the operating system. See country-dependent date and time formats. Note: The OS/2 kernel sets file timestamps in UTC, rather than in local time. It assumes that the hardware real-time clock has been set to UTC. Examples [c:\]touch /S *.txt sets the last modification date and time stamps of all TXT files in the current directory and all subdirectories to the current date and time. [c:\]touch /D1-1-1980 *.txt sets the last modification date and time stamps of all TXT files in the current directory to the date 1980-01-01 and the current time. [c:\]touch /D1-1-1980 /T1:14:32 *.txt sets the last modification date and time stamps of all TXT files in the current directory to the date 1980-01-01 and the time 01:14:32. [c:\]touch /MA *.txt sets the last access date and time stamp of all TXT files in the current directory to the current date and time. [c:\]touch /MC /D1-1-1980 /T0:0:0 *.txt sets the creation date and time stamp of all TXT files in the current directory to the date 1980-01-01 and the time 0:0:0. ═══ 42. TREE - Display a filesystem tree ═══ Synopsis TREE [/?] [/A[[-|+]drash]] [/FGB[-|+]] [Filespecs ...] Options /? Display command syntax information. /A Select files by attribute. /F Display files as well. (default:OFF) /G Use graphic characters. (default:ON) /B Display "brief" output, which doesn't include size and allocation information. (default:OFF) Note The sizes of directories, i.e. the number of bytes on disc that are consumed by the directories themselves, are not reported by OS/2 to applications. OS/2 always returns 0 for the length and allocation size of a directory. (This is the reason that the DIR command built into the command interpreter displays "" in the length field for directories.) TREE displays whatever size OS/2 reports, for both files and directories. If this behaviour of OS/2 is ever fixed, TREE will thus automatically display the correct size information for directories. Description The TREE command displays the filesystem tree that is rooted at the directory given in the wildcard specifications, or the current directory if none are supplied. It uses indentation and graphics characters to display the tree structure. If the /F option is used, the TREE command will also display all files, subject to any attribute masks specified with the /A option, that match the basename portion of the wildcard specifications. Otherwise, the basename portion is ignored. Examples [C:\CLU]tree /b c:\mptn\ c:\MPTN\ ├──BIN ├──DLL ├──MSG │ └──NLS └──PROTOCOL [C:\CLU]tree /f c:\mptn\*.dll c:\MPTN\ 0 0 ├──BIN 0 0 ├──DLL 49075 49152 │ dapwsock.dll 190099 190464 │ ddnsres.dll 49064 49152 │ pmwsock.dll 37842 37888 │ so32dll.dll 62289 62464 │ tcp32dll.dll 47279 47616 │ tcpipdll.dll 34304 34304 │ tcpmri.dll 32288 32768 │ tcptime.dll 66048 66048 │ tnls32.dll 0 0 ├──MSG 0 0 │ └──NLS 6144 6144 │ ddnscfg.dll 10752 10752 │ dhcpmres.dll 0 0 └──PROTOCOL ═══ 43. WC - Count words, lines, letters, and characters in files ═══ Synopsis WC [/?] [/A[[-|+]drash]] [/O[lwacb]] [/SECHU[-|+]] [Filespecs ...] Options /? Display command syntax information. /A Select files by attribute. /E Do not display non-fatal error messages. /S Recurse into subdirectories. /B Display in "Bare" format, without header or footer lines. (default:OFF) /C Prevent control characters from being counted as characters. (default:OFF) /H Prevent hyphens from splitting words into two. (default:OFF) /U Prevent punctuation characters from splitting words. (default:OFF) /O Specify a string that determines what information should be output, comprising zero or more of the following characters: L Print the number of lines. W Print the number of words. A Print the number of letters. (Mnemonic: "A = alphabet") C Print the number of characters. B Print the number of bytes. Description The WC command opens and reads all of the files denoted by the wildcard specifications, counting the number of lines, words, letters, characters, and bytes that they contain. If no filenames are specified, WC will act as a filter command, counting the number of lines, words, letters, characters, and bytes on its standard input. In the absence of options to the contrary, WC will will normally split words at any character that is not a letter character. The /C option is useful for counting characters in files that are not plain text files, such as document files used by some wordprocessors. Such files use control characters for embedded formatting information, such as fount changes. Whitespace characters do not count towards the total number of characters irrespective of the state of the /C toggle. Examples [C:\CLU]wc *.txt lines words letters chars bytes (name) -------- -------- -------- -------- -------- 403 3518 13699 20174 20980 blurb.txt 151 1157 4123 5972 6274 readme.txt -------- -------- -------- -------- -------- 554 4675 17822 26146 27254 (Total) ═══ 44. WHAT - Search files for ID strings ═══ Synopsis WHAT [/?] [/A[[-|+]drash]] [/SEU[-|+]] [Filespecs ...] Options /? Display command syntax information. /A Select files by attribute. /E Do not display non-fatal error messages. /S Recurse into subdirectories. /U Do not display summary information. Description The WHAT command searches the files denoted by the wildcard specifications for the identifying strings used in SCCS ("@(#)" and "@[#]"), and displays them. If no filenames are specified, WHAT will act as a filter command, scanning its standard input. Note: The WHAT command deals solely with ID strings, and no longer calculates the CRC-16 for each file as well. A wider range of CRC and checksum data than that provided by earlier releases of the WHAT command is now available with the SUM command. To display the module name information from an executable file, use the DUMP command. Examples [C:\CLU]what what.exe What.exe WHAT Aug 24 1999 11:52:00 version 1.20 1 files found, 1 files scanned. ═══ 45. WHICH - Locate a command on the PATH ═══ Synopsis WHICH [/?] [/P[variable]] [/X[variable]] [/B[-|+]] Filespecs ... Options /? Display command syntax information. /B Display "bare" filenames, without attribute, size, or date information. (default:OFF) /P Specify an alternate environment variable to use instead of PATH. /X Specify an alternate environment variable to use instead of PATHEXT. /ISO8601 Display date and time in the standard format. Note: Although OS/2 itself places no restriction on the case of environment variable names, all command interpreters, by convention, only use upper case names for environment variables. Description WHICH determines what command would be executed were it to be typed at the command line. It searches the directories listed in the path environment variable for the command, using the extensions specified by the extensions environment variable. If the current directory is not explicitly mentioned in the path environment variable, WHICH will also search the current directory first. If the /X option is not used and the "PATHEXT" environment variable does not exist, WHICH will by default use the extensions COM, EXE, BTM, BAT, and CMD. WHICH is aware of internal commands that are built in to the various command processors and "executable extensions", and will will indicate any that it finds. WHICH supports standard wildcards in the file specifications, allowing for searches for partial commands, such as [c:\]which *boot* which will locate all of the commands that contain "BOOT" in their names (e.g. SETBOOT, BOOT, and BOOTDISK). Note: If a file specification contains a wildcard ending with an asterisk, WHICH will display the names of the commands found twice, the first time as a result of matching the wildcard as it stands, and the second as a result of matching the wildcard with one of the extensions tacked onto the end. The /P and /X options can be useful for locating files other than executables. For example, Presentation Manager locates help files using the HELP environment variables, and the HLP extension: [c:\]set HELPEXT=.hlp & which /PHELP /XHELPEXT wphelp For another example, the VIEW command locates on-line books using the BOOKSHELF environment variable and the INF extension: [c:\]set BOOKEXT=.INF & which /PBOOKSHELF /XBOOKEXT cmdref Examples [C:\]which /iso8601 find 1999-08-24 11:27:18 814 138 _____A C:\CLU\find.cmd 1996-08-09 00:24:16 30859 0 _____A C:\OS2\FIND.EXE [C:\]which /iso8601 help HELP is built-in to 4OS2 and Take Command. 1999-08-24 11:27:18 1935 140 _____A C:\CLU\help.cmd 1994-10-31 19:29:08 586 0 _____A C:\OS2\HELP.CMD 1994-10-31 19:29:08 591 0 _____A C:\OS2\MDOS\HELP.BAT [C:\]which /iso8601 dir set DIR is built-in to the 16-bit CMD, and 4OS2 and Take Command. SET is built-in to the 16-bit CMD, the 32-bit CMD, and 4OS2 and Take Command. ═══ 46. WINSIGHT - Display PM window relationships ═══ Synopsis WINSIGHT [/?] [/CONFIRMCLOSE] [/Iinstancename] Options /? Display command syntax information. /I Specify the "instance" name used for saving and restoring the window position to and from the OS/2 User Profile file. /CONFIRMCLOSERequire confirmation before closing the program. (default:OFF) Description The WINSIGHT command displays the hierarchy of Presentation Manager windows. The hierarchy is displayed as a tree, with each window descending from its parent window. For each window, WINSIGHT displays the window handle, the handle of the window's owner window, the process and thread ID to which it belongs, the window's style flags and ID, the window's class, and the window's text. The standard class names (e.g. WC_FRAME) are translated from their internal numeric form into their symbolic names. The display of WINSIGHT is static, and is only updated when it is first started, or when "Refresh" is selected from the menu. Note: WINSIGHT writes its current window position, whenever it exits, to the "OS2CLU PM Window Tree:Position" section of the OS/2 User Profile file (usually C:\OS2\OS2.INI), which it then reads and uses when it next starts up. The name of the key used is determined by the /I option. ═══ 47. XDEL - Extended DEL ═══ Synopsis XDEL [/?] [/A[[-|+]drash]] [/SEPZQNUXWF[-|+]] Filespecs ... Options /? Display command syntax information. /A Select files by attribute. /E Do not display non-fatal error messages. /N Simulate execution. /Q Operate quietly. /S Recurse into subdirectories. /U Do not display summary information. /Z Override the read-only attribute on files. /X Remove empty subdirectories when /S option is used. (default:OFF) /F Prevent undelete information from being saved. (default:OFF) /W Zero the contents of each file before deleting it. (default:OFF) ( Note on wiping files) Use this option with caution. The contents of all files deleted in this manner are unrecoverable. Even if undeleted with the UNDELETE command, the original contents of the files will have been lost. /ISO8601 Display date and time in the standard format. Description The XDEL command is an extended DEL command that deletes the the files specified by the wildcard specifications. Unlike the DEL command built in to CMD, the default command interpreter in OS/2, XDEL supports extended wildcards, deleting files in subdirectories, removing empty subdirectories, selection of files by attribute, and overriding the read-only attribute. Examples [c:\]xdel /se \*.{bak,bkp} deletes all *.BAK and *.BKP files (usually backup copies of files modified by a text editor) in all subdirectories starting from the root directory. [c:\]xdel /w *.txt deletes all *.TXT files from the current directory, overwriting them entirely with zeroes first. [c:\]xdel /s/x/z c:\subdir1\ deletes the entire tree rooted at the directory C:\SUBDIR1\, including read-only files and removing all empty subdirectories as well. Notice the trailing slash. This is equivalent to the DELTREE command in DR-DOS or MS-DOS. [c:\]xdel /s/x/z c:\subdir1 recursively scans the entire directory tree on drive C:, deleting all files named SUBDIR1, and removing all empty subdirectories. Directories in the Workplace Shell Desktop are usually empty, and will be deleted by this command if your WPS desktop happens to be on drive C:. This will cause your system to become unbootable.. ═══ 47.1. Wiping files ═══ Some governments require that high security files be wiped by writing patterns of ones and zeros over the file data several times. The purpose of this is to ensure that the magnetic domains on the magnetic medium storing the file are thoroughly altered. ( Depending upon how well the read/write head is aligned, simply overwriting data once may not realign all of the magnetic domains; and the old data may be readable by accessing the disc platter using specialised hardware to read the off-centre magnetic flux patterns. Writing 1s and 0s multiple times ensures that the magnetic domains on the fringes of the track are also brought into line. ) The /W option to the XDEL command does not provide this facility. This is because with an operating system like OS/2, which has disc caching, simply writing a file multiple times in an application (such as the XDEL command) does not guarantee that the actual sectors on the disc will be written multiple times. All write requests but the final one may well be satisfied entirely by the disc cache, and actual writes to disk need not necessarily occur. In order to ensure that the writes physically happen, one has to instruct the operating system not to use its cache. Unfortunately, this still doesn't help with the case where the file is on a network server, since the server may implement caching that is invisible to applications running on the client machine, or may use a LAN protocol where caching may not be disabled. The /W option to the XDEL command is intended to provide the level of security necessary to guard against attacks from ordinary users, rather than from foreign powers. Ordinary users usually do not have the ability, or the specialised equipment, to open up a hard disc and read "off-centre" data off the platter. The level of file recovery available to ordinary users is therefore nothing more sophisticated than software undeletion, using the standard disc read-write hardware. Overwriting the file with zeroes, as XDEL /W does, is sufficient to protect against data being recovered in this way. ═══ 48. XDIR - Extended DIR ═══ Synopsis XDIR [/?] [/A[[-|+]drash]] [/T[acw]] [/SEUBF[-|+]] [/O[[-|+]NEDSG]] [Filespecs ...] Options /? Display command syntax information. /A Select files by attribute. /E Do not display non-fatal error messages. /S Recurse into subdirectories. /U Do not display summary information. /B Display "bare" filenames, without attribute, size, or date information. (default:OFF) /F Display full filenames, rather than simply basenames. (default:ON) /T Specify which of the last access (/TA), last write (/TW, the default), or creation times (/TC) to display. /O Specify a sort string that determines how the output should be sorted, comprising zero or more of the following characters (optionally preceded by '-' to reverse the sense): A Sort by name, treating digits as numbers. D Sort by date stamp (according to the /T option). E Sort by extension (the part of the name following the final full stop). G Sort by attribute (directories, then hidden and system files, then all other files). N Sort by name. S Sort by size. /ISO8601 Display date and time in the standard format. Note The sizes of directories, i.e. the number of bytes on disc that are consumed by the directories themselves, are not reported by OS/2 to applications. OS/2 always returns 0 for the length and allocation size of a directory. (This is the reason that the DIR command built into the command interpreter displays "" in the length field for directories.) XDIR displays whatever size OS/2 reports, for both files and directories. If this behaviour of OS/2 is ever fixed, XDIR will thus automatically display the correct size information for directories. Description The XDIR command is an extended DIR command that displays information about the files specified by the wildcard specifications. Unlike the DIR command built in to CMD, the default command interpreter in OS/2, XDIR supports extended wildcards, displaying the creation and last access timestamps, and sorting files from multiple subdirectories. The /O option causes files to be sorted in memory, and displayed in sorted order once all files have been found. There may thus be a delay between the command being invoked and it producing any output. If the internal sort buffer overflows (if the system is low on available virtual memory), files are displayed in unsorted order. If no sort options are specified, the sort order is the order that files were found. ( There is no 'U' for "Unsorted" option. It makes no sense to have a sort option letter that specifies that there are no sort option letters! For unsorted output, simply don't use the /O option at all. ) The 'A' sort option performs an "alphanumeric" sort by filename, whereas the 'N' sort option is a plain lexical sort. When 'A' is used, sequences of digits in the name are treated as numbers. So "FILE3.TXT" will precede "FILE0012.TXT" because 3 is less than 12, even though "3" is lexically greater than "0012". Examples [c:\]xdir /tc *.{su,mo,tu,we,th,fr,sa}[0-9] will list all of the Fidonet ARCmail files in the current directory, along with their creation dates. [c:\]xdir /oa/s/e *.txt will list all of the TXT files in all subdirectories, sorting them all into alphanumeric order. ═══ 49. Y - Y-shaped pipe fitting ═══ Synopsis Y [/?] [/A[[-|+]drash]] [/SE[-|+]] [Filespecs ...] Options /? Display command syntax information. /A Select files by attribute. /E Do not display non-fatal error messages. /S Recurse into subdirectories. Description The Y command is a "Y shaped fitting" for use in command pipelines. It can also be used as a more powerful replacement for the TYPE command that is built in to CMD and 4OS2. It first copies whatever it receives from its standard intput to its standard output, and then it copies to its standard output the contents of the files specified by the wildcard specifications. Unlike the TYPE command built in to CMD and 4OS2, and unlike the Y command built into 4OS2, Y supports extended wildcards, recursion into subdirectories, and the ability to include and exclude files from processing by their attributes. To use Y as a replacement for TYPE, simply redirect NUL to its standard input. Examples [c:\]saydate | y /s *.{cmd,btm} will display the output of the SAYDATE command, and then the contents of all CMD and all BTM files in the current directory and all subdirectories beneath it. [c:\]y *.txt < nul will display the contents of all of the TXT files the current directory. ═══ 50. Acknowledgements ═══ The following people helped with the pre-release testing of these utilities:  Andy Roberts, FIDONET#1:109/921.1  Jack Stein, FIDONET#1:129/171.0  Jack Pfisterer, FIDONET#1:102/837.0  George Fliger, FIDONET#1:137/2.0  Tony Pater, FIDONET#3:712/848.0  Francois Thunus, FIDONET#2:270/25.2  Roy J. Tellason, FIDONET#1:270/615.0  Sarah Nunez, FIDONET#1:130/604.0  Jeffrey J. Counsil, FIDONET#1:268/402.0  Lee Aroner, FIDONET#1:343/40.0  Gord Hannah, FIDONET#1:109/921.23  Will Honea  Coridon Henshaw  Don Woodall  Eddy Thilleman  Francois Massonneau  Richard Gelderblom  Joe Hunter  Kaya Imre  Leonard Erickson  Richard Gelderblom  Russell Tiedt ═══ ═══ For more information about the CPUID instruction, see:  Cyrix M2 CPU Software Identification, Cyrix corporation  AMD Processor Recognition, Document Number 20734J, Advanced Micro Devices  Intel Architecture Software Developers' Manual Volume 2: Instruction Set Reference, Order Number 243191, Intel corporation ═══ ═══ Master Boot Record ═══ ═══ [c:\].\date --version date - GNU sh-utils 1.12 [c:\].\date --date=1999-12-31 Fri Dec 31 00:00:00 GMT 1999 [c:\].\date --date=2000-01-01 Thu Jan 1 00:00:00 GMT 1970 [c:\] ═══ ═══ In Presentation Manager terminology, a window's parent is the window that encloses it, and has nothing to do with which process actually created the window.