On Thu, Mar 19, 2020 at 07:25:05PM +0100, Martin Pieuchot wrote:
> A map contains (key, value) pairs.  In that sense delete() deletes a
> pair.  What about:
Correct, but I wanted to keep it short and therefore implied that
removing a key also removes the value.

>   Delete the pair indexed by `key'.
Even better, I did say `@map[key]' because `key' can be anything and
`@map[index]' might imply `index' bein numerical only, but your wording
combines both and seems clearer.

> > +.It Fn exit
> > +Terminate with exit code 0
> 
> I don't see the value of mentioning the exit code.  What about:
> 
>   Terminate the execution.
"Terminate" is already a generic term;  abort(3) also terminates the
program.  Plus, exit(3) takes an argument but btrace's exit() does not,
the instead of leaving users at guess I want to document it explicitly.

It could also return 1, or garbage or the status of the last function
call or something, but it is always 0/success.

> >  .It Fn print "@map"
> >  Print all (key, value) pairs from map
> >  .Va @map
> > @@ -120,6 +127,9 @@ print formatted string
> >  .It Fn time timefmt
> >  print timestamps using
> >  .Xr strftime 3
> > +.It Fn zero "@map"
> > +Set values to 0 for all keys from map
> > +.Va @map
> 
>       Set all values of/from @map to 0?
> 
> While here what do you think about replacing 'from map @map' by 'from
> @map' in clear() and print().  Since the manual is mentioning pairs
> already this now seems redundant to me.
Totally fine with me, just wanted to keep the diff clear, but I'll do so
now before the manual grows further.

OK?


Index: bt.5
===================================================================
RCS file: /cvs/src/usr.sbin/btrace/bt.5,v
retrieving revision 1.3
diff -u -p -r1.3 bt.5
--- bt.5        18 Mar 2020 20:19:42 -0000      1.3
+++ bt.5        19 Mar 2020 18:57:57 -0000
@@ -107,12 +107,19 @@ of the corresponding probe
 .Pp
 Functions:
 .Pp
-.Bl -tag -width "printf fmt ...  " -compact
+.Bl -tag -width "delete(@map[key])" -compact
 .It Fn clear "@map"
-Delete all (key, value) pairs from map
+Delete all (key, value) pairs from
 .Va @map
+.It Fn delete "@map[key]"
+Delete the pair indexed by
+.Va key
+from
+.Va @map
+.It Fn exit
+Terminate execution with exit code 0
 .It Fn print "@map"
-Print all (key, value) pairs from map
+Print all pairs from
 .Va @map
 .It Fn printf "fmt" ...
 print formatted string
@@ -120,6 +127,10 @@ print formatted string
 .It Fn time timefmt
 print timestamps using
 .Xr strftime 3
+.It Fn zero "@map"
+Set all values from
+.Va @map
+to 0.
 .El
 .Sh SEE ALSO
 .Xr awk 1 ,

Reply via email to