logo

oasis

Own branch of Oasis Linux (upstream: <https://git.sr.ht/~mcf/oasis/>) git clone https://anongit.hacktivis.me/git/oasis.git

caps.c (338B)


  1. #include <assert.h>
  2. #include <limits.h>
  3. #include <string.h>
  4. #include "caps.h"
  5. int
  6. cap_from_name(const char *name)
  7. {
  8. int i;
  9. static_assert(sizeof cap_names / sizeof *cap_names <= INT_MAX);
  10. for (i = 0; i < sizeof cap_names / sizeof *cap_names; ++i) {
  11. if (cap_names[i] && strcmp(cap_names[i], name) == 0)
  12. return i;
  13. }
  14. return -1;
  15. }