cap-list.c revision 93cc7779e0c121b75183920173f37cd1ee9d59cf
95ed3294c632f5606327149f10cef1eb34422862Thomas Hindoe Paaboel Andersen/*-*- Mode: C; c-basic-offset: 8; indent-tabs-mode: nil -*-*/
95ed3294c632f5606327149f10cef1eb34422862Thomas Hindoe Paaboel Andersen This file is part of systemd.
95ed3294c632f5606327149f10cef1eb34422862Thomas Hindoe Paaboel Andersen Copyright 2014 Lennart Poettering
95ed3294c632f5606327149f10cef1eb34422862Thomas Hindoe Paaboel Andersen systemd is free software; you can redistribute it and/or modify it
95ed3294c632f5606327149f10cef1eb34422862Thomas Hindoe Paaboel Andersen under the terms of the GNU Lesser General Public License as published by
95ed3294c632f5606327149f10cef1eb34422862Thomas Hindoe Paaboel Andersen the Free Software Foundation; either version 2.1 of the License, or
95ed3294c632f5606327149f10cef1eb34422862Thomas Hindoe Paaboel Andersen (at your option) any later version.
95ed3294c632f5606327149f10cef1eb34422862Thomas Hindoe Paaboel Andersen systemd is distributed in the hope that it will be useful, but
95ed3294c632f5606327149f10cef1eb34422862Thomas Hindoe Paaboel Andersen WITHOUT ANY WARRANTY; without even the implied warranty of
95ed3294c632f5606327149f10cef1eb34422862Thomas Hindoe Paaboel Andersen MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
95ed3294c632f5606327149f10cef1eb34422862Thomas Hindoe Paaboel Andersen Lesser General Public License for more details.
95ed3294c632f5606327149f10cef1eb34422862Thomas Hindoe Paaboel Andersen You should have received a copy of the GNU Lesser General Public License
95ed3294c632f5606327149f10cef1eb34422862Thomas Hindoe Paaboel Andersen along with systemd; If not, see <http://www.gnu.org/licenses/>.
95ed3294c632f5606327149f10cef1eb34422862Thomas Hindoe Paaboel Andersenstatic const struct capability_name* lookup_capability(register const char *str, register unsigned int len);
95ed3294c632f5606327149f10cef1eb34422862Thomas Hindoe Paaboel Andersenconst char *capability_to_name(int id) {
95ed3294c632f5606327149f10cef1eb34422862Thomas Hindoe Paaboel Andersen if (id >= (int) ELEMENTSOF(capability_names))
95ed3294c632f5606327149f10cef1eb34422862Thomas Hindoe Paaboel Andersenint capability_from_name(const char *name) {
95ed3294c632f5606327149f10cef1eb34422862Thomas Hindoe Paaboel Andersen const struct capability_name *sc;
95ed3294c632f5606327149f10cef1eb34422862Thomas Hindoe Paaboel Andersen /* Try to parse numeric capability */
95ed3294c632f5606327149f10cef1eb34422862Thomas Hindoe Paaboel Andersen if (r >= 0 && i >= 0)
95ed3294c632f5606327149f10cef1eb34422862Thomas Hindoe Paaboel Andersen /* Try to parse string capability */
95ed3294c632f5606327149f10cef1eb34422862Thomas Hindoe Paaboel Andersen sc = lookup_capability(name, strlen(name));
95ed3294c632f5606327149f10cef1eb34422862Thomas Hindoe Paaboel Andersenint capability_list_length(void) {