home *** CD-ROM | disk | FTP | other *** search
- Odds and Ends in this section:
-
- REDIRECTION
- NIL and PRT DEVICES
- ESCAPE CODES
- STRIPPING A WORKBENCH
- ________________________________________________________________________________
-
- REDIRECTION
-
- the process by which you can channel input/output from/to an alternate
- source
-
- That didn't make too much sense, so I'll try again.
-
- There are two operators for redirection, the "greater than" > and
- the "less than" < keys.
-
- More accurately the ">" key is the output operator /* write to */
- and the "<" key is the input operator /* read from */.
-
- By using these keys between the command and the pathname, AmigaDOS
- "redirects" the I/O /* Input/Output */ in accordance with your directions.
- There may be more than one argument required by the command but the redirection
- string would still go right after the command.
-
- We've use redirection a few times before, but let's have another look at
- one example again:
-
- >> DIR >ram:a
- /* we'll get drive activity but no output to the screen */
- >> DIR ram:
- c (dir)
- a
- /* there might be other junk here, too. you can clean it up on your own later */
-
- >> TYPE <ram:a
- /* a normal DIR listing */
-
- Frankly, and this may be due to lack of imagination, but I haven't found
- too much use for the "read from" function. In the situation above, it would also
- have worked by just using the TYPE command alone.
- However, ">" is very useful. As you've seen above, it will "capture"
- fleeting displays to be perused at your leisure.
- It can also discard displays you might find distracting or inconvenient.
- Some programs begin with a flourish. They can display anything from a simple
- usage statement to opening windows that pay homage to their creator.
- Should you find yourself in the situation of wanting to dispose of
- little thorns in your bed of roses, we'll use our redirect and a unique device.
- NIL:
-
- ________________________________________________________________________________
-
- NIL and PRT DEVICES
-
- NIL: pseudo-device that just returns an End-of-File (EOF)
- PRT: the device that is configured through "preferences" and handles
- output to your printer.
-
- NIL: first...
-
- If it's a device, why doesn't it show up at the end of an ASSIGN LIST
- command? Why isn't it mounted? Where is it?
-
- I don't know. But it works as advertised.
-
- NIL: will take input from anywhere....and throw it away.
-
- Just as an example, since AmigaDOS commands don't really fit the
- catagories described above.
-
- >> DIR >nil:
- /* same old disk activity */
- >> DIR nil:
- nil: not found
-
- If you noticed that there isn't a filename specified in the redirection
- line, good for you. So try it with a filename:
-
- >> DIR >nil:a
- /* as soon as you hit <RETURN> you should have gotten a system requester asking
- that you insert volumn "nil" in any drive. Hit cancel */
- CLI error: Unable to open redirection file
-
-
- Way back when if you watched the movie mentioned in the intro section,
- the program Projector begins by printing out a message. To prevent a message of
- this nature from being displayed, you'd start the program:
-
- BS> projector >nil: filename.film
-
- This techique will only throw away the display and won't interfere with
- the normal operation of the program.
-
-
-
- PRT:
-
- Files can be sent to PRT: in several ways. You can:
-
- BS> COPY [pathname/]filename prt:
- or
- BS> TYPE [pathname/]filename >prt:
-
- You can also type straight to the printer from the keyboard by:
-
- BS> COPY * >prt:
- /* the cursor will disappear now */
- /* the "*" here represents the screen/console, but if you're using the ARP
- commands this method won't work since the "*" is a wildcard. */
-
- To exit this mode, type <CTLR>\ /* control + back slash */. When you do
- this your cursor will re-appear.
-
- ________________________________________________________________________________
-
- ESCAPE CODES
-
- The CLI has a great many similarities with a printer, but it's more
- versatile. By sending it what is known as a command sequence indicator (CSI) to
- it, it will produce some of the same effects the a printer. The CSI is the
- <ESC> key.
-
- As was mentioned in the tutorial.5, ED doesn't allow <ESC> to be entered
- directly but you saw how we could get around that. You may have also noticed a
- few other "*somethings" in the file. Here's what they do:
-
- *E = <ESC>
- *F = <FF>
- *N = <LF>
- *T = <TAB>
- *V = <VTAB>
-
- /* e=escape, f=formfeed, n=linefeed(return), t=tab, v=vertical tab */
-
- One thing to remember is that, all these commands do is change the way
- the display is handled. They don't effect any change on the results of a
- command, except where, as in the case of our example with the startup-sequence,
- we might inadvertently mess up the syntax.
-
- Escape codes can be used to change the style of print:
- reversed
- bold
- italics
- underlined
-
- They can change the color .
-
- They can be used with almost any command that receives it's arguments in
- quotes, an exception being NEWCLI. The commands I've used most are ECHO and
- PROMPT. TYPE will just print /* display */ a file, if the textfile contains
- escape codes, TYPE doesn't care, but the display IS changed.
-
- Escape code syntax is:
- "<ESC>[ /* a number[s] specifing the effect *//* a terminal character */
-
- For example, "<ESC>[0m", turns off the effect of previously used escape
- codes. Try this:
-
- >> echo "*e[33mHow did it work?"
- How did it work?
- >> /* type a few letters here, then <CTRL>X to erase the line */
-
- What we did there was check that the second line was the original color.
- So when do we need to delimit the effects?
-
- >> echo "*e[33;42mHow did it work?"
- /* now we've ended up with a full screen outofcontrol line across the screen
- under our test line, since that wasn't what we wanted, we can insure that this
- sort of thing doesn't happen by delimiting the effect */
-
- >> echo "*e[33;42mHow did it work?*e[0m"
- How did it work?
-
- Here are the escape codes I've found. This isn't necessarily all of
- them, you can experiment around with your printer manual, which will usually
- have a list of escape codes that it recognizes, and try to find something that
- would give you any results you can't get with these.
-
- ________________________________________________________________________________
-
- Escape Codes
-
- with ED
- /* *E==<ESC>
- *F==<FF>
- *N==<LF>
- *T==<TAB>
- *V==<Vert tab> */
-
-
- use ";" to seperate multiple codes
-
- <ESC>[0m =reset/cancel
-
- Type Styles:
- <ESC>[1m =bold characters
- <ESC>[3m =italics
- <ESC>[4m =underlined
- <ESC>[7m =<ESC>[30;41m
- <ESC>[8m =(puts "cursors" of register 3 at beginning and end of
- blank line of the same length as spaces between this command and
- the delimiter)
-
- Colors:
- <ESC>[30m =set foreground to register 0 (background color)
- <ESC>[31m =foreground to register 1 (border & main body of disk icon)
- <ESC>[32m =foreground to register 2 (border of disk icon)
- <ESC>[33m =foreground to register 3 (general highlights & flap on disk icon)
- <ESC>[34m-<ESC>[39m =repeat as above
- <ESC>[40m =set background to register 0
- <ESC>[41m =background to register 1
- <ESC>[42m =background to register 2
- <ESC>[43m =background to register 3
- <ESC>[44m-<ESC>[49m =repeat as above
-
- Prompt:
- <ESC>[0<SPACE>p=turns cursor off
- <ESC>[<SPACE>p=turns cursor on
-
-
- ________________________________________________________________________________
-
- STRIPPING A WORKBENCH
-
- This blurb will discuss some of the ways that you can take a standard
- workbench and remove some of the things you might not need. This will create
- more room on the disk for you to install new commands as you find them.
-
- WARNING !!!
- DO NOT DO THIS TO YOUR ORIGINAL WORKBENCH DISK, ALWAYS WORK ON A COPY !!!
-
- As a suggestion before we start, I have complete disks that mirror some
- of the directories found on the workbench. "C" and "fonts" in particular.
- Before I removed some of this stuff from my workbench, I copied it to the disks.
- This way I can still have the more essential items at my disposal. There are
- lots of commands and fonts out there and by using the ASSIGN, CD, or PATH
- commands it's easy to use external /* not on the workbench */ directories.
-
- I have decided the best way to go about this is to make up a seperate
- file describing the operation. If you want to continue, copy the file
- "WB_axe"
- to the copy of the workbench you're going to have at. Reboot with that disk,
- break the startup-sequence with <CTRL>D, RUN ED, and TYPE WB_axe. This
- operation can be done from a batchfile, so that's the way we're going to do it.
- WB_axe will lead you through editing the batchfile we're going to need to
- perform the surgery, but if you're interested in creating the disks I mentioned
- above, you'll have to do that on your own.
- The operation of copying the directories over is different from a
- single drive to a multiple drive system, so since you know what you're
- working with and I don't...you handle it.
- /* Either way you can do it with something like:
-
- BS> copy wb:directory diskname: all
-
- using diskname instead of a drive number allows the single drive folks
- to use it too */
-
- It might be easier for you if you print out the file "WB_axe". Then you
- won't have to RUN ED to do the job or mess with TYPEing it.
- ________________________________________________________________________________
-
- I guess that about does it. Hopefully this has been so some help to you
- in understanding a little better how the CLI works and how to use it. Once
- again, you'll be steps ahead if you purchase the two books mentioned at the
- beginning of all this. They were written by people with the support of
- Commodore-Amiga and should be considered the definitive works on the subject.
-
- At any rate, the text files I've written can be distributed to anyone
- that might find them helpful as long as it's done free of charge. If errors are
- found or you have a better way to offer examples, let me know so these changes
- might be initiated.
-
- To Ken Grocke, where ever you are, I got your READER from a friend and
- it's great. Hopefully, you don't mind its being used for this purpose.
-
- ©1988, J. Petermann
-