home *** CD-ROM | disk | FTP | other *** search
/ PC Welt 2006 March / PCWELT_3_2006.ISO / base / 05_common.mo / usr / share / elvis-2.2_0 / scripts / decode.ex < prev    next >
Encoding:
Text File  |  2004-02-22  |  500 b   |  22 lines

  1. "This script defines a :decode alias, which handles simple letter<->number
  2. "ciphers.  You tell it a starting letter and number, and it fills in the
  3. "rest of the alphabet.
  4. alias decode {
  5.  "secret decoder ring
  6.  local i=1 l=-1 n=!2
  7.  try let l='!1'
  8.  if l < 'a' || l > 'z' || n < 1 || n > 26
  9.   then error usage: [lines] decode letter number
  10.  while i <= 26
  11.  do {
  12.   try eval !% s/\<(n)\>/(char(l))/g
  13.   let i=i+1
  14.   let n=n+1
  15.   if n > 26
  16.    then set n=1
  17.   if l == 'z'
  18.    then let l='a'
  19.    else let l=l+1
  20.  }
  21. }
  22.