/*
- * Copyright (C) 2004-2006 Kay Sievers <kay.sievers@vrfy.org>
+ * Copyright (C) 2004-2008 Kay Sievers <kay.sievers@vrfy.org>
*
- * 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
- * Free Software Foundation version 2 of the License.
- *
- * This program is distributed in the hope that it will be useful, but
- * WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
- * General Public License for more details.
- *
- * You should have received a copy of the GNU General Public License along
- * with this program; if not, write to the Free Software Foundation, Inc.,
- * 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
+ * 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 Free Software Foundation, either version 2 of the License, or
+ * (at your option) any later version.
*
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU General Public License for more details.
+ *
+ * You should have received a copy of the GNU General Public License
+ * along with this program. If not, see <http://www.gnu.org/licenses/>.
*/
#include <unistd.h>
udev_exit = 1;
}
-static int print_properties_cb(struct udev_device *udev_device, const char *key, const char *value, void *data)
-{
- printf("%s=%s\n", key, value);
- return 0;
-}
-
-static void print_properties(struct udev_device *device)
-{
- udev_device_get_properties(device, print_properties_cb, NULL);
- printf("\n");
-}
-
int udevadm_monitor(struct udev *udev, int argc, char *argv[])
{
struct sigaction act;
udev_device_get_action(device),
udev_device_get_devpath(device),
udev_device_get_subsystem(device));
- if (env)
- print_properties(device);
+ if (env) {
+ struct udev_list *list;
+
+ list = udev_device_get_properties_list(device);
+ while (list != NULL) {
+ printf("%s=%s\n", udev_list_get_name(list), udev_list_get_value(list));
+ list = udev_list_get_next(list);
+ }
+ printf("\n");
+ }
udev_device_unref(device);
}
udev_device_get_action(device),
udev_device_get_devpath(device),
udev_device_get_subsystem(device));
- if (env)
- print_properties(device);
+ if (env) {
+ struct udev_list *list;
+
+ list = udev_device_get_properties_list(device);
+ while (list != NULL) {
+ printf("%s=%s\n", udev_list_get_name(list), udev_list_get_value(list));
+ list = udev_list_get_next(list);
+ }
+ printf("\n");
+ }
udev_device_unref(device);
}
}