[net.micro.amiga] A CLI toy

dewi@druca.UUCP (WilliamsD) (02/28/86)

Here's a simple CLI command that grew out of my experiments with
Metacomco's assembler package (Manx C should arrive real soon now...)
It's an extended version of the AmigaDOS echo command that allows X3.64
ansi escape sequences to be easily generated. It has certain similarities
to the UN*X echo command, except that it uses backslash hex instead of
backslash octal for ideological reasons.

My apologies if this is too simple for submission -- I thought that it
might amuse somebody out there in netland. Send mail if you want the
source -- since it's an asm file I assumed most people wouldn't be
interested.

There's an attached command file that exercises most of the capabilities
of ansiecho.
---------------------------- snip here ---------------------------------
echo "creating source files:"
echo "\tansiecho.doc"
cat <<"FUNKYSTUFF" >ansiecho.doc
This is a replacement for the AmigaDOS echo CLI command. It should be
upwardly compatible with the original, with one exception:

AmigaDOS echo, when presented with a '?', will print out a colon as a null
help prompt. This version will just echo the question mark.

The ANSI X3.64 codes used by the console driver are supported, and a means
of suppressing the final newline has been supplied. In a manner similar to
that of the UNIX(tm) echo command, a backslash is used to introduce special
sequences.
The following backslash constructs are supported:
         \t    tab
         \n    newline
         \f    formfeed (clear screen)
         \e    escape character
         \c    on end of string, suppresses newline
         \b    backspace
         \\    single backslash
         \"    explicit string quote, otherwise eaten.
         \nn   hexadecimal character (must be upper case to avoid
               ambiguity).

