Skip site navigation (1)Skip section navigation (2)
Date:      Wed, 12 Oct 2005 16:17:14 -0700 (PDT)
From:      ringworm01@gmail.com
To:        FreeBSD-gnats-submit@FreeBSD.org
Cc:        reaper@reaper.hn.org
Subject:   ports/87349: [NON-MAINTAINER] sysutils/portmanager update to 0.2.9_9
Message-ID:  <20051012231714.23FA5130C23@ringworm.mechee.com>
Resent-Message-ID: <200510122320.j9CNKGac075042@freefall.freebsd.org>

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

>Number:         87349
>Category:       ports
>Synopsis:       [NON-MAINTAINER] sysutils/portmanager update to 0.2.9_9
>Confidential:   no
>Severity:       non-critical
>Priority:       low
>Responsible:    freebsd-ports-bugs
>State:          open
>Quarter:        
>Keywords:       
>Date-Required:
>Class:          update
>Submitter-Id:   current-users
>Arrival-Date:   Wed Oct 12 23:20:16 GMT 2005
>Closed-Date:
>Last-Modified:
>Originator:     Michael C. Shultz
>Release:        FreeBSD 5.4-STABLE i386
>Organization:
>Environment:
System: FreeBSD ringworm.mechee.com 5.4-STABLE FreeBSD 5.4-STABLE #0: Wed Oct 5 10:40:33 PDT 2005 root@ringworm.mechee.com:/usr5/obj/usr5/src/sys/RINGWORM5 i386


>Description:

	portmanager seg-faults when run from cron

>How-To-Repeat:

	run portmanager from cron

>Fix:

	test environment variable before using them.

	also this patch includes a few spelling/man page corrections.

--- portmanager-0.2.9_9.diff begins here ---
diff -ruN portmanager/Makefile portmanager-0.2.9_9/Makefile
--- portmanager/Makefile	Tue Sep 20 09:23:48 2005
+++ portmanager-0.2.9_9/Makefile	Wed Oct 12 16:06:58 2005
@@ -7,7 +7,7 @@
 
 PORTNAME=	portmanager
 PORTVERSION=	0.2.9
-PORTREVISION=	8
+PORTREVISION=	9
 #-----------------------------------------
 #for local use, remove before submitting PR
 CATEGORIES=		sysutils
