X-Git-Url: http://www.chiark.greenend.org.uk/ucgi/~ianmdlvl/git?p=elogind.git;a=blobdiff_plain;f=namedev_parse.c;h=e6575fa108431958e33d0a283b2c7bd20935f4ba;hp=546d767aed6a665f55cd9156adac6a6f3cc035d8;hb=95a6f4c8acafe7031087667aa556a50a6a091c93;hpb=eb7a964a7c66e5aff8147026a60c99258454b612 diff --git a/namedev_parse.c b/namedev_parse.c index 546d767ae..e6575fa10 100644 --- a/namedev_parse.c +++ b/namedev_parse.c @@ -3,7 +3,7 @@ * * Userspace devfs * - * Copyright (C) 2003 Greg Kroah-Hartman + * Copyright (C) 2003,2004 Greg Kroah-Hartman * * * This program is free software; you can redistribute it and/or modify it @@ -52,41 +52,6 @@ static int add_config_dev(struct config_device *new_dev) return 0; } -int get_pair(char **orig_string, char **left, char **right) -{ - char *temp; - char *string = *orig_string; - - if (!string) - return -ENODEV; - - /* eat any whitespace */ - while (isspace(*string) || *string == ',') - ++string; - - /* split based on '=' */ - temp = strsep(&string, "="); - *left = temp; - if (!string) - return -ENODEV; - - /* take the right side and strip off the '"' */ - while (isspace(*string)) - ++string; - if (*string == '"') - ++string; - else - return -ENODEV; - - temp = strsep(&string, "\""); - if (!string || *temp == '\0') - return -ENODEV; - *right = temp; - *orig_string = string; - - return 0; -} - void dump_config_dev(struct config_device *dev) { /*FIXME dump all sysfs's */ @@ -120,7 +85,6 @@ void dump_perm_dev_list(void) dump_perm_dev(dev); } - int namedev_init_rules(void) { char line[255]; @@ -167,7 +131,7 @@ int namedev_init_rules(void) /* get all known keys */ while (1) { - retval = get_pair(&temp, &temp2, &temp3); + retval = parse_get_pair(&temp, &temp2, &temp3); if (retval) break; @@ -345,6 +309,5 @@ int namedev_init_permissions(void) exit: fclose(fd); return retval; -} - +}