zf

zenflows testing
git clone https://s.sonu.ch/~srfsh/zf.git
Log | Files | Refs | Submodules | README | LICENSE

common.h (1496B)


      1 #ifndef fsevent_watch_common_h
      2 #define fsevent_watch_common_h
      3 
      4 #include <CoreFoundation/CoreFoundation.h>
      5 #include <CoreServices/CoreServices.h>
      6 #include <unistd.h>
      7 #include <fcntl.h>
      8 #include "compat.h"
      9 
     10 #define _str(s) #s
     11 #define _xstr(s) _str(s)
     12 
     13 #define COMPILED_AT __DATE__ " " __TIME__
     14 
     15 #define FPRINTF_FLAG_CHECK(flags, flag, msg, fd)  \
     16   do {                                            \
     17     if ((flags) & (flag)) {                       \
     18       fprintf(fd, "%s\n", msg); } }               \
     19   while (0)
     20 
     21 #define FLAG_CHECK_STDERR(flags, flag, msg)       \
     22         FPRINTF_FLAG_CHECK(flags, flag, msg, stderr)
     23 
     24 /*
     25  * FSEVENTSBITS:
     26  * generated by `make printflags` (and pasted here)
     27  * flags MUST be ordered (bits ascending) and sorted
     28  *
     29  * idea from: http://www.openbsd.org/cgi-bin/cvsweb/src/sbin/ifconfig/ifconfig.c (see printb())
     30  */
     31 #define	FSEVENTSBITS \
     32 "\1mustscansubdirs\2userdropped\3kerneldropped\4eventidswrapped\5historydone\6rootchanged\7mount\10unmount\11created\12removed\13inodemetamod\14renamed\15modified\16finderinfomod\17changeowner\20xattrmod\21isfile\22isdir\23issymlink\24ownevent"
     33 
     34 static inline void
     35 sprintb(char *buf, unsigned short v, char *bits)
     36 {
     37         int i, any = 0;
     38         char c;
     39 	char *bufp = buf;
     40 
     41 	while ((i = *bits++)) {
     42 		if (v & (1 << (i-1))) {
     43 			if (any)
     44 				*bufp++ = ',';
     45 			any = 1;
     46 			for (; (c = *bits) > 32; bits++)
     47 				*bufp++ = c;
     48 		} else
     49 			for (; *bits > 32; bits++)
     50 				;
     51 	}
     52 	*bufp = '\0';
     53 }
     54 
     55 #endif /* fsevent_watch_common_h */