Skip site navigation (1)Skip section navigation (2)
Date:      Fri, 25 Oct 2002 14:20:11 +0200 (CEST)
From:      Volker Stolz <stolz@i2.informatik.rwth-aachen.de>
To:        FreeBSD-gnats-submit@FreeBSD.org
Subject:   ports/44460: [patch] Update port: mail/mmr, C++ fixes for GCC3
Message-ID:  <200210251220.g9PCKBbK089633@bsd.localdomain>

next in thread | raw e-mail | index | archive | help

>Number:         44460
>Category:       ports
>Synopsis:       [patch] Update port: mail/mmr, C++ fixes for GCC3
>Confidential:   no
>Severity:       non-critical
>Priority:       low
>Responsible:    freebsd-ports
>State:          open
>Quarter:        
>Keywords:       
>Date-Required:
>Class:          sw-bug
>Submitter-Id:   current-users
>Arrival-Date:   Fri Oct 25 05:30:01 PDT 2002
>Closed-Date:
>Last-Modified:
>Originator:     Volker Stolz
>Release:        FreeBSD 4.6-STABLE i386
>Organization:
Lehrstuhl für Informatik II
>Environment:
System: FreeBSD bsd.localdomain 4.6-STABLE FreeBSD 4.6-STABLE #3: Mon Oct 7 16:20:29 CEST 2002 root@bsd.localdomain:/opt/src/sys/compile/BSD i386


>Description:
mail/mmr still breaks with GCC3. The following patch-set gets it to
compile with g++31 -Wall. Will provide patches to original author.

- post-extract target no longer necessary
- C++ target practice

>How-To-Repeat:
>Fix:
File lost:
files/patch-ae (superseded by patch-mailmsg.cpp)

