[RC5] Win32: feature creep

Joe Zbiciak j-zbiciak1 at ti.com
Sun Nov 23 22:20:28 EST 1997


'Greg Wooledge' said previously:
| 
| Joe Zbiciak (j-zbiciak1 at ti.com) wrote:
| 
| > thought vi's regexp's were cryptic (eg. the following gibberish is a
| > valid command in vi, and anyone who can tell me what it does wins an
| > MIT-MAGIC-COOKIE:  ':/\/bin\/false/s/^\([^:]*\):\([^:]*\)/\2:\1/g'),
| 
| Well, with an empty buffer it makes vim say 'Pattern not found: \/bin\/false'.

Big hint:  Load in a buffer which has this string in it.  Like, maybe,
/etc/passwd.  :-)  Basically, it tells vi to only perform the
's'earch/replace operation on lines containing '/bin/false'.

| I can tell you what the part beginning with 's/' does: it reverses the
| first two fields of lines with the format 'foo:bar:...'.  You can omit
| the trailing 'g' since you can only perform this substitution once per
| line anyway (due to the '^' anchor).

Well, pointing out that the 'g' was unneccessary earns you the 
MIT-MAGIC-COOKIE despite the fact you didn't get the first part...
As a compromise, you'll have to share the cookie with the rest of
the mailing list... Here goes:

192.0.0.10:0  MIT-MAGIC-COOKIE-1  625674247328b453960734aae69cfc13

:-)  Enjoy!

| This message has been brought to you through the power of vi. :-)

Ditto!

PS. For those of you out there with vi clones that have a suitably deep
macro stack, you might find the following macros educational.  Put these
macros in a file, source it from inside 'vi', and hit '=' to start.  (NOTE: 
You need to replace all the ^M's with <Ctrl-M>'s, ^V's with <Ctrl-V>'s
and ^['s with <ESC>'s...  A "uuencoded" copy with the ctrl characters
intact is available after my .sig.)  If anyone has a way to overcome the
macro recursion depth limitations universally, please let me know!  :-)


" solve a maze with VI macros!
"
" end recursion with a "failed" command
map _e F?
"
" core routine: grab four neighbors, and act according to contents
map ; "ayl at a
map X k;jl;hj;kh;lr#
" subroutines: actions for various pathways
map x :^M
map # :^M
map + :^M
map ^V| :^M
map S :^M
map - :^M
map . rx:^MX
map ^V   rx:^MX
map E _e
" main() 
map = 1G/S^[X


And here's a sample maze for it to solve:

+----+-----+---+---------+---+----------+
||   |     |   |         |   |     |   ||
||S| | | | | | | | | |- -+ | | | | | | ||
||-+ + | +-+ | | | +-+ + +-+ | | +-+ | ||
||     |     | | |   |   |     |     | ||
|| ----+-----+ | | --+- -+ ----+-----+ ||
||          +--+ |       |          +--+|
|| | + | -+    | | +---- | | + | -+    ||
|| |   |  +--+ | | |     | |   |  +--+ ||
|| +---+---+ | | | +-----+ +---+---+ | ||
||         |     |                 |   ||
|+---+---- +---+-+------ +---+---+ |---+|
||   |     |   |         |   |     |   ||
|| | | | | | | | | | |- -+ | | | | | | ||
|+-+ | | +-+ | | | +-+ + +-+ | | +-+ | ||
||     |     | | |   |   |     |     | ||
|| ----+-----+ | | --+- -+ ----+-----+ ||
||          +--+ |       |          +--+|
|| | + | -+    | | +---- | | + | -+    ||
|| |   |  +--+ | | |     | |   |  |+-+ ||
|| +---+---+ | | | +-----+ +---+--+| | ||
||        E|     |       |         |   ||
+----------------+-------+---------+----+


Anyone care to write an RC5 client as a vi macro?  ;-)

Enjoy,

--Joe "too much time on my hands" Zbiciak


-- 
 +------------ Joseph Zbiciak -----------+ 
 |- - - - -  j-zbiciak1 at ti.com  - - - - -|   You have the capacity to 
 | - http://www.primenet.com/~im14u2c/ - |   learn from mistakes.
 |- - - -Texas Instruments, Dallas- - - -|   You will learn alot today.
 +------#include <std_disclaimer.h>------+ 

begin 644 maze.vi
M(B!S;VQV92!A(&UA>F4@=VET:"!622!M86-R;W,A"B(@"B(@96YD(')E8W5R
M<VEO;B!W:71H(&$@(F9A:6QE9"(@8V]M;6%N9 HB;6%P(%]E(#HE<R]8+RXO
M9PTZ)7,O+2\N+V<-1C\*;6%P(%]E($8_"B(*(B!C;W)E(')O=71I;F4Z(&=R
M86(@9F]U<B!N96EG:&)O<G,L(&%N9"!A8W0 at 86-C;W)D:6YG('1O(&-O;G1E
M;G1S"FUA<" [(")A>6Q 80IM87 @6"!K.VIL.VAJ.VMH.VQR(PHB;6%P(%@@
M:SMJ;#MH:CMK:#ML<B *(B!S=6)R;W5T:6YE<SH at 86-T:6]N<R!F;W(@=F%R
M:6]U<R!P871H=V%Y<PIM87 @>" Z#0IM87 @(R Z#0IM87 @*R Z#0IM87 @
M%GP at .@T*;6%P(%, at .@T*;6%P("T at .@T*;6%P("X@<G at Z#5@*;6%P(!8@("!R
D>#H-6 IM87 @12!?90HB(&UA:6XH*0IM87 @/2 Q1R]3&U@*
 
end
--
To unsubcribe, send 'unsubscribe rc5' to majordomo at llamas.net
rc5-digest subscribers replace rc5 with rc5-digest



More information about the rc5 mailing list