home *** CD-ROM | disk | FTP | other *** search
- # Checks for some unix utilites, used often in scripts. Reports wich dll's
- # or .EXEs are missing
-
- @ old_novice = novice
-
- ^set novice off
-
- @ missing.dlls = []
- @ missing.exes = []
-
- alias run_exe {
- @ re.exe = [$0]
- @ re.old_sh = SHELL
- @ re.old_sh_f = SHELL_FLAGS
- @ re.error = 0
- ^set SHELL cmd
- ^set SHELL_FLAGS /c
- ^on ^exec_error "run_exe SYS1804: The system cannot find the file *." {
- if (!match($8DLL $missing.dlls)) {
- if (missing_dlls) {
- @ missing.dlls = missing.dlls ## [ ] ## [$8DLL]
- }{
- @ missing.dlls = [$8DLL]
- }
- }
- @ re.error = 1
- }
- ^on ^exec_error "run_exe SYS1041:*" {
- if (!match($re.exe $missing.exes)) {
- if (missing.exes) {
- @ missing.exes = missing.exes ## [ ] ## re.exe
- }{
- @ missing.exes = re.exe
- }
- }
- @ re.error = 1
- }
- ^on ^exec_error "run_exe *" #
- ^on ^exec "run_exe *" #
- exec -name run_exe $0-
- wait %run_exe
- if (re.error) {
- echo *** $re.exe\ test failed!
- }{
- echo *** $re.exe\ test passed...
- }
- ^on ^exec_error -"run_exe SYS1804: The system cannot find the file *."
- ^on ^exec_error -"run_exe SYS1041:*"
- ^on ^exec_error -"run_exe *"
- ^on ^exec -"run_exe *"
- ^set SHELL $re.old_sh
- ^set SHELL_FLAGS $re.old_sh_f
- ^assign -re.exe
- ^assign -re.old_sh
- ^assign -re.old_sh_f
- @ function_return = re.error
- ^assign -re.error
- }
-
- alias test_ls_exe_ok {
- @ re.exe = [$0]
- @ re.old_sh = SHELL
- @ re.old_sh_f = SHELL_FLAGS
- @ re.error = 1
- ^set SHELL cmd
- ^set SHELL_FLAGS /c
-
- ^exec -name blah_crap echo blahcrapblah > delete.me
- wait %blah_crap
- ^on ^exec "ls_test *" #
- ^on ^exec_error "ls_test *" #
- ^on ^exec "ls_test *delete.me*" {
- if (([$5]==15) && ([$9]==[delete.me])) {
- @ re.error = 0
- }{
- @ re.error = [$1-]
- }
- }
-
- ^exec -name ls_test ls -al
- wait %ls_test
- ^exec -name ls_delete del delete.me
- wait %ls_delete
-
- if (re.error) {
- echo *** Error: LS is displaying data in wrong (non-unix format)
- echo ***
- echo *** Expected : -rw-rw-rw- 1 user group 15 Mar 01 10:14 delete.me
- echo *** LS output: $re.error
- echo ***
- echo *** This mean that you have another LS.EXE or LS.CMD somewhere on the PATH
- echo *** before LS.EXE included with IrcII/OS2. Please search directories on your
- echo *** PATH for LS.* and delete all copies except one included with IrcII/OS2
- echo
- }{
- echo *** LS.EXE output format test passed
- }
-
- ^on ^exec -"ls_test *"
- ^on ^exec_error -"ls_test *" #
- ^on ^exec -"ls_test *delete.me*"
- ^set SHELL $re.old_sh
- ^set SHELL_FLAGS $re.old_sh_f
- ^assign -re.exe
- ^assign -re.old_sh
- ^assign -re.old_sh_f
- ^assign -re.error
- }
-
- alias test_cat_exe_ok {
- @ re.exe = [$0]
- @ re.old_sh = SHELL
- @ re.old_sh_f = SHELL_FLAGS
- @ re.error = 1
- ^set SHELL sh
- ^set SHELL_FLAGS -c
-
- ^on ^exec "cat_test blahcrapblah" {
- @ re.error = 0
- }
-
- ^exec -name cat_test echo blahcrapblah| cat
- wait %cat_test
-
- ^on ^exec -"cat_test blahcrapblah"
-
-
- if (re.error) {
- echo *** Error: CAT dosn't echoing data correctly
- echo ***
- echo *** CAT is unix utility that just echoing all its input to output
- echo *** We are executed "/exec echo blahcrapblah | cat", but cat doesnt
- echo *** echoing "blahcrapblah" back
- echo ***
- echo *** This mean that you some other CAT.EXE or CAT.CMD somewhere on the PATH
- echo *** before CAT.EXE included with IrcII/OS2. Please search directories on your
- echo *** PATH for CAT.* and delete or rename all copies except one included with
- echo *** IrcII/OS2
- }{
- echo *** CAT.EXE output format test passed
- }
-
- ^set SHELL $re.old_sh
- ^set SHELL_FLAGS $re.old_sh_f
- ^assign -re.exe
- ^assign -re.old_sh
- ^assign -re.old_sh_f
- ^assign -re.error
- }
-
- alias run_all_tests {
- echo *** -----------------------------------------------------------------
- echo *** Testing if all vital unix utilites are working. If you will see
- echo *** any errors, almoust all unix scripts will fail to work correctly
- echo *** -----------------------------------------------------------------
- @ sh_ok = run_exe(SH.EXE ------------)
- @ ls_ok = run_exe(LS.EXE)
- @ cat_ok = run_exe(CAT.EXE --version)
- run_exe RM.EXE --version
- run_exe TAIL.EXE --version
- run_exe HEAD.EXE --version
- run_exe WC.EXE --version
- run_exe FMT.EXE --version
-
- echo ***
-
- if (missing.dlls) {
- echo *** Missing DLL's \($missing.dlls\\)
- }
- if (missing.exes)
- {
- echo *** Missing EXE's \($missing.exes\\)
- }
- if (!sh_ok && !ls_ok) {
- echo ***
- echo *** Testing LS output format
- test_ls_exe_ok
- }
- if (!sh_ok && !cat_ok) {
- echo ***
- echo *** Testing if CAT is really working
- test_cat_exe_ok
- }
-
- if (missing.dlls) {
- echo ***
- echo *** Some of DLL files requred are not found on LIBPATH.
- echo ***
- echo *** EMX*.DLL (emx runtime) can be downloaded from hobbes
- echo *** ftp site ftp://hobbes.nmsu.edu/os2/unix/emx09a/emxrt.zip
- echo ***
- echo *** GNU*.DLL (runtime for GNU Utilites) are included with IrcII/OS2
- echo *** in DLL subdirectory. Edit your CONFIG.SYS and add x:\\ircii\\dll to
- echo *** LIBPATH, reboot after that.
- }
- if (missing.exes)
- {
- echo ***
- echo *** Some of .EXE files requred are not found on the PATH. All needed .EXE
- echo *** files are included with Ircii/OS2 in BIN subdirectory. Edit your
- echo *** CONFIG.SYS file and make sure that x:\\ircii\\bin is in the PATH.
- echo ***
- echo *** You will also need to add x:\\ircii\\dll to a LIBPATH in CONFIG.SYS,
- echo *** it contains needed DLL's. Also all unix utilites are using EMX runtime
- echo *** DLL's. These DLL's also should be on a LIBPATH. EMX can be downloaded
- echo *** from ftp://hobbes.nmsu.edu/os2/unix/emxrt.zip
- }
- }
-
- run_all_tests
-
- ^eval ^set novice $old_novice
- ^assign -old_novice
- ^assign -missing.dlls
- ^assign -missing.exes
- ^alias -run_exe
- ^alias -run_all_tests
- ^alias -test_ls_exe_ok
- ^alias -test_cat_exe_ok
-
-
-