smdev

suckless mdev
git clone git://git.suckless.org/smdev
Log | Files | Refs | README | LICENSE

commit 5ce5c84744b108344c59ac30c77ef6a0d2dcde76
parent d7f305ee12680d8f218e73e6e3d5d77b74b319d6
Author: sin <sin@2f30.org>
Date:   Wed, 21 Aug 2013 11:19:21 +0100

Add some comments

Diffstat:
Msmdev.c | 4++++
1 file changed, 4 insertions(+), 0 deletions(-)

diff --git a/smdev.c b/smdev.c @@ -107,6 +107,7 @@ create_dev(const char *path) if (matchrule(Rule, devname) < 0) continue; + /* Create the dev paths if necessary */ if (Rule->path) { switch (Rule->path[0]) { case '=': @@ -129,6 +130,7 @@ create_dev(const char *path) } } + /* Create the actual dev nodes */ ret = mknod(devpath, Rules[i].mode | type, makedev(maj, min)); if (ret < 0 && errno != EEXIST) eprintf("mknod %s:", devpath); @@ -142,12 +144,14 @@ create_dev(const char *path) if (ret < 0) eprintf("chown %s:", devpath); + /* Export the needed environment */ if (chdir("/dev") < 0) eprintf("chdir /dev:"); snprintf(buf, sizeof(buf), "SMDEV=%s", devname); if (putenv(buf) < 0) eprintf("putenv:"); + /* Run the command hooks for this rule */ if (Rule->cmd) { switch (Rule->cmd[0]) { case '@':