Page MenuHomeFreeBSD

proccontrol: use a table for modes
ClosedPublic

Authored by brooks on Aug 23 2024, 8:47 PM.
Tags
None
Referenced Files
Unknown Object (File)
Mon, Nov 11, 4:14 AM
Unknown Object (File)
Thu, Nov 7, 11:28 PM
Unknown Object (File)
Oct 19 2024, 12:50 AM
Unknown Object (File)
Oct 16 2024, 6:43 AM
Unknown Object (File)
Oct 15 2024, 3:48 PM
Unknown Object (File)
Oct 13 2024, 12:48 PM
Unknown Object (File)
Oct 11 2024, 12:09 PM
Unknown Object (File)
Oct 10 2024, 11:52 AM
Subscribers

Details

Summary

Add a central table of modes and loop over it rather than spelling out
10 essentialy identical strcmp if statemnts. Use the stable to generate
usage as well reducing the number of ifdefs.

Disallow multiple -m options. Previouly multiple were allowed, but only
the last one was used and there was no indication this happened.

Diff Detail

Repository
rG FreeBSD src repository
Lint
Lint Not Applicable
Unit
Tests Not Applicable

Event Timeline

There might be room for further table use (all the setting cases follow the same pattern), but this seems like a good place to start.

kib added inline comments.
usr.bin/proccontrol/proccontrol.c
56
This revision is now accepted and ready to land.Aug 23 2024, 8:58 PM
This revision was automatically updated to reflect the committed changes.