Hello again.
puppy:st$ make ev_passwd
gcc -Wall -O3 -g -DDEBUG -D_GNU_SOURCE -DUSE_RESOLVE -lev -o ev_passwd
ev_passwd.c: In function ‘main’:
ev_passwd.c:28: warning: implicit declaration of function ‘ev_path_set’
/home/anton/tmp/ccqKUU2t.o: In function `main':
/home/anton/WORK/lib/ev_passwd.c:28: undefined reference to `ev_path_set'
collect2: ld returned 1 exit status
make: *** [ev_passwd] Error 1
puppy:lib$ cat ev_passwd.c
#include <stdio.h>
#include <ev.h>
/* Example: Watch "/etc/passwd" for attribute changes.
Copy-paste from ev.3
*/
static void
passwd_cb (struct ev_loop *loop, ev_stat *w, int revents)
{
/* /etc/passwd changed in some way */
if (w->attr.st_nlink)
{
printf ("passwd current size %ld\n", (long)w->attr.st_size);
printf ("passwd current atime %ld\n", (long)w->attr.st_mtime);
printf ("passwd current mtime %ld\n", (long)w->attr.st_mtime);
}
else /* you shalt not abuse printf for puts */
puts ("wow, /etc/passwd is not there, expect problems. "
"if this is windows, they already arrived\n");
}
int
main ()
{
ev_stat passwd;
struct ev_loop *loop = ev_default_loop (0);
ev_stat_init (&passwd, passwd_cb, "/etc/passwd", 0.);
ev_stat_start (loop, &passwd);
ev_loop (loop, 0);
return 0;
}
puppy:lib$_
Did You miss ev_path_set in the ev.c? That function used in the ev_stat_init
macro. Something like that?
void
ev_path_set (ev_stat *ev, char *path, ev_tstamp t)
{
ev->interval = t;
ev->path = path;
}
WBR,
Anton Umnikov.
_______________________________________________
libev mailing list
[email protected]
http://lists.schmorp.de/cgi-bin/mailman/listinfo/libev