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)
Wed, Apr 29, 9:04 AM
Unknown Object (File)
Wed, Apr 29, 9:01 AM
Unknown Object (File)
Tue, Apr 28, 4:32 PM
Unknown Object (File)
Tue, Apr 28, 4:27 PM
Unknown Object (File)
Mon, Apr 27, 12:10 PM
Unknown Object (File)
Tue, Apr 21, 12:50 AM
Unknown Object (File)
Sun, Apr 19, 3:50 PM
Unknown Object (File)
Apr 17 2026, 1:48 PM
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.