ftp.delorie.com/archives/browse.cgi   search  
Mail Archives: djgpp/2007/05/16/15:51:07

X-Authentication-Warning: delorie.com: mail set sender to djgpp-bounces using -f
Date: Wed, 16 May 2007 22:50:37 +0300
From: alex bodnaru <alexbodn AT 012 DOT net DOT il>
Subject: Re: How to count the occurance of a character in a string?
In-reply-to: <20070516180657.GE20179@freenet.de>
To: djgpp AT delorie DOT com
Message-id: <464B608D.9020303@alex3>
MIME-version: 1.0
X-Enigmail-Version: 0.94.2.0
References: <20070511181210 DOT GT3209 AT freenet DOT de> <f22p42$bu7$1 AT aioe DOT org>
<20070512111553 DOT GO1881 AT freenet DOT de> <f24kg3$k88$1 AT aioe DOT org>
<20070515164057 DOT GC1818 AT freenet DOT de> <f2f79a$1i6$1 AT aioe DOT org>
<20070516160358 DOT GA20179 AT freenet DOT de> <464B3526 DOT 2080909 AT schluessler DOT org>
<20070516180657 DOT GE20179 AT freenet DOT de>
User-Agent: Icedove 1.5.0.10 (X11/20070329)
X-MIME-Autoconverted: from QUOTED-PRINTABLE to 8bit by delorie.com id l4GJoqWC005252
Reply-To: djgpp AT delorie DOT com
Errors-To: nobody AT delorie DOT com
X-Mailing-List: djgpp AT delorie DOT com
X-Unsubscribes-To: listserv AT delorie DOT com

-----BEGIN PGP SIGNED MESSAGE-----
Hash: SHA1


michelle,

if you have a mailbox in the maildir format, you can definitely
transform it in a directory tree using a recursive run on each of the
subdirs names in the mailbox:


~/Maildir
.INBOX
.INBOX.djgpp
.INBOX.gis
.INBOX.family
.INBOX.family.wife
.INBOX.family.children
.INBOX.family.parents

if you wish to access your very mailbox from dos,
i'd suggest you build the directory tree as you have asked (more on this
below), with the leaves on the tree being links to the real subdirs in
the mailbox.

the directory tree top should be exported as nfs or samba, to be
accessed in dos, simultaneusly with linux.

building the dir tree (on linux):

char *topdestdir = "rmaildir";
mkdir(topdestdir);
for each directory in maildir
{
  if (*directory == '.')
  {
      char *origdir = directory;
      char *tmp;
      chdir(topdestdir);
      while ((tmp = strchr(directory + 1, '.')) != NULL)
      {
          *tmp = '\0';
          if (access(directory + 1, D_OK)
             mkdir(directory + 1);
          chdir(directory + 1);
          directory = tmp;
          *tmp = '.'
      }
      mklink(origdir, directory);
  }
}

regards,

alex

Michelle Konzack wrote:
> Am 2007-05-16 18:45:26, schrieb Timo Schlüßler:
>> Do you only need strdup() or strdupa() ?? Why don't you write your own?
>> Like:
>> char *strdup(const char *s)
>> {
>>   size_t len = strlen (s) + 1;
>>   char *result = (char*) malloc (len);
>>   if (result == (char*) 0)
>>     return (char*) 0;
>>   return (char*) memcpy (result, s, len);
>> }
>>
>> (This is the code for the real strdup() function.)
>>
>> All the best and sorry for writting if this wasn't your real problem
> 
> Maybe you are right.  I should copy the original function into my code.
> I have only found two functions, which are not available under DJGPP.
> 
> Thanks, Greetings and nice Day
>     Michelle Konzack
> 
> 
-----BEGIN PGP SIGNATURE-----
Version: GnuPG v1.4.6 (GNU/Linux)
Comment: Using GnuPG with Mozilla - http://enigmail.mozdev.org

iQCVAwUBRktgjdpwN1sq38njAQKAkwQAuN3fINZnVBUAahEn9V8dndzI3WOJj6FA
b7uF4att+Ap8a6AWQYVBR9XaZsMksXosXuqCoWCttvkGw21IFMMP8wsUEwO1uoRt
VLTkKd4hFg/piE51C97eqY6/Rh3FT1qYuwyy//5pe033vELdlgeozu327bjMTScL
xYPpggQICK0=
=Xu8y
-----END PGP SIGNATURE-----


- Raw text -


  webmaster     delorie software   privacy  
  Copyright © 2019   by DJ Delorie     Updated Jul 2019