コード例 #1
0
void output_event_csv( struct inotify_event * event ) {
    const char *filename = csv_escape(inotifytools_filename_from_wd(event->wd));
    char strtmp[1024]="";
    sprintf(strtmp, "%s", filename);

    if (filename != NULL)
        printf("%s,", csv_escape(filename));

	printf("%s,", csv_escape( inotifytools_event_to_str( event->mask ) ) );
	if ( event->len > 0 )
		printf("%s", csv_escape( event->name ) );
	printf("\n");
	if (( filename != NULL )&&( event->len > 0 )){
        openlog("seci-inotify",  LOG_PID, LOG_LOCAL0 );
        syslog(LOG_INFO, "type=%s path=%s file=%s", inotifytools_event_to_str( event->mask ) , strtmp, event->name );
        closelog();
	}
}
コード例 #2
0
ファイル: inotifywait.c プロジェクト: alaahd/inotify-tools
void output_event_csv( struct inotify_event * event ) {
    char *filename = csv_escape(inotifytools_filename_from_wd(event->wd));
    if (filename != NULL)
        printf("%s,", csv_escape(filename));

	printf("%s,", csv_escape( inotifytools_event_to_str( event->mask ) ) );
	if ( event->len > 0 )
		printf("%s", csv_escape( event->name ) );
	printf("\n");
}
コード例 #3
0
ファイル: test.c プロジェクト: songweibeijing/dirInfoMonitor
void event_to_str()
{
    ENTER
    verify2(
        !strcmp(inotifytools_event_to_str(IN_OPEN | IN_MODIFY | IN_ACCESS),
                "OPEN,MODIFY,ACCESS") ||
        !strcmp(inotifytools_event_to_str(IN_OPEN | IN_MODIFY | IN_ACCESS),
                "OPEN,ACCESS,MODIFY") ||
        !strcmp(inotifytools_event_to_str(IN_OPEN | IN_MODIFY | IN_ACCESS),
                "ACCESS,OPEN,MODIFY") ||
        !strcmp(inotifytools_event_to_str(IN_OPEN | IN_MODIFY | IN_ACCESS),
                "MODIFY,OPEN,ACCESS") ||
        !strcmp(inotifytools_event_to_str(IN_OPEN | IN_MODIFY | IN_ACCESS),
                "ACCESS,MODIFY,OPEN") ||
        !strcmp(inotifytools_event_to_str(IN_OPEN | IN_MODIFY | IN_ACCESS),
                "MODIFY,ACCESS,OPEN")
        , inotifytools_event_to_str(IN_OPEN | IN_MODIFY | IN_ACCESS));
    EXIT
}