Overview
Comment: | hmac-main: add command-line options to control output format |
---|---|
Timelines: | family | ancestors | descendants | both | trunk |
Files: | files | file ages | folders |
SHA1: |
3c8ac9180a79bd2f3f8fe6b1d55637fe |
User & Date: | nat on 2014-04-08 19:05:14 |
Other Links: | manifest | tags |
Context
2014-04-09
| ||
19:34 | s_expressions-file_readers: new package to encapsulate file reading as a S-expression or as an atom check-in: 68274aec88 user: nat tags: trunk | |
2014-04-08
| ||
19:05 | hmac-main: add command-line options to control output format check-in: 3c8ac9180a user: nat tags: trunk | |
2014-04-07
| ||
19:04 | tools: new directory for command-line tools using directly Natools library, seeded with HMAC tools check-in: 4d8481daa6 user: nat tags: trunk | |
Changes
Modified tools/hmac-main.adb from [7ad0682bf7] to [6514f50961].
︙ | |||
12 13 14 15 16 17 18 19 20 21 22 23 24 25 | 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 111 112 113 114 115 116 117 118 119 120 121 122 123 124 125 126 127 128 129 130 131 132 133 134 135 136 137 138 139 140 141 142 143 144 145 146 147 148 149 150 151 152 153 154 155 156 157 158 159 160 161 162 163 164 165 166 167 168 169 170 171 172 173 | + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + - - - - - + + + + + + + + + + + + + + - + + + + + + + + + + + + + + - - - - - - - - - - - - - - - + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + - - - - + - - + - - - - - - - - - - - - + - | -- WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN AN -- -- ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF -- -- OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE. -- ------------------------------------------------------------------------------ with Ada.Command_Line; with Ada.Streams; with Ada.Strings.Unbounded; with Ada.Text_IO; with Ada.Text_IO.Text_Streams; with Natools.Getopt_Long; with Natools.S_Expressions; with Natools.S_Expressions.Encodings; procedure HMAC.Main is procedure Base64_Output (Digest : in Ada.Streams.Stream_Element_Array); -- Output the given binary Digest in base-64 procedure Lower_Hex_Output (Digest : in Ada.Streams.Stream_Element_Array); -- Output the given binary Digest in lower-case hexadecimal procedure Raw_Output (Digest : in Ada.Streams.Stream_Element_Array); -- Output the given binary Direct directly procedure Upper_Hex_Output (Digest : in Ada.Streams.Stream_Element_Array); -- Output the given binary Digest in upper-case hexadecimal package Options is type Id is (Base64_Output, Lower_Hex_Output, Raw_Output, Upper_Hex_Output); end Options; package Getopt is new Natools.Getopt_Long (Options.Id); type Encode_Output is not null access procedure (Digest : in Ada.Streams.Stream_Element_Array); type Callback is new Getopt.Handlers.Callback with record Output : Encode_Output := Lower_Hex_Output'Access; Key : Ada.Strings.Unbounded.Unbounded_String; Has_Key : Boolean := False; Done : Boolean := False; end record; overriding procedure Option (Handler : in out Callback; Id : in Options.Id; Argument : in String); overriding procedure Argument (Handler : in out Callback; Argument : in String); overriding procedure Option (Handler : in out Callback; Id : in Options.Id; Argument : in String) is pragma Unreferenced (Argument); |