Subject: Re: imapd on cygwin
From: Andrew DeFaria <[email-masked]>
To: [email-masked]
Date: Tue, 02 Apr 2002 23:37:58 -0800
Newsgroups: gmane.os.cygwin

Andrew DeFaria wrote:

> I used to have this working but it broke somewhere.
>
> I installed imapd for cygwin. Now whenever I run it it simply coredumps:
>
> $ /usr/local/sbin/imapd
> Segmentation fault (core dumped)
> $
>
> I have followed everything in the readme WRT to setting this up and as 
> I said before I did have this working. The one part that didn't work 
> was accessing Inbox but that was because I wasn't using a mail server 
> that made mbox style inboxes. Now I have exim and have even configured 
> mutt to work. But I want imap to work for me.
>
> Before I dive into debugging this I was wondering if anybody had any 
> ideas?

Well I build a debugable version of imapd and did a little debugging 
with gdb and this is odd. I'm dying at gettimeofday in the function 
rfc822_timezone which gdb shows me as:

void rfc822_timezone (char *s,void *t)
{
        struct timezone d;
        struct tm *tm;
        int hr;

        gettimeofday(NULL, &d);
        hr = d.tz_minuteswest / 60;
        tm = (struct tm *)t;
        if (tm->tm_isdst) {
                hr++;
        }
        sprintf(s + strlen(s), " (%+04d)", (hr * 100));
}

I can find no man page for gettimeofday in Cygwin! And I can't seem to 
even call it properly:

#include <time.h>
#include <stdio.h>
int main (void) {
  struct timezone d;
  printf ("Calling gettimeofday\n");
  gettimeofday (NULL, &d);
  printf ("Returned from gettimeofday\n");
}

$ gcc foo.c
foo.c: In function `main':
foo.c:4: storage size of `d' isn't known

So how the hell did it get compiled into imapd this way?!? And how does 
on call gettimeofday in Cygwin?

Finally I tried:

$ grep gettimeofday /usr/include/*
/usr/include/_syslist.h:#define _gettimeofday gettimeofday
/usr/include/reent.h:extern int _gettimeofday_r _PARAMS ((struct _reent 
*, struct timeval *tp, struct timezone *tzp));

Any ideas?

--
Unsubscribe info:      http://cygwin.com/ml/#unsubscribe-simple
Bug reporting:         http://cygwin.com/bugs.html
Documentation:         http://cygwin.com/docs.html
FAQ:                   http://cygwin.com/faq/