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
open! Core
open! Import
let login_name = Funcall.Wrap.("user-login-name" <: nullary @-> return string)
let real_login_name = Funcall.Wrap.("user-real-login-name" <: nullary @-> return string)
let system_user_names = Funcall.Wrap.("system-users" <: nullary @-> return (list string))
let system_group_names =
Funcall.Wrap.("system-groups" <: nullary @-> return (list string))
;;
let full_name = Funcall.Wrap.("user-full-name" <: nullary @-> return string)
let uid = Funcall.Wrap.("user-uid" <: nullary @-> return int)
let real_uid = Funcall.Wrap.("user-real-uid" <: nullary @-> return int)
let gid = Funcall.Wrap.("group-gid" <: nullary @-> return int)
let real_gid = Funcall.Wrap.("group-real-gid" <: nullary @-> return int)
let () =
Defun.defun_nullary_nil
("ecaml-test-user-module" |> Symbol.intern)
[%here]
~docstring:
{|
Test the [Ecaml.User] module by showing the output of some of its functions.
|}
~interactive:No_arg
(fun () ->
message_s
[%message
""
(login_name () : string)
(real_login_name () : string)
(uid () : int)
(real_uid () : int)
(gid () : int)
(real_gid () : int)
(system_user_names () : string list)
(system_group_names () : string list)])
;;