commands/base64/base64.cif
changeset 95 b3ffff030d5c
equal deleted inserted replaced
94:8df58d8c99e8 95:b3ffff030d5c
       
     1 # base64.cif
       
     2 # 
       
     3 # Copyright (c) 2010 Accenture. All rights reserved.
       
     4 # This component and the accompanying materials are made available
       
     5 # under the terms of the "Eclipse Public License v1.0"
       
     6 # which accompanies this distribution, and is available
       
     7 # at the URL "http://www.eclipse.org/legal/epl-v10.html".
       
     8 # 
       
     9 # Initial Contributors:
       
    10 # Accenture - Initial contribution
       
    11 #
       
    12 
       
    13 ==name base64
       
    14 
       
    15 ==short-description
       
    16 
       
    17 Encode to or decode from Base64.
       
    18 
       
    19 ==long-description
       
    20 
       
    21 Turns binary data into an ASCII encoded form and vice versa.
       
    22 
       
    23 
       
    24 ==argument enum operation
       
    25 
       
    26 ==enum-value decode
       
    27 
       
    28 Read lines from C<STDIN> until F<KErrEof> or a blank line is read. Decode the read data and write the binary equivalent to the named file.
       
    29 
       
    30 ==enum-value encode
       
    31 
       
    32 Read binary data from the named file, and write the encoded equivalent as lines to C<STDOUT>.
       
    33 
       
    34 
       
    35 ==argument filename filename
       
    36 
       
    37 The name of the file to write when decoding. The name of the file to read when encoding.
       
    38 
       
    39 
       
    40 ==option bool v verbose
       
    41 
       
    42 Enable verbose output.
       
    43 
       
    44 ==option bool o overwrite
       
    45 
       
    46 When decoding, overwrite the output file if it already exists.
       
    47 
       
    48 
       
    49 ==smoke-test
       
    50 
       
    51 exists base64_temp && rm -rf base64_temp
       
    52 mkdir base64_temp
       
    53 cd base64_temp
       
    54 
       
    55 echo -n 'A' > a.txt
       
    56 base64 encode a.txt | base64 decode a2.txt
       
    57 compare a.txt a2.txt || $Error
       
    58 
       
    59 echo -n 'AB' > ab.txt
       
    60 base64 encode ab.txt | base64 decode ab2.txt
       
    61 compare ab.txt ab2.txt || $Error
       
    62 
       
    63 echo -n 'ABC' > abc.txt
       
    64 base64 encode abc.txt | base64 decode abc2.txt
       
    65 compare abc.txt abc2.txt || $Error
       
    66 
       
    67 echo -n 'ABCD' > abcd.txt
       
    68 base64 encode abcd.txt | base64 decode abcd2.txt
       
    69 compare abcd.txt abcd2.txt || $Error
       
    70 
       
    71 echo -n 'ABCDE' > abcde.txt
       
    72 base64 encode abcde.txt | base64 decode abcde2.txt
       
    73 compare abcde.txt abcde2.txt || $Error
       
    74 
       
    75 # Assume fshell.cif is in same location as base64.cif (it's quite a bit bigger which is why we use it in preference)
       
    76 base64 encode $SCRIPT_PATH\fshell.cif | base64 decode fshell2.cif
       
    77 compare $SCRIPT_PATH\fshell.cif fshell2.cif || $Error
       
    78 
       
    79 cd ..
       
    80 rm -rf base64_temp
       
    81 
       
    82 ==copyright
       
    83 
       
    84 Copyright (c) 2010 Accenture. All rights reserved.