Re: pthreads in YahooPOPs

2002-10-14 Thread Andrew Lynch

OK Thanks!  All future messages will go to the mailing
list only.

I have had some success with SaveMyModem and the
cygwin port of YahooPOPs since these messages.  I was
able to comment out the pthreads portion and add a few
other minor changes, Makefile tweaks, etc.  After a
bit of work, I was able to compile and build the
latest YahooPOPs for Linux on Cygwin.  I was able to
get some success as well, downloading a single message
from my Yahoo! Mail account into SaveMyModem.  There
were some obvious bugs but the proof of concept is
there.  Now its just fault isolation and debug.  (If
you want more of the details, visit the URLs below.) 
Good News!

I suspect that the code snippet is a result of a
problem on the original authors OS that is not present
in Cygwin.  I am able to get full or near full
functionality without these nonportable modifications.

I think the way to handle this and other changes to
the code as a result of the Cygwin port is to just add
in #ifdef/#endif around this section like any other
port.  I passed your comments on to the YahooPOPs
forum so hopefully the author can eliminate these
nonportable sections and make porting to other
architectures that much easier.

Thanks again for your help!

Andrew Lynch

PS, if you or anyone else is interested in this FREE
(GPL) Cross Platform Mail Filter project using Cygwin,
the URLs are:

http://sourceforge.net/projects/yahoopops
http://sourceforge.net/projects/savemymodem