As an example, try ansiecho \e[37mhello world\e[0m. Note that the arguments
to echo must be quoted if you want to emit an embedded semi-colon e.g.

               echo "this;that"

or the CLI will treat everything after the semicolon as a comment.

Note that the \nn sequence is in hex, rather than the octal of the UNIX(tm)
echo command. I chose that representation because that's how the console
documentation is written. Besides, I don't like octal!

For an example of the capabilities of this CLI command, execute the
supplied ansiecho.demo. You'll need a full-size CLI window.

This command is distributed as "ansiecho" in order to avoid confusion. Feel
free to rename it as echo if it  meets your needs.

                        Enjoy!

Perpetrator: Dewi Williams  ..!ihnp4!druca!dewi
             Unconditionally placed in the public domain.

Legal gobbledegook:
        UNIX is a trademark of AT&T Bell Laboratories.
        AmigaDOS is presumably a trademark of Commodore-Amiga Inc.
FUNKYSTUFF
echo "\tansiecho.demo"
cat <<"FUNKYSTUFF" >ansiecho.demo
; Demo file showing what can be done with the ANSI capabilities of the
; replacement echo ("ansiecho") command.
; Remember that if you need to output semicolons, put *everything* in quotes.
; Sequences are split into multiple echoes in order to introduce a delay
; effect -- ansiecho is quite happy with maximum size (255) command lines.
; Perpetrator: Dewi Williams ..!ihnp4!druca!dewi

ansiecho \f           ; clears the window
ansiecho \e[10E\e[13C\c
ansiecho \e[37mThis is a demonstration of ANSI echo sequences\e[0m
ansiecho \e[13C----------------------------------------------
wait 1
; Now do some slow-ish scrolling.
ansiecho \e[2S\c
ansiecho \e[2S\c
ansiecho \e[2S\c
ansiecho \e[2S\c
ansiecho "\e[2S\e[4;1H\c"
ansiecho This echo allows full access to the ANSI X3.64 codes for the CON: driver.
ansiecho These allow the following capabilities:
ansiecho "\e[10C\e[37mScrolling\e[0m\e[6;40Hboth up and down"
ansiecho "\e[10C\e[37mColor change\e[0m\e[7;40Has already demonstrated"
wait 1
ansiecho "\e[10C\e[37mCursor movement\e[0m\e[20;40H\c"
wait 1
ansiecho "to over here...\e[8;40H\c"
wait 1

ansiecho "\e[20;40H\e[1M\e[9;11H\c"
ansiecho "\e[37mErase to end of line\e[0m\e[9;40Htext soon to disappear...\c"
ansiecho "\e[9;40H\c"
wait 1
ansiecho "\e[9;40H\e[1K\c"
wait 1
ansiecho "\n\e[10C\e[37mIns Character\e[0m\e[10;37Hinsert space & shift right\c"
wait 2
ansiecho "\e[10;14H\e[3@\c"
wait 1
ansiecho "ert\c"
wait 1
ansiecho "\e[11;11H\e[37mDelete Charac\e[mXX\e[37mter\e[0m\c"
ansiecho "\e[11;42Hdelete & shift left\c"
wait 1
ansiecho "\e[11;24H\c"
wait 1
ansiecho "\e[2P"
ansiecho "\e[12;11H\e[37mInsert Line\e[m\c"
wait 1
ansiecho "\e[1L\e[13;40Hlike so..."

; Now start moving the main body of the text slowly out of sight.
; Do this by repetitive single insert line calls -- otherwise it'll
; just shoot on by...
wait 2
ansiecho "\e[4;1H\e[1L\c"
ansiecho \e[1L\c
ansiecho \e[1L\c
ansiecho \e[1L\c
ansiecho \e[1L\c
ansiecho \e[1L\c
ansiecho \e[1L\c
ansiecho \e[1L\c
ansiecho \e[1L\c
ansiecho \e[1L\c
ansiecho \e[1L\c
ansiecho \e[1L\c
ansiecho \e[1L\c
ansiecho \e[1L\c
ansiecho \e[1L\c
ansiecho \e[1L\c
ansiecho \e[1L\c
ansiecho \e[1L\c
ansiecho \e[1L\c
ansiecho \e[1L\c
ansiecho "\e[7;16HHave fun brightening up your command files!"
wait 1
ansiecho \e[37m\c
ansiecho "\e[7;15HHave fun brightening up your command files!"
ansiecho \e[0m\c
ansiecho "\e[7;15HHave fun brightening up your command files!"
ansiecho \e[37m\c
ansiecho "\e[7;15HHave fun brightening up your command files!"
ansiecho \e[0m\c
ansiecho "\e[7;15HHave fun brightening up your command files!"
ansiecho \e[37m\c
ansiecho "\e[7;15HHave fun brightening up your command files!"
ansiecho \e[0m\c
ansiecho "\e[7;15HHave fun brightening up your command files!"
ansiecho \e[37m\c
ansiecho "\e[7;15HHave fun brightening up your command files!"
ansiecho \e[0m\c
ansiecho "\e[7;15HHave fun brightening up your command files!"
ansiecho \e[37m\c
ansiecho "\e[7;15HHave fun brightening up your command files!"
ansiecho \e[0m\c
ansiecho "\e[7;15HHave fun brightening up your command files!"
wait 3
FUNKYSTUFF
echo "\tansiecho.uu"
cat <<"FUNKYSTUFF" >ansiecho.uu
begin 666 foo
M   #\P         !              ""   #Z0   ().4O[40^K^U$ZY   !
MKDCG@.!#^@'F<  O#BQX  1.KOYH+%\L0$J 9@9P%&   /Y.KO_$*@!,WP<!
M> !"@PP0  !G  #.#!  7&8  +X,*     %G  "T4D@,$ !T9@  "A+\  E@
M  ":#!  8F8   H2_  (8   B@P0 &YF   *$OP "F   'H,$ !E9@  "A+\
M !M@  !J#!  7&8   9@  !F#!  9F8   H2_  ,8   3@P0 &-F   2#"@ 
M   !9@  1'C_8   1@P0 ")F   *$OP (F   "82$$ZY   !,&<  "(2*  !
M3KD   $P9P  %$ZY   !6E)($L!22%)#8 #_-A+84D-@ /\N2H1F   ($OP 
M"E)#0>K^U"0((@5.KO_0< !.6DYU# $ ,&T   H, 0 Y;P  $@P! $%M   0
M# $ 1FX   AP_V    1P $YU2.=P@$* 0H-"@0P0 #EB   2#!  ,&T  #82
M/  P8   %@P0 $%M   F#!  1F(  !X2/  W0H(4&)2!Z8C0@@R#     6< 
M  92@V"Z3-\!#DYU2.=_?@P0 ")F!%- 4D@,   !9@80O   8"PB2-/ 54FS
MR&<8#!$ (&8$4TE@\@P1 ")G E))$KP  & *#!$ (&;R$+P  $S??OY.=61O
M<RYL:6)R87)Y       #[     0         ^@   /    #B    "@      
#  /R
 
end
FUNKYSTUFF
echo "source file creation complete"
-- 


----------------------------------------------------------------------
	Dewi Williams.
				uucp:	   ..!ihnp4!druca!dewi
				phone:     (303) 538 4884