[Omake] grep -v
Jason Hickey
jyh at cs.caltech.edu
Wed Sep 20 14:31:07 PDT 2006
Thanks! I've applied this patch to the repository.
Jason
David Kågedal wrote:
> I noticed that Shell.grep (which is $(builtin-grep)) doesn't handle
> the -v flag, even though the grep function has a corresponding "v"
> flag. And similar with the -h flag.
>
> Also, it seems that $(grep H, ...) is treated like $(grep h, ...),
> although "grep -h" and "grep -H" are typically the inverse of
> each other.
>
> This patch seems to take care of, but a couple of tests should
> probably be written as well.
>
> --- omake_builtin_io_fun.ml (revision 9564)
> +++ omake_builtin_io_fun.ml (working copy)
> @@ -237,13 +237,13 @@
> else
> let flag =
> match s.[i] with
> - 'q' | 'Q' ->
> + 'q' ->
> GrepQuiet
> - | 'n' | 'N' ->
> + | 'n' ->
> GrepPrint
> - | 'v' | 'V' ->
> + | 'v' ->
> GrepNoMatch
> - | 'h' | 'H' ->
> + | 'h' ->
> GrepNoPrint
> | c ->
> raise (OmakeException (loc_pos loc pos, StringStringError ("illegal grep option", String.make 1 c)))
> @@ -354,6 +354,10 @@
> collect ("q" ^ flags) args
> | "-n" ->
> collect ("n" ^ flags) args
> + | "-v" ->
> + collect ("v" ^ flags) args
> + | "-h" ->
> + collect ("h" ^ flags) args
> | pattern ->
> flags, pattern, args)
> | [] ->
>
>
--
Jason Hickey http://www.cs.caltech.edu/~jyh
Caltech Computer Science Tel: 626-395-6568 FAX: 626-792-4257
More information about the Omake
mailing list