Manual - Sun, Jun 16, 2024
DOG Operation Guide
Introduction
When working with DOG in the prompt, you typically use the internal and external commands, and other programs.
The batch commands are used to program batch files, called DOGfiles, and cover things like loops, forks and user input. They aren’t available when working on the prompt.
The external commands are stand-alone executables, but considered to be part of DOG, and may access DOG internals where needed.
Syntax
DOG [-P|-E envsz|-A aliassz|-C command line]
Parameters
-P
- Makes DOG a PERMANENT shell.-E:envsz
- Makes the environment to envsz bytes (divisible by 16).-A:aliassz
- Makes the alias space to aliassz bytes (divisible by 16).-C command line
- Executes the command line and exits.
Internal Commands
These internal commands are built into to the DOG binary and are available at the command prompt as well as in DOGfiles (see below).
AL - Alias
Syntax
AL [ALIAS] [COMMAND]
Parameters
ALIAS
- The command alias to set/unset The name is UPPERCASED.COMMAND
- The real command that ALIAS expands to. Without COMMAND, AL unsets ALIAS-
- Without arguments the command prints all ALIASes to the screen.
Effect
Creates a command ALIAS
Example
AL CV CP -v
creates an alias command CV
which expands into the command CP -v
.
You can also use AL to create an ALIAS of an existing command. It has
the same effect as if you typed the expansion.
e.g. AL CP CP -v
makes it so that whenever you use just
CP
, the -v
option is used, handy for setting default options.
CC - Change Codepage [NOT IMPLEMENTED YET]
Syntax
CC [CODEPAGE]
Parameters
CODEPAGE
- Codepage number to set as current- cc without Args shows available codepages.
Effect
Changes the current codepage to CodePage.
CD - Change Directory
Syntax
CD [PATH]
Parameters
PATH
- The destination path. The..
directory can be appended directly to cd like inCOMMAND.COM
. e.g.cd..
The virtual directory...
means..\..
e.g.cd...
is equal tocd ..\..
.- cd without Args prints the current directory on the screen.
Effect
Changes the current directory to Path.
Note
In DOG, directories are executable: typing dog\src\util
implicitly means
cd dog\src\util
when util
is a directory.
CT - Change Terminal
Syntax
CT DEV
Parameters
DEV
- The name of the device that I/O is set to. Eg.CON
,AUX
,NUL
Effect
Changes the current IO terminal to Device.
EH - Echo
Syntax
EH [TEXT]
Parameters
TEXT
- Anything you want to type out from a DOG file.- EH by itself will put a new line.
Use these special characters to format the text:
$$
- the $ sign.$_
- space$b
- vertical bar ( ¦ )$e
- The ESC character (ASCII 27 = 1b in hex)$l
- Left angle ( < )$g
- Right angle ( > )$n
- New line$r
- Carriage return$t
- Tabulator
Effect
Print a (formatted) string to stdout (normally the screen).
HH - Help
Syntax
HH [COMMAND]
Parameters
COMMAND
- Giving the name of a DOG command will display detailed help for that command.- HH alone displays a list of all DOG commands.
Effect
Displays usage information for DOG commands.
MD - Make Directory
Syntax
MD <DIR>
Parameters
DIR
- Name or Path of new directory.
Effect
Creates a new directory named dir
.
RD - Remove Directory
Syntax
RD <DIR>
Parameters
DIR
- Name or path of an empty directory to remove.
Effect
Removes directory named DIR
SE - Set Environment
Syntax
SE [VARIABLE] [VALUE]
Parameters
VARIABLE
- the name of the environment variable. The name is UPPERCASED.VALUE
- The value thatVARIABLE
should have. WithoutVALUE
, SE unsetsVARIABLE
- Without arguments the command prints all VARIABLEs to the screen.
Variables set and used by DOG:
COMSPEC
- Path to DOGPATH
- The list of paths where to search for commands. The paths are separated by the;
character.PROMPT
- The string displayed indicating that DOG is waiting for a command You can use these special characters:$$
- the $ sign.$_
- space$b
- vertical bar|
$e
- The ESC character (ASCII 27 = 1b in hex)$l
- Left angle<
$g
- Right angle>
$n
- New line$r
- Carriage return$t
- Tabulator$p
- Current drive and path$c
- Current time
Effect
Sets the specified VARIABLE to VALUE in the environment.
XX - Exit
Syntax
XX
Effect
Exit the current DOG shell, unless it is the primary shell, in which case the command has no effect.
External commands
These commands are actually external stand-alone programs and can be used outside of DOG.
BP - Beep
Syntax
BP [FREQ [TIME]]
Parameters
FREQ
- Frequency of the sound in Herz (Hz)TIME
- Duration in milliseconds (1000 ms = 1 second)- Without parameters, BP puts ASCII character 07h into stdout, causing a beep provided that the ANSI driver is loaded.
Effect
Makes a constant sound with frequency FREQ Hz for TIME milliseconds through the PC Speaker.
Some Music notes and their frequency:
- C ~ 262 Hz
- D ~ 294 Hz
- E ~ 330 Hz
- F ~ 349 Hz
- G ~ 392 Hz
- A = 440 Hz
- H/B ~ 493 Hz
- C ~ 523 Hz
BR - Break
Syntax
BR [ON|OFF]
Parameters
ON
- Set DOS Break flag to ON: Check for break on all DOS calls.OFF
- Set DOS Break flag to OFF: Check for break only when reading/writing stdin/stdout/stderr.
Effect
Toggles the DOS Break flag. In case no parameters are given it returns the Break Flag
CL - Clear screen
Syntax
CL
Effect
Clears the screen. Works on 50 lines/page screens too.
CP - Copy
Syntax
CP [OPTION]... SOURCE DEST
or
CP [OPTION]... [PATH1\]PATTERN1 [PATH2\]PATTERN2
Parameters
SOURCE
- The source file(s) to copyDEST
- The target file(s) to create
or
PATTERN1
- The source file(s) to copyPATTERN2
- The target file(s) to create
OPTION
can be one of these (in any order):
-v
- print filename of each copied file-f
- force all files to be overwritten-i
- interactive, asks before copying every file
Effect
Copies one or more files to the destination. CP asks before overwriting a file (can be overridden with -f).
Examples
cp dog.com wolf.com
cp dog.com c:dog
cp dog.com c:dogwolf.com
cp c:dog
cp dog.* wolf.*
cp dog.* wolf.*
cp *.o *.obj
DT - Date and Time
Syntax
DT [OPTION]
Parameters
OPTION
can be one of these:-s
- set DATE and TIME-d
- set DATE only-t
- set TIME only
Effect
DT displays the current date and time. By using the options DT
can
be used to set the DATE and/or TIME
LS - List directory
Syntax
LS [OPTION]... [PATTERN]...
Parameters
PATTERN
- Pattern can be a number of paths including wild characters *
and ?
?
represents any single character and*
represents 0 or more characters e.g.*.dog
*.*
DO?.COM,
*.?
OPTION
can be one of these (in any order, some don`t work together):
-d
- Directories Only-f
- Files Only-l
- show volume label-w
- show file names only (6 per row)-z
- show human readable sizes (B, KB, MB, GB)
Effect
List files according to switches and search PATTERN
.
MV - Move / Rename File
Syntax
MV [OPTION]... SOURCE DEST
or
MV [OPTION]... [PATH1\]PATTERN1 [PATH2\]PATTERN2
Parameters
SOURCE
- The source file to moveDEST
- The new file name or target
or
PATTERN1
- The source file name(s)PATTERN2
- The new file name(s)
OPTION
can be one of these (in any order):
-v
- print filename of each moved file
Effect
Moves one or more files to the destination or renames files according to the patterns. MV asks before overwriting an existing file.
Examples
mv dog.com wolf.com
mv dog.com c:dog
mv dog.com c:dogwolf.com
mv c:dog
mv dog.* wolf.*
mv dog.* wolf.*
mv *.o *.obj
RM - Remove
Syntax
RM [OPTION]... <PATTERN|@FILE>...
Parameters
PATTERN
- Pattern can be a number of paths including wild characters *
and ?
?
represents any single character and*
represents 0 or more characters e.g.*.dog
*.*
DO?.COM
,*.?
@FILE
- Filename preceded by @
which is read and every line is handled
like a PATTERN
OPTION
can be one of these (in any order):
-i
- prompt (Yes/No/All) for each file or directory-r
- recurse into sub-directories. Removes all files in subdirectories too-v
- print filename of each removed file
Effect
Removes the file(s) and/or directory(ies) matching PATTERN
RT - Remove Tree
Syntax
RT [OPTION]... <DIRECTORY|@FILE>...
Parameters
DIRECTORY
- The directory(s) to delete.@FILE
- Filename preceded by@
which is read and every line is handled like a DIRECTORYOPTION
can be one of these (in any order):-i
- prompt (Yes/No/All) for each file or directory-v
- print filename of each removed file
Effect
Removes the tree(s) indicated by DIRECTORY(s) with all their subdirectories and files.
SZ - calculate file Sizes
Syntax
SZ [OPTION]... [PATTERN]...
Parameters
-
PATTERN
- Pattern can be a number of paths including wild characters*
and?
?
represents any single character and*
represents 0 or more characters e.g.*.dog
*.*
DO?.COM
,*.?
-
OPTION can be one of these (in any order):
-k
- give sizes in KB-m
- give sizes in MB
Effect
Prints the size of the files matching PATTERN
.
TP - Type File contents
Syntax
TP FILE...
Parameters
FILE
- A space separated list of files
Effect
Types the contents of the files specified by FILE
to stdout.
VF - DOS Verify flag
Syntax
VF [ON|OFF]
Parameters
ON
- Set the DOS Verify flag to ONOFF
- Set the DOS Verify flag to OFF
Effect
If ON or OFF specified sets Verify flag to this value. Otherwise VF returns the current setting.
VR
Syntax
VR
Effect
Prints the DOG and DOS version. VF tries very hard to identify the flavor of DOS.
DOGfile commands
These commands are only available when running DOGfiles. Dogfiles have
a .dog
file ending. Note that unlike COMMAND-COM
, DOGfiles are
always the equivalent of ECHO OFF
, that is the commands are not
echoed to STDOUT when a DOGfile is being processes.
CA - Call other DOGfile
Syntax
CA <DOGFILE>
Parameters
DOGFILE
- A DOGfile to call
Effect
Calls the DOGFILE from another. Once it has finished running, execution continues on the next line in the DOGfile where CA was executed from.
DO - Do command while condition is true
Syntax
DO <COMMAND> [WHILE <CONDITION>]
Parameters
COMMAND
- The command to repeat.CONDITION
- The condition for repeating the command.
CONDITION can take the form:
ERROR [IS|NOT] <NUMBER>
-NUMBER
compared to the ERRORLEVEL<VARIABLE> [IS|NOT] <VALUE>
-VARIABLE
is an environment variable and is compared toVALUE
[NOT] EXIST <FILE>
- Returns true as long asFILE
exists.
IS
- is optional and has no effect other than makes the statement look a little bit more like English.NOT
- reverses the condition value in all cases.
Effect
Repeats COMMAND
while CONDITION
is true. Without a CONDITION
the
COMMAND
is repeated as long as it returns 0 as its exit code.
44 - For loop
Syntax
44 <VAR> IN <SET> DO <COMMAND>
Parameters
VAR
- A variable name, use as %%VAR%% as a placeholder in COMMANDSET
- A comma separated list of words.COMMAND
- The command to repeat. You can use %%VAR%% as a placeholder for VAR.
Effect
For each word in SET
runs the COMMAND
. Each word in SET will be
set to VAR for each repeat of the for loop. This allows the COMMAND
to include %%VAR%%
which will be replaced with a word from SET
.
Example
44 F IN DOG,CAT,WOLF,BEAR DO MV %%F%%.CC %%F%%.CPP
This command will first run MV DOG.CC DOG.CPP
by replacing %%F%%
with DOG
in the first iteration, etc for each of the terms in SET.
GO - Go to label
Syntax
GO <LABEL>
Parameters
LABEL
- A label in the DOGfile.
Effect
Jumps the DOGfile processing to the LABEL. A label is identified as
line containing :LABEL
. DO will jump to the line after the :LABEL
line.
IF - Conditional execution
Syntax
IF CONDITION <COMMAND1> [ELSE <COMMAND2>]
Parameters
COMMAND1
- The command to run if CONDITION is TRUE.COMMAND2
- The optional command to run if CONDITION is FALSE.CONDITION
- The condition for repeating the command.
CONDITION can take the form:
ERROR [IS|NOT] <NUMBER>
-NUMBER
compared to theERRORLEVEL
<VARIABLE> [IS|NOT] <VALUE>
-VARIABLE
is an environment variable and is compared toVALUE
[NOT] EXIST <FILE>
- Returns true as long as FILE exists.
IS
- is optional and has no effect other than makes the statement look a little bit more like English.NOT
- reverses the condition value in all cases.
Effect
If CONDITION
is TRUE
the COMMAND1
is executed, else COMMAND2
is executed.
IN - Input
Syntax
IN <VARIABLE> [PROMPT]
Parameters
VARIABLE
- The environment variable to store the user input.PROMPT
- An optional message to display to the user. With no prompt DOG will displayEnter value for VARIABLE:
Effect
Prompts the user for input and saves that input in the environment.
SH - Shift
Syntax
SH [NUM]
Parameters
NUM
- A number to indicate how many variables to shift
Effect
Shifts the DOGfile input arguments by NUM steps. Normally A DOGfile can only index 10 arguments at one time (%0 to %9). This command allows a DOGfile to shift the variables right so that what was previously %1 is now %2, etc.
By giving the command a number NUM
, the arguments are shifted
NUM
steps instead of just one to a maximum of 9.
TI - Timed break
Syntax
TI [TIME]
Parameters
TIME
- The number of seconds to wait.- Without an argument
TI
waits forever for a key stroke
Effect
Waits TIME seconds or for a key press before continuing the DOGFile execution