TurboList v0.08 alpha (8-Aug-95) ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ coded by Conrad Sanderson (e-mail: g.sanderson@ais.gu.edu.au) Mail me with bug reports or suggestions... NOTE: I gotta finish a BEng degree (and i'm aiming for Honors), hence i cannot waste time coding this thing. I will only develop this thing further when i get sick of studying or something. With the way Escum is proceeding with the "development" of new Amigas, i'll be buying a PCI PowerMac as soon as i accumulate enough money. I invite other Amiga coders (demos makers and utility writers) to join me - there's much work to be done in Amigaizing PCI PowerMacs, which have some lovely hardware, but a semi-crap OS. The philosophy behind my move is long - but it's sufficient to say that the numbers (of various kinds) for Amiga don't add up anymore. TABLE OF CONTENTS ~~~~~~~~~~~~~~~~~ 0. Legal Notice 1. Requirements 2. Quick Overview 3. List of features 4. Why is it faster? 5. It's still experimental 6. Options 7. Aliasing 8. History 9. To do 0. LEGAL NOTICE ~~~~~~~~~~~~~~~ TurboList is (c) Copyright 1995 Conrad Sanderson. This program (TurboList) and its documentation files can be distributed and used freely, as long as all of the following conditions are satisfied: 0.1 the executable and documentation file(s) are not modified in any way. 0.2 the executable and documentation file(s) are not stored on, or transferred from, (in any manner) any device which is property (whole or partially) of Microsoft or any of its subsidiaries (owned whole or partially by Microsoft). 0.3 any breaches of conditions 0.1 and 0.2 must be reported to me (Conrad Sanderson) immediately. Failure to obey the above conditions (0.1, 0.2 and 0.3) is treated as a violation of copyright laws AND acceptance of all of the following conditions: 0.4 each copy of the executable and documentation file(s) requires a license for either use, distribution or storage. 0.5 Each license can be obtained from me (Conrad Sanderson) for US$1,000,000.00 1. Requirements ~~~~~~~~~~~~~~~ At least Kickstart 2.04 (v37.175) The 68020 version requires at least a 68020 processor (ie. Amiga A1200, CD32, A2500, A3000, A4000 or any machine with a 68020+ accelerator). This version has been specifically optimized for 32 bit memory access and 32 bit maths and hence is faster than the 68000 version. The 68000 version can be used on any Amiga, but is best suited for machines which only have the 68000 or the 68010 processor (A500, A600, A2000). The are 2 executables supplied in the archive: "tl.020" and "tl.000" rename the appropriate one for your computer to "tl". 2. Quick Overview ~~~~~~~~~~~~~~~~~ NEW: as of v0.08, TurboList is pure and hence can be made resident. If the 'p' bit (indicating pure) is not set when the executable is extracted from the archive, use shell> protect tl +p Once the 'p' bit is set, use shell> resident tl to make it resident (can be part of startup). This way tl will not have to be loaded from disk each time it's used. TurboList is a command similar to the standard list command supplied with AmigaDOS. The normal 'list' command, lists files like this: etherpeek 2369 ---arwed 04-Jan-95 22:21:34 alien.iff 1314114 ----rwed 07-Jan-95 01:31:08 desert.rat.toxic.article.gz 3684 ----rwed 05-Apr-95 17:24:34 ultoa020.o 444 ----rwed 28-Mar-95 19:11:11 ftphunt.gz 13768 ---arwed 04-Jan-95 14:27:41 mui23usr.LZX 504572 ----rwed 26-Mar-95 19:21:54 electric.bullet 1416 ---arwed 04-Jan-95 22:16:54 ar311.lha 95557 ----rwed Today 02:44:23 replacement.functions 1029 ----rwed 11-Mar-93 23:20:17 9 files - 3796 blocks used TurboList lists them like this (similar to unix ls): ---arwed 04 Jan 22:21 2.3 K etherpeek ----rwed 07 Jan 01:31 1.3 M alien.iff ----rwed 05 Apr 17:24 3.6 K desert.rat.toxic.article.gz ----rwed 28 Mar 19:11 0.5 K ultoa020.o ---arwed 04 Jan 14:27 13.4 K ftphunt.gz ----rwed 26 Mar 19:21 492.8 K mui23usr.LZX ---arwed 04 Jan 22:16 1.4 K electric.bullet ----rwed Tod 02:44:23 93.3 K ar311.lha ----rwed 11 Mar xx93 1.0 K replacement.functions TOTAL: 9 files [1.8 M] and 0 dirs [1.9 M used, 1.0 M free] As you can see, long filenames do not stuffup the formatting. Additionally, file sizes are approximated to their nearest multiplier (ie. Kilobytes, Megabytes or Gigabytes), which is much easier to read. This behaviour can be switched off. The date/time output is also different - if the file was created on the day you are listing it, it will print out "Tod hh:mm:ss", where Tod = Today, hh = hours, mm = minutes, ss = seconds. If the file was created within 6 months of Today, the day of the month and the month will be printed, along with hh:mm. If the file is older than 6 months, the full date, but no time, is printed. This unix-like behaviour can be switched off and the full date printed without any conditions. Additionally, the file sizes are added up and listed at the end (the [1.8 M] in above example). The actual space taken up by the listed files is also printed (ie. 1.9 M used) - this is due to the amount of blocks being used for a file, and blocks have constant sizes (usually 512 bytes on FFS), hence a file which takes up 444 bytes actually takes up 2 blocks, 1 * 512 for the file, and 1 * 512 for the directory entry (these values all depend on the file system used). The amount of free space (ie. 1 M free) on the device is also printed. Files which have the hidden ('h') protection bit enabled will be ignored and not taken into account when counting sizes/space taken up. This can be switched off. NOTE: I have been informed that 'h' actually means hold, not hidden. However, the 'h' has never been properly implemented in the OS and hasn't been documented either. I will remove 'h' bit code (which detects hidden files) from tl and replace it with looking for files which start with '.' (ie. a dot). File size conversion explanation: K = 1024 bytes (1 Kilobyte) M = 1024 K (1 Megabyte) G = 1024 M (1 Gigabyte) NOTE: If any of the above values exceed 4 Gigabytes, strange/incorrect results will be printed... but not many people have 4 Gigabyte drives. 3. List of features ~~~~~~~~~~~~~~~~~~~ - Can be upto 30% faster than the normal 'list' command - Long filenames fit without stuffing up the display - Approximates the file size so it can be read easily (can be turned off) - similar to unix-ls date printing behaviour - doesn't display hidden files (with the h bit) (can be turned off) - handles patterns (ie. stuff like foobar.#? etc) - listing according to dates (since/upto date limitations) 4. Why is it faster? ~~~~~~~~~~~~~~~~~~~~ - grabs 3 filenames before printing them (can be turned off) (note: caching filenames may not be desirable when using pattern matching on a slow drive... will be fixed later) - Turns off the cursor while printing, but turns it back on as soon as it has finished printing a set of names. The cursor can be configured to remain on at all times. - Direct writes (can be forced to use normal printing methods) 5. It's still experimental ~~~~~~~~~~~~~~~~~~~~~~~~~~ - don't expect everything working perfectly - a lot of functions are missing when compared to the normal list command eg. recursive directories 6. Options ~~~~~~~~~~ The letters after '/' specify the type of argument /M = multiple strings (keyword doesn't have to be present) /S = switch (ie. enable) (keyword has to be present) /K = keyword followed by a string If a keyword (or its shortcut) has the same name as a directory/filename you are trying to list, you must use DIR=filename to avoid the conflict. Alternatively, you can use UNIX like keywords (see the "-unix" option for more information). DIR/M, -h=-?=HELP = ABOUT/S, -sh=SH = SHOWHIDDEN/S, -co=CO = CURSORON/S, -nj=NJ = NOJUMP/S, -nd=ND = NODIRECT/S, -unix/S, -files = FILES/S, -dirs = DIRS/S, -noda=NODA = NODATES/S, -ex=EX = EXACT/S, -free = FREE/S, -since = SINCE/K, -upto = UPTO/K, -normd=NORMD = NORMALDATE/S -com=COM = COMMENT/S -nototal = NOTOTAL/S DIR Name of a directory or a file or nothing (will list current dir). Currently tlist can only process one name (no multiple directories). ABOUT, HELP, -?, -h Print version/date information. In some versions this option may also display various debugging information. SHOWHIDDEN, SH, -sh Show hidden files/directories (h protection bit). CURSORON, CO, -co Keep the cursor on at all times. Tlist turns the cursor off while printing something. If you are using tlist over a comm link (eg. modem link, AUX:, null-modem, etc.), your terminal may not be able to interpret cursor on/off commands, hence this option. NOJUMP, NJ, -nj Do not cache filenames - print out filnames as soon as they are read from the disk. This can be used if you have a slow drive and are listing patterns. Normally tlist caches 3 names before printing them. I'll probably change the name of this option to NOCACHE in later versions. NODIRECT, ND, -nd Use normal printing methods instead of direct writes. Direct writes may conflict with some console-handlers (eg. KingCON with Jump Scroll enabled) or communication links. -unix Instructs tlist to use options _only_ which start with '-'. Useful when a option has the same name as a dir/file, or you prefer UNIX type keywords. Only works properly when it is specified as part of the command line. (note: even if you do not specify -unix, options starting with '-' still work. ) FILES, -files List only files DIRS, -dirs List only directories NODATES, NODA, -noda Do not print date/time of files/dirs. EXACT, EX, -ex Print out the exact size of files (ie. no approximations). FREE, -free Display the amount of used and free space only. Example: shell> tlist free dh0: [7.1 M used, 917.1 K free] 'dh0:' can be replaced with any filename/directory/device or even omitted. If it's omitted, tlist will use the current directory as the argument. SINCE, -since Limit listing of files to only those which were created since a specified date/time. The date/time must be specified in standard AmigaDOS format. Examples of valid dates: today, yesterday, thursday (ie. any day of the week), 01-Jun-93, 2:08 (ie. hh:mm), 2:08:01 (ie. hh:mm:ss). When specifying a time, it will be assumed you are referring to a time which was Today. UPTO, -upto Similar to SINCE, but instead it limits listing of files to only those which were created upto a specified date/time. COMMENT, COM, -com Display filecomments NOTOTAL, -nototal don't print the TOTAL: ... 7. Aliasing ~~~~~~~~~~~ You can alias tlist to have a default behaviour which you want. It has to be aliased for every shell window you open (can be part of s:shell-startup) Example1: shell> alias tlist tlist showhidden exact ... and whenever tlist is used, the showhidden and exact options will be on. Example2: shell> alias tlist tlist -unix ... and whenever tlist is used, only options which start with '-' will be used. In later versions tlist may also use environment variables, so the default behaviour can be modified globally. 8. History ~~~~~~~~~~ 0.08 seperated fields by 2 spaces seperated size multiplier by 1 space modified date output to be more unix like modified file size approximator to always display in x.x format added COMMENT/S added NOTOTAL/S removed BOTH/S can now be made resident: uses cres.o for resident startup, hence the executable is larger than necessary. Next version may have a stripped down version of cres.o 0.07 reversed order of fields when printing - now looks similar to unix ls modified code to use jump tables instead of checking variables all the time when deciding what function to use. modified filestats() - ignores hidden files completely modified date output to look like unix ls modified string handling function again... in time critical code, replaced mystrcat() with combinations of mystrputchar(), mystrputword(), mystrputlong() - results in smaller and faster code using memcpy() instread of mystrcat() when handling long strings results in much less access to memory, hence faster added SINCE, UPTO, NORMALDATE, and BOTH keywords modified ultoa() so it can pad generated strings with spaces, depending on the length of the generated string. This made mysprintf() totally redundant. 0.06 major code update (read: optimized the crap out of it) - replaced many occurances of strcat()/strcpy() with mystrcpy()/mystrcat() which are much faster... tlist now accesses memory much less - replaced most occurances of mysprintf() (and hence RawDoFmt()) with mystrcat()/mystrcpy()/mystrputchar()/ultoa() - due to above changes, tlist now is ~8% faster than last version added FREE keyword rearranged filestats(), added total size of files and total space used by files added CPU check for 68020+ version 68000 version uses utility.library for 32 bit maths 0.05 implemented patterns (#?.sfsf#? etc) 0.04 added dates 0.03 replaced many occurences of mysprintf() with strcat()/strcpy() added filestats() 0.02 added protection bits 0.01 tested the theory that print buffering and no cursor would speed up directory listing 9. To do ~~~~~~~~ - show/don't show .info files (hidden by default, SHOWINFO) - show files/dirs bigger/smaller according to specified size - multiple directories - recursive directories - resolve the 'h' protection bit -> ie. hidden or take it out? - make files starting with . hidden - strip cres.o to bare essentials