--- egor duda  wrote:
> Hi!
> 
> >> AL> lock.__m_reserved = 0;
> >> AL> lock.__m_count = 0;
> >> AL> lock.__m_owner = 0;
> >> AL> lock.__m_kind = PTHREAD_MUTEX_TIMED_NP;
> >> AL> lock.__m_lock.__status = 0;
> >> AL> lock.__m_lock.__spinlock =
> __LT_SPINLOCK_INIT;
> 
> It's hard to be sure from such short snippet, but it
> looks like they
> should use pthread_mutex_init() function if they
> want to create a new
> pthread mutex and initialize it.
> 
> Single Unix Specification
> (http://www.opengroup.org/onlinepubs/007908799/)
> is a standard cygwin is trying to conform to. They
> have all needed
> reference information online.
> 


__
Do you Yahoo!?
Faith Hill - Exclusive Performances, Videos & More
http://faith.yahoo.com

--
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/




Re: pthreads in YahooPOPs

2002-10-14 Thread egor duda

Hi!

Sunday, 13 October, 2002 Andrew Lynch [EMAIL PROTECTED] wrote:

AL> Hopefully, the author will see the issue and rewrite
AL> the code in a more portable manner.  Can you deduce
AL> what the YahooPOPs author is trying to do?  Would you
AL> suggest a more portable method I could look at?  I
AL> will likely be finding or writing a replacement for
AL> this code section and appreciate any tips.

>> AL> lock.__m_reserved = 0;
>> AL> lock.__m_count = 0;
>> AL> lock.__m_owner = 0;
>> AL> lock.__m_kind = PTHREAD_MUTEX_TIMED_NP;
>> AL> lock.__m_lock.__status = 0;
>> AL> lock.__m_lock.__spinlock = __LT_SPINLOCK_INIT;

It's hard to be sure from such short snippet, but it looks like they
should use pthread_mutex_init() function if they want to create a new
pthread mutex and initialize it.

Single Unix Specification (http://www.opengroup.org/onlinepubs/007908799/)
is a standard cygwin is trying to conform to. They have all needed
reference information online.

Additionally, would you please keep the answers on-list? I
deliberately set 'Reply-To:' to point to mailing list, because i read
it along with my personal e-mail, so i don't want to get duplicate
copies of one message.

Egor.mailto:[EMAIL PROTECTED] ICQ 5165414 FidoNet 2:5020/496.19


--
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/




pthreads in YahooPOPs

2002-10-13 Thread Andrew Lynch

Hi,
I am trying to build YahooPOPs for Linux 

http://sourceforge.net/projects/yahoopops 

on Cygwin but have run into a problem with pthreads.  

The lines below do not compile even though Cygwin
supports pthreads and pthread.h is included in the
header file.

lock.__m_reserved = 0;
lock.__m_count = 0;
lock.__m_owner = 0;
lock.__m_kind = PTHREAD_MUTEX_TIMED_NP;
lock.__m_lock.__status = 0;
lock.__m_lock.__spinlock = __LT_SPINLOCK_INIT;

Does anyone know why these pthread commands(?) are not
supported or won't compile?

Thanks in advance for the help!

Andrew Lynch

PS, I am also helping the author of SaveMyModem debug
that software.  It now builds under Cygwin and many of
the bugs have been found and fixed.  Give it a try,
(cvs version only).  Hopefully, version 0.14 will be
out soon and much improved.

http://sourceforge.net/projects/savemymodem



__
Do you Yahoo!?
Faith Hill - Exclusive Performances, Videos & More
http://faith.yahoo.com


LogFile.cpp
Description: LogFile.cpp

/*
*
* YahooPOPs!
*
* YahooPOPs! is an application that provides POP3 access to Yahoo! Mail.
* You do not need to enable POP3 access with Yahoo! to use this program.
* This program works within the license agreement of Yahoo! to provide
* you with POP3 access.
*
* YahooPOPs! emulates a POP3 mail server and should work with most of the
* email clients. Since YahooPOPs! is not a full-fledged POP3 mail server
* you might find it not working with all mail clients. Do keep us informed
* about such mail clients so that we can enhance YahooPOPs!
*
* Official Website: http://yahoopops.sourceforge.net
*
* Credits:
* - YahooPOPs! has been inspired by FetchYahoo, a Perl based application
*   that works with mail clients supporting mbox'es (Netscape, Pine, etc.).
*   FetchYahoo is authored by Ravi Ramkissoon <[EMAIL PROTECTED]>
*-
*
* Name: LogFile.h
*
* Purpose : To maintain an activity log file
*
* Author  : Anuj Seth <[EMAIL PROTECTED]>
*   K.Shyam   <[EMAIL PROTECTED]>
*
* License : GNU Public License (Version 2 or later)
*
*-
*
* THIS SOFTWARE IS PROVIDED ``AS IS'' BY THE AUTHORS AND INDEPENDENT
* CONTRIBUTORS AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT 
* LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A 
* PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE AUTHOR OR 
* CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, 
* EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, 
* PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR 
* PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF 
* LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING 
* NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS 
* SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
*
*/
#ifndef _LOGFILE_H_
#define _LOGFILE_H_

#ifdef WIN32
#if _MSC_VER > 1000
#pragma once
#endif // _MSC_VER > 1000
/* added by K.Shyam.we shall use Mstring on *ix systems */
#include "StdString.h" 
#else
#include 
#include 
#include  /* for the locks */
#include "MString.h"
#include "Defines.h"
typedef MString CStdString;
#endif

typedef enum { LOG_BASIC, LOG_ADVANCED } LOGTYPE;

class LogFile  
{
public:
void Write(const LOGTYPE type, const char *format, ...);
LogFile(const CStdString &filename = "yahoopops.log");
virtual ~LogFile();

protected:
void Trim();
CStdString  m_strLogFile;
longm_nFileSize;
FILE*fp;
#ifdef WIN32
CCriticalSection lock;
#else
pthread_mutex_t lock;
#endif
};

#endif


cd ../common;make;cd ../unix
make[1]: Entering directory `/home/andrew/yahoopops/yahoopops.sav/common'
rm -f LogFile.o
g++ -g -I.  -I../unix -D_REENTRANT -c LogFile.cpp
LogFile.cpp: In method `LogFile::LogFile(const MString & = "yahoopops.log")':
LogFile.cpp:87: request for member `__m_reserved' in `LogFile::lock', which is of 
non-aggregate type `void *'
LogFile.cpp:88: request for member `__m_count' in `LogFile::lock', which is of 
non-aggregate type `void *'
LogFile.cpp:89: request for member `__m_owner' in `LogFile::lock', which is of 
non-aggregate type `void *'
LogFile.cpp:90: request for member `__m_kind' in `LogFile::lock', which is of 
non-aggregate type `void *'
LogFile.cpp:90: `PTHREAD_MUTEX_TIMED_NP' undeclared (first use this function)
LogFile.cpp:90: (Each undeclared identifier is reported only once
LogFile.cpp:90: for each function it appears in.)
LogFile.cpp:91: request for member `__m_lock' in `LogFile::lock', which is of 
non-aggregate type `void *'
LogFile.cpp:92: request for member `__m

Re: pthreads in YahooPOPs

2002-10-13 Thread Andrew Lynch

Egor,

Thank you for the info! I will post it to the
YahooPOPs for Linux development forum and see what
happens.  

Hopefully, the author will see the issue and rewrite
the code in a more portable manner.  Can you deduce
what the YahooPOPs author is trying to do?  Would you
suggest a more portable method I could look at?  I
will likely be finding or writing a replacement for
this code section and appreciate any tips.

Andrew Lynch

--- egor duda  wrote:
> Hi!
> 
> Sunday, 13 October, 2002 Andrew Lynch
> wrote:
> 
> AL> http://sourceforge.net/projects/yahoopops 
> 
> AL> on Cygwin but have run into a problem with
> pthreads.  
> 
> AL> The lines below do not compile even though
> Cygwin
> AL> supports pthreads and pthread.h is included in
> the
> AL> header file.
> 
> AL> lock.__m_reserved = 0;
> AL> lock.__m_count = 0;
> AL> lock.__m_owner = 0;
> AL> lock.__m_kind = PTHREAD_MUTEX_TIMED_NP;
> AL> lock.__m_lock.__status = 0;
> AL> lock.__m_lock.__spinlock = __LT_SPINLOCK_INIT;
> 
> AL> Does anyone know why these pthread commands(?)
> are not
> AL> supported or won't compile?
> 
> The project you're talking about is using
> non-portable method of
> dealing with pthreads. Pthread interface doesn't
> specify an internal
> structure of pthread primitives, so their actual
> implementation may
> vary (and does vary) between different systems. You
> should ask
> YahooPOPs people to use portable constructs so that
> their code can be
> compiled on any system which supports pthread
> interface.
> 
> Egor. 

__
Do you Yahoo!?
Faith Hill - Exclusive Performances, Videos & More
http://faith.yahoo.com

--
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/




Re: pthreads in YahooPOPs

2002-10-13 Thread egor duda

Hi!

Sunday, 13 October, 2002 Andrew Lynch [EMAIL PROTECTED] wrote:

AL> http://sourceforge.net/projects/yahoopops 

AL> on Cygwin but have run into a problem with pthreads.  

AL> The lines below do not compile even though Cygwin
AL> supports pthreads and pthread.h is included in the
AL> header file.

AL> lock.__m_reserved = 0;
AL> lock.__m_count = 0;
AL> lock.__m_owner = 0;
AL> lock.__m_kind = PTHREAD_MUTEX_TIMED_NP;
AL> lock.__m_lock.__status = 0;
AL> lock.__m_lock.__spinlock = __LT_SPINLOCK_INIT;

AL> Does anyone know why these pthread commands(?) are not
AL> supported or won't compile?

The project you're talking about is using non-portable method of
dealing with pthreads. Pthread interface doesn't specify an internal
structure of pthread primitives, so their actual implementation may
vary (and does vary) between different systems. You should ask
YahooPOPs people to use portable constructs so that their code can be
compiled on any system which supports pthread interface.

Egor.mailto:[EMAIL PROTECTED] ICQ 5165414 FidoNet 2:5020/496.19


--
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/