6 * Copyright (C) 2003 Greg Kroah-Hartman <greg@kroah.com>
9 * This program is free software; you can redistribute it and/or modify it
10 * under the terms of the GNU General Public License as published by the
11 * Free Software Foundation version 2 of the License.
13 * This program is distributed in the hope that it will be useful, but
14 * WITHOUT ANY WARRANTY; without even the implied warranty of
15 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
16 * General Public License for more details.
18 * You should have received a copy of the GNU General Public License along
19 * with this program; if not, write to the Free Software Foundation, Inc.,
20 * 675 Mass Ave, Cambridge, MA 02139, USA.
32 #include "udev_version.h"
34 #include "libsysfs/libsysfs.h"
37 static char *get_action(void)
41 action = getenv("ACTION");
46 static char *get_device(void)
50 device = getenv("DEVPATH");
54 int main(int argc, char *argv[])
62 dbg ("unknown number of arguments");
68 device = get_device();
73 dbg("looking at %s", device);
75 /* we only care about class devices and block stuff */
76 if (!strstr(device, "class") &&
77 !strstr(device, "block")) {
78 dbg("not block or class");
82 /* but we don't care about net class devices */
83 if (strcmp(subsystem, "net") == 0) {
84 dbg("don't care about net devices");
88 action = get_action();
94 /* initialize the naming deamon */
97 if (strcmp(action, "add") == 0)
98 return udev_add_device(device, argv[1]);
100 if (strcmp(action, "remove") == 0)
101 return udev_remove_device(device, argv[1]);
103 dbg("Unknown action: %s", action);