diff -ruN portmanager/files/patch-0.2.9_9 portmanager-0.2.9_9/files/patch-0.2.9_9
--- portmanager/files/patch-0.2.9_9	Wed Dec 31 16:00:00 1969
+++ portmanager-0.2.9_9/files/patch-0.2.9_9	Wed Oct 12 16:06:24 2005
@@ -0,0 +1,769 @@
+diff -ruN ./libPMGR/src/PMGRrInitialize.c ../0.2.9_9/libPMGR/src/PMGRrInitialize.c
+--- ./libPMGR/src/PMGRrInitialize.c	Sun Sep 18 17:08:18 2005
++++ ../0.2.9_9/libPMGR/src/PMGRrInitialize.c	Wed Oct 12 15:44:43 2005
+@@ -36,6 +36,298 @@
+ 
+ #include	<libPMGR.h>
+ 
++#define OFF			-2
++#define HELP			0
++#define VER 			2
++#define PMSTATUS		3
++#define PMUPGRADE		4
++#define	SHOWLEAVES		5
++#define	SHOWLEAVESDELETE	6
++
++int	rPkgAdd( char* port );
++
++
++int	portmanager( int argc, char** argv )
++{
++	FILE*	handle		= NULL;
++	char	id[]		= "portmanager";
++	char	ignorePortDir[80];
++	char	s[]		= "-s";
++	char	showLeaves[]	= "--show-leaves";
++	char	sl[]		= "-sl";
++	char	slidDelete[]	= "--show-leaves-interactive-delete";
++	char	slid[]		= "-slid";
++	char	status[]	= "--status";
++	char	u[]		= "-u";
++	char	upgrade[]	= "--upgrade";
++	char	ui[]		= "-ui";
++	char	upgradeInteractive[] = "--upgrade-interactive";
++	char	v[]		= "-v";
++	char	version[]	= "--version";
++	char*	buffer		= NULL;
++	char*	command		= NULL;
++	char*	xtermTitle	= NULL;
++	int	bufferSize	= 0;
++	int	errorCode	= 0;
++	int	idx		= 0;	
++	int	selection	= 0;
++	int	stringSize	= 0;
++	structProperty	property;
++	char*	bufferIdx	= NULL;
++
++	/*
++	 * Insure only one instance of portmanager is running as there is no locking of
++	 * data bases yet implemented.
++	 *
++	 * In debug mode gdb causes extra pids to be reported by ps so instance checking
++	 * has to be disabled.
++	 *
++	 */
++#ifndef	DEBUG
++		stringSize	= strlen( "ps au | grep 'portmanager'" ) + 1;
++
++		command		= (char*)malloc( stringSize );
++		command[0]	= 0;
++		strcpy( command, "ps au | grep 'portmanager'" );
++		buffer		= (char*)malloc( 16000 );
++		handle		= popen( command, "r" );
++		free( command );
++
++		fread( buffer, 16000, 1, handle );
++		pclose( handle );
++
++		bufferIdx	= strstr( buffer, "portmanager" );
++		if( bufferIdx )
++		{
++			bufferIdx++;
++			bufferIdx	= strstr( bufferIdx, "portmanager" );
++			if( bufferIdx )
++			{
++				bufferIdx++;
++				bufferIdx	= strstr( bufferIdx, "portmanager" );
++				if( bufferIdx )
++				{
++					bufferIdx++;
++					bufferIdx	= strstr( bufferIdx, "portmanager" );
++					if( bufferIdx )
++					{
++						fprintf( stderr, "there is already one instance of portmanager running:\n%s\n",
++							buffer );
++						exit(0);
++					}
++				}
++			}
++		}
++		free( buffer );	
++#else
++		fprintf( stdout, "%s\n", DOUBLE_LINES );
++		fprintf( stdout, "%s %s is running in DEBUG mode ", id, VERSION );
++		fprintf( stdout, "multiple instances of\n" );
++		fprintf( stdout, "portmanager is now possible, " );
++		fprintf( stdout, "a second instance will damage data bases so\n" );
++		fprintf( stdout, "use caution\n" );
++		fprintf( stdout, "%s\n", DOUBLE_LINES );
++		while( fflush( stdout ) );
++#endif
++
++	/*
++	 * set xterm title
++	 */
++	if( getenv("TERM") )
++	{
++		if( !strncmp( getenv("TERM"), "xterm", 5 ) && isatty(fileno(stdout)) )
++		{
++			stringSize	= strlen( id )
++					+ 1
++					+ strlen( VERSION )
++					+ 1;
++			xtermTitle	= malloc( stringSize );
++			xtermTitle[0]	= 0;
++			strcat( xtermTitle, id );
++			strcat( xtermTitle, " " );
++			strcat( xtermTitle, VERSION );
++			printf( "%c]0;%s%c", '\033', xtermTitle, '\007' );
++			free( xtermTitle );
++		}
++	}
++	/*
++	 * set initial values
++	 */
++	bufferIdx	= 0;	/* to stop bufferIdx not used warning */
++	PMGRrInitialize( &property, argc, (char**)argv );
++
++	/*
++	 * help menu
++	 */
++	if( argc > 1 && ( !strcmp( argv[1], "-h" ) || !strcmp( argv[1],
++		"--help" ) ) )
++	{
++		bufferSize	= MGrFileSize( property.helpFile ) + 1;
++		buffer		= (char*)malloc( bufferSize );
++		handle		= fopen( property.helpFile, "r" );
++		if( !handle )
++		{
++			fprintf( stderr, "error:  help file is missing!\n" );
++			exit( 1 );
++		}
++		fread( buffer, bufferSize, 1, handle );
++		fprintf( stdout, buffer );
++		free( buffer );
++		fclose( handle );
++		exit( 0 );
++	}
++
++	property.ignoreDb	= MGdbCreate( property.ignoreDbFileName, property.fieldIgnorePortDir, property.fieldIgnoreReason, NULL ); 
++	property.strikesDb	= MGdbCreate( property.strikesDbFileName, property.field3strikesPortDir, property.fieldStrikes,	NULL );
++
++	/*
++	 * convert pm-020.conf to config.db
++	 */
++	PMGRrReadConfigure( &property );
++	property.configDb	= MGdbOpen( property.configDbFileName );
++	
++	idx	= 1;
++	while( idx < argc )
++	{
++		if( !strcmp(argv[idx], "-ip") )
++		{
++			idx++;
++			fprintf( stdout, "%s\n", SINGLE_LINES );
++			while( idx < argc && argv[idx][0] != '-' )
++			{
++				if( argv[idx][0] != '/' )
++				{
++					ignorePortDir[0]	= '/';
++					ignorePortDir[1]	= 0;
++					strcat( ignorePortDir, argv[idx] );
++				}
++				else
++				{
++					ignorePortDir[0]	= 0;
++					strcat( ignorePortDir, argv[idx] );
++				}
++				
++				fprintf( stdout, "%s %s info: adding %s to ignore.db  reason: command line option -ip\n",
++					id, VERSION, ignorePortDir );
++
++				MGdbAdd( property.ignoreDb, ignorePortDir, "command line option -ip", NULL );
++				idx++;
++			}
++			idx--;
++		}
++		idx++;
++	}
++	idx	= 0;
++
++	while( idx < argc )
++	{
++		if( !strcmp( argv[idx], showLeaves ) || !strcmp( argv[idx], sl ) )
++		{
++			selection	= SHOWLEAVES;
++			break;
++		}
++
++		if( !strcmp( argv[idx], slidDelete ) || !strcmp( argv[idx], slid ) )
++		{
++			selection	= SHOWLEAVESDELETE;
++			break;
++		}
++
++		if( !strcmp( argv[idx], status ) || !strcmp( argv[idx], s ) )
++		{
++			selection	= PMSTATUS;
++			break;
++		}
++
++		if( !strcmp( argv[idx], upgrade ) || !strcmp( argv[idx], u ) )
++		{
++			stringSize	= strlen( "rm -f " )
++					+ strlen( property.cacheDbFileName ) + 1;
++			command		= malloc( stringSize );
++			command[0]	= 0;
++			strcat( command, "rm -f " );
++			strcat( command, property.cacheDbFileName );
++			fprintf( stdout, "%s %s info: executing %s\n", id, VERSION, command );
++			while( fflush( stdout ) );
++			system( command );
++			free( command ); 
++
++			property.interactive = 0;
++
++			selection	= PMUPGRADE;
++			break;
++		}
++
++		if( !strcmp( argv[idx], upgradeInteractive ) || !strcmp( argv[idx], ui ) )
++		{
++			
++			stringSize	= strlen( "rm -f " )
++					+ strlen( property.cacheDbFileName ) + 1;
++			command		= malloc( stringSize );
++			command[0]	= 0;
++			strcat( command, "rm -f " );
++			strcat( command, property.cacheDbFileName );
++			fprintf( stdout, "%s %s info: executing %s\n", id, VERSION, command );
++			while( fflush( stdout ) );
++			system( command );
++			free( command ); 
++
++			property.interactive = 1;
++
++			selection	= PMUPGRADE;
++			break;
++		}
++
++		if( !strcmp( argv[idx], version ) || !strcmp( argv[idx], v ) )
++		{
++			selection	= VER;
++			break;
++		}
++		idx++;
++	}
++
++	switch( selection )
++	{
++		case	VER:
++		{
++			fprintf( stdout, "\n%s %s VERSION info:\n", id, VERSION );
++			break;
++		}
++		case	PMSTATUS:
++		{
++			errorCode	= PMGRrStatus(&property);
++			if(errorCode)
++			{
++				fprintf(stderr, "%s %s error: %s returned errorCode %d\n", id, VERSION, "PMGRrStatus", errorCode);
++			}
++			break;
++		}
++		case	PMUPGRADE:
++		{
++			errorCode	= PMGRrUpgrade(&property);
++			if(errorCode)
++			{
++				fprintf(stderr, "%s %s error: %s returned errorCode %d\n", id, VERSION, "PMGRrUpGrade", errorCode);
++			}
++			break;
++		}
++		case	SHOWLEAVES:
++		{
++			PMGRrShowLeaves(&property);
++			break;
++		}
++		case	SHOWLEAVESDELETE:
++		{
++			PMGRrShowLeavesDelete(&property);
++			break;
++		}
++		default:
++			break;
++	}
++	exit(0);
++}
++
++
+ int	PMGRrInitialize( structProperty* property, int argc, char** argv )
+ {
+ 	char	id[]		= "PMGRrInitialize";
+diff -ruN ./libPMGR/src/PMGRrStatus.c ../0.2.9_9/libPMGR/src/PMGRrStatus.c
+--- ./libPMGR/src/PMGRrStatus.c	Sun Sep 18 17:20:06 2005
++++ ../0.2.9_9/libPMGR/src/PMGRrStatus.c	Tue Sep 20 02:32:22 2005
+@@ -51,7 +51,7 @@
+ 	
+ 	/*.............................................................*/
+ 	fprintf( stdout,"%s\n", SINGLE_LINES );
+-	fprintf( stdout,"%s %s info: Creating inital data bases\n", id, VERSION );
++	fprintf( stdout,"%s %s info: Creating initial data bases\n", id, VERSION );
+ 	fprintf( stdout,"%s\n", SINGLE_LINES );
+ 	while( fflush( stdout ) );
+ 
+diff -ruN ./libPMGR/src/PMGRrUpgrade.c ../0.2.9_9/libPMGR/src/PMGRrUpgrade.c
+--- ./libPMGR/src/PMGRrUpgrade.c	Sun Sep 18 17:23:05 2005
++++ ../0.2.9_9/libPMGR/src/PMGRrUpgrade.c	Wed Oct 12 15:26:08 2005
+@@ -86,58 +86,60 @@
+ 		fprintf( stdout, "percentDone-=>%d = 100 - ( 100 * ( QTY_outOfDatePortsDb-=>%d / TOTAL_outOfDatePortsDb-=>%d ) ) \n",
+ 	(int)percentDone, QTY_outOfDatePortsDb-1, TOTAL_outOfDatePortsDb );
+ 		while( fflush( stdout ) );
+-/*
+-pr 81481
+-To fix the modification of xterm title, even when redirecting, one can
+-test isatty(fileno(stdout)) before printing the escape sequence.
+-*/
+-		if( !strncmp( getenv("TERM"), "xterm", 5 ) && isatty(fileno(stdout)) )
++		if( getenv("TERM") ) /* test for empty in case being run from cron */
+ 		{
+-			stringSize	= strlen( id )
+-					+ strlen( " done:%" )
+-					+ 5;
+-					
+-			xtermTitle	= malloc( stringSize );
+-			xtermTitle[0]	= 0;
+-			strcat( xtermTitle, id );
+-			strcat( xtermTitle, " " );
+-			strcat( xtermTitle, " done:%" );
+-			strcat( xtermTitle, MGrIntToString( (long)percentDone ) );
+-			printf( "%c]0;%s%c", '\033', xtermTitle, '\007' );
+-			free( xtermTitle );
+-		}
+-		
+-		if( QTY_outOfDatePortsDb < 2 )
+-		{
+-
+ 			/*
+-			 *  Set xterm title bar indicator
+-			 */
+-
+-/*
+-pr 81481
+-To fix the modification of xterm title, even when redirecting, one can
+-test isatty(fileno(stdout)) before printing the escape sequence.
+-*/
++			pr 81481
++			To fix the modification of xterm title, even when redirecting, one can
++			test isatty(fileno(stdout)) before printing the escape sequence.
++			*/
+ 			if( !strncmp( getenv("TERM"), "xterm", 5 ) && isatty(fileno(stdout)) )
+ 			{
+-				stringSize	= strlen( id )
+-						+ strlen( " finished" )
+-						+ 5;
+-				xtermTitle	= malloc( stringSize );
+-				xtermTitle[0]	= 0;
+-				strcat( xtermTitle, id );
+-				strcat( xtermTitle, " " );
+-				strcat( xtermTitle, " finished" );
+-				printf( "%c]0;%s%c", '\033', xtermTitle, '\007' );
+-				free( xtermTitle );
++			  stringSize	= strlen( id )
++					  + strlen( " done:%" )
++					  + 5;
++
++			  xtermTitle	= malloc( stringSize );
++			  xtermTitle[0]	= 0;
++			  strcat( xtermTitle, id );
++			  strcat( xtermTitle, " " );
++			  strcat( xtermTitle, " done:%" );
++			  strcat( xtermTitle, MGrIntToString( (long)percentDone ) );
++			  printf( "%c]0;%s%c", '\033', xtermTitle, '\007' );
++			  free( xtermTitle );
+ 			}
+ 
+-			fprintf( stdout, "%s %s INFO: all ports are up to date\n", id, VERSION );
+-			while( fflush( stdout ) );
+-			return(0);
+-		}
++			if( QTY_outOfDatePortsDb < 2 )
++			{
++
++			  /*
++			   *  Set xterm title bar indicator
++			   */
++
++			/*
++			pr 81481
++			To fix the modification of xterm title, even when redirecting, one can
++			test isatty(fileno(stdout)) before printing the escape sequence.
++			*/
++			  if( !strncmp( getenv("TERM"), "xterm", 5 ) && isatty(fileno(stdout)) )
++			  {
++				  stringSize	= strlen( id )
++						  + strlen( " finished" )
++						  + 5;
++				  xtermTitle	= malloc( stringSize );
++				  xtermTitle[0]	= 0;
++				  strcat( xtermTitle, id );
++				  strcat( xtermTitle, " " );
++				  strcat( xtermTitle, " finished" );
++				  printf( "%c]0;%s%c", '\033', xtermTitle, '\007' );
++				  free( xtermTitle );
++			  }
+ 
++			  fprintf( stdout, "%s %s INFO: all ports are up to date\n", id, VERSION );
++			  while( fflush( stdout ) );
++			  return(0);
++			}
++		}
+ 		errorCode	= upgrade( property );
+ 
+ 		if(errorCode)
+diff -ruN ./portmanager/portmanager.1 ../0.2.9_9/portmanager/portmanager.1
+--- ./portmanager/portmanager.1	Sun Sep 18 17:08:18 2005
++++ ../0.2.9_9/portmanager/portmanager.1	Sun Sep 18 21:24:48 2005
+@@ -245,13 +245,29 @@
+  \&.endif
+  #
+  \&.if ${\&.CURDIR:M*/multimedia/mplayer}
+- WITH_OPTIMIZED_CFLAGS=yes WITHOUT_RUNTIME_CPUDETECTION=yes	\\
+- WITH_GTK1=yes WITH_RTC=yes WITH_LIBUNGIF=yes WITH_ARTS=yes	\\
+- WITH_FRIBIDI=yes WITH_CDPARANOIA=yes WITH_LIBDV=yes		\\
+- WITH_MAD=yes WITH_SVGALIB=yes WITH_AALIB=yes WITH_THEORA=yes	\\
+- WITH_SDL=yes WITH_ESOUND=yes WITH_VORBIS=yes WITH_XANIM=yes	\\
+- WITH_LIVEMEDIA=yes WITH_MATROSKA=yes WITH_XVID=yes WITH_LZO=yes	\\
+- WITH_XMMS=yes WITH_LANG=en
++ WITH_OPTIMIZED_CFLAGS=yes
++ WITHOUT_RUNTIME_CPUDETECTION=yes
++ WITH_GTK1=yes
++ WITH_RTC=yes
++ WITH_LIBUNGIF=yes
++ WITH_ARTS=yes
++ WITH_FRIBIDI=yes
++ WITH_CDPARANOIA=yes
++ WITH_LIBDV=yes
++ WITH_MAD=yes
++ WITH_SVGALIB=yes
++ WITH_AALIB=yes
++ WITH_THEORA=yes
++ WITH_SDL=yes
++ WITH_ESOUND=yes
++ WITH_VORBIS=yes
++ WITH_XANIM=yes
++ WITH_LIVEMEDIA=yes
++ WITH_MATROSKA=yes
++ WITH_XVID=yes
++ WITH_LZO=yes
++ WITH_XMMS=yes
++ WITH_LANG=en
+  .endif
+ .\"=======================================================================
+ .Sh BUGS
+diff -ruN ./portmanager/portmanager.c ../0.2.9_9/portmanager/portmanager.c
+--- ./portmanager/portmanager.c	Sun Sep 18 17:25:45 2005
++++ ../0.2.9_9/portmanager/portmanager.c	Wed Oct 12 14:55:52 2005
+@@ -28,15 +28,6 @@
+ */
+ #include	<libPMGR.h>
+ 
+-#define OFF			-2
+-#define HELP			0
+-#define VER 			2
+-#define PMSTATUS		3
+-#define PMUPGRADE		4
+-#define	SHOWLEAVES		5
+-#define	SHOWLEAVESDELETE	6
+-
+-int	rPkgAdd( char* port );
+ int	portmanager( int argc, char** argv );
+ 
+ /*
+@@ -44,284 +35,8 @@
+  */
+ int	main( int argc, char** argv )
+ {
+-	portmanager( argc, (char**)argv );
++	/* located in PMGRrInitialize.c */
++	portmanager( argc, (char**)argv ); 
+ 	exit(0);
+ }
+ 
+-int	portmanager( int argc, char** argv )
+-{
+-	FILE*	handle		= NULL;
+-	char	id[]		= "portmanager";
+-	char	ignorePortDir[80];
+-	char	s[]		= "-s";
+-	char	showLeaves[]	= "--show-leaves";
+-	char	sl[]		= "-sl";
+-	char	slidDelete[]	= "--show-leaves-interactive-delete";
+-	char	slid[]		= "-slid";
+-	char	status[]	= "--status";
+-	char	u[]		= "-u";
+-	char	upgrade[]	= "--upgrade";
+-	char	ui[]		= "-ui";
+-	char	upgradeInteractive[] = "--upgrade-interactive";
+-	char	v[]		= "-v";
+-	char	version[]	= "--version";
+-	char*	buffer		= NULL;
+-	char*	command		= NULL;
+-	char*	xtermTitle	= NULL;
+-	int	bufferSize	= 0;
+-	int	errorCode	= 0;
+-	int	idx		= 0;	
+-	int	selection	= 0;
+-	int	stringSize	= 0;
+-	structProperty	property;
+-	char*	bufferIdx	= NULL;
+-
+-	/*
+-	 * Insure only one instance of portmanager is running as there is no locking of
+-	 * data bases yet implemented.
+-	 *
+-	 * In debug mode gdb causes extra pids to be reported by ps so instance checking
+-	 * has to be disabled.
+-	 *
+-	 */
+-#ifndef	DEBUG
+-		stringSize	= strlen( "ps au | grep 'portmanager'" ) + 1;
+-
+-		command		= (char*)malloc( stringSize );
+-		command[0]	= 0;
+-		strcpy( command, "ps au | grep 'portmanager'" );
+-		buffer		= (char*)malloc( 16000 );
+-		handle		= popen( command, "r" );
+-		free( command );
+-
+-		fread( buffer, 16000, 1, handle );
+-		pclose( handle );
+-
+-		bufferIdx	= strstr( buffer, "portmanager" );
+-		if( bufferIdx )
+-		{
+-			bufferIdx++;
+-			bufferIdx	= strstr( bufferIdx, "portmanager" );
+-			if( bufferIdx )
+-			{
+-				bufferIdx++;
+-				bufferIdx	= strstr( bufferIdx, "portmanager" );
+-				if( bufferIdx )
+-				{
+-					bufferIdx++;
+-					bufferIdx	= strstr( bufferIdx, "portmanager" );
+-					if( bufferIdx )
+-					{
+-						fprintf( stderr, "there is already one instance of portmanager running:\n%s\n",
+-							buffer );
+-						exit(0);
+-					}
+-				}
+-			}
+-		}
+-		free( buffer );	
+-#else
+-		fprintf( stdout, "%s\n", DOUBLE_LINES );
+-		fprintf( stdout, "%s %s is running in DEBUG mode ", id, VERSION );
+-		fprintf( stdout, "multiple instances of\n" );
+-		fprintf( stdout, "portmanager is now possible, " );
+-		fprintf( stdout, "a second instance will damage data bases so\n" );
+-		fprintf( stdout, "use caution\n" );
+-		fprintf( stdout, "%s\n", DOUBLE_LINES );
+-		while( fflush( stdout ) );
+-#endif
+-
+-	/*
+-	 * set xterm title
+-	 */
+-	if( !strncmp( getenv("TERM"), "xterm", 5 ) && isatty(fileno(stdout)) )
+-	{
+-		stringSize	= strlen( id )
+-				+ 1
+-				+ strlen( VERSION )
+-				+ 1;
+-		xtermTitle	= malloc( stringSize );
+-		xtermTitle[0]	= 0;
+-		strcat( xtermTitle, id );
+-		strcat( xtermTitle, " " );
+-		strcat( xtermTitle, VERSION );
+-		printf( "%c]0;%s%c", '\033', xtermTitle, '\007' );
+-		free( xtermTitle );
+-	}
+-
+-	/*
+-	 * set initial values
+-	 */
+-	bufferIdx	= 0;	/* to stop bufferIdx not used warning */
+-	PMGRrInitialize( &property, argc, (char**)argv );
+-
+-	/*
+-	 * help menu
+-	 */
+-	if( argc > 1 && ( !strcmp( argv[1], "-h" ) || !strcmp( argv[1],
+-		"--help" ) ) )
+-	{
+-		bufferSize	= MGrFileSize( property.helpFile ) + 1;
+-		buffer		= (char*)malloc( bufferSize );
+-		handle		= fopen( property.helpFile, "r" );
+-		if( !handle )
+-		{
+-			fprintf( stderr, "error:  help file is missing!\n" );
+-			exit( 1 );
+-		}
+-		fread( buffer, bufferSize, 1, handle );
+-		fprintf( stdout, buffer );
+-		free( buffer );
+-		fclose( handle );
+-		exit( 0 );
+-	}
+-
+-	property.ignoreDb	= MGdbCreate( property.ignoreDbFileName, property.fieldIgnorePortDir, property.fieldIgnoreReason, NULL ); 
+-	property.strikesDb	= MGdbCreate( property.strikesDbFileName, property.field3strikesPortDir, property.fieldStrikes,	NULL );
+-
+-	/*
+-	 * convert pm-020.conf to config.db
+-	 */
+-	PMGRrReadConfigure( &property );
+-	property.configDb	= MGdbOpen( property.configDbFileName );
+-	
+-	idx	= 1;
+-	while( idx < argc )
+-	{
+-		if( !strcmp(argv[idx], "-ip") )
+-		{
+-			idx++;
+-			fprintf( stdout, "%s\n", SINGLE_LINES );
+-			while( idx < argc && argv[idx][0] != '-' )
+-			{
+-				if( argv[idx][0] != '/' )
+-				{
+-					ignorePortDir[0]	= '/';
+-					ignorePortDir[1]	= 0;
+-					strcat( ignorePortDir, argv[idx] );
+-				}
+-				else
+-				{
+-					ignorePortDir[0]	= 0;
+-					strcat( ignorePortDir, argv[idx] );
+-				}
+-				
+-				fprintf( stdout, "%s %s info: adding %s to ignore.db  reason: command line option -ip\n",
+-					id, VERSION, ignorePortDir );
+-
+-				MGdbAdd( property.ignoreDb, ignorePortDir, "command line option -ip", NULL );
+-				idx++;
+-			}
+-			idx--;
+-		}
+-		idx++;
+-	}
+-	idx	= 0;
+-
+-	while( idx < argc )
+-	{
+-		if( !strcmp( argv[idx], showLeaves ) || !strcmp( argv[idx], sl ) )
+-		{
+-			selection	= SHOWLEAVES;
+-			break;
+-		}
+-
+-		if( !strcmp( argv[idx], slidDelete ) || !strcmp( argv[idx], slid ) )
+-		{
+-			selection	= SHOWLEAVESDELETE;
+-			break;
+-		}
+-
+-		if( !strcmp( argv[idx], status ) || !strcmp( argv[idx], s ) )
+-		{
+-			selection	= PMSTATUS;
+-			break;
+-		}
+-
+-		if( !strcmp( argv[idx], upgrade ) || !strcmp( argv[idx], u ) )
+-		{
+-			stringSize	= strlen( "rm -f " )
+-					+ strlen( property.cacheDbFileName ) + 1;
+-			command		= malloc( stringSize );
+-			command[0]	= 0;
+-			strcat( command, "rm -f " );
+-			strcat( command, property.cacheDbFileName );
+-			fprintf( stdout, "%s %s info: executing %s\n", id, VERSION, command );
+-			while( fflush( stdout ) );
+-			system( command );
+-			free( command ); 
+-
+-			property.interactive = 0;
+-
+-			selection	= PMUPGRADE;
+-			break;
+-		}
+-
+-		if( !strcmp( argv[idx], upgradeInteractive ) || !strcmp( argv[idx], ui ) )
+-		{
+-			
+-			stringSize	= strlen( "rm -f " )
+-					+ strlen( property.cacheDbFileName ) + 1;
+-			command		= malloc( stringSize );
+-			command[0]	= 0;
+-			strcat( command, "rm -f " );
+-			strcat( command, property.cacheDbFileName );
+-			fprintf( stdout, "%s %s info: executing %s\n", id, VERSION, command );
+-			while( fflush( stdout ) );
+-			system( command );
+-			free( command ); 
+-
+-			property.interactive = 1;
+-
+-			selection	= PMUPGRADE;
+-			break;
+-		}
+-
+-		if( !strcmp( argv[idx], version ) || !strcmp( argv[idx], v ) )
+-		{
+-			selection	= VER;
+-			break;
+-		}
+-		idx++;
+-	}
+-
+-	switch( selection )
+-	{
+-		case	VER:
+-		{
+-			fprintf( stdout, "\n%s %s VERSION info:\n", id, VERSION );
+-			break;
+-		}
+-		case	PMSTATUS:
+-		{
+-			errorCode	= PMGRrStatus(&property);
+-			if(errorCode)
+-			{
+-				fprintf(stderr, "%s %s error: %s returned errorCode %d\n", id, VERSION, "PMGRrStatus", errorCode);
+-			}
+-			break;
+-		}
+-		case	PMUPGRADE:
+-		{
+-			errorCode	= PMGRrUpgrade(&property);
+-			if(errorCode)
+-			{
+-				fprintf(stderr, "%s %s error: %s returned errorCode %d\n", id, VERSION, "PMGRrUpGrade", errorCode);
+-			}
+-			break;
+-		}
+-		case	SHOWLEAVES:
+-		{
+-			PMGRrShowLeaves(&property);
+-			break;
+-		}
+-		case	SHOWLEAVESDELETE:
+-		{
+-			PMGRrShowLeavesDelete(&property);
+-			break;
+-		}
+-		default:
+-			break;
+-	}
+-	exit(0);
+-}
--- portmanager-0.2.9_9.diff ends here ---


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



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