[prev in list] [next in list] [prev in thread] [next in thread] 

List:       kde-devel
Subject:    C wrappers for ioslaves ! was: Re: Announce: KIO-Sync 0.1.0
From:       aleXXX <alexander.neundorf () gmx ! net>
Date:       2001-10-30 1:20:15
[Download RAW message or body]

On Sat 27 Oct 01 03:09, Charles Samuels wrote:

> and do (more or less) what the shell tools do.  Also is libkiosyms, which
> allows LD_PRELOADing!  For example, the following is supported:
>
> LD_PRELOAD=libkiosync.so ls
> ftp://anonymous:fred%40bob.com:altair.dhs.org/pub/
>
> This uses libkiosync to make the GNU "ls" shell tool able to access KIO.
> (I've had success with ls, stat, and cat only)

I really overlooked these few lines and started to implement C wrappers 
myself, when compiling I found they were already there !

How to put it....
Great !!!!!!!!!!!!!!!!

I will play a bit with xmms tomorrow if I find time....

A small problem nevertheless:
extern "C" DirEnt *readdir64(DIR *d)
{
   CHECK_INIT();
   if (d->x!=0xdeadbeef)
      return orig_readdir64(d);
   if (d->i >= d->files.count()) return 0;
/* DirEnt *de=(DirEnt*)::malloc(sizeof(DirEnt));  produces memleaks, doesn't 
it ?
   ::strcpy(de->d_name, d->files.at(d->i));
   d->i++;
   return de;*/
   static DirEnt de;
    cerr<<"inside: "<<d->files.at(d->i)<<endl;
   ::strcpy(de.d_name, d->files.at(d->i));
   printf("inside2: %s\n",de.d_name);
   d->i++;
   return &de;
}

and 

int main()
{
    DIR *dp;
   struct dirent *ep;
   dp = opendir ("/kio/smb://alex2_pc/");
   if (dp != NULL)
   {
      while (ep = readdir64 (dp))
         printf("%s\n",ep->d_name);
      (void) closedir (dp);
   }
   else
      puts ("Couldn't open the directory.");
   return 0;
};

gives

Start
End
open /kio/smb://alex2_pc/
/ alex2_pc
/tmp/ksocket-alex2/pid-30568alex2_pc0(null)(null)
inside: public
inside2: public
 
inside: der test x
inside2: der test x
 
inside: writeable
inside2: writeable

i.e. the printf() in main prints only an empty line, strange. Will go to bed 
now.

Very great !!!!
This is soooo cool :-)

Bye
Alex
 
>> Visit http://mail.kde.org/mailman/listinfo/kde-devel#unsub to unsubscribe <<

[prev in list] [next in list] [prev in thread] [next in thread] 

Configure | About | News | Add a list | Sponsored by KoreLogic