aboutsummaryrefslogtreecommitdiff
path: root/libinotifytools/src/inotifytools.c
diff options
context:
space:
mode:
Diffstat (limited to 'libinotifytools/src/inotifytools.c')
-rw-r--r--libinotifytools/src/inotifytools.c14
1 files changed, 14 insertions, 0 deletions
diff --git a/libinotifytools/src/inotifytools.c b/libinotifytools/src/inotifytools.c
index 609f749..f76f4ea 100644
--- a/libinotifytools/src/inotifytools.c
+++ b/libinotifytools/src/inotifytools.c
@@ -1655,6 +1655,8 @@ int inotifytools_get_num_watches() {
* The following tokens will be replaced with the specified string:
* \li \c \%w - This will be replaced with the name of the Watched file on
* which an event occurred.
+ * \li \c \%c - This will be replaced with the cookie of the Watched file on
+ * which an event occurred.
* \li \c \%f - When an event occurs within a directory, this will be replaced
* with the name of the File which caused the event to occur.
* Otherwise, this will be replaced with an empty string.
@@ -1700,6 +1702,8 @@ int inotifytools_printf( struct inotify_event* event, char* fmt ) {
* The following tokens will be replaced with the specified string:
* \li \c \%w - This will be replaced with the name of the Watched file on
* which an event occurred.
+ * \li \c \%c - This will be replaced with the cookie of the Watched file on
+ * which an event occurred.
* \li \c \%f - When an event occurs within a directory, this will be replaced
* with the name of the File which caused the event to occur.
* Otherwise, this will be replaced with an empty string.
@@ -1754,6 +1758,8 @@ int inotifytools_fprintf( FILE* file, struct inotify_event* event, char* fmt ) {
* The following tokens will be replaced with the specified string:
* \li \c \%w - This will be replaced with the name of the Watched file on
* which an event occurred.
+ * \li \c \%c - This will be replaced with the cookie of the Watched file on
+ * which an event occurred.
* \li \c \%f - When an event occurs within a directory, this will be replaced
* with the name of the File which caused the event to occur.
* Otherwise, this will be replaced with an empty string.
@@ -1806,6 +1812,8 @@ int inotifytools_sprintf( char * out, struct inotify_event* event, char* fmt ) {
* The following tokens will be replaced with the specified string:
* \li \c \%w - This will be replaced with the name of the Watched file on
* which an event occurred.
+ * \li \c \%c - This will be replaced with cookie of the Watched file on
+ * which an event occurred.
* \li \c \%f - When an event occurs within a directory, this will be replaced
* with the name of the File which caused the event to occur.
* Otherwise, this will be replaced with an empty string.
@@ -1901,6 +1909,12 @@ int inotifytools_snprintf( char * out, int size,
continue;
}
+ if ( ch1 == 'c' ) {
+ ind += snprintf( &out[ind], size-ind, "%x", event->cookie);
+ ++i;
+ continue;
+ }
+
if ( ch1 == 'e' ) {
eventstr = inotifytools_event_to_str( event->mask );
strncpy( &out[ind], eventstr, size - ind );