1
0

util.c 320 B

12345678910111213141516171819
  1. /*
  2. * Copyright (C) 2016, Red Hat Inc, Andrew Jones <drjones@redhat.com>
  3. *
  4. * This work is licensed under the terms of the GNU LGPL, version 2.
  5. */
  6. #include <libcflat.h>
  7. #include "util.h"
  8. int parse_keyval(char *s, long *val)
  9. {
  10. char *p;
  11. p = strchr(s, '=');
  12. if (!p)
  13. return -1;
  14. *val = atol(p+1);
  15. return p - s;
  16. }