home *** CD-ROM | disk | FTP | other *** search
/ OS/2 Shareware BBS: 11 Util / 11-Util.zip / sosutl12.zip / doc / sosutil.inf (.txt) < prev    next >
OS/2 Help File  |  1993-10-20  |  19KB  |  476 lines

  1.  
  2. ΓòÉΓòÉΓòÉ 1. SOS Utilities overview ΓòÉΓòÉΓòÉ
  3.  
  4. This file documents SOS Utilities version 1.2, a collection of small 
  5. command-line utilities for OS/2. 
  6.  
  7. Copyright (C) 1993, SuperOscar Softwares, Tommi Nieminen. 
  8.  
  9.  
  10. ΓòÉΓòÉΓòÉ 2. Permissions ΓòÉΓòÉΓòÉ
  11.  
  12. Permission is granted to make and distribute verbatim copies of this manual 
  13. provided the copyright notice and this permission notice are preserved on all 
  14. copies. 
  15.  
  16. Permission is granted to process this file through TeX and print the results, 
  17. provided the printed document carries copying permission notice identical to 
  18. this one except for the removal of this paragraph (this paragraph not being 
  19. relevant to the printed manual). 
  20.  
  21. Permission is granted to copy and distribute modified versions of this manual 
  22. under the conditions for verbatim copying, provided that the entire resulting 
  23. derived work is distributed under the terms of a permission notice identical to 
  24. this one. 
  25.  
  26. Permission is granted to copy and distribute translations of this manual into 
  27. another language, under the above conditions for modified versions, except that 
  28. this permission notice may be stated in a translation approved by the Free 
  29. Software Foundation. SOS Utilities is a collection of small useful utilities 
  30. written in REXX, the OS/2 batch file processing language. Also included is SOS 
  31. Tree, a utility for displaying the directory tree. 
  32.  
  33.  
  34. ΓòÉΓòÉΓòÉ 3. ChName---file name modifier ΓòÉΓòÉΓòÉ
  35.  
  36. ChName changes long HPFS file names to FAT format and vice versa. It is a 
  37. useful tool when copying files to or from diskettes. 
  38.  
  39.  
  40. ΓòÉΓòÉΓòÉ 3.1. ChName usage ΓòÉΓòÉΓòÉ
  41.  
  42.     [D:\] chname FILE ... [ /f /h /q /x /? ]
  43.  
  44. `/f' 
  45.           HPFS to FAT (default) 
  46.  
  47. `/h' 
  48.           FAT to HPFS (ie. reverse what was done with /f) 
  49.  
  50. `/q' 
  51.           Quiet mode 
  52.  
  53. `/x' 
  54.           Send output to a REXX queue instead of standard output 
  55.  
  56. `/?' 
  57.           Show help page and quit 
  58.  
  59.  
  60. ΓòÉΓòÉΓòÉ 3.2. How it's done ΓòÉΓòÉΓòÉ
  61.  
  62. When changing HPFS names to FAT, the program first simply tries to truncate the 
  63. name to the `????????.???' mask. Spaces are converted to underlines, and the 
  64. first and the last dot-separated part are put together. For example, 
  65.  
  66.     "What ever happened to Baby Jane.txt.Z" -> WHAT_EVE.Z
  67.  
  68. If there already is a file with the same name, a part of the resulting name is 
  69. substituted with a number, eg. `WHAT_EV0.Z'. Only as many letters are 
  70. substituted as necessary---first one number is tried (`0...9'), then two 
  71. numbers (`00...99') and so on. Eventually a unique file name is very probably 
  72. found. 
  73.  
  74. The long HPFS file name is saved to the `.LONGNAME' extended attribute so that 
  75. the name can later be restored with the `/h' switch, eg. 
  76.  
  77.     WHAT_E00.Z -> "What ever happened to Baby Jane.txt.Z"
  78.  
  79.  
  80. ΓòÉΓòÉΓòÉ 3.3. Using REXX queues ΓòÉΓòÉΓòÉ
  81.  
  82. The `/x' switch is designed to be a helpful addition for REXX programmers. With 
  83. it, the output of ChName (ie. the old file names, whether long or short, and 
  84. corresponding new names)  can be easily fetched. For example, the following 
  85. program saves all the long names to long_name stem variable, and corresponding 
  86. short names to short_name stem. 
  87.  
  88.     /* example.cmd */
  89.  
  90.     "@echo off"
  91.     Parse Arg list
  92.  
  93.     n = 1
  94.     Do i = 1 To Words(list)
  95.         file = Word(list, i)
  96.         Call ChName file "/f /x"
  97.         Do While Queued() > 0
  98.             Parse Pull long " -> " short
  99.             long_name.n = long
  100.             short_name.n = short
  101.             n = n + 1
  102.         End
  103.     End
  104.  
  105.  
  106. ΓòÉΓòÉΓòÉ 3.4. Known bugs ΓòÉΓòÉΓòÉ
  107.  
  108. Spaces in file names cannot be handled from the command line, ie. you cannot 
  109. use ChName like this: 
  110.  
  111.     [D:\] chname "What really happened to Baby Jane.txt.Z"
  112.  
  113. Because OS/2 seems to strip the quotes before anything reaches REXX, ChName 
  114. gives you a list of silly messages about files not found: 
  115.  
  116.     ChName v1.1: File 'What' not found
  117.     ChName v1.1: File 'really' not found
  118.     ...
  119.  
  120. But spaces are still allowed in file names, so the following is possible even 
  121. if the `*.txt.Z' mask matched also files with spaces in their names: 
  122.  
  123.     [D:\] chname *.txt.Z
  124.  
  125.  
  126. ΓòÉΓòÉΓòÉ 4. Extract ΓòÉΓòÉΓòÉ
  127.  
  128. Extract---extract files from archives or list archive contents.  A REXX script. 
  129.  
  130. Note: Extract only chooses the appropriate archiver and forms the command line 
  131. which is passed to it; you will still need all the archivers whose archive 
  132. files you encounter. However, Extract makes working with the archivers much 
  133. more comfortable since you don't need to remember every switch of every program 
  134. (or indeed, remember the actual executable names of the archives). It also 
  135. makes it possible to put the archivers to a directory not contained in 
  136. `PATH'---just edit the line arcdir=... in `extract.cmd' to point to your 
  137. archiver directory. 
  138.  
  139.  
  140. ΓòÉΓòÉΓòÉ 4.1. Extract usage ΓòÉΓòÉΓòÉ
  141.  
  142.     [D:\] extract ARCHIVE [ FILE ... ] [ /jlp? /t DIR ]
  143.  
  144. `/j' 
  145.           Junk directories (ie. don't extract them). With this switch, files 
  146.           are extracted to the current directory, or the directory given with 
  147.           `/t' switch. Can't be used together with `/l' or `/p'. 
  148.  
  149. `/l' 
  150.           Show archive contents. Output goes to stdout. Can't be used together 
  151.           with `/l', `/p', or `/t'. 
  152.  
  153. `/p' 
  154.           Extract to stdout. Useful in viewing document files stored in the 
  155.           archive. 
  156.  
  157. `/t DIR' 
  158.           Set directory in which files are extracted. Without the `/j' 
  159.           switches, any subdirectories contained in the archive file will be 
  160.           created under DIR. The space between the switch and the directory 
  161.           name isn't necessary. 
  162.  
  163. `/?' 
  164.           Display help page and quit. 
  165.  
  166.  
  167. ΓòÉΓòÉΓòÉ 4.2. Examples of Extract usage ΓòÉΓòÉΓòÉ
  168.  
  169. Suppose you have a file `foo.zoo', which includes the following files (and 
  170. subdirectories): (Zoo, Zip, gzip, tar and Compress use slashes instead of 
  171. backslashes internally to separate directories, but in the command line of 
  172. Extract you should use backslashes---otherwise you'll get silly messages of 
  173. unknown switches...) 
  174.  
  175.     src\foo.c
  176.     src\foo.h
  177.     src\foo.mak
  178.     exe\foo.exe
  179.     man\foo.man
  180.     README
  181.     Copyright
  182.  
  183. To extract all the files, use 
  184.  
  185.     [D:\] extract foo.zoo
  186.  
  187. To extract all the files in `src' subdirectory (ie. `foo.c', `foo.h', and 
  188. `foo.mak'): 
  189.  
  190.     [D:\] extract foo.zoo src\*
  191.  
  192. The same as above, but do not create `src' subdirectory, ie. extract files to 
  193. the current directory: 
  194.  
  195.     [D:\] extract foo.zoo src\* /j
  196.  
  197. The same as above, but extract to `C:\tmp\thrash' directory: 
  198.  
  199.     [D:\] extract foo.zoo src\* /j /t C:\tmp\thrash
  200.  
  201. To list the contents of this archive, use: 
  202.  
  203.     [D:\] extract foo.zoo /l
  204.  
  205. To view the `README' file with `more', use: 
  206.  
  207.     [D:\] extract foo.zoo README /p |more
  208.  
  209. To redirect `README' to printer: 
  210.  
  211.     [D:\] extract foo.zoo README /p >prn
  212.  
  213.  
  214. ΓòÉΓòÉΓòÉ 5. FileFind ΓòÉΓòÉΓòÉ
  215.  
  216. FileFind---whereis-like find file utility written completely in REXX. 
  217.  
  218.  
  219. ΓòÉΓòÉΓòÉ 5.1. FileFind usage ΓòÉΓòÉΓòÉ
  220.  
  221.     [D:\] filefind [PATH\]FILENAME ... [ /h /n /? ]
  222.  
  223. FileFind finds files under PATH if that is specified, or the current directory 
  224. (= `.') if it isn't. Multiple command line arguments are allowed. 
  225.  
  226. `/h' 
  227.           find hidden and system files too 
  228.  
  229. `/n' 
  230.           brief format: display only file names 
  231.  
  232. `/?' 
  233.           display help page and quit 
  234.  
  235.  
  236. ΓòÉΓòÉΓòÉ 5.2. Examples of FileFind usage ΓòÉΓòÉΓòÉ
  237.  
  238. Note the prompt (ie. current directory info) in the following examples! 
  239.  
  240. Find all `*.inf' files under `D:\OS2' 
  241.  
  242.     [D:\OS2] filefind *.inf
  243.  
  244. The same as preceding, but note that the current directory is now different: 
  245.  
  246.     [D:\] filefind \OS2\*.inf
  247.  
  248. Find all `*.exe' files under `C:\Bin' 
  249.  
  250.     [D:\] filefind C:\Bin\*.exe
  251.  
  252. Find all `*.inf' files under `D:\OS2\DLL' and `D:\os2\apps'---this demonstrates 
  253. multiple command line arguments 
  254.  
  255.     [D:\OS2] filefind DLL\*.inf apps\*.inf
  256.  
  257.  
  258. ΓòÉΓòÉΓòÉ 5.3. Warning ΓòÉΓòÉΓòÉ
  259.  
  260. FileFind displays file dates and times in the national format, which is found 
  261. with a SysIni() call to `os2.ini'. However, this seems to be causing troubles 
  262. every now and then---sometimes SysIni() returns insane results, like `0' as the 
  263. date or time separator.  If you are having problems with this, remove all date 
  264. and time formatting lines from the program, and change the following line: 
  265.  
  266.     ok = SysFileTree(Word(find, i), files, "fst", "*--*-")
  267.  
  268. to 
  269.  
  270.     ok = SysFileTree(Word(find, i), files, "fs", "*--*-")
  271.  
  272. FileFind will then display dates and times in the American formats (`MM/DD/YY' 
  273. and `HH:MM{am|pm}', respectively) which are insane but work fine. 
  274.  
  275.  
  276. ΓòÉΓòÉΓòÉ 6. kill---kill processes ΓòÉΓòÉΓòÉ
  277.  
  278. kill---kill processes by their process id's (PID). 
  279.  
  280.  
  281. ΓòÉΓòÉΓòÉ 6.1. kill usage ΓòÉΓòÉΓòÉ
  282.  
  283.     [D:\] kill PID ...
  284.  
  285. Process id's are given in decimals, not hexadecimals. To get decimal process 
  286. id's, use ps (See ps) instead of the OS/2 system utility PSTAT (well, actually 
  287. ps runs PSTAT). 
  288.  
  289.  
  290. ΓòÉΓòÉΓòÉ 6.2. System requirements ΓòÉΓòÉΓòÉ
  291.  
  292. kill is a Perl program and requires you to have Perl installed. Perl is a 
  293. programming language which originally was designed for UNIX (how else) but is 
  294. now ported for many other operating systems. Perl should be find by anonymous 
  295. FTP'ing to one of the following places: 
  296.  
  297.     hobbes.nmsu.edu
  298.     ftp.cdrom.com
  299.     ftp.luth.se
  300.     ftp.informatik.tu-muenchen.de
  301.     ftp.urz.uni-heidelberg.de
  302.  
  303. and possibly many others. Try directories like 
  304.  
  305.     .../os2/2_x/programming                or
  306.     .../os2/2_x/unix/programming
  307.  
  308. and search for files starting `perl'. 
  309.  
  310.  
  311. ΓòÉΓòÉΓòÉ 6.3. Tips ΓòÉΓòÉΓòÉ
  312.  
  313. If you are using an aliasing shell like 4OS2, this script should be easy to 
  314. convert to an alias. For example, when using 4OS2, put the line 
  315.  
  316.     KILL=perl -e "kill(9, %$);"
  317.  
  318. in your alias file, or type 
  319.  
  320.     [D:\] alias kill=`perl -e "kill(9, %$);"`
  321.  
  322. at the command line. 
  323.  
  324. I haven't yet figured out how command line can be passed to sh (ms_sh 2.1C). 
  325. The easiest solution (using `$*') doesn't seem to work. 
  326.  
  327.  
  328. ΓòÉΓòÉΓòÉ 7. ps---process status ΓòÉΓòÉΓòÉ
  329.  
  330. ps---display processes with their process id's (PID),  parent process id's 
  331. (PPID), and session id's (SID). 
  332.  
  333.  
  334. ΓòÉΓòÉΓòÉ 7.1. ps usage ΓòÉΓòÉΓòÉ
  335.  
  336.     [D:\] ps
  337.  
  338. ps output looks like this: 
  339.  
  340.     PID  PPID   SID  PROCESS
  341.      3     1     1   d:\os2\pmshell.exe
  342.      7     3    18   d:\bin\pc2\pc2.exe
  343.      6     3    17   d:\bin\xfeel.exe
  344.      5     3    16   d:\os2\pmshell.exe
  345.      4     3     0   d:\os2\system\harderr.exe
  346.  
  347. All the numeric values are decimals. If you want hexadecimals, just remove all 
  348. calls to Format() and X2D() in lines 24--26 of `ps.cmd'; ie. change 
  349.  
  350.     pid = Format(X2D(Word(line, 1)), 4)
  351.  
  352. to 
  353.  
  354.     pid = Word(line, 1)
  355.  
  356. You may have to reformat the header line to get the columns right. 
  357.  
  358.  
  359. ΓòÉΓòÉΓòÉ 7.2. System requirements ΓòÉΓòÉΓòÉ
  360.  
  361. ps is a REXX program and requires you to have REXX installed. Also, ps calls 
  362. PSTAT to obtain the information, and only re-formats the output to a more 
  363. readable and at least shorter format. PSTAT is part of the OS/2 Diagnostic 
  364. Tools installation options; if you don't have the file `pstat.exe' in your 
  365. `\OS2' directory, use the `Selective Install' object in your System folder to 
  366. install it. REXX can be installed in the same way, in the unlikely case you 
  367. haven't it installed already. 
  368.  
  369. `rxqueue.exe' should also be found in the `\OS2' directory. It is part of the 
  370. REXX installation option. 
  371.  
  372.  
  373. ΓòÉΓòÉΓòÉ 7.3. Implementation notes ΓòÉΓòÉΓòÉ
  374.  
  375. It took a long while before I found out how to pipe output to REXX routines 
  376. inside a REXX program. Maybe there are even better altern- atives than the 
  377. rxqueue method this program uses, but none of them is documented in the 
  378. standard OS/2 package. I really wish IBM would some day give a full, decent 
  379. documentation free with the OS/2 system... 
  380.  
  381.  
  382. ΓòÉΓòÉΓòÉ 8. SOS Tree ΓòÉΓòÉΓòÉ
  383.  
  384. SOS Tree---directory tree drawer utility for OS/2. 
  385.  
  386.  
  387. ΓòÉΓòÉΓòÉ 8.1. SOS Tree usage ΓòÉΓòÉΓòÉ
  388.  
  389.     [D:\] sostree [ -adfnqz ] PATH
  390.  
  391. `-a' 
  392.           Display file attributes in the format `ADHRS' 
  393.  
  394. `-d' 
  395.           Display dates and times too (in current national format). 
  396.  
  397. `-f' 
  398.           Include plain files too in the listing. 
  399.  
  400. `-n' 
  401.           List all directories (or all files and directories with -f option) 
  402.           with full path names; do not draw the tree graph. 
  403.  
  404. `-q' 
  405.           Don't display the `Directory tree of ...' header. 
  406.  
  407. `-z' 
  408.           Display file sizes too. This switch is meaningless if `-f' isn't used 
  409.           simultaneously. 
  410.  
  411.  
  412. ΓòÉΓòÉΓòÉ 8.2. Note of re-compiling SOS Tree ΓòÉΓòÉΓòÉ
  413.  
  414. I have tried to make SOS Tree as easy to be translated to other languages as 
  415. possible, but without the IBM mkmsgf utility I'm forced to use different 
  416. methods than the handy message file system OS/2 offers. However, it should 
  417. still be easy to make other-language versions of the program. From version 1.0a 
  418. onwards, after the standard `.h' files have been included, there are 
  419. conditional #include clauses (lines 24- in `sostree.c'): 
  420.  
  421.     #if defined(LANG_SUOMI)
  422.     #include "msg_suomi.inc"
  423.     ...
  424.     #else
  425.     #include "msg_english.inc"      /* The default */
  426.     #endif
  427.  
  428. To get the Finnish messages, compile with `LANG_SUOMI' symbolic constant 
  429. defined. For example, using Borland C++: 
  430.  
  431.     [D:\] bcc -DLANG_SUOMI sostree.c
  432.  
  433. To create a custom message file, examine `msg_english.inc' or for an example, 
  434. and then add an appropriate #elsif clause to `sostree.c': 
  435.  
  436.     #if defined(LANG_SUOMI)
  437.     #include "msg_suomi.h"
  438.     #elsif defined(LANG_ESPERANTO)
  439.     #include "msg_esperanto.h"
  440.     ...
  441.     #else
  442.     #include "msg_english.h"
  443.     #endif
  444.  
  445. No other changes to `sostree.c' are necessary. To compile this new version, you 
  446. need to define `LANG_ESPERANTO' constant in the command line of the compiler, 
  447. of course. 
  448.  
  449. NOTE: please send your translations to me so that I can include them in the 
  450. next `official' release of SOS Tree. 
  451.  
  452.  
  453. ΓòÉΓòÉΓòÉ 9. Version and copyrights ΓòÉΓòÉΓòÉ
  454.  
  455. SOS Utilities version 1.2 
  456.  
  457. SOS Tree v1.0a---directory drawer 
  458. ChName v1.1b---change names to/from FAT format 
  459. Extract v1.1---archive extractor/lister 
  460. FindFile v1.4a---file finder 
  461. kill v1.0--kill process 
  462. ps v4.0a---display process status 
  463. Copyright (C) 1993, SuperOscar Softwares, Tommi Nieminen. 
  464.  
  465. These programs are free software; you can redistribute them and/or modify them 
  466. under the terms of the GNU General Public License as published by the Free 
  467. Software Foundation; either version 1, or (at your option) any later version. 
  468.  
  469. These programs are distributed in the hope that they will be useful, but 
  470. WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or 
  471. FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for more 
  472. details. 
  473.  
  474. You should have received a copy of the GNU General Public License along with 
  475. this program package; if not, write to the Free Software Foundation, Inc., 675 
  476. Mass Ave, Cambridge, MA 02139, USA.