This file is indexed.

/usr/lib/ocaml/ocamlbricks/argv.mli is in libocamlbricks-ocaml-dev 0.90+bzr367-1build1.

This file is owned by root:root, with mode 0o644.

The actual contents of the file can be viewed below.

  1
  2
  3
  4
  5
  6
  7
  8
  9
 10
 11
 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
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
(* This file is part of ocamlbricks
   Copyright (C) 2012  Jean-Vincent Loddo

   This program is free software: you can redistribute it and/or modify
   it under the terms of the GNU General Public License as published by
   the Free Software Foundation, either version 2 of the License, or
   (at your option) any later version.

   This program is distributed in the hope that it will be useful,
   but WITHOUT ANY WARRANTY; without even the implied warranty of
   MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
   GNU General Public License for more details.

   You should have received a copy of the GNU General Public License
   along with this program.  If not, see <http://www.gnu.org/licenses/>. *)

(** High-level impure but cool API for the standard module [Arg]. *)

(** List of available registering functions with their codomain:

{[val register_usage_msg : string -> unit
val register_h_option_as_help : unit -> unit

val register_unit_option      : .. -> unit option ref
val register_bool_option      : .. -> bool option ref
val register_string_option    : .. -> string option ref
val register_filename_option  : .. -> string option ref
val register_directory_option : .. -> string option ref
val register_enum_option      : .. -> string option ref
val register_int_option       : .. -> int option ref
val register_float_option     : .. -> float option ref

val register_string_optional_argument : .. -> string option ref
val register_string_argument          : .. -> string ref
val register_string_list0_argument    : .. -> string list ref
val register_string_list1_argument    : .. -> string list ref

val register_bool_optional_argument   : .. -> ?default:bool option -> bool option ref
val register_bool_argument            : .. -> bool ref
val register_bool_list0_argument      : .. -> bool list ref
val register_bool_list1_argument      : .. -> bool list ref

val register_int_optional_argument    : .. -> int option ref
val register_int_argument             : .. -> int ref
val register_int_list0_argument       : .. -> int list ref
val register_int_list1_argument       : .. -> int list ref

val register_float_optional_argument  : .. -> float option ref
val register_float_argument           : .. -> float ref
val register_float_list0_argument     : .. -> float list ref
val register_float_list1_argument     : .. -> ?error_msg:error_msg -> float list ref

val register_filename_optional_argument : .. -> string option ref
val register_filename_argument          : .. -> string ref
val register_filename_list0_argument    : .. -> string list ref
val register_filename_list1_argument    : .. -> string list ref
]}

{b Example}:

{[(* Registering usage: *)
let () = register_usage_msg "Usage: myprogram [OPTIONS] LENGTH [FLAGS..] POWERS[POWERS..] FILE[FILES..]\nOptions:" ;;

(* Registering options: *)
let option_x = register_unit_option "x" ~doc:"very useful option -x" () ;;
let option_y = register_unit_option "y" () ;;
let option_z = register_bool_option "z" () ;;
let option_s = register_string_option "s" ~tests:[(((<>)"none"), "not none please for the option `-s'")] () ;;
let option_t = register_enum_option "t" ~admissible_args:["BLACK"; "WHITE"] ~doc:"very useful option -t" () ;;
let option_f = register_filename_option "f" ~w:() ~r:() ~b:() ~doc:"very useful option -f" () ;;
let option_d = register_directory_option "d" ~w:() ~doc:"very useful option -d" () ;;
let () = register_h_option_as_help () ;;

(* Registering arguments: *)
let length = register_float_argument () ;;
let flags  = register_bool_list0_argument () ;;
let powers = register_int_list1_argument () ;;
let files  = register_filename_list1_argument ~r:() ~f:() () ;;

let main =
  begin
    (* Parse the command line (Sys.argv). The program will exit if something goes wrong parsing the command line: *)
    parse ();
    (* At this point all involved references have been updated: *)
    ...
  end
;;
]}

Now, for instance, at command line:

{[$ myprogram -x -y -z trued -s none 3.14 42 /etc/a[ln]*
myprogram: wrong argument `trued'; option `-z' expects a boolean.
Usage: myprogram [OPTIONS] LENGTH FLAGS.. POWERS[POWERS..] FILE[FILES..]
Options:
  -x        very useful option -x
  -y        undocumented
  -z BOOL   undocumented
  -s STRING undocumented
  -t {BLACK|WHITE}
            very useful option -t
  -f FILE   very useful option -f
  -d DIR    very useful option d
  -h        Display this list of options
  -help     Display this list of options
  --help    Display this list of options

(* end of example *)
]}
*)

type error_msg = string

val register_usage_msg : string -> unit

val tuning :
  ?no_error_location_parsing_arguments:unit ->
  ?no_usage_on_error_parsing_arguments:unit ->
  unit -> unit

(** {2 Options without argument} *)

val register_unit_option :
  string -> ?aliases:string list ->
  ?doc:string -> ?default:unit option -> ?toggle:unit ->
  unit -> unit option ref

(** {2 Options with argument} *)

val register_bool_option :
  string -> ?aliases:string list ->
  ?arg_name_in_help:string ->
  ?doc:string -> ?default:bool option ->
  unit -> bool option ref

val register_string_option :
  string -> ?aliases:string list ->
  ?tests:((string -> bool) * error_msg) list ->
  ?arg_name_in_help:string ->
  ?doc:string -> ?default:string option ->
  unit -> string option ref

val register_filename_option :
  string -> ?aliases:string list ->
  ?r:unit -> ?w:unit -> ?x:unit ->
  ?follow:unit -> ?f:unit -> ?d:unit -> ?c:unit -> ?b:unit -> ?h:unit -> ?p:unit -> ?socket:unit ->
  ?error_msg:string ->
  ?tests:((string -> bool) * error_msg) list ->
  ?arg_name_in_help:string ->
  ?doc:string -> ?default:string option ->
  unit -> string option ref

val register_directory_option :
  string -> ?aliases:string list ->
  ?r:unit -> ?w:unit -> ?x:unit ->
  ?error_msg:string ->
  ?tests:((string -> bool) * error_msg) list ->
  ?arg_name_in_help:string ->
  ?doc:string -> ?default:string option ->
  unit -> string option ref

val register_enum_option :
  string -> ?aliases:string list ->
  admissible_args:string list ->
  ?doc:string -> ?default:string option ->
  unit -> string option ref

val register_int_option :
  string -> ?aliases:string list ->
  ?tests:((int -> bool) * error_msg) list ->
  ?arg_name_in_help:string ->
  ?doc:string -> ?default:int option ->
  unit -> int option ref

val register_float_option :
  string -> ?aliases:string list ->
  ?tests:((float -> bool) * error_msg) list ->
  ?arg_name_in_help:string ->
  ?doc:string -> ?default:float option ->
  unit -> float option ref

val register_h_option_as_help : unit -> unit

(** {2 String arguments } *)

val register_string_optional_argument :
  ?tests:((string -> bool) * error_msg) list ->
  ?default:string option ->
  unit -> string option ref

val register_string_argument :
  ?tests:((string -> bool) * error_msg) list ->
  ?error_msg:error_msg ->
  unit -> string ref

val register_string_list0_argument :
  ?tests:((string -> bool) * error_msg) list ->
  unit -> string list ref

val register_string_list1_argument :
  ?tests:((string -> bool) * error_msg) list ->
  ?error_msg:error_msg ->
  unit -> string list ref

(** {2 Bool arguments } *)

val register_bool_optional_argument :
  ?default:bool option ->
  unit -> bool option ref

val register_bool_argument       :
  ?error_msg:error_msg ->
  unit -> bool ref

val register_bool_list0_argument :
  unit -> bool list ref

val register_bool_list1_argument :
  ?error_msg:error_msg ->
  unit -> bool list ref

(** {2 Int arguments } *)

val register_int_optional_argument :
  ?tests:((int -> bool) * error_msg) list ->
  ?default:int option ->
  unit -> int option ref

val register_int_argument :
  ?tests:((int -> bool) * error_msg) list ->
  ?error_msg:error_msg ->
  unit -> int ref

val register_int_list0_argument :
  ?tests:((int -> bool) * error_msg) list ->
  unit -> int list ref

val register_int_list1_argument :
  ?tests:((int -> bool) * error_msg) list ->
  ?error_msg:error_msg ->
  unit -> int list ref

(** {2 Float arguments } *)

val register_float_optional_argument :
  ?tests:((float -> bool) * error_msg) list ->
  ?default:float option ->
  unit -> float option ref

val register_float_argument :
  ?tests:((float -> bool) * error_msg) list ->
  ?error_msg:error_msg ->
  unit -> float ref

val register_float_list0_argument :
  ?tests:((float -> bool) * error_msg) list ->
  unit -> float list ref

val register_float_list1_argument :
  ?tests:((float -> bool) * error_msg) list ->
  ?error_msg:error_msg -> unit -> float list ref

(** {2 Filename arguments } *)

val register_filename_optional_argument :
  ?r:unit -> ?w:unit -> ?x:unit ->
  ?follow:unit -> ?f:unit -> ?d:unit -> ?c:unit -> ?b:unit -> ?h:unit -> ?p:unit -> ?socket:unit ->
  ?error_msg:string ->
  ?tests:((string -> bool) * error_msg) list ->
  ?default:string option ->
  unit -> string option ref

val register_filename_argument :
  ?r:unit -> ?w:unit -> ?x:unit ->
  ?follow:unit -> ?f:unit -> ?d:unit -> ?c:unit -> ?b:unit -> ?h:unit -> ?p:unit -> ?socket:unit ->
  ?error_msg:string ->
  ?tests:((string -> bool) * error_msg) list ->
  unit -> string ref

val register_filename_list0_argument :
  ?r:unit -> ?w:unit -> ?x:unit ->
  ?follow:unit -> ?f:unit -> ?d:unit -> ?c:unit -> ?b:unit -> ?h:unit -> ?p:unit -> ?socket:unit ->
  ?error_msg:string ->
  ?tests:((string -> bool) * error_msg) list ->
  unit -> string list ref

val register_filename_list1_argument :
  ?r:unit -> ?w:unit -> ?x:unit ->
  ?follow:unit -> ?f:unit -> ?d:unit -> ?c:unit -> ?b:unit -> ?h:unit -> ?p:unit -> ?socket:unit ->
  ?error_msg:string ->
  ?tests:((string -> bool) * error_msg) list ->
  unit -> string list ref

(** {2 Parsing functions } *)

val parse_argv : string array -> unit
val parse : ?exit_with_errno:int -> unit -> unit