inotify: if PROG is -, print events to stdout
function old new delta inotifyd_main 516 589 +73 packed_usage 28698 28709 +11 Signed-off-by: Flemming Madsen <busybox@themadsens.dk> Signed-off-by: Denys Vlasenko <vda.linux@googlemail.com>
This commit is contained in:
parent
39ec6a2ad5
commit
ecccbac37b
@ -33,6 +33,7 @@
|
|||||||
//usage: "Run PROG on filesystem changes."
|
//usage: "Run PROG on filesystem changes."
|
||||||
//usage: "\nWhen a filesystem event matching MASK occurs on FILEn,"
|
//usage: "\nWhen a filesystem event matching MASK occurs on FILEn,"
|
||||||
//usage: "\nPROG ACTUAL_EVENTS FILEn [SUBFILE] is run."
|
//usage: "\nPROG ACTUAL_EVENTS FILEn [SUBFILE] is run."
|
||||||
|
//usage: "\nIf PROG is -, events are sent to stdout."
|
||||||
//usage: "\nEvents:"
|
//usage: "\nEvents:"
|
||||||
//usage: "\n a File is accessed"
|
//usage: "\n a File is accessed"
|
||||||
//usage: "\n c File is modified"
|
//usage: "\n c File is modified"
|
||||||
@ -177,12 +178,20 @@ int inotifyd_main(int argc, char **argv)
|
|||||||
*s++ = mask_names[i];
|
*s++ = mask_names[i];
|
||||||
}
|
}
|
||||||
*s = '\0';
|
*s = '\0';
|
||||||
// bb_error_msg("exec %s %08X\t%s\t%s\t%s", args[0],
|
if (LONE_CHAR(args[0], '-')) {
|
||||||
// ie->mask, events, watches[ie->wd], ie->len ? ie->name : "");
|
/* "inotifyd - FILE": built-in echo */
|
||||||
args[1] = events;
|
printf(ie->len ? "%s\t%s\t%s\n" : "%s\t%s\n", events,
|
||||||
args[2] = watches[ie->wd];
|
watches[ie->wd],
|
||||||
args[3] = ie->len ? ie->name : NULL;
|
ie->name);
|
||||||
spawn_and_wait((char **)args);
|
fflush(stdout);
|
||||||
|
} else {
|
||||||
|
// bb_error_msg("exec %s %08X\t%s\t%s\t%s", args[0],
|
||||||
|
// ie->mask, events, watches[ie->wd], ie->len ? ie->name : "");
|
||||||
|
args[1] = events;
|
||||||
|
args[2] = watches[ie->wd];
|
||||||
|
args[3] = ie->len ? ie->name : NULL;
|
||||||
|
spawn_and_wait((char **)args);
|
||||||
|
}
|
||||||
// we are done if all files got final x event
|
// we are done if all files got final x event
|
||||||
if (ie->mask & 0x8000) {
|
if (ie->mask & 0x8000) {
|
||||||
if (--argc <= 0)
|
if (--argc <= 0)
|
||||||
|
Loading…
Reference in New Issue
Block a user