*
* Userspace devfs
*
- * Copyright (C) 2003 Greg Kroah-Hartman <greg@kroah.com>
+ * Copyright (C) 2003,2004 Greg Kroah-Hartman <greg@kroah.com>
*
* This program is free software; you can redistribute it and/or modify it
* under the terms of the GNU General Public License as published by the
extern void dump_perm_dev(struct perm_device *dev);
extern void dump_perm_dev_list(void);
-extern int get_pair(char **orig_string, char **left, char **right);
-
#endif
*
* Userspace devfs
*
- * Copyright (C) 2003 Greg Kroah-Hartman <greg@kroah.com>
+ * Copyright (C) 2003,2004 Greg Kroah-Hartman <greg@kroah.com>
*
*
* This program is free software; you can redistribute it and/or modify it
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 */
/* get all known keys */
while (1) {
- retval = get_pair(&temp, &temp2, &temp3);
+ retval = parse_get_pair(&temp, &temp2, &temp3);
if (retval)
break;
extern int udev_add_device(char *path, char *subsystem);
extern int udev_remove_device(char *path, char *subsystem);
extern void udev_init_config(void);
+extern int parse_get_pair(char **orig_string, char **left, char **right);
extern char **main_argv;
extern char **main_envp;
*
* Userspace devfs
*
- * Copyright (C) 2003 Greg Kroah-Hartman <greg@kroah.com>
+ * Copyright (C) 2003,2004 Greg Kroah-Hartman <greg@kroah.com>
*
*
* This program is free software; you can redistribute it and/or modify it
strncpy(_var, value, sizeof(_var)); \
}
+int parse_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;
+}
+
static int parse_config_file(void)
{
char line[255];
if (*temp == COMMENT_CHARACTER)
continue;
- retval = get_pair(&temp, &variable, &value);
+ retval = parse_get_pair(&temp, &variable, &value);
if (retval)
break;