Updated many new tests, disk images for new make system, documentation, all sorts of stuff. Remy needs to run IFNUMTEST and look at Complex Math 2, the last test. Fixed ARGTEST to match new spec.

This commit is contained in:
Patrick Kloepfer 2019-04-06 22:20:39 -04:00
parent 5fd4d702f2
commit f52ec163ab
24 changed files with 704 additions and 75 deletions

View File

@ -2,13 +2,13 @@
This Guide provides information on all the A2osX commands and utilities. This Guide helps you not only learn the purpose of each command but also what options a command supports and what arguments it either supports or requires.
A2osX comes with a nice variety of system, file, network and data utilities or what we refer to as external commands. This just means that each of the following commands or utilities is built as a separate BIN or executable file that runs under A2osX. The source for all of these external commands is readily available, so you can make your own as your needs dictate.
A2osX comes with a nice variety of system, file, network and data utilities or what we refer to as external commands. This just means that each of the following commands or utilities is built as a separate BIN or executable file that runs under A2osX. The source for all of these external commands is readily available, so you can make your own or modify these as your needs dictate.
>Note, that there are some **internal** commands that are build into the shell (the interactive prompt) such CD (change directory) or PWD (print working directory). Those commands are discussed in-depth in the **[Shell Developers Guide](.Docs/Shell%20Developers%20Guide.md).**
>Note, that there are some **internal** commands that are build into the shell (the interactive prompt) such as CD (change directory) or PWD (print working directory). Those commands are discussed in-depth in the **[Shell Developers Guide](.Docs/Shell%20Developers%20Guide.md).**
## System Commands
Typcically, you will not directly use the System group commands; they are more commonly found in A2osX system scripts such as ./ETC/INIT or they are launched by the A2osX Kernel itself. All of these commands are found in ./SBIN/ letting you know they are special system commands.
Typcically, you will not directly use the System group commands; they are more commonly found in A2osX system scripts such as ./ETC/INIT or they are launched by the A2osX Kernel itself. All of these commands are found in **./SBIN/** letting you know they are special system commands.
### GETTY
@ -16,12 +16,12 @@ Typcically, you will not directly use the System group commands; they are more c
| --- | --- |
| GETTY | -E : Exit upon disconnect |
GETTY, short for "get tty", is a system process for A2osX that manages physical or virtual terminals (TTYs). When it detects a connection, it prompts for a username and then loads the system process LOGIN to authenticate the user. Each GETTY process creates a pseudo file such as /DEV/TTY1 /DEV/TTY2 to allow A2osX pass input/output streams between processes and connected users.
GETTY, short for "get tty", is a system process for A2osX that manages physical or virtual terminals (TTYs). When it detects a connection, it prompts for a username and then loads the system process LOGIN to authenticate the user. Each GETTY process creates a pseudo file such as /DEV/TTY1 or /DEV/TTY2 to allow A2osX pass input/output streams between processes and connected users.
GETTY handles 3 types of connections:
- virtual terminals presented and controlled by your Apple Screen and Keyboard. One GETTY process serves one virtual terminal. You can configure the number of virtual terminals on your A2osX system using the KCONFIG utility. Please see **[KCONFIG](#kconfig)**.
- serial terminals (or emulated terminals i.e. a PC running a VT-100 emulator) connected to your Apple via a Super Serial Card. One GETTY process serves one terminal. See the User Guide for setup and configuration information on connecting Physical Terminals.
- internet terminals connected to your Apple via via the internet using A2osX TCP networking suite. This suite includes a TELNETD server process that listens for requests from the internet and when such a request is initiated, TELNETD will launch a GETTY process to support that user. One GETTY process will launch for each TELNET user and will exit when then user disconnects (the TELNETD process calls GETTY with the -E option).
**GETTY handles 3 types of connections:
- *virtual terminals* presented and controlled by your Apple Screen and Keyboard. One GETTY process serves one virtual terminal. You can configure the number of virtual terminals on your A2osX system using the KCONFIG utility. Please see **[KCONFIG](#kconfig)**.
- *serial terminals* (or emulated terminals i.e. a PC running a VT-100 emulator) connected to your Apple via a Super Serial Card. One GETTY process serves one terminal. See the User Guide for setup and configuration information on connecting Physical Terminals.
- *internet terminals* connected to your Apple via via the internet using A2osX TCP networking suite. This suite includes a TELNETD server process that listens for requests from the internet and when such a request is initiated, TELNETD will launch a GETTY process to support that user. One GETTY process will launch for each TELNET user and will exit when then user disconnects (the TELNETD process calls GETTY with the -E option).
### INITD
@ -47,7 +47,7 @@ INSDRV, short for "install driver", is a system process that loads and initializ
![](../.screen-shots/ScreenShot.KCONFIG.png)
KCONFIG, short for "Kernel Configuration" Utility, is a system programs that allows the A2osX administrator to configure various settings of their A2osX system. Any changes to your system configuration are stored in ${ROOT}/A2OSX.KCONFIG. When A2osX boots and loads the KERNEL process, it looks for this file, and if not present it initialized the KERNEL with A2osX defaults.
KCONFIG, short for "Kernel Configuration" Utility, is a system program that allows the A2osX administrator to configure various settings of their A2osX system. Any changes to your system configuration are stored in ${ROOT}/A2OSX.KCONFIG. When A2osX boots and loads the KERNEL process, it looks for this file, and if not present it initializes the KERNEL with A2osX defaults.
In KCONFIG you can set:
- Machine Timing, either 60 (Default) or 50Hz. If you change this RGXX will happen.
@ -110,68 +110,59 @@ Note that the numbering of the lines didn't change, because that is their true n
| Command | Options |
| --- | --- |
| CUT | CUT \<opt\> "line" or CMD\|CUT \<opt\> <br> -H : This help screen <br> -F nn : Output field nn <br> -M nn : Output starting at nn <br> -N nn : Output Ending at nn <br> -S ch : Change default SPACE separator to 'ch' |
| CUT | CUT \<opt\> "line" or CMD\|CUT \<opt\> <br> -H : This help screen <br> -F nn : Output field nn <br> -M nn : Output starting at nn <br> -N nn : Output Ending at nn <br> -S ch : Change default SPACE separator to 'ch' |
The CUT command is used to extract a sub part or portion of a string. While one use of this command can be used to simply extract substrings much like Basic's MID, LEFT, or RIGHT might be used, it can also be used within the powerful FOR NEXT construct to process fields of columns from files or the output of processes.
As an example, normally when you execute the **LS -L /** command you get output similar to:
----------
>/A2OSX.BUILD/ROOT/$ LS -L /
>/RAM3 S3D2 Blocks Used:8 Total:16000
>/A2OSX.BUILD S7D1 Blocks Used: 3230 Total:65535
>/MAKE S7D2 Blocks Used:48946 Total:65535
----------
/A2OSX.BUILD/ROOT/$ LS -L /
/RAM3 S3D2 Blocks Used:8 Total:16000
/A2OSX.BUILD S7D1 Blocks Used: 3230 Total:65535
/MAKE S7D2 Blocks Used:48946 Total:65535
Now, if instead we execute the follow command at the shell prompt:
/A2OSX/ROOT/$ CAT -N CATTEXT
/A2OSX.BUILD/ROOT/$ FOR F IN `LS -L /`;ECHO $F;NEXT
/RAM3 S3D2 Blocks Used:8 Total:16000
/A2OSX.BUILD S7D1 Blocks Used: 3230 Total:65535
/MAKE S7D2 Blocks Used:48946 Total:65535
----------
>/A2OSX.BUILD/ROOT/$ FOR F IN `LS -L /`;ECHO $F;NEXT
>/RAM3 S3D2 Blocks Used:8 Total:16000
>/A2OSX.BUILD S7D1 Blocks Used: 3230 Total:65535
>/MAKE S7D2 Blocks Used:48946 Total:65535
----------
It looks like the same results, but from now instead of LS simply outputting all of its results at once, each line is being passed to the FOR loop (as VAR $F) where we simply ECHO it. Now imagine if instead we passed $F to CUT, we can display only specific columns of information as seen in these two examples:
----------
>/A2OSX.BUILD/ROOT/$ FOR F IN `LS -L /`;CUT -M 00 -N 15 $F;NEXT
>/RAM3
>/A2OSX.BUILD
>/MAKE
----------
/A2OSX.BUILD/ROOT/$ FOR F IN `LS -L /`;CUT -M 00 -N 15 $F;NEXT
/RAM3
/A2OSX.BUILD
/MAKE
----------
>/A2OSX.BUILD/ROOT/$ FOR F IN `LS -L /`;CUT -M 17 -N 21 $F;NEXT
>S3D2
>S7D1
>S7D2
----------
/A2OSX.BUILD/ROOT/$ FOR F IN `LS -L /`;CUT -M 17 -N 21 $F;NEXT
S3D2
S7D1
S7D2
Another use of CUT. Given a Text File like ./ETC/PASSWORD with the following contents:
----------
>root:1cedeaefaffab15fd23d7a282c6610b1:0:0:A2osX Root:/root:/bin/sh
>guest:084e0343a0486ff05530df6c705c8bb4:1000:1000:Guest Account:/home/guest:/bin/sh
----------
root:1cedeaefaffab15fd23d7a282c6610b1:0:0:A2osX Root:/root:/bin/sh
guest:084e0343a0486ff05530df6c705c8bb4:1000:1000:Guest Account:/home/guest:/bin/sh
Note the results of various CUT commands that use the -S option to denote : (colon) as the field separator. This makes CUT a great tool for processing delimited text files.
Note here the results of various CUT commands that use the -S option to denote : (colon) as the field separator. This makes CUT a great tool for processing delimited text files.
----------
> /A2OSX.BUILD/ROOT/$ FOR F IN `CAT ../ETC/PASSWD`;CUT -S : -F 1 ${F};NEXT
> root
> guest
> /A2OSX.BUILD/ROOT/$ FOR F IN `CAT ../ETC/PASSWD`;CUT -S : -F 2 ${F};NEXT
> 1cedeaefaffab15fd23d7a282c6610b1
> 084e0343a0486ff05530df6c705c8bb4
> /A2OSX.BUILD/ROOT/$ FOR F IN `CAT ../ETC/PASSWD`;CUT -S : -F 3 ${F};NEXT
> 0
> 1000
> /A2OSX.BUILD/ROOT/$ FOR F IN `CAT ../ETC/PASSWD`;CUT -S : -F 5 ${F};NEXT
> A2osX Root
> Guest Account
----------
/A2OSX.BUILD/ROOT/$ FOR F IN `CAT ../ETC/PASSWD`;CUT -S : -F 1 ${F};NEXT
root
guest
/A2OSX.BUILD/ROOT/$ FOR F IN `CAT ../ETC/PASSWD`;CUT -S : -F 2 ${F};NEXT
1cedeaefaffab15fd23d7a282c6610b1
084e0343a0486ff05530df6c705c8bb4
/A2OSX.BUILD/ROOT/$ FOR F IN `CAT ../ETC/PASSWD`;CUT -S : -F 3 ${F};NEXT
0
1000
/A2OSX.BUILD/ROOT/$ FOR F IN `CAT ../ETC/PASSWD`;CUT -S : -F 5 ${F};NEXT
A2osX Root
Guest Account
### CHGRP
@ -208,10 +199,12 @@ This command is not currently implemented.
| Command | Options |
| --- | --- |
| CP | Working | -C : Continue On Error <br> -Q : Quiet <br> -R : Recurse subdirectories <br> -Y : Dont't Prompt For Override | 0.93 |
| CP | -C : Continue On Error <br> -Q : Quiet <br> -R : Recurse subdirectories <br> -Y : Dont't Prompt For Override | 0.93 |
CP, which stands for Copy, is one of the most powerful commands in A2osX. Not only can it copy files from one ProDOS volume to another, it can copy entire directories or even directory trees from volume to volume, or to another location on the same volume. This recursive nature allows you to use a single command to copy the contents of an entire ProDOS volume with a single command. CP also supports wild cards so that you can copy just those files matching a pattern.
### EDIT
| Command | Options |

View File

@ -122,3 +122,15 @@ note : '$VAR' does NOT expand Variable
| 1> | Working | |
| 2>> | Working | StdErr redirection |
| 2> | Working | |
## Stuff to work on
if [] && [] is AND
if [] || [] is OR
functions
* DIV/MOD

View File

@ -214,6 +214,18 @@ Additional resources
##Networking
install the drivers for the hardware (uther, lances, ssc, etc.)
then NETWORKD lib lib (and the libs are tcpip or etalk maybe) libs are protocalls here
in the LIB directory now are LIBTCPIP and LIBETALK
NETWORKD will read ETC/NETWORK will load network programs
right now it contains IPCONFIG, you can also add to it HTTPD TELNETD etc, they are loaded in order and each needs to complete its full load before next one happens (assuring IPCONFIG happends before TELNETD tries to load)
IPCONFIG will then look for ETC/TCPIP.CONF, if found uses those settings, if not does dhcp. in addition ipconfig uses ETC/HOSTNAME and ETC/HOSTS for setting hostname and doing DNSloopups
Hardware Drivers
MAC Address
TCPIPD

Binary file not shown.

BIN
.Floppies/BLEED.140 .dsk Normal file

Binary file not shown.

BIN
.Floppies/BLEED.32MB .po Normal file

Binary file not shown.

BIN
.Floppies/BLEED.800 .po Normal file

Binary file not shown.

BIN
.Floppies/RC.140.dsk Normal file

Binary file not shown.

BIN
.Floppies/RC.32MB.po Normal file

Binary file not shown.

BIN
.Floppies/RC.800.po Normal file

Binary file not shown.

BIN
.Floppies/RELEASE.140.dsk Normal file

Binary file not shown.

BIN
.Floppies/RELEASE.32MB .po Normal file

Binary file not shown.

BIN
.Floppies/RELEASE.800.po Normal file

Binary file not shown.

BIN
.Floppies/STABLE.140.dsk Normal file

Binary file not shown.

BIN
.Floppies/STABLE.32MB.po Normal file

Binary file not shown.

BIN
.Floppies/STABLE.800 .po Normal file

Binary file not shown.

36
EXAMPLES/MVDIR.txt Normal file
View File

@ -0,0 +1,36 @@
NEW
PREFIX
AUTO 4,1
#!/BIN/SH
#
# This utility moves an entire directory sctructure from
# one place to another. The source must be a directory and
# and the destination must not already exist.
#
# Examples: MVDIR PATRICK HOME/PATRICK will move the
# subdirectory PATRICK and all the files and dirs in it to the
# new location of HOME/PATRICK, HOME having to exist but HOME/PATRICK not.
#
#!/BIN/SH
IF [ -D $1 ]
ELSE
ECHO "Invalid Source Directory - Aborting"
EXIT
FI
IF [ -E $2 ]
ECHO "Destination Already Exists - Aborting"
EXIT
FI
MD $2
IF [ -D $2 ]
ELSE
ECHO "SOMETHING IS WRONG, COULD NOT CREATE DESTINATION"
EXIT
FI
ECHO "Moving Files...."
MV -Q -R "${1}/*" "${2}"
RM -Q -R $1
RD $1
ECHO "Finished"
MAN
TEXT /MAKE/USR/SHARE/EXAMPLES/MVDIR

View File

@ -5,29 +5,35 @@ AUTO 4,1
#
# This script creates the empty dirs to hold A2osX
#
Echo "\f\n\n\n Enter directory to create new A2osX file system in"
echo -N "\n\n Directory: "
Echo "\f\n\n\n Enter volumne to create new A2osX file system on"
echo -N "\n\n Volume: "
READ fsdir
IF [ -D $fsdir ]
ECHO "\n\nValid Volume found"
ELSE
ECHO "\n\nCould not find Valid Volume - Exiting"
EXIT
FI
echo "\n\n Creating file system in ${fsdir}"
md ${fsdir}
md ${fsdir}/bin
md ${fsdir}/bin/atk
md ${fsdir}/bin/dev
#md ${fsdir}/bin/atk
#md ${fsdir}/bin/dev
md ${fsdir}/drv
md ${fsdir}/drv/gui
#md ${fsdir}/drv/gui
md ${fsdir}/etc
md ${fsdir}/home
md ${fsdir}/inc
md ${fsdir}/lib
md ${fsdir}/lib/gui
#md ${fsdir}/lib/gui
md ${fsdir}/root
md ${fsdir}/sbin
md ${fsdir}/sbin/gui
#md ${fsdir}/sbin/gui
md ${fsdir}/srv
md ${fsdir}/sys
md ${fsdir}/sys/atk
md ${fsdir}/sys/available
md ${fsdir}/tmp
md ${fsdir}/usr
md ${fsdir}/usr/bin
md ${fsdir}/usr/src
md ${fsdir}/usr/src/bin
md ${fsdir}/usr/src/drv
@ -35,8 +41,10 @@ md ${fsdir}/usr/src/lib
md ${fsdir}/usr/src/sbin
md ${fsdir}/usr/src/sys
md ${fsdir}/usr/share
md ${fsdir}/usr/share/tests
md ${fsdir}/usr/share/admin
md ${fsdir}/usr/share/examples
md ${fsdir}/usr/share/make
md ${fsdir}/usr/share/tests
md ${fsdir}/var
md ${fsdir}/var/log
MAN

53
MAKE/FL.MINBOOT.txt Normal file
View File

@ -0,0 +1,53 @@
A2OSX.SYSTEM
BIN/KILL
BIN/CAT
BIN/CHTYP
BIN/CP
BIN/EDIT
BIN/FORMAT
BIN/IPCONFIG
BIN/LS
BIN/LSDEV
BIN/LSOF
BIN/MD5
BIN/MEM
BIN/MKDIR
BIN/MORE
BIN/MV
BIN/NETSTAT
BIN/NSCUTIL
BIN/PING
BIN/PS
BIN/RM
BIN/TELNET
BIN/HTTPGET
BIN/CSH
BIN/SH
BIN/CUT
BIN/GREP
DRV/LANCEGS.DRV
DRV/SSC.DRV
DRV/UTHERNET.DRV
DRV/UTHERNET2.DRV
ETC/HOSTNAME
ETC/HOSTS
ETC/INIT
ETC/INIT.BOOT
ETC/TCPIP.CONFIG
ETC/NETWORK
ETC/PASSWD
LIB/LIBBLKDEV
LIB/LIBCRYPT
LIB/LIBTCPIP
SBIN/GETTY
SBIN/NETWORKD
SBIN/INSDRV
SBIN/KCONFIG
SBIN/LOGIN
SBIN/TELNETD
SYS/KERNEL
SYS/KM.RAMWORKS
SYS/KM.NSC
SYS/KM.VSDRIVE
SYS/ATK/KM.APPLETALK
ROOT/PROFILE

168
MAKE/MAKEDISKS.txt Normal file
View File

@ -0,0 +1,168 @@
NEW
PREFIX
AUTO 4,1
#!/BIN/SH
#
# This script creates Bootable A2osX Disks.
#
# This script will prompt the user for any needed information
# such as version of PRODOS to include and then will verify that
# it has the right media and files available.
#
# Note this is the first version of the script so it may not
# include the finished/polished UI that is planned.
#
# Media Types: RELEASE, RC, STABLE, and BLEED.
# Media Formats: 140K, 800K, and 32MB.
#
# First we define the functions this script uses.
#
#FUNC ECHOAT
# ECHO -N "\e[${1};${2}H${3}"
#END
ECHO "\f A2osX Make Discs Utility"
ECHO
READ -P "Which Build Number is the Source: " Build
SET SOURCE = "/MAKE/BUILDS/BUILD${BUILD}"
IF [ -Z $BUILD ]
ECHO "You pressed return with no choice, bad idea"
EXIT
FI
IF [ -D $SOURCE ]
ELSE
ECHO "Invalid Build - Exiting"
EXIT
FI
ECHO "\nTypes: RELEASE, RC, STABLE, and BLEED"
READ -P "Which Type to you want to make: " TYPE
IF [ -Z $TYPE ]
ECHO "You pressed return with no choice, bad idea"
EXIT
FI
SWITCH $TYPE
CASE "release"
CASE "Release"
CASE "RELEASE"
SET TYPE = "RELEASE"
BREAK
CASE "rc"
CASE "Rc"
CASE "RC"
SET TYPE = "RC"
BREAK
CASE "stable"
CASE "Stable"
CASE "STABLE"
SET TYPE = "STABLE"
BREAK
CASE "bleed"
CASE "Bleed"
CASE "BLEED"
SET TYPE = "BLEED"
BREAK
DEFAULT
ECHO "You entered an invalid choice"
EXIT
END
ECHO "\nMedia: 140K, 800K and 32MB (1, 8 or 32)"
READ -P "Which Media to you want to make: " MEDIA
IF [ -Z $MEDIA ]
ECHO "You pressed return with no choice, bad idea"
EXIT
FI
SWITCH $MEDIA
CASE "1"
CASE "140"
CASE "140K"
CASE "140k"
SET MEDIA = "140"
BREAK
CASE "8"
CASE "800"
CASE "800K"
CASE "800k"
SET MEDIA = "800"
BREAK
CASE "32"
CASE "32MB"
CASE "32mb"
CASE "32Mb"
SET MEDIA = "32"
BREAK
DEFAULT
ECHO "You entered an invalid choice"
EXIT
END
ECHO "\nProDOS version: 2.03 or 2.42 (3 or 42)"
READ -P "Which ProDOS version to want installed: " PRODOS
IF [ -Z $PRODOS ]
ECHO "You pressed return with no choice, bad idea"
EXIT
FI
SWITCH $PRODOS
CASE "3"
CASE "03"
CASE "2.03"
SET PRODOS = "2.03"
BREAK
CASE "42"
CASE "2.42"
SET PRODOS = "2.42"
BREAK
DEFAULT
ECHO "You entered an invalid choice"
EXIT
END
ECHO "\nPlease make sure that the ${TYPE} ${MEDIA} is online"
READ -P "Ready to make your disk (Y/N): " GO
IF [ -Z $GO ]
ECHO "You pressed return with no choice, bad idea"
EXIT
FI
IF [ $GO = "y" ]
SET GO = "Y"
FI
IF [ $GO = "Y" ]
ELSE
ECHO "\nOK, Well you have a nice day. Bye!"
EXIT
FI
SET DEST = "/${TYPE}${MEDIA}/"
# Verify that DESTINATION is ONLINE
IF [ -D $DEST ]
ECHO "\n\nValid Destination Volume found"
ELSE
ECHO "\n\nCould not find Valid Destination Volume - Exiting"
EXIT
FI
# At least check that a2osx.system is on disk.
IF [ -F ${SOURCE}/A2OSX.SYSTEM ]
ELSE
ECHO "\n\nSource Directory missing SYSTEM files - Exiting"
EXIT
FI
#
# List check that there is 1 and only 1 DEST volume on line
# and get its DEV id so we can format it.
#
# Verify that ProDOS is on DEST DISK
IF [ -F ${DEST}/PRODOS ]
ELSE
ECHO "\n\nDestination Volume missing ProDOS - Exiting"
EXIT
FI
CP ${SOURCE} ${DEST}
MAN
TEXT /MAKE/USR/SHARE/MAKE/MAKEDISKS

View File

@ -22,7 +22,7 @@ IF [ -Z $T ]
SET T = 0
FI
SET T = $T + 1
IF [ $0 = "${PWD}ARGTEST2" ]
IF [ $0 = "ARGTEST2" ]
IF [ -N $Log ]
SET P = $P + 1
echo "ARGTEST Arg 0 Passed" >> ${Log}
@ -155,10 +155,10 @@ ELSE
echo "ARGTEST Arg 7 Failed"
FI
#
# $8 should be the process id of the parent
# $8 should be the process id of the parent which is same as mine
#
SET T = $T + 1
IF [ $8 -EQ $@ ]
IF [ $8 -EQ $$ ]
IF [ -N $Log ]
SET P = $P + 1
echo "ARGTEST Arg 8 Passed" >> ${Log}
@ -167,7 +167,7 @@ IF [ $8 -EQ $@ ]
ELSE
IF [ -N $Log ]
SET F = $F + 1
echo "ARGTEST Arg 8 Failed - $8 vs $@" >> ${Log}
echo "ARGTEST Arg 8 Failed - $8 vs $$" >> ${Log}
FI
echo "ARGTEST Arg 8 Failed"
FI
@ -203,15 +203,13 @@ ELSE
SET F = $F + 1
echo "ARGTEST Arg Count Failed - $#" >> ${Log}
FI
echo "ARGTEST Arg Count Failed"
echo "ARGTEST Arg Count Failed - $#"
FI
#
# $* should be 'A 1 B 2 C 3 Hello $@ 82 Tenth'
# Note $$ was actually passed after Hello, but
# we sub $@ as its our parents ID.
# $* should be 'A 1 B 2 C 3 Hello $$ 82 Tenth'
#
SET T = $T + 1
IF [ $* = "A 1 B 2 C 3 Hello $@ 82 Tenth" ]
IF [ $* = "A 1 B 2 C 3 Hello $$ 82 Tenth" ]
IF [ -N $Log ]
SET P = $P + 1
echo "ARGTEST Arg ALL Passed" >> ${Log}
@ -222,7 +220,7 @@ ELSE
SET F = $F + 1
echo "ARGTEST Arg ALL Failed - $*" >> ${Log}
FI
echo "ARGTEST Arg ALL Failed"
echo "ARGTEST Arg ALL Failed - $*"
FI
ECHO "Arg Tests Done"
IF [ -N $Log ]

View File

@ -83,6 +83,8 @@ ECHO "\n----------------------------------------\n" >> ${Log}
ECHO "\n----------------------------------------\n" >> ${Log}
. IFNUMTEST
ECHO "\n----------------------------------------\n" >> ${Log}
. IFANDORTEST
ECHO "\n----------------------------------------\n" >> ${Log}
. WHILETEST
#
# End of Tests
@ -98,6 +100,12 @@ echo " Total Tests: ${T}" >> ${Log}
echo " Tests Passed: ${P}" >> ${Log}
echo " Tests Failed: ${F}" >> ${Log}
echo "----------------------------------------" >> ${Log}
echo
echo "Here are the variables that are still SET" >> ${Log}
echo "----------------------------------------" >> ${Log}
echo >> ${Log}
SET >> ${Log}
echo "----------------------------------------" >> ${Log}
SET T =
SET P =
SET F =

213
TESTS/IFANDORTEST.txt Normal file
View File

@ -0,0 +1,213 @@
NEW
PREFIX
AUTO 4,1
#!/BIN/SH
#
# This script tests all the variants of the AND and OR Logic in IFs
#
ECHO "\f\n\n If AND (AND) OR (OR) Tests"
ECHO "\n\nThis Performs Several Complex IF logic tests"
ECHO
ECHO "Begin IF AND OR Tests"
ECHO
IF [ -N $Log ]
ECHO "Begin IF AND OR Tests" >> ${Log}
ELSE
SET T = 0
SET F = 0
SET P = 0
FI
# First test AND True True
SET T = $T + 1
IF [ 99 -EQ 99 ] AND [ "A" = "A" ]
Echo " Test 1 AND True True : True : PASSED"
IF [ -N $Log ]
ECHO "Test 1 AND True True : True : PASSED" >> ${Log}
SET P = $P + 1
FI
ELSE
Echo " Test 1 AND True True : False : FAILED"
IF [ -N $Log ]
ECHO "Test 1 AND True True : False : FAILED" >> ${Log}
SET F = $F + 1
FI
FI
# 2nd test AND True False
SET T = $T + 1
IF [ 99 -EQ 99 ] AND [ "A" = "b" ]
Echo " Test 2 AND True False : True : FAILED"
IF [ -N $Log ]
ECHO "Test 2 AND True False : True : FAILED" >> ${Log}
SET F = $F + 1
FI
ELSE
Echo " Test 2 AND True False : False : PASSED"
IF [ -N $Log ]
ECHO "Test 2 AND True False : False : PASSED" >> ${Log}
SET P = $P + 1
FI
FI
# 3rd test AND False True
SET T = $T + 1
IF [ 99 -EQ 79 ] AND [ "A" = "A" ]
Echo " Test 3 AND False True : True : FAILED"
IF [ -N $Log ]
ECHO "Test 3 AND False True : True : FAILED" >> ${Log}
SET F = $F + 1
FI
ELSE
Echo " Test 3 AND False True : False : PASSED"
IF [ -N $Log ]
ECHO "Test 3 AND False True : False : PASSED" >> ${Log}
SET P = $P + 1
FI
FI
# 4th test AND False False
SET T = $T + 1
IF [ 99 -EQ 79 ] AND [ "A" = "b" ]
Echo " Test 4 AND False False : True : FAILED"
IF [ -N $Log ]
ECHO "Test 4 AND False False : True : FAILED" >> ${Log}
SET F = $F + 1
FI
ELSE
Echo " Test 4 AND False False : False : PASSED"
IF [ -N $Log ]
ECHO "Test 4 AND False False : False : PASSED" >> ${Log}
SET P = $P + 1
FI
FI
# 5th test OR True True
SET T = $T + 1
IF [ 99 -EQ 99 ] OR [ "A" = "A" ]
Echo " Test 5 OR True True : True : PASSED"
IF [ -N $Log ]
ECHO "Test 5 OR True True : True : PASSED" >> ${Log}
SET P = $P + 1
FI
ELSE
Echo " Test 5 OR True True : False : FAILED"
IF [ -N $Log ]
ECHO "Test 5 OR True True : False : FAILED" >> ${Log}
SET F = $F + 1
FI
FI
# 6th test OR True False
SET T = $T + 1
IF [ 99 -EQ 99 ] OR [ "A" = "b" ]
Echo " Test 6 OR True False : True : PASSED"
IF [ -N $Log ]
ECHO "Test 6 OR True False : True : PASSED" >> ${Log}
SET P = $P + 1
FI
ELSE
Echo " Test 6 OR True False : False : FAILED"
IF [ -N $Log ]
ECHO "Test 6 OR True False : False : FAILED" >> ${Log}
SET F = $F + 1
FI
FI
# 7th test OR False True
SET T = $T + 1
IF [ 99 -EQ 79 ] OR [ "A" = "A" ]
Echo " Test 7 OR False True : True : PASSED"
IF [ -N $Log ]
ECHO "Test 7 OR False True : True : PASSED" >> ${Log}
SET P = $P + 1
FI
ELSE
Echo " Test 7 OR False True : False : FAILED"
IF [ -N $Log ]
ECHO "Test 7 OR False True : False : FAILED" >> ${Log}
SET F = $F + 1
FI
FI
# 8th test OR False False
SET T = $T + 1
IF [ 99 -EQ 79 ] OR [ "A" = "b" ]
Echo " Test 8 OR False False : True : FAILED"
IF [ -N $Log ]
ECHO "Test 8 OR False False : True : FAILED" >> ${Log}
SET F = $F + 1
FI
ELSE
Echo " Test 8 OR False False : False : PASSED"
IF [ -N $Log ]
ECHO "Test 8 OR False False : False : PASSED" >> ${Log}
SET P = $P + 1
FI
FI
# 9th test AND True True True
SET T = $T + 1
IF [ 99 -EQ 99 ] AND [ "A" = "A" ] AND [ 1 -LT 7 ]
Echo " Test 9 AND Tru Tru Tru : True : PASSED"
IF [ -N $Log ]
ECHO "Test 9 AND Tru Tru Tru : True : PASSED" >> ${Log}
SET P = $P + 1
FI
ELSE
Echo " Test 9 AND Tru Tru Tru : False : FAILED"
IF [ -N $Log ]
ECHO "Test 9 AND Tru Tru Tru : False : FAILED" >> ${Log}
SET F = $F + 1
FI
FI
# 10th test AND True True False
SET T = $T + 1
IF [ 99 -EQ 99 ] AND [ "A" = "A" ] AND [ 7 -LT 1 ]
Echo " Test 10 AND Tru Tru Fal : True : FAILED"
IF [ -N $Log ]
ECHO "Test 10 AND Tru Tru Fal : True : FAILED" >> ${Log}
SET F = $F + 1
FI
ELSE
Echo " Test 10 AND Tru Tru Fal : False : PASSED"
IF [ -N $Log ]
ECHO "Test 10 AND Tru Tru Fal : False : PASSED" >> ${Log}
SET P = $P + 1
FI
FI
# 11th test AND True False False
SET T = $T + 1
IF [ 99 -EQ 99 ] AND [ "A" = "b" ] AND [ 7 -LT 1 ]
Echo " Test 11 AND Tru Fal Fal : True : FAILED"
IF [ -N $Log ]
ECHO "Test 11 AND Tru Fal Fal : True : FAILED" >> ${Log}
SET F = $F + 1
FI
ELSE
Echo " Test 11 AND Tru Fal Fal : False : PASSED"
IF [ -N $Log ]
ECHO "Test 11 AND Tru Fal Fal : False : PASSED" >> ${Log}
SET P = $P + 1
FI
FI
# 12th test AND True False True
SET T = $T + 1
IF [ 99 -EQ 99 ] AND [ "A" = "b" ] AND [ 1 -LT 7 ]
Echo " Test 12 AND Tru Fal Tru : True : FAILED"
IF [ -N $Log ]
ECHO "Test 12 AND Tru Fal Tru : True : FAILED" >> ${Log}
SET F = $F + 1
FI
ELSE
Echo " Test 12 AND Tru Fal Tru : False : PASSED"
IF [ -N $Log ]
ECHO "Test 12 AND Tru Fal Tru : False : PASSED" >> ${Log}
SET P = $P + 1
FI
FI
MAN
TEXT /MAKE/USR/SHARE/TESTS/IFANDORTEST
this tests the IF [] AND [] and IF [] OR []
we should test all of --> true true | true false | false true | false false variants
need to write a subs standalone script that I call with . subs
and then can get rid of with SET -F
EXIT, or EXIT <exp>
EXIT $RC + 1 works

View File

@ -278,6 +278,134 @@ ELSE
SET F = $F + 1
FI
FI
# 18th Test * or Multiplication Test 1
SET T = $T + 1
SET GHI = 10 * 7 * 3 * 5
IF [ $GHI -EQ 1050 ]
Echo " Test 18 Multiplication 1 : True : PASSED"
IF [ -N $Log ]
ECHO "Test 18 Multiplication 1 : True : PASSED" >> ${Log}
SET P = $P + 1
FI
ELSE
Echo " Test 18 Multiplication 1 : False : FAILED"
IF [ -N $Log ]
ECHO "Test 18 Multiplication 1 : False : FAILED" >> ${Log}
SET F = $F + 1
FI
FI
# 19th Test * or Multiplication Test 2
SET T = $T + 1
SET GHI = 1 * 2 * 3 * 4 * 5 * 6 * 7 * 8 * 9
IF [ $GHI -EQ 362880 ]
Echo " Test 19 Multiplication 2 : True : PASSED"
IF [ -N $Log ]
ECHO "Test 19 Multiplication 2 : True : PASSED" >> ${Log}
SET P = $P + 1
FI
ELSE
Echo " Test 19 Multiplication 2 : False : FAILED"
IF [ -N $Log ]
ECHO "Test 19 Multiplication 2 : False : FAILED" >> ${Log}
SET F = $F + 1
FI
FI
# 20th Test / or Division Test 1
SET T = $T + 1
SET GHI = 362880 / 9 / 8 / 7 / 6 / 5
IF [ $GHI -EQ 24 ]
Echo " Test 20 Division 1 : True : PASSED"
IF [ -N $Log ]
ECHO "Test 20 Division 1 : True : PASSED" >> ${Log}
SET P = $P + 1
FI
ELSE
Echo " Test 20 Division 1 : False : FAILED"
IF [ -N $Log ]
ECHO "Test 20 Division 1 : False : FAILED" >> ${Log}
SET F = $F + 1
FI
FI
# 21th Test / or Division Test 2
SET T = $T + 1
SET GHI = 100000 / 100 / 20 / 5
IF [ $GHI -EQ 10 ]
Echo " Test 21 Division 2 : True : PASSED"
IF [ -N $Log ]
ECHO "Test 21 Division 2 : True : PASSED" >> ${Log}
SET P = $P + 1
FI
ELSE
Echo " Test 21 Division 2 : False : FAILED"
IF [ -N $Log ]
ECHO "Test 21 Division 2 : False : FAILED" >> ${Log}
SET F = $F + 1
FI
FI
# 22th Test MOD 1
SET T = $T + 1
SET GHI = 27 MOD 7
IF [ $GHI -EQ 6 ]
Echo " Test 22 MOD 1 : True : PASSED"
IF [ -N $Log ]
ECHO "Test 22 MOD 1 : True : PASSED" >> ${Log}
SET P = $P + 1
FI
ELSE
Echo " Test 22 MOD 1 : False : FAILED"
IF [ -N $Log ]
ECHO "Test 22 MOD 1 : False : FAILED" >> ${Log}
SET F = $F + 1
FI
FI
# 23th Test MOD 2
SET T = $T + 1
SET GHI = 198 MOD 30
IF [ $GHI -EQ 18 ]
Echo " Test 23 MOD 2 : True : PASSED"
IF [ -N $Log ]
ECHO "Test 23 MOD 2 : True : PASSED" >> ${Log}
SET P = $P + 1
FI
ELSE
Echo " Test 23 MOD 2 : False : FAILED"
IF [ -N $Log ]
ECHO "Test 23 MOD 2 : False : FAILED" >> ${Log}
SET F = $F + 1
FI
FI
# 24th Test Complex Math 1
SET T = $T + 1
SET GHI = 2 * 3 + 8 * 14 / 4 - 4 / 9 * 5
IF [ $GHI -EQ 25 ]
Echo " Test 24 Complex 1 : True : PASSED"
IF [ -N $Log ]
ECHO "Test 24 Complex 1 : True : PASSED" >> ${Log}
SET P = $P + 1
FI
ELSE
Echo " Test 24 Complex 1 : False : FAILED"
IF [ -N $Log ]
ECHO "Test 24 Complex 1 : False : FAILED" >> ${Log}
SET F = $F + 1
FI
FI
# 25th Test Complex Math 2
SET T = $T + 1
SET GHI = 22 - 50 / 14 + 4 * 28 - 64
IF [ $GHI -EQ -8 ]
Echo " Test 25 Complex 2 : True : PASSED"
IF [ -N $Log ]
ECHO "Test 25 Complex 2 : True : PASSED" >> ${Log}
SET P = $P + 1
FI
ELSE
Echo " Test 25 Complex 2 : False : FAILED - $GHI"
IF [ -N $Log ]
ECHO "Test 25 Complex 2 : False : FAILED - $GHI" >> ${Log}
SET F = $F + 1
FI
FI
ECHO
ECHO "End IF Numeric Tests"
ECHO