Browse Source

Ensure encoder/decoder validate the # of arguments

prototype
Alex Williams 10 months ago
parent
commit
b189e15e23
Signed by: aw GPG Key ID: 19EE4AAA361A7E2C
2 changed files with 20 additions and 18 deletions
  1. +6
    -5
      decoder.l
  2. +14
    -13
      encoder.l

+ 6
- 5
decoder.l View File

@ -2,11 +2,12 @@
(load "libboawp.l")
(catch 'boawp-error
(let Fd (open (opt))
(finally (and (close Fd) *Msg (bye 1))
(let (Res (boawp-validate Fd))
(when (=1 (length (argv)))
(catch 'boawp-error
(let Fd (open (opt))
(finally (and (close Fd) *Msg (bye 1))
(let (Res (boawp-validate Fd))
(println Res) ]
(println Res) ]
(bye)

+ 14
- 13
encoder.l View File

@ -2,19 +2,20 @@
(load "libboawp.l")
(catch 'boawp-error
(let Fd (open (opt))
(finally (and (close Fd) *Msg (bye 1))
(let (Res (boawp-validate Fd)
Enc (boawp-encode
(list
(mapcar char (car Res))
(list 0 (car (; Res 2)))
(; Res 3)
(mapcar char (; Res 4)) ) ) )
(when (= 2 (length (argv)))
(catch 'boawp-error
(let Fd (open (opt))
(finally (and (close Fd) *Msg (bye 1))
(let (Res (boawp-validate Fd)
Enc (boawp-encode
(list
(mapcar char (car Res))
(list 0 (car (; Res 2)))
(; Res 3)
(mapcar char (; Res 4)) ) ) )
(println Res)
(println Enc)
(out (opt) (apply wr Enc)) ]
(println Res)
(println Enc)
(out (opt) (apply wr Enc)) ]
(bye)

Loading…
Cancel
Save