--- files/patch-iobottle.cpp.orig	Fri Oct 25 14:06:37 2002
+++ files/patch-iobottle.cpp	Fri Oct 25 13:59:34 2002
@@ -1,7 +1,25 @@
---- iobottle.cpp.orig	Mon Oct 21 23:30:11 2002
-+++ iobottle.cpp	Mon Oct 21 23:30:37 2002
+--- iobottle.cpp.orig	Fri Aug  6 05:39:19 1999
++++ iobottle.cpp	Fri Oct 25 13:58:58 2002
 @@ -1,3 +1,4 @@
 +#include <string.h>
  
  extern "C" {
  #include <stdlib.h>
+@@ -97,7 +98,7 @@
+ }
+ /* If buf[len-1] is a null, then a newline should be written */
+ size_t
+-IObottle:: writeline(char *buf, size_t len = 0) {
++IObottle:: writeline(char *buf, size_t len) {
+ 	int lenwritten = 0;
+ 
+ 	if ( fputs(buf, wfp) >= 0 )
+@@ -134,7 +135,7 @@
+ 	return(0);
+ }
+ int
+-IObottle:: set_time(time_t actime, time_t modtime = 0) {
++IObottle:: set_time(time_t actime, time_t modtime) {
+ 	struct stat    sb;
+ 	struct utimbuf ub;
+ 
--- Makefile.orig	Fri Oct 25 14:04:07 2002
+++ Makefile	Fri Oct 25 14:04:27 2002
@@ -14,9 +14,6 @@
 
 ALL_TARGET=	# empty
 
-post-extract:
-	@${RM} -f ${WRKSRC}/*.o
-
 do-install:
 	${INSTALL_PROGRAM} ${WRKSRC}/mmr ${PREFIX}/bin
 	@${MKDIR} ${PREFIX}/share/examples/mmr

New files obtained via shar:
# This is a shell archive.  Save it in a file, remove anything before
# this line, and then unpack it by entering "sh file".  Note, it may
# create directories; files and directories will be owned by you and
# have default permissions.
#
# This archive contains:
#
#	files/patch-base64.cpp
#	files/patch-main.cpp
#	files/patch-listings.cpp
#	files/patch-terminal.cpp
#	files/patch-mailmsg.cpp
#	files/patch-mime.cpp
#
echo x - files/patch-base64.cpp
sed 's/^X//' >files/patch-base64.cpp << 'END-of-files/patch-base64.cpp'
X--- base64.cpp.orig	Mon Oct 21 23:29:39 2002
X+++ base64.cpp	Mon Oct 21 23:29:56 2002
X@@ -1,3 +1,4 @@
X+#include <string.h>
X 
X /* Convert to Base64 encoding */
X static char to_base64[64] = {
END-of-files/patch-base64.cpp
echo x - files/patch-main.cpp
sed 's/^X//' >files/patch-main.cpp << 'END-of-files/patch-main.cpp'
X--- main.cpp.orig	Fri Oct 25 13:49:34 2002
X+++ main.cpp	Fri Oct 25 13:49:52 2002
X@@ -38,12 +38,12 @@
X void LoadStatus(mailmsg *message)
X {
X 	static char twiddle[] = "-+|+";
X-	cerr << "\b\b" << twiddle[message->Index()%4] << ')';
X+	std::cerr << "\b\b" << twiddle[message->Index()%4] << ')';
X }
X void QuitStatus(mailmsg *message)
X {
X 	static char twiddle[] = "-+|+";
X-	cerr << "\b\b" << twiddle[message->Index()%4] << ')';
X+	std::cerr << "\b\b" << twiddle[message->Index()%4] << ')';
X }
X 
X void CleanupMessages(void)
X@@ -149,26 +149,26 @@
X 		case SIGHUP:
X 			if ( messages )
X 				messages->Abort();
X-			cout << "\rExiting because of hang-up signal!" << endl;
X+			std::cout << "\rExiting because of hang-up signal!" << std::cerr;
X 			break;
X 		case SIGINT:
X 		case SIGQUIT:
X 			if ( messages )
X 				messages->Abort();
X-			cout << "\rExiting because of keyboard interrupt!" <<
X-									endl;
X+			std::cout << "\rExiting because of keyboard interrupt!" <<
X+									std::cerr;
X 			break;
X 		case SIGSEGV:
X 		case SIGBUS:
X 			if ( messages )
X 				messages->Abort();
X-			cout << "\rExiting because of program bug!" << endl;
X+			std::cout << "\rExiting because of program bug!" << std::cerr;
X 			break;
X 		case SIGTERM:
X 			if ( messages )
X 				messages->Abort();
X-			cout << "\rExiting because of termination signal!" <<
X-									endl;
X+			std::cout << "\rExiting because of termination signal!" <<
X+									std::cerr;
X 			break;
X 		default:
X 			break;
X@@ -178,17 +178,17 @@
X 		char cmdbuf[BUFSIZ];
X 
X 		if ( messages ) {
X-			cout << "Saving  messages: ( )" << flush;
X+			std::cout << "Saving  messages: ( )" << std::flush;
X 			messages->OnSave(QuitStatus);
X 			CleanupMessages();
X 			messages = NULL;
X-			cout << " -- Done." <<  endl;
X+			std::cout << " -- Done." <<  std::cerr;
X 
X 			/* Check for new mail */
X 			time_t atime, mtime;
X 			mailfile->get_time(&atime, &mtime);
X 			if ( mtime > atime )
X-				cout << "You have NEW mail!" << endl;
X+				std::cout << "You have NEW mail!" << std::cerr;
X 		}
X 		if ( was_compressed ) {
X 			/* For some reason, this crashes on some mailboxes
X@@ -202,9 +202,9 @@
X 
X 		/* Any final mailfile cleanup */
X 		if ( was_compressed ) {
X-			cout << "Compressing mailfile..." << flush;
X+			std::cout << "Compressing mailfile..." << std::flush;
X 			(void) system(cmdbuf);
X-			cout << "Done." << endl;
X+			std::cout << "Done." << std::cerr;
X 			/* For some reason, this crashes on some mailboxes
X 				delete[] cmdbuf;
X 			*/
X@@ -447,12 +447,12 @@
X 
X void Usage(char *prog)
X {
X-	cout << 
X-Version << endl << endl <<
X-"Usage: " << prog << " [-s subject] recipient1 recipient2 ... " << endl <<
X-"or...  " << prog << " -c" << endl <<
X-"or...  " << prog << " [-r initfile] [-f mailbox]" << endl <<
X-	endl;
X+	std::cout << 
X+Version << std::cerr << std::cerr <<
X+"Usage: " << prog << " [-s subject] recipient1 recipient2 ... " << std::cerr <<
X+"or...  " << prog << " -c" << std::cerr <<
X+"or...  " << prog << " [-r initfile] [-f mailbox]" << std::cerr <<
X+	std::cerr;
X }
X 
X main(int argc, char *argv[])
X@@ -511,7 +511,7 @@
X 	/* Command line mailing? */
X 	if ( *argv ) {
X 		if ( NewMail(argv, subject) < 0 ) {
X-			cerr << "Mail send failed!" << endl;
X+			std::cerr << "Mail send failed!" << std::cerr;
X 			quit(-1);
X 		}
X 		quit(0);
X@@ -526,7 +526,7 @@
X 			((mailpath=(char *)getenv("MAIL")) == NULL) ) {
X 		if ( ((whoami=getlogin()) == NULL) &&
X 					((whoami=mycuserid()) == NULL) ) {
X-			cerr << "Who are you?  -- Aborting!" << endl;
X+			std::cerr << "Who are you?  -- Aborting!" << std::cerr;
X 			quit(-1);
X 		}
X 		mailpath = new char[strlen(MAILPATH)+1+strlen(whoami)+1];
X@@ -546,25 +546,25 @@
X 	struct stat sb;
X 
X 	if ( stat(mailpath, &sb) < 0 ) {
X-		cout << mailpath << " is not readable" << endl;
X+		std::cout << mailpath << " is not readable" << std::cerr;
X 		quit(0);
X 	}
X 	if ( sb.st_size == 0 )  {
X-		cout << "No mail." << endl;
X+		std::cout << "No mail." << std::cerr;
X 		quit(0);
X 	}
X 	if ( check_mail ) {
X 		if ( sb.st_mtime < sb.st_atime )
X-			cout << "You have mail." << endl;
X+			std::cout << "You have mail." << std::cerr;
X 		else
X-			cout << "You have NEW mail." << endl;
X+			std::cout << "You have NEW mail." << std::cerr;
X 		quit(0);
X 	}
X 
X 	/* Check to see if the lock file exists */
X 	if ( CheckLock(mailpath) ) {
X-		cout << "Lockfile (" << mailpath << ".lock) exists!" << endl;
X-		cout << "Please try again later..." << endl;
X+		std::cout << "Lockfile (" << mailpath << ".lock) exists!" << std::cerr;
X+		std::cout << "Please try again later..." << std::cerr;
X 		quit(0);
X 	}
X 
X@@ -592,10 +592,10 @@
X 
X 		/* Perform decompression */
X 		if ( decompress ) {
X-			cout << "Uncompressing mailfile..." << flush;
X+			std::cout << "Uncompressing mailfile..." << std::flush;
X 			if ( system(cmdbuf) == 0 )
X 				was_compressed = 1;
X-			cout << "Done." << endl;
X+			std::cout << "Done." << std::cerr;
X 		}
X 		delete[] cmdbuf;
X 	}
X@@ -616,11 +616,11 @@
X 	char             buffer[BUFSIZ];
X 
X 	if ( mailfile->fail() || mailfile->eof() ) {
X-		cout << "No mail in " << mailpath << endl;
X+		std::cout << "No mail in " << mailpath << std::cerr;
X 		quit(0);
X 	}
X 	if ( mailfile->readline(buffer, BUFSIZ) == 1 ) {
X-		cout << "Newline at start of mailfile -- aborting!" << endl;
X+		std::cout << "Newline at start of mailfile -- aborting!" << std::cerr;
X 		quit(-1);
X 	}
X 	mailfile->seekg(0);
X@@ -629,7 +629,7 @@
X 	MIME_body::MIME_Ignore(GetStartVar("MIME_ignore"));
X 
X 	/* If we have succeeded in opening the mailfile, load mail */
X-	cout << "Loading messages: ( )" << flush;
X+	std::cout << "Loading messages: ( )" << std::flush;
X 	messages = new mailmsg(mailfile, LoadStatus);
X 	if ( ((current = messages->ByStatus("N")) == NULL) &&
X 	     ((current = messages->ByStatus("O")) == NULL) ) {
X@@ -637,7 +637,7 @@
X 		for ( current = messages; newmsg = current->Next(); )
X 			current = newmsg;
X 	}
X-	cout << " -- Done." <<  endl;
X+	std::cout << " -- Done." <<  std::cerr;
X 	sleep(1);
X 	mailfile->get_time(NULL, &last_mtime);
X 	mailfile->Size(&last_size);
END-of-files/patch-main.cpp
echo x - files/patch-listings.cpp
sed 's/^X//' >files/patch-listings.cpp << 'END-of-files/patch-listings.cpp'
X--- listing.cpp.orig	Fri Oct 25 14:00:55 2002
X+++ listing.cpp	Fri Oct 25 14:01:12 2002
X@@ -40,7 +40,7 @@
X }
X 
X void
X-Msg_Listing:: ReSize(int modified = 1)
X+Msg_Listing:: ReSize(int modified)
X {
X 	if ( modified ) {
X 		helppane->reset();
X@@ -1197,7 +1197,7 @@
X }
X 
X mailmsg *
X-Msg_Listing:: View(mailmsg *which, MIME_body *body = NULL)
X+Msg_Listing:: View(mailmsg *which, MIME_body *body)
X {
X 	mailmsg   *newmsg, *holder;
X 
END-of-files/patch-listings.cpp
echo x - files/patch-terminal.cpp
sed 's/^X//' >files/patch-terminal.cpp << 'END-of-files/patch-terminal.cpp'
X--- terminal.cpp.orig	Fri Oct 25 13:51:29 2002
X+++ terminal.cpp	Fri Oct 25 13:51:50 2002
X@@ -11,7 +11,7 @@
X int Terminal::wasraw = 0;
X int Terminal::maxwait = 0;
X 
X-Terminal:: Terminal(int makeraw = 1)
X+Terminal:: Terminal(int makeraw)
X {
X 	/* Initialize curses, if necessary */
X 	if ( refcount == 0 ) {
X@@ -133,7 +133,7 @@
X 
X /* Input routines */
X int
X-Terminal:: waitchar(WINDOW *the_win = NULL)
X+Terminal:: waitchar(WINDOW *the_win)
X {
X 	int ch, t;
X 
END-of-files/patch-terminal.cpp
echo x - files/patch-mailmsg.cpp
sed 's/^X//' >files/patch-mailmsg.cpp << 'END-of-files/patch-mailmsg.cpp'
X--- mailmsg.cpp.orig	Tue May 30 01:59:06 2000
X+++ mailmsg.cpp	Fri Oct 25 13:54:39 2002
X@@ -18,7 +18,7 @@
X mailmsg::boundary[] = { "From", NULL };
X 
X /* This is called by a program to create a new list of messages */
X-mailmsg:: mailmsg(IObottle *mailfile, void (*oncreate)(mailmsg *ptr) = NULL)
X+mailmsg:: mailmsg(IObottle *mailfile, void (*oncreate)(mailmsg *ptr))
X {
X 	struct mbox_data *MBox;
X 
X@@ -173,7 +173,7 @@
X 			/* Simple corruption check -- early end? */
X 			if ( strncmp(newdata, "From ",
X 					strlen("From ")) == 0 ) {
X-				cerr << "Warning: Corrupt mailfile?" << endl;
X+				std::cerr << "Warning: Corrupt mailfile?" << std::cerr;
X 				break;
X 			}
X 
X@@ -338,7 +338,7 @@
X 
X /* See/Set the status of the message */
X const char *
X-mailmsg:: Status(int in_listing = 0)
X+mailmsg:: Status(int in_listing)
X {
X 	/* Thread aware. :) */
X 	if ( in_listing && (mbox->showthreads == HIDE_THREADS) ) {
X@@ -664,8 +664,8 @@
X 
X 		/* Sanity check */
X 		if ( i != (strlen(newsubject)-RElen) ) {
X-			cerr << "Warning: RE stripping: possible corruption!"
X-								<< endl;
X+			std::cerr << "Warning: RE stripping: possible corruption!"
X+								<< std::cerr;
X 		}
X 
X 		/* Make it the new subject */
END-of-files/patch-mailmsg.cpp
echo x - files/patch-mime.cpp
sed 's/^X//' >files/patch-mime.cpp << 'END-of-files/patch-mime.cpp'
X--- mime.cpp.orig	Fri Oct 25 13:55:40 2002
X+++ mime.cpp	Fri Oct 25 13:56:15 2002
X@@ -102,7 +102,7 @@
X 
X /* The MIME_body class constructor */
X MIME_body:: MIME_body(IObottle *RawFile, char *endings[],
X-						MIME_body *lineage = NULL)
X+						MIME_body *lineage)
X {
X 	MD5_CTX md5_ctx;
X 	int i;
X@@ -652,7 +652,7 @@
X    length) to a new IO stream with SaveRaw(), or these changes will be lost.
X  */
X int
X-MIME_body:: AddPart(const char *file, int is_mime = 0)
X+MIME_body:: AddPart(const char *file, int is_mime)
X {
X 	MD5_CTX md5_ctx;
X 	int (*EncodeFile)(FILE *, IObottle *);
END-of-files/patch-mime.cpp
exit


>Release-Note:
>Audit-Trail:
>Unformatted:

To Unsubscribe: send mail to majordomo@FreeBSD.org
with "unsubscribe freebsd-ports" in the body of the message




Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?200210251220.g9PCKBbK089633>