: all-groups ( -- seq )
[ getgrent dup ] [ group-struct>group ] [ drop ] produce ;
+: <group-cache> ( -- assoc )
+ all-groups [ [ id>> ] keep ] H{ } map>assoc ;
+
: with-group-cache ( quot -- )
- all-groups [ [ id>> ] keep ] H{ } map>assoc
- group-cache rot with-variable ; inline
+ [ <group-cache> group-cache ] dip with-variable ; inline
: real-group-id ( -- id )
getgid ; inline
SYMBOL: user-cache
+: <user-cache> ( -- assoc )
+ all-users [ [ uid>> ] keep ] H{ } map>assoc ;
+
: with-user-cache ( quot -- )
- all-users [ [ uid>> ] keep ] H{ } map>assoc
- user-cache rot with-variable ; inline
+ [ <user-cache> user-cache ] dip with-variable ; inline
GENERIC: user-passwd ( obj -- passwd )