Re: [SLE] directory listing daemon ?
From: Laurent Renard (lrenard_at_epicuria.be)
Date: 04/30/05
- Previous message: Greg Freemyer: "Re: [SLE] Interesting review of SuSE 9.3"
- In reply to: Anders Johansson: "Re: [SLE] directory listing daemon ?"
- Messages sorted by: [ date ] [ thread ] [ subject ] [ author ]
Date: Sat, 30 Apr 2005 23:21:07 +0200
Le samedi 30 avril 2005 à 20:24 +0200, Anders Johansson a écrit :
> On Saturday 30 April 2005 19:03, Laurent Renard wrote:
> > Hello everyone,
> >
> > i'm looking for something that could listen to a directory content
> > ( console )
> > and dynamicaly display it ( and display changes in real-time )
>
> watch ls directory
>
> perhaps?
>
> Or if you want it to be closer to real time, a simple program that uses the
> file alteration monitor would do it. Something like this (hacked together in
> about 5 minutes, to give you the general idea)
>
> #include <stdio.h>
> #include <fam.h>
> #include <sys/types.h>
> #include <dirent.h>
> #include <sys/select.h>
>
> int main(int argc, char *argv[]){
> FAMConnection fc;
> FAMRequest fr;
> FAMEvent fe;
> DIR *dir;
> struct dirent *entry;
>
> printf("Monitoring directory %s\n", argv[1]);
>
> if(FAMOpen(&fc)){
> fprintf(stderr, "Couldn't open connection to FAM daemon\n");
> exit(1);
> }
>
> if(FAMMonitorDirectory(&fc, argv[1], &fr, NULL))
> exit(1);
>
> while(FAMNextEvent(&fc, &fe) != -1){
> printf("The directory changed\n");
> dir = opendir(argv[1]);
> while((entry = readdir(dir)) != NULL)
> printf("%s\n", entry->d_name);
> closedir(dir);
> }
> FAMClose(&fc);
> return 0;
> }
It seems that i need a few more libs to execute it or is there a place
where i could drop it to run ?
-- Laurent Renard -- Check the headers for your unsubscription address For additional commands send e-mail to suse-linux-e-help@suse.com Also check the archives at http://lists.suse.com Please read the FAQs: suse-linux-e-faq@suse.com
- Previous message: Greg Freemyer: "Re: [SLE] Interesting review of SuSE 9.3"
- In reply to: Anders Johansson: "Re: [SLE] directory listing daemon ?"
- Messages sorted by: [ date ] [ thread ] [ subject ] [ author ]
Relevant Pages
|
|