#include <unistd.h>
#include <errno.h>
+#include "libsysfs/sysfs/libsysfs.h"
+#include "libsysfs/dlist.h"
#include "udev.h"
#include "udev_version.h"
#include "logging.h"
#include "udevdb.h"
-#include "libsysfs/libsysfs.h"
# define SYSFS_VALUE_MAX 200
char **main_argv;
int main_argc;
-unsigned char logname[42];
-int log_ok(void)
+#ifdef LOG
+unsigned char logname[42];
+void log_message (int level, const char *format, ...)
{
- return 1;
+ va_list args;
+
+ va_start(args, format);
+ vsyslog(level, format, args);
+ va_end(args);
}
+#endif
static int print_all_attributes(const char *path)
{
dlist_for_each_data(attributes, attr, struct sysfs_attribute) {
if (attr->value != NULL) {
- strncpy(value, attr->value, SYSFS_VALUE_MAX);
+ strfieldcpy(value, attr->value);
len = strlen(value);
if (len == 0)
continue;
len--;
}
if (len == 0)
- printf(" SYSFS_%s=\"%s\"\n", attr->name, value);
+ printf(" SYSFS{%s}=\"%s\"\n", attr->name, value);
}
}
printf("\n");
} else {
if (path[0] != '/') {
/* prepend '/' if missing */
- strcat(temp, "/");
- strncat(temp, path, sizeof(path));
+ strfieldcat(temp, "/");
+ strfieldcat(temp, path);
pos = temp;
} else {
pos = path;
case NAME:
if (root)
strfieldcpy(result, udev_root);
- strncat(result, dev.name, sizeof(result));
+ strfieldcat(result, dev.name);
break;
case SYMLINK:
/* prepend sysfs mountpoint if not given */
strfieldcpy(temp, path);
strfieldcpy(path, sysfs_path);
- strncat(path, temp, sizeof(path));
+ strfieldcat(path, temp);
}
print_device_chain(path);
return 0;