WARNSify
This commit is contained in:
parent
1bb761e96f
commit
795e0608f6
@ -1,7 +1,6 @@
|
||||
# $NetBSD: Makefile,v 1.19 1997/10/24 09:00:31 lukem Exp $
|
||||
# $NetBSD: Makefile,v 1.20 1998/02/22 12:55:44 christos Exp $
|
||||
# @(#)Makefile 8.1 (Berkeley) 6/29/93
|
||||
|
||||
WARNS= 0
|
||||
PROG= gprof
|
||||
SRCS= gprof.c arcs.c dfn.c lookup.c ${MACHINE_ARCH}.c hertz.c \
|
||||
printgprof.c printlist.c
|
||||
|
@ -1,7 +1,8 @@
|
||||
/* $NetBSD: alpha.c,v 1.1 1995/04/19 07:24:19 cgd Exp $ */
|
||||
/* $NetBSD: alpha.c,v 1.2 1998/02/22 12:55:44 christos Exp $ */
|
||||
|
||||
#include <sys/cdefs.h>
|
||||
#ifndef lint
|
||||
static char rcsid[] = "$NetBSD: alpha.c,v 1.1 1995/04/19 07:24:19 cgd Exp $";
|
||||
__RCSID("$NetBSD: alpha.c,v 1.2 1998/02/22 12:55:44 christos Exp $");
|
||||
#endif /* not lint */
|
||||
|
||||
#include "gprof.h"
|
||||
@ -9,6 +10,7 @@ static char rcsid[] = "$NetBSD: alpha.c,v 1.1 1995/04/19 07:24:19 cgd Exp $";
|
||||
/*
|
||||
* gprof -c isn't currently supported...
|
||||
*/
|
||||
void
|
||||
findcall( parentp , p_lowpc , p_highpc )
|
||||
nltype *parentp;
|
||||
unsigned long p_lowpc;
|
||||
|
@ -1,4 +1,4 @@
|
||||
/* $NetBSD: arcs.c,v 1.6 1995/04/19 07:15:52 cgd Exp $ */
|
||||
/* $NetBSD: arcs.c,v 1.7 1998/02/22 12:55:44 christos Exp $ */
|
||||
|
||||
/*
|
||||
* Copyright (c) 1983, 1993
|
||||
@ -33,11 +33,12 @@
|
||||
* SUCH DAMAGE.
|
||||
*/
|
||||
|
||||
#include <sys/cdefs.h>
|
||||
#ifndef lint
|
||||
#if 0
|
||||
static char sccsid[] = "@(#)arcs.c 8.1 (Berkeley) 6/6/93";
|
||||
#else
|
||||
static char rcsid[] = "$NetBSD: arcs.c,v 1.6 1995/04/19 07:15:52 cgd Exp $";
|
||||
__RCSID("$NetBSD: arcs.c,v 1.7 1998/02/22 12:55:44 christos Exp $");
|
||||
#endif
|
||||
#endif /* not lint */
|
||||
|
||||
@ -48,11 +49,12 @@ int visited;
|
||||
int viable;
|
||||
int newcycle;
|
||||
int oldcycle;
|
||||
#endif DEBUG
|
||||
#endif /* DEBUG */
|
||||
|
||||
/*
|
||||
* add (or just increment) an arc
|
||||
*/
|
||||
void
|
||||
addarc( parentp , childp , count )
|
||||
nltype *parentp;
|
||||
nltype *childp;
|
||||
@ -60,23 +62,23 @@ addarc( parentp , childp , count )
|
||||
{
|
||||
arctype *arcp;
|
||||
|
||||
# ifdef DEBUG
|
||||
#ifdef DEBUG
|
||||
if ( debug & TALLYDEBUG ) {
|
||||
printf( "[addarc] %d arcs from %s to %s\n" ,
|
||||
count , parentp -> name , childp -> name );
|
||||
}
|
||||
# endif DEBUG
|
||||
#endif /* DEBUG */
|
||||
arcp = arclookup( parentp , childp );
|
||||
if ( arcp != 0 ) {
|
||||
/*
|
||||
* a hit: just increment the count.
|
||||
*/
|
||||
# ifdef DEBUG
|
||||
#ifdef DEBUG
|
||||
if ( debug & TALLYDEBUG ) {
|
||||
printf( "[tally] hit %d += %d\n" ,
|
||||
arcp -> arc_count , count );
|
||||
}
|
||||
# endif DEBUG
|
||||
#endif /* DEBUG */
|
||||
arcp -> arc_count += count;
|
||||
return;
|
||||
}
|
||||
@ -106,10 +108,12 @@ addarc( parentp , childp , count )
|
||||
*/
|
||||
nltype **topsortnlp;
|
||||
|
||||
topcmp( npp1 , npp2 )
|
||||
nltype **npp1;
|
||||
nltype **npp2;
|
||||
int
|
||||
topcmp( v1 , v2 )
|
||||
const void *v1, *v2;
|
||||
{
|
||||
const nltype *const *npp1 = v1;
|
||||
const nltype *const *npp2 = v2;
|
||||
return (*npp1) -> toporder - (*npp2) -> toporder;
|
||||
}
|
||||
|
||||
@ -172,11 +176,11 @@ doarcs()
|
||||
/*
|
||||
* analyze cycles to determine breakup
|
||||
*/
|
||||
# ifdef DEBUG
|
||||
#ifdef DEBUG
|
||||
if ( debug & BREAKCYCLE ) {
|
||||
printf("[doarcs] pass %d, cycle(s) %d\n" , pass , ncycle );
|
||||
}
|
||||
# endif DEBUG
|
||||
#endif /* DEBUG */
|
||||
if ( pass == 1 ) {
|
||||
printf( "\n\n%s %s\n%s %d:\n" ,
|
||||
"The following arcs were deleted" ,
|
||||
@ -210,7 +214,7 @@ doarcs()
|
||||
topsortnlp[ index ] = &nl[ index ];
|
||||
}
|
||||
qsort( topsortnlp , nname , sizeof(nltype *) , topcmp );
|
||||
# ifdef DEBUG
|
||||
#ifdef DEBUG
|
||||
if ( debug & DFNDEBUG ) {
|
||||
printf( "[doarcs] topological sort listing\n" );
|
||||
for ( index = 0 ; index < nname ; index += 1 ) {
|
||||
@ -220,7 +224,7 @@ doarcs()
|
||||
printf( "\n" );
|
||||
}
|
||||
}
|
||||
# endif DEBUG
|
||||
#endif /* DEBUG */
|
||||
/*
|
||||
* starting from the topological top,
|
||||
* propagate print flags to children.
|
||||
@ -256,6 +260,7 @@ doarcs()
|
||||
return( timesortnlp );
|
||||
}
|
||||
|
||||
void
|
||||
dotime()
|
||||
{
|
||||
int index;
|
||||
@ -266,6 +271,7 @@ dotime()
|
||||
}
|
||||
}
|
||||
|
||||
void
|
||||
timepropagate( parentp )
|
||||
nltype *parentp;
|
||||
{
|
||||
@ -339,7 +345,7 @@ timepropagate( parentp )
|
||||
parentp -> cyclehead -> childtime += share;
|
||||
parentp -> cyclehead -> propchild += propshare;
|
||||
}
|
||||
# ifdef DEBUG
|
||||
#ifdef DEBUG
|
||||
if ( debug & PROPDEBUG ) {
|
||||
printf( "[dotime] child \t" );
|
||||
printname( childp );
|
||||
@ -350,10 +356,11 @@ timepropagate( parentp )
|
||||
printname( parentp );
|
||||
printf( "\n[dotime] share %f\n" , share );
|
||||
}
|
||||
# endif DEBUG
|
||||
#endif /* DEBUG */
|
||||
}
|
||||
}
|
||||
|
||||
void
|
||||
cyclelink()
|
||||
{
|
||||
register nltype *nlp;
|
||||
@ -412,13 +419,13 @@ cyclelink()
|
||||
cyclenlp -> cnext = nlp; /* pointer to next member of cycle */
|
||||
cyclenlp -> parents = 0; /* list of caller arcs */
|
||||
cyclenlp -> children = 0; /* list of callee arcs */
|
||||
# ifdef DEBUG
|
||||
#ifdef DEBUG
|
||||
if ( debug & CYCLEDEBUG ) {
|
||||
printf( "[cyclelink] " );
|
||||
printname( nlp );
|
||||
printf( " is the head of cycle %d\n" , cycle );
|
||||
}
|
||||
# endif DEBUG
|
||||
#endif /* DEBUG */
|
||||
/*
|
||||
* link members to cycle header
|
||||
*/
|
||||
@ -448,6 +455,7 @@ cyclelink()
|
||||
/*
|
||||
* analyze cycles to determine breakup
|
||||
*/
|
||||
bool
|
||||
cycleanalyze()
|
||||
{
|
||||
arctype **cyclestack;
|
||||
@ -486,14 +494,14 @@ cycleanalyze()
|
||||
if ( cyclestack == 0 ) {
|
||||
fprintf( stderr , "%s: No room for %d bytes of cycle stack\n" ,
|
||||
whoami , ( size + 1 ) * sizeof( arctype * ) );
|
||||
return;
|
||||
return done;
|
||||
}
|
||||
# ifdef DEBUG
|
||||
#ifdef DEBUG
|
||||
if ( debug & BREAKCYCLE ) {
|
||||
printf( "[cycleanalyze] starting cycle %d of %d, size %d\n" ,
|
||||
cycleno , ncycle , size );
|
||||
}
|
||||
# endif DEBUG
|
||||
#endif /* DEBUG */
|
||||
for ( nlp = cyclenl[ cycleno ] . cnext ; nlp ; nlp = nlp -> cnext ) {
|
||||
stkp = &cyclestack[0];
|
||||
nlp -> flags |= CYCLEHEAD;
|
||||
@ -516,15 +524,16 @@ cycleanalyze()
|
||||
cyclehead = 0;
|
||||
}
|
||||
}
|
||||
# ifdef DEBUG
|
||||
#ifdef DEBUG
|
||||
if ( debug & BREAKCYCLE ) {
|
||||
printf("%s visited %d, viable %d, newcycle %d, oldcycle %d\n",
|
||||
"[doarcs]" , visited , viable , newcycle , oldcycle);
|
||||
}
|
||||
# endif DEBUG
|
||||
#endif /* DEBUG */
|
||||
return( done );
|
||||
}
|
||||
|
||||
bool
|
||||
descend( node , stkstart , stkp )
|
||||
nltype *node;
|
||||
arctype **stkstart;
|
||||
@ -534,16 +543,16 @@ descend( node , stkstart , stkp )
|
||||
bool ret;
|
||||
|
||||
for ( arcp = node -> children ; arcp ; arcp = arcp -> arc_childlist ) {
|
||||
# ifdef DEBUG
|
||||
#ifdef DEBUG
|
||||
visited++;
|
||||
# endif DEBUG
|
||||
#endif /* DEBUG */
|
||||
if ( arcp -> arc_childp -> cycleno != node -> cycleno
|
||||
|| ( arcp -> arc_childp -> flags & VISITED )
|
||||
|| ( arcp -> arc_flags & DEADARC ) )
|
||||
continue;
|
||||
# ifdef DEBUG
|
||||
#ifdef DEBUG
|
||||
viable++;
|
||||
# endif DEBUG
|
||||
#endif /* DEBUG */
|
||||
*stkp = arcp;
|
||||
if ( arcp -> arc_childp -> flags & CYCLEHEAD ) {
|
||||
if ( addcycle( stkstart , stkp ) == FALSE )
|
||||
@ -556,14 +565,16 @@ descend( node , stkstart , stkp )
|
||||
if ( ret == FALSE )
|
||||
return( FALSE );
|
||||
}
|
||||
return TRUE;
|
||||
}
|
||||
|
||||
bool
|
||||
addcycle( stkstart , stkend )
|
||||
arctype **stkstart;
|
||||
arctype **stkend;
|
||||
{
|
||||
arctype **arcpp;
|
||||
arctype **stkloc;
|
||||
arctype **stkloc = NULL;
|
||||
arctype **stkp;
|
||||
arctype **endlist;
|
||||
arctype *minarc;
|
||||
@ -592,9 +603,9 @@ addcycle( stkstart , stkend )
|
||||
stkp = stkstart;
|
||||
}
|
||||
if ( arcpp == endlist ) {
|
||||
# ifdef DEBUG
|
||||
#ifdef DEBUG
|
||||
oldcycle++;
|
||||
# endif DEBUG
|
||||
#endif /* DEBUG */
|
||||
return( TRUE );
|
||||
}
|
||||
}
|
||||
@ -621,18 +632,19 @@ addcycle( stkstart , stkend )
|
||||
clp -> size = size;
|
||||
clp -> next = cyclehead;
|
||||
cyclehead = clp;
|
||||
# ifdef DEBUG
|
||||
#ifdef DEBUG
|
||||
newcycle++;
|
||||
if ( debug & SUBCYCLELIST ) {
|
||||
printsubcycle( clp );
|
||||
}
|
||||
# endif DEBUG
|
||||
#endif /* DEBUG */
|
||||
cyclecnt++;
|
||||
if ( cyclecnt >= CYCLEMAX )
|
||||
return( FALSE );
|
||||
return( TRUE );
|
||||
}
|
||||
|
||||
void
|
||||
compresslist()
|
||||
{
|
||||
cltype *clp;
|
||||
@ -641,13 +653,15 @@ compresslist()
|
||||
arctype **endlist;
|
||||
arctype *arcp;
|
||||
arctype *maxarcp;
|
||||
arctype *maxexitarcp;
|
||||
arctype *maxwithparentarcp;
|
||||
arctype *maxnoparentarcp;
|
||||
arctype *maxexitarcp = NULL;
|
||||
arctype *maxwithparentarcp = NULL;
|
||||
arctype *maxnoparentarcp = NULL;
|
||||
int maxexitcnt;
|
||||
int maxwithparentcnt;
|
||||
int maxnoparentcnt;
|
||||
#ifdef DEBUG
|
||||
char *type;
|
||||
# endif /* DEBUG */
|
||||
|
||||
maxexitcnt = 0;
|
||||
maxwithparentcnt = 0;
|
||||
@ -690,40 +704,40 @@ compresslist()
|
||||
* first choice is edge leading to node with out-of-cycle parent
|
||||
*/
|
||||
maxarcp = maxexitarcp;
|
||||
# ifdef DEBUG
|
||||
#ifdef DEBUG
|
||||
type = "exit";
|
||||
# endif DEBUG
|
||||
#endif /* DEBUG */
|
||||
} else if ( maxwithparentcnt > 0 ) {
|
||||
/*
|
||||
* second choice is edge leading to node with at least one
|
||||
* other in-cycle parent
|
||||
*/
|
||||
maxarcp = maxwithparentarcp;
|
||||
# ifdef DEBUG
|
||||
#ifdef DEBUG
|
||||
type = "internal";
|
||||
# endif DEBUG
|
||||
#endif /* DEBUG */
|
||||
} else {
|
||||
/*
|
||||
* last choice is edge leading to node with only this arc as
|
||||
* a parent (as it will now be orphaned)
|
||||
*/
|
||||
maxarcp = maxnoparentarcp;
|
||||
# ifdef DEBUG
|
||||
#ifdef DEBUG
|
||||
type = "orphan";
|
||||
# endif DEBUG
|
||||
#endif /* DEBUG */
|
||||
}
|
||||
maxarcp -> arc_flags |= DEADARC;
|
||||
maxarcp -> arc_childp -> parentcnt -= 1;
|
||||
maxarcp -> arc_childp -> npropcall -= maxarcp -> arc_count;
|
||||
# ifdef DEBUG
|
||||
#ifdef DEBUG
|
||||
if ( debug & BREAKCYCLE ) {
|
||||
printf( "%s delete %s arc: %s (%d) -> %s from %d cycle(s)\n" ,
|
||||
"[compresslist]" , type , maxarcp -> arc_parentp -> name ,
|
||||
maxarcp -> arc_count , maxarcp -> arc_childp -> name ,
|
||||
maxarcp -> arc_cyclecnt );
|
||||
}
|
||||
# endif DEBUG
|
||||
printf( "\t%s to %s with %d calls\n" , maxarcp -> arc_parentp -> name ,
|
||||
#endif /* DEBUG */
|
||||
printf( "\t%s to %s with %ld calls\n" , maxarcp -> arc_parentp -> name ,
|
||||
maxarcp -> arc_childp -> name , maxarcp -> arc_count );
|
||||
prev = &cyclehead;
|
||||
for ( clp = cyclehead ; clp ; ) {
|
||||
@ -746,6 +760,7 @@ compresslist()
|
||||
}
|
||||
|
||||
#ifdef DEBUG
|
||||
void
|
||||
printsubcycle( clp )
|
||||
cltype *clp;
|
||||
{
|
||||
@ -759,8 +774,9 @@ printsubcycle( clp )
|
||||
printf( "\t(%d) -> %s\n" , (*arcpp) -> arc_count ,
|
||||
(*arcpp) -> arc_childp -> name ) ;
|
||||
}
|
||||
#endif DEBUG
|
||||
#endif /* DEBUG */
|
||||
|
||||
void
|
||||
cycletime()
|
||||
{
|
||||
int cycle;
|
||||
@ -790,6 +806,7 @@ cycletime()
|
||||
* propfraction as the sum of fractional parents' propfractions
|
||||
* and while we're here, sum time for functions.
|
||||
*/
|
||||
void
|
||||
doflags()
|
||||
{
|
||||
int index;
|
||||
@ -810,14 +827,14 @@ doflags()
|
||||
oldhead = childp -> cyclehead;
|
||||
inheritflags( childp );
|
||||
}
|
||||
# ifdef DEBUG
|
||||
#ifdef DEBUG
|
||||
if ( debug & PROPDEBUG ) {
|
||||
printf( "[doflags] " );
|
||||
printname( childp );
|
||||
printf( " inherits printflag %d and propfraction %f\n" ,
|
||||
childp -> printflag , childp -> propfraction );
|
||||
}
|
||||
# endif DEBUG
|
||||
#endif /* DEBUG */
|
||||
if ( ! childp -> printflag ) {
|
||||
/*
|
||||
* printflag is off
|
||||
@ -864,7 +881,7 @@ doflags()
|
||||
}
|
||||
childp -> propself = childp -> time * childp -> propfraction;
|
||||
printtime += childp -> propself;
|
||||
# ifdef DEBUG
|
||||
#ifdef DEBUG
|
||||
if ( debug & PROPDEBUG ) {
|
||||
printf( "[doflags] " );
|
||||
printname( childp );
|
||||
@ -873,7 +890,7 @@ doflags()
|
||||
printf( "time %f propself %f printtime %f\n" ,
|
||||
childp -> time , childp -> propself , printtime );
|
||||
}
|
||||
# endif DEBUG
|
||||
#endif /* DEBUG */
|
||||
}
|
||||
}
|
||||
|
||||
@ -884,6 +901,7 @@ doflags()
|
||||
* print flag of the child (cycle) appropriately.
|
||||
* similarly, deal with propagation fractions from parents.
|
||||
*/
|
||||
void
|
||||
inheritflags( childp )
|
||||
nltype *childp;
|
||||
{
|
||||
|
@ -1,7 +1,8 @@
|
||||
/* $NetBSD: arm32.c,v 1.1 1996/04/01 21:51:22 mark Exp $ */
|
||||
/* $NetBSD: arm32.c,v 1.2 1998/02/22 12:55:44 christos Exp $ */
|
||||
|
||||
#include <sys/cdefs.h>
|
||||
#ifndef lint
|
||||
static char rcsid[] = "$NetBSD: arm32.c,v 1.1 1996/04/01 21:51:22 mark Exp $";
|
||||
__RCSID("$NetBSD: arm32.c,v 1.2 1998/02/22 12:55:44 christos Exp $");
|
||||
#endif /* not lint */
|
||||
|
||||
#include "gprof.h"
|
||||
@ -9,6 +10,7 @@ static char rcsid[] = "$NetBSD: arm32.c,v 1.1 1996/04/01 21:51:22 mark Exp $";
|
||||
/*
|
||||
* gprof -c isn't currently supported...
|
||||
*/
|
||||
void
|
||||
findcall( parentp , p_lowpc , p_highpc )
|
||||
nltype *parentp;
|
||||
unsigned long p_lowpc;
|
||||
|
@ -1,4 +1,4 @@
|
||||
/* $NetBSD: dfn.c,v 1.5 1995/04/19 07:15:56 cgd Exp $ */
|
||||
/* $NetBSD: dfn.c,v 1.6 1998/02/22 12:55:44 christos Exp $ */
|
||||
|
||||
/*
|
||||
* Copyright (c) 1983, 1993
|
||||
@ -33,11 +33,12 @@
|
||||
* SUCH DAMAGE.
|
||||
*/
|
||||
|
||||
#include <sys/cdefs.h>
|
||||
#ifndef lint
|
||||
#if 0
|
||||
static char sccsid[] = "@(#)dfn.c 8.1 (Berkeley) 6/6/93";
|
||||
#else
|
||||
static char rcsid[] = "$NetBSD: dfn.c,v 1.5 1995/04/19 07:15:56 cgd Exp $";
|
||||
__RCSID("$NetBSD: dfn.c,v 1.6 1998/02/22 12:55:44 christos Exp $");
|
||||
#endif
|
||||
#endif /* not lint */
|
||||
|
||||
@ -56,6 +57,7 @@ int dfn_depth;
|
||||
|
||||
int dfn_counter;
|
||||
|
||||
void
|
||||
dfn_init()
|
||||
{
|
||||
|
||||
@ -66,18 +68,19 @@ dfn_init()
|
||||
/*
|
||||
* given this parent, depth first number its children.
|
||||
*/
|
||||
void
|
||||
dfn( parentp )
|
||||
nltype *parentp;
|
||||
{
|
||||
arctype *arcp;
|
||||
|
||||
# ifdef DEBUG
|
||||
#ifdef DEBUG
|
||||
if ( debug & DFNDEBUG ) {
|
||||
printf( "[dfn] dfn(" );
|
||||
printname( parentp );
|
||||
printf( ")\n" );
|
||||
}
|
||||
# endif DEBUG
|
||||
#endif /* DEBUG */
|
||||
/*
|
||||
* if we're already numbered, no need to look any furthur.
|
||||
*/
|
||||
@ -112,6 +115,7 @@ dfn( parentp )
|
||||
/*
|
||||
* push a parent onto the stack and mark it busy
|
||||
*/
|
||||
void
|
||||
dfn_pre_visit( parentp )
|
||||
nltype *parentp;
|
||||
{
|
||||
@ -124,13 +128,13 @@ dfn_pre_visit( parentp )
|
||||
dfn_stack[ dfn_depth ].nlentryp = parentp;
|
||||
dfn_stack[ dfn_depth ].cycletop = dfn_depth;
|
||||
parentp -> toporder = DFN_BUSY;
|
||||
# ifdef DEBUG
|
||||
#ifdef DEBUG
|
||||
if ( debug & DFNDEBUG ) {
|
||||
printf( "[dfn_pre_visit]\t\t%d:" , dfn_depth );
|
||||
printname( parentp );
|
||||
printf( "\n" );
|
||||
}
|
||||
# endif DEBUG
|
||||
#endif /* DEBUG */
|
||||
}
|
||||
|
||||
/*
|
||||
@ -161,6 +165,7 @@ dfn_busy( childp )
|
||||
/*
|
||||
* MISSING: an explanation
|
||||
*/
|
||||
void
|
||||
dfn_findcycle( childp )
|
||||
nltype *childp;
|
||||
{
|
||||
@ -183,14 +188,14 @@ dfn_findcycle( childp )
|
||||
fprintf( stderr , "[dfn_findcycle] couldn't find head of cycle\n" );
|
||||
exit( 1 );
|
||||
}
|
||||
# ifdef DEBUG
|
||||
#ifdef DEBUG
|
||||
if ( debug & DFNDEBUG ) {
|
||||
printf( "[dfn_findcycle] dfn_depth %d cycletop %d " ,
|
||||
dfn_depth , cycletop );
|
||||
printname( cycleheadp );
|
||||
printf( "\n" );
|
||||
}
|
||||
# endif DEBUG
|
||||
#endif /* DEBUG */
|
||||
if ( cycletop == dfn_depth ) {
|
||||
/*
|
||||
* this is previous function, e.g. this calls itself
|
||||
@ -206,13 +211,13 @@ dfn_findcycle( childp )
|
||||
*/
|
||||
for ( tailp = cycleheadp ; tailp -> cnext ; tailp = tailp -> cnext ) {
|
||||
/* void: chase down to tail of things already glommed */
|
||||
# ifdef DEBUG
|
||||
#ifdef DEBUG
|
||||
if ( debug & DFNDEBUG ) {
|
||||
printf( "[dfn_findcycle] tail " );
|
||||
printname( tailp );
|
||||
printf( "\n" );
|
||||
}
|
||||
# endif DEBUG
|
||||
#endif /* DEBUG */
|
||||
}
|
||||
/*
|
||||
* if what we think is the top of the cycle
|
||||
@ -221,13 +226,13 @@ dfn_findcycle( childp )
|
||||
*/
|
||||
if ( cycleheadp -> cyclehead != cycleheadp ) {
|
||||
cycleheadp = cycleheadp -> cyclehead;
|
||||
# ifdef DEBUG
|
||||
#ifdef DEBUG
|
||||
if ( debug & DFNDEBUG ) {
|
||||
printf( "[dfn_findcycle] new cyclehead " );
|
||||
printname( cycleheadp );
|
||||
printf( "\n" );
|
||||
}
|
||||
# endif DEBUG
|
||||
#endif /* DEBUG */
|
||||
}
|
||||
for ( index = cycletop + 1 ; index <= dfn_depth ; index += 1 ) {
|
||||
childp = dfn_stack[ index ].nlentryp;
|
||||
@ -238,7 +243,7 @@ dfn_findcycle( childp )
|
||||
*/
|
||||
tailp -> cnext = childp;
|
||||
childp -> cyclehead = cycleheadp;
|
||||
# ifdef DEBUG
|
||||
#ifdef DEBUG
|
||||
if ( debug & DFNDEBUG ) {
|
||||
printf( "[dfn_findcycle] glomming " );
|
||||
printname( childp );
|
||||
@ -246,10 +251,10 @@ dfn_findcycle( childp )
|
||||
printname( cycleheadp );
|
||||
printf( "\n" );
|
||||
}
|
||||
# endif DEBUG
|
||||
#endif /* DEBUG */
|
||||
for ( tailp = childp ; tailp->cnext ; tailp = tailp->cnext ) {
|
||||
tailp -> cnext -> cyclehead = cycleheadp;
|
||||
# ifdef DEBUG
|
||||
#ifdef DEBUG
|
||||
if ( debug & DFNDEBUG ) {
|
||||
printf( "[dfn_findcycle] and its tail " );
|
||||
printname( tailp -> cnext );
|
||||
@ -257,7 +262,7 @@ dfn_findcycle( childp )
|
||||
printname( cycleheadp );
|
||||
printf( "\n" );
|
||||
}
|
||||
# endif DEBUG
|
||||
#endif /* DEBUG */
|
||||
}
|
||||
} else if ( childp -> cyclehead != cycleheadp /* firewall */ ) {
|
||||
fprintf( stderr ,
|
||||
@ -271,6 +276,7 @@ dfn_findcycle( childp )
|
||||
* deal with self-cycles
|
||||
* for lint: ARGSUSED
|
||||
*/
|
||||
void
|
||||
dfn_self_cycle( parentp )
|
||||
nltype *parentp;
|
||||
{
|
||||
@ -278,13 +284,13 @@ dfn_self_cycle( parentp )
|
||||
* since we are taking out self-cycles elsewhere
|
||||
* no need for the special case, here.
|
||||
*/
|
||||
# ifdef DEBUG
|
||||
#ifdef DEBUG
|
||||
if ( debug & DFNDEBUG ) {
|
||||
printf( "[dfn_self_cycle] " );
|
||||
printname( parentp );
|
||||
printf( "\n" );
|
||||
}
|
||||
# endif DEBUG
|
||||
#endif /* DEBUG */
|
||||
}
|
||||
|
||||
/*
|
||||
@ -292,18 +298,19 @@ dfn_self_cycle( parentp )
|
||||
* [MISSING: an explanation]
|
||||
* and pop it off the stack
|
||||
*/
|
||||
void
|
||||
dfn_post_visit( parentp )
|
||||
nltype *parentp;
|
||||
{
|
||||
nltype *memberp;
|
||||
|
||||
# ifdef DEBUG
|
||||
#ifdef DEBUG
|
||||
if ( debug & DFNDEBUG ) {
|
||||
printf( "[dfn_post_visit]\t%d: " , dfn_depth );
|
||||
printname( parentp );
|
||||
printf( "\n" );
|
||||
}
|
||||
# endif DEBUG
|
||||
#endif /* DEBUG */
|
||||
/*
|
||||
* number functions and things in their cycles
|
||||
* unless the function is itself part of a cycle
|
||||
@ -312,20 +319,20 @@ dfn_post_visit( parentp )
|
||||
dfn_counter += 1;
|
||||
for ( memberp = parentp ; memberp ; memberp = memberp -> cnext ) {
|
||||
memberp -> toporder = dfn_counter;
|
||||
# ifdef DEBUG
|
||||
#ifdef DEBUG
|
||||
if ( debug & DFNDEBUG ) {
|
||||
printf( "[dfn_post_visit]\t\tmember " );
|
||||
printname( memberp );
|
||||
printf( " -> toporder = %d\n" , dfn_counter );
|
||||
}
|
||||
# endif DEBUG
|
||||
#endif /* DEBUG */
|
||||
}
|
||||
} else {
|
||||
# ifdef DEBUG
|
||||
#ifdef DEBUG
|
||||
if ( debug & DFNDEBUG ) {
|
||||
printf( "[dfn_post_visit]\t\tis part of a cycle\n" );
|
||||
}
|
||||
# endif DEBUG
|
||||
#endif /* DEBUG */
|
||||
}
|
||||
dfn_depth -= 1;
|
||||
}
|
||||
|
@ -1,4 +1,4 @@
|
||||
/* $NetBSD: gprof.c,v 1.9 1997/01/30 09:20:55 matthias Exp $ */
|
||||
/* $NetBSD: gprof.c,v 1.10 1998/02/22 12:55:44 christos Exp $ */
|
||||
|
||||
/*
|
||||
* Copyright (c) 1983, 1993
|
||||
@ -33,23 +33,25 @@
|
||||
* SUCH DAMAGE.
|
||||
*/
|
||||
|
||||
#include <sys/cdefs.h>
|
||||
#ifndef lint
|
||||
static char copyright[] =
|
||||
"@(#) Copyright (c) 1983, 1993\n\
|
||||
The Regents of the University of California. All rights reserved.\n";
|
||||
__COPYRIGHT("@(#) Copyright (c) 1983, 1993\n\
|
||||
The Regents of the University of California. All rights reserved.\n");
|
||||
#endif /* not lint */
|
||||
|
||||
#ifndef lint
|
||||
#if 0
|
||||
static char sccsid[] = "@(#)gprof.c 8.1 (Berkeley) 6/6/93";
|
||||
#else
|
||||
static char rcsid[] = "$NetBSD: gprof.c,v 1.9 1997/01/30 09:20:55 matthias Exp $";
|
||||
__RCSID("$NetBSD: gprof.c,v 1.10 1998/02/22 12:55:44 christos Exp $");
|
||||
#endif
|
||||
#endif /* not lint */
|
||||
|
||||
#include "gprof.h"
|
||||
|
||||
char *whoami = "gprof";
|
||||
extern char *__progname;
|
||||
|
||||
char *whoami;
|
||||
|
||||
/*
|
||||
* things which get -E excluded by default.
|
||||
@ -58,6 +60,9 @@ char *defaultEs[] = { "mcount" , "__mcleanup" , 0 };
|
||||
|
||||
static struct gmonhdr gmonhdr;
|
||||
|
||||
int main __P((int, char **));
|
||||
|
||||
int
|
||||
main(argc, argv)
|
||||
int argc;
|
||||
char **argv;
|
||||
@ -65,6 +70,7 @@ main(argc, argv)
|
||||
char **sp;
|
||||
nltype **timesortnlp;
|
||||
|
||||
whoami = __progname;
|
||||
--argc;
|
||||
argv++;
|
||||
debug = 0;
|
||||
@ -95,11 +101,11 @@ main(argc, argv)
|
||||
setlinebuf(stdout);
|
||||
debug |= atoi( *++argv );
|
||||
debug |= ANYDEBUG;
|
||||
# ifdef DEBUG
|
||||
#ifdef DEBUG
|
||||
printf("[main] debug = %d\n", debug);
|
||||
# else not DEBUG
|
||||
printf("%s: -d ignored\n", whoami);
|
||||
# endif DEBUG
|
||||
#endif /* DEBUG */
|
||||
break;
|
||||
case 'E':
|
||||
++argv;
|
||||
@ -206,6 +212,7 @@ main(argc, argv)
|
||||
*/
|
||||
printindex();
|
||||
done();
|
||||
return 0;
|
||||
}
|
||||
|
||||
/*
|
||||
@ -213,10 +220,10 @@ main(argc, argv)
|
||||
* and optionally the text space.
|
||||
* On return symbol table is sorted by value.
|
||||
*/
|
||||
void
|
||||
getnfile()
|
||||
{
|
||||
FILE *nfile;
|
||||
int valcmp();
|
||||
|
||||
nfile = fopen( a_outname ,"r");
|
||||
if (nfile == NULL) {
|
||||
@ -233,7 +240,7 @@ getnfile()
|
||||
gettextspace( nfile );
|
||||
qsort(nl, nname, sizeof(nltype), valcmp);
|
||||
fclose(nfile);
|
||||
# ifdef DEBUG
|
||||
#ifdef DEBUG
|
||||
if ( debug & AOUTDEBUG ) {
|
||||
register int j;
|
||||
|
||||
@ -241,9 +248,10 @@ getnfile()
|
||||
printf("[getnfile] 0X%08x\t%s\n", nl[j].value, nl[j].name);
|
||||
}
|
||||
}
|
||||
# endif DEBUG
|
||||
#endif /* DEBUG */
|
||||
}
|
||||
|
||||
void
|
||||
getstrtab(nfile)
|
||||
FILE *nfile;
|
||||
{
|
||||
@ -256,7 +264,7 @@ getstrtab(nfile)
|
||||
}
|
||||
strtab = calloc(ssiz, 1);
|
||||
if (strtab == NULL) {
|
||||
fprintf(stderr, "%s: %s: no room for %d bytes of string table\n",
|
||||
fprintf(stderr, "%s: %s: no room for %ld bytes of string table\n",
|
||||
whoami , a_outname , ssiz);
|
||||
done();
|
||||
}
|
||||
@ -270,6 +278,7 @@ getstrtab(nfile)
|
||||
/*
|
||||
* Read in symbol table
|
||||
*/
|
||||
void
|
||||
getsymtab(nfile)
|
||||
FILE *nfile;
|
||||
{
|
||||
@ -306,22 +315,22 @@ getsymtab(nfile)
|
||||
for (i = xbuf.a_syms; i > 0; i -= sizeof(struct nlist)) {
|
||||
fread(&nbuf, sizeof(nbuf), 1, nfile);
|
||||
if ( ! funcsymbol( &nbuf ) ) {
|
||||
# ifdef DEBUG
|
||||
#ifdef DEBUG
|
||||
if ( debug & AOUTDEBUG ) {
|
||||
printf( "[getsymtab] rejecting: 0x%x %s\n" ,
|
||||
nbuf.n_type , strtab + nbuf.n_un.n_strx );
|
||||
}
|
||||
# endif DEBUG
|
||||
#endif /* DEBUG */
|
||||
continue;
|
||||
}
|
||||
npe->value = nbuf.n_value;
|
||||
npe->name = strtab+nbuf.n_un.n_strx;
|
||||
# ifdef DEBUG
|
||||
#ifdef DEBUG
|
||||
if ( debug & AOUTDEBUG ) {
|
||||
printf( "[getsymtab] %d %s 0x%08x\n" ,
|
||||
nname , npe -> name , npe -> value );
|
||||
}
|
||||
# endif DEBUG
|
||||
#endif /* DEBUG */
|
||||
npe++;
|
||||
nname++;
|
||||
}
|
||||
@ -331,6 +340,7 @@ getsymtab(nfile)
|
||||
/*
|
||||
* read in the text space of an a.out file
|
||||
*/
|
||||
void
|
||||
gettextspace( nfile )
|
||||
FILE *nfile;
|
||||
{
|
||||
@ -340,7 +350,7 @@ gettextspace( nfile )
|
||||
}
|
||||
textspace = (u_char *) malloc( xbuf.a_text );
|
||||
if ( textspace == 0 ) {
|
||||
fprintf( stderr , "%s: ran out room for %d bytes of text space: " ,
|
||||
fprintf( stderr , "%s: ran out room for %ld bytes of text space: " ,
|
||||
whoami , xbuf.a_text );
|
||||
fprintf( stderr , "can't do -c\n" );
|
||||
return;
|
||||
@ -359,11 +369,11 @@ gettextspace( nfile )
|
||||
* an array of sampling hits within pc ranges,
|
||||
* and the arcs.
|
||||
*/
|
||||
void
|
||||
getpfile(filename)
|
||||
char *filename;
|
||||
{
|
||||
FILE *pfile;
|
||||
FILE *openpfile();
|
||||
struct rawarc arc;
|
||||
|
||||
pfile = openpfile(filename);
|
||||
@ -373,12 +383,12 @@ getpfile(filename)
|
||||
* a bunch of <from,self,count> tuples.
|
||||
*/
|
||||
while ( fread( &arc , sizeof arc , 1 , pfile ) == 1 ) {
|
||||
# ifdef DEBUG
|
||||
#ifdef DEBUG
|
||||
if ( debug & SAMPLEDEBUG ) {
|
||||
printf( "[getpfile] frompc 0x%x selfpc 0x%x count %d\n" ,
|
||||
arc.raw_frompc , arc.raw_selfpc , arc.raw_count );
|
||||
}
|
||||
# endif DEBUG
|
||||
#endif /* DEBUG */
|
||||
/*
|
||||
* add this arc
|
||||
*/
|
||||
@ -420,7 +430,7 @@ openpfile(filename)
|
||||
hz = rate;
|
||||
} else if (hz != rate) {
|
||||
fprintf(stderr,
|
||||
"%s: profile clock rate (%d) %s (%d) in first gmon file\n",
|
||||
"%s: profile clock rate (%d) %s (%ld) in first gmon file\n",
|
||||
filename, rate, "incompatible with clock rate", hz);
|
||||
done();
|
||||
}
|
||||
@ -430,7 +440,7 @@ openpfile(filename)
|
||||
highpc = (unsigned long)gmonhdr.hpc / sizeof(UNIT);
|
||||
sampbytes = gmonhdr.ncnt - size;
|
||||
nsamples = sampbytes / sizeof (UNIT);
|
||||
# ifdef DEBUG
|
||||
#ifdef DEBUG
|
||||
if ( debug & SAMPLEDEBUG ) {
|
||||
printf( "[openpfile] hdr.lpc 0x%x hdr.hpc 0x%x hdr.ncnt %d\n",
|
||||
gmonhdr.lpc , gmonhdr.hpc , gmonhdr.ncnt );
|
||||
@ -442,10 +452,11 @@ openpfile(filename)
|
||||
sampbytes , nsamples );
|
||||
printf( "[openpfile] sample rate %d\n" , hz );
|
||||
}
|
||||
# endif DEBUG
|
||||
#endif /* DEBUG */
|
||||
return(pfile);
|
||||
}
|
||||
|
||||
void
|
||||
tally( rawp )
|
||||
struct rawarc *rawp;
|
||||
{
|
||||
@ -462,18 +473,19 @@ tally( rawp )
|
||||
return;
|
||||
}
|
||||
childp -> ncall += rawp -> raw_count;
|
||||
# ifdef DEBUG
|
||||
#ifdef DEBUG
|
||||
if ( debug & TALLYDEBUG ) {
|
||||
printf( "[tally] arc from %s to %s traversed %d times\n" ,
|
||||
parentp -> name , childp -> name , rawp -> raw_count );
|
||||
}
|
||||
# endif DEBUG
|
||||
#endif /* DEBUG */
|
||||
addarc( parentp , childp , rawp -> raw_count );
|
||||
}
|
||||
|
||||
/*
|
||||
* dump out the gmon.sum file
|
||||
*/
|
||||
void
|
||||
dumpsum( sumfile )
|
||||
char *sumfile;
|
||||
{
|
||||
@ -512,20 +524,22 @@ dumpsum( sumfile )
|
||||
perror( sumfile );
|
||||
done();
|
||||
}
|
||||
# ifdef DEBUG
|
||||
#ifdef DEBUG
|
||||
if ( debug & SAMPLEDEBUG ) {
|
||||
printf( "[dumpsum] frompc 0x%x selfpc 0x%x count %d\n" ,
|
||||
arc.raw_frompc , arc.raw_selfpc , arc.raw_count );
|
||||
}
|
||||
# endif DEBUG
|
||||
#endif /* DEBUG */
|
||||
}
|
||||
}
|
||||
fclose( sfile );
|
||||
}
|
||||
|
||||
valcmp(p1, p2)
|
||||
nltype *p1, *p2;
|
||||
int
|
||||
valcmp(v1, v2)
|
||||
const void *v1, *v2;
|
||||
{
|
||||
const nltype *p1 = v1, *p2 = v2;
|
||||
if ( p1 -> value < p2 -> value ) {
|
||||
return LESSTHAN;
|
||||
}
|
||||
@ -535,6 +549,7 @@ valcmp(p1, p2)
|
||||
return EQUALTO;
|
||||
}
|
||||
|
||||
void
|
||||
readsamples(pfile)
|
||||
FILE *pfile;
|
||||
{
|
||||
@ -595,6 +610,7 @@ readsamples(pfile)
|
||||
* only one sample for every four bytes of text space and never
|
||||
* have any overlap (the two end cases, above).
|
||||
*/
|
||||
void
|
||||
asgnsamples()
|
||||
{
|
||||
register int j;
|
||||
@ -616,12 +632,12 @@ asgnsamples()
|
||||
pcl = lowpc + scale * i;
|
||||
pch = lowpc + scale * (i + 1);
|
||||
time = ccnt;
|
||||
# ifdef DEBUG
|
||||
#ifdef DEBUG
|
||||
if ( debug & SAMPLEDEBUG ) {
|
||||
printf( "[asgnsamples] pcl 0x%x pch 0x%x ccnt %d\n" ,
|
||||
pcl , pch , ccnt );
|
||||
}
|
||||
# endif DEBUG
|
||||
#endif /* DEBUG */
|
||||
totime += time;
|
||||
for (j = j - 1; j < nname; j++) {
|
||||
svalue0 = nl[j].svalue;
|
||||
@ -640,25 +656,25 @@ asgnsamples()
|
||||
continue;
|
||||
overlap = min(pch, svalue1) - max(pcl, svalue0);
|
||||
if (overlap > 0) {
|
||||
# ifdef DEBUG
|
||||
#ifdef DEBUG
|
||||
if (debug & SAMPLEDEBUG) {
|
||||
printf("[asgnsamples] (0x%x->0x%x-0x%x) %s gets %f ticks %d overlap\n",
|
||||
nl[j].value/sizeof(UNIT), svalue0, svalue1,
|
||||
nl[j].name,
|
||||
overlap * time / scale, overlap);
|
||||
}
|
||||
# endif DEBUG
|
||||
#endif /* DEBUG */
|
||||
nl[j].time += overlap * time / scale;
|
||||
if ( onlist( Elist , nl[j].name ) )
|
||||
totime -= overlap * time / scale;
|
||||
}
|
||||
}
|
||||
}
|
||||
# ifdef DEBUG
|
||||
#ifdef DEBUG
|
||||
if (debug & SAMPLEDEBUG) {
|
||||
printf("[asgnsamples] totime %f\n", totime);
|
||||
}
|
||||
# endif DEBUG
|
||||
#endif /* DEBUG */
|
||||
}
|
||||
|
||||
|
||||
@ -686,6 +702,7 @@ max(a, b)
|
||||
* if it turns out that the entry point is in one bucket and the code
|
||||
* for a routine is in the next bucket.
|
||||
*/
|
||||
void
|
||||
alignentries()
|
||||
{
|
||||
register struct nl *nlp;
|
||||
@ -697,12 +714,12 @@ alignentries()
|
||||
bucket_of_entry = (nlp->svalue - lowpc) / scale;
|
||||
bucket_of_code = (nlp->svalue + UNITS_TO_CODE - lowpc) / scale;
|
||||
if (bucket_of_entry < bucket_of_code) {
|
||||
# ifdef DEBUG
|
||||
#ifdef DEBUG
|
||||
if (debug & SAMPLEDEBUG) {
|
||||
printf("[alignentries] pushing svalue 0x%x to 0x%x\n",
|
||||
nlp->svalue, nlp->svalue + UNITS_TO_CODE);
|
||||
}
|
||||
# endif DEBUG
|
||||
#endif /* DEBUG */
|
||||
nlp->svalue += UNITS_TO_CODE;
|
||||
}
|
||||
}
|
||||
@ -744,7 +761,7 @@ funcsymbol( nlistp )
|
||||
return TRUE;
|
||||
}
|
||||
#endif
|
||||
while ( c = *name++ ) {
|
||||
while ( (c = *name++) != '\0' ) {
|
||||
if ( c == '.' || c == '$' ) {
|
||||
return FALSE;
|
||||
}
|
||||
@ -752,6 +769,7 @@ funcsymbol( nlistp )
|
||||
return TRUE;
|
||||
}
|
||||
|
||||
void
|
||||
done()
|
||||
{
|
||||
|
||||
|
@ -1,4 +1,4 @@
|
||||
/* $NetBSD: gprof.h,v 1.13 1996/04/01 21:54:06 mark Exp $ */
|
||||
/* $NetBSD: gprof.h,v 1.14 1998/02/22 12:55:45 christos Exp $ */
|
||||
|
||||
/*
|
||||
* Copyright (c) 1983, 1993
|
||||
@ -268,76 +268,87 @@ struct stringlist *ktolist;
|
||||
/*
|
||||
* function declarations
|
||||
*/
|
||||
/*
|
||||
addarc();
|
||||
*/
|
||||
int arccmp();
|
||||
arctype *arclookup();
|
||||
/*
|
||||
asgnsamples();
|
||||
printblurb();
|
||||
cyclelink();
|
||||
dfn();
|
||||
*/
|
||||
bool dfn_busy();
|
||||
/*
|
||||
dfn_findcycle();
|
||||
*/
|
||||
bool dfn_numbered();
|
||||
/*
|
||||
dfn_post_visit();
|
||||
dfn_pre_visit();
|
||||
dfn_self_cycle();
|
||||
*/
|
||||
nltype **doarcs();
|
||||
/*
|
||||
done();
|
||||
findcalls();
|
||||
flatprofheader();
|
||||
flatprofline();
|
||||
*/
|
||||
bool funcsymbol();
|
||||
/*
|
||||
getnfile();
|
||||
getpfile();
|
||||
getstrtab();
|
||||
getsymtab();
|
||||
gettextspace();
|
||||
gprofheader();
|
||||
gprofline();
|
||||
main();
|
||||
*/
|
||||
unsigned long max();
|
||||
int membercmp();
|
||||
unsigned long min();
|
||||
nltype *nllookup();
|
||||
FILE *openpfile();
|
||||
long operandlength();
|
||||
operandenum operandmode();
|
||||
char *operandname();
|
||||
/*
|
||||
printchildren();
|
||||
printcycle();
|
||||
printgprof();
|
||||
printmembers();
|
||||
printname();
|
||||
printparents();
|
||||
printprof();
|
||||
readsamples();
|
||||
*/
|
||||
unsigned long reladdr();
|
||||
/*
|
||||
sortchildren();
|
||||
sortmembers();
|
||||
sortparents();
|
||||
tally();
|
||||
timecmp();
|
||||
topcmp();
|
||||
*/
|
||||
int totalcmp();
|
||||
/*
|
||||
valcmp();
|
||||
*/
|
||||
/* ${MACHINE}.c */
|
||||
void findcall __P((nltype *, unsigned long, unsigned long));
|
||||
|
||||
/* arcs.c */
|
||||
void addarc __P((nltype *, nltype *, long));
|
||||
int topcmp __P((const void *, const void *));
|
||||
nltype **doarcs __P((void));
|
||||
void dotime __P((void));
|
||||
void timepropagate __P((nltype *));
|
||||
void cyclelink __P((void));
|
||||
bool cycleanalyze __P((void));
|
||||
bool descend __P((nltype *, arctype **, arctype **));
|
||||
bool addcycle __P((arctype **, arctype **));
|
||||
void compresslist __P((void));
|
||||
void printsubcycle __P((cltype *));
|
||||
void cycletime __P((void));
|
||||
void doflags __P((void));
|
||||
void inheritflags __P((nltype *));
|
||||
|
||||
/* dfn.c */
|
||||
void dfn_init __P((void));
|
||||
void dfn __P((nltype *));
|
||||
void dfn_pre_visit __P((nltype *));
|
||||
bool dfn_numbered __P((nltype *));
|
||||
bool dfn_busy __P((nltype *));
|
||||
void dfn_findcycle __P((nltype *));
|
||||
void dfn_self_cycle __P((nltype *));
|
||||
void dfn_post_visit __P((nltype *));
|
||||
|
||||
/* gprof.c */
|
||||
int main __P((int, char **));
|
||||
void getnfile __P((void));
|
||||
void getstrtab __P((FILE *));
|
||||
void getsymtab __P((FILE *));
|
||||
void gettextspace __P((FILE *));
|
||||
void getpfile __P((char *));
|
||||
FILE *openpfile __P((char *));
|
||||
void tally __P((struct rawarc *));
|
||||
void dumpsum __P((char *));
|
||||
int valcmp __P((const void *, const void *));
|
||||
void readsamples __P((FILE *));
|
||||
void asgnsamples __P((void));
|
||||
unsigned long min __P((unsigned long, unsigned long ));
|
||||
unsigned long max __P((unsigned long, unsigned long ));
|
||||
void alignentries __P((void));
|
||||
bool funcsymbol __P((struct nlist *));
|
||||
void done __P((void));
|
||||
|
||||
/* hertz.c */
|
||||
int hertz __P((void));
|
||||
|
||||
/* lookup.c */
|
||||
nltype *nllookup __P((unsigned long));
|
||||
arctype *arclookup __P((nltype *, nltype *));
|
||||
|
||||
/* printgprof.c */
|
||||
void printprof __P((void));
|
||||
int timecmp __P((const void *, const void *));
|
||||
void flatprofheader __P((void));
|
||||
void flatprofline __P((nltype *));
|
||||
void gprofheader __P((void));
|
||||
void gprofline __P((nltype *));
|
||||
void printgprof __P((nltype **));
|
||||
int totalcmp __P((const void *, const void *));
|
||||
void printparents __P((nltype *));
|
||||
void printchildren __P((nltype *));
|
||||
void printname __P((nltype *));
|
||||
void sortchildren __P((nltype *));
|
||||
void sortparents __P((nltype *));
|
||||
void printcycle __P((nltype *));
|
||||
void printmembers __P((nltype *));
|
||||
void sortmembers __P((nltype *));
|
||||
int membercmp __P((const void *, const void *));
|
||||
int arccmp __P((const void *, const void *));
|
||||
void printblurb __P((char *));
|
||||
int namecmp __P((const void *, const void *));
|
||||
void printindex __P((void));
|
||||
|
||||
/* printlist.c */
|
||||
void addlist __P((struct stringlist *, char *));
|
||||
bool onlist __P((struct stringlist *, char *));
|
||||
|
||||
#define LESSTHAN -1
|
||||
#define EQUALTO 0
|
||||
|
@ -1,4 +1,4 @@
|
||||
/* $NetBSD: hertz.c,v 1.5 1995/04/19 07:16:03 cgd Exp $ */
|
||||
/* $NetBSD: hertz.c,v 1.6 1998/02/22 12:55:45 christos Exp $ */
|
||||
|
||||
/*
|
||||
* Copyright (c) 1983, 1993
|
||||
@ -33,15 +33,17 @@
|
||||
* SUCH DAMAGE.
|
||||
*/
|
||||
|
||||
#include <sys/cdefs.h>
|
||||
#ifndef lint
|
||||
#if 0
|
||||
static char sccsid[] = "@(#)hertz.c 8.1 (Berkeley) 6/6/93";
|
||||
#else
|
||||
static char rcsid[] = "$NetBSD: hertz.c,v 1.5 1995/04/19 07:16:03 cgd Exp $";
|
||||
__RCSID("$NetBSD: hertz.c,v 1.6 1998/02/22 12:55:45 christos Exp $");
|
||||
#endif
|
||||
#endif /* not lint */
|
||||
|
||||
#include <sys/time.h>
|
||||
#include "gprof.h"
|
||||
|
||||
/*
|
||||
* discover the tick frequency of the machine
|
||||
@ -49,6 +51,7 @@ static char rcsid[] = "$NetBSD: hertz.c,v 1.5 1995/04/19 07:16:03 cgd Exp $";
|
||||
*/
|
||||
#define HZ_WRONG 0
|
||||
|
||||
int
|
||||
hertz()
|
||||
{
|
||||
struct itimerval tim;
|
||||
|
@ -1,7 +1,8 @@
|
||||
/* $NetBSD: i386.c,v 1.5 1995/04/19 07:16:04 cgd Exp $ */
|
||||
/* $NetBSD: i386.c,v 1.6 1998/02/22 12:55:45 christos Exp $ */
|
||||
|
||||
#include <sys/cdefs.h>
|
||||
#ifndef lint
|
||||
static char rcsid[] = "$NetBSD: i386.c,v 1.5 1995/04/19 07:16:04 cgd Exp $";
|
||||
__RCSID("$NetBSD: i386.c,v 1.6 1998/02/22 12:55:45 christos Exp $");
|
||||
#endif /* not lint */
|
||||
|
||||
#include "gprof.h"
|
||||
@ -9,6 +10,7 @@ static char rcsid[] = "$NetBSD: i386.c,v 1.5 1995/04/19 07:16:04 cgd Exp $";
|
||||
/*
|
||||
* gprof -c isn't currently supported...
|
||||
*/
|
||||
void
|
||||
findcall( parentp , p_lowpc , p_highpc )
|
||||
nltype *parentp;
|
||||
unsigned long p_lowpc;
|
||||
|
@ -1,4 +1,4 @@
|
||||
/* $NetBSD: lookup.c,v 1.5 1995/04/19 07:16:06 cgd Exp $ */
|
||||
/* $NetBSD: lookup.c,v 1.6 1998/02/22 12:55:45 christos Exp $ */
|
||||
|
||||
/*
|
||||
* Copyright (c) 1983, 1993
|
||||
@ -33,11 +33,12 @@
|
||||
* SUCH DAMAGE.
|
||||
*/
|
||||
|
||||
#include <sys/cdefs.h>
|
||||
#ifndef lint
|
||||
#if 0
|
||||
static char sccsid[] = "@(#)lookup.c 8.1 (Berkeley) 6/6/93";
|
||||
#else
|
||||
static char rcsid[] = "$NetBSD: lookup.c,v 1.5 1995/04/19 07:16:06 cgd Exp $";
|
||||
__RCSID("$NetBSD: lookup.c,v 1.6 1998/02/22 12:55:45 christos Exp $");
|
||||
#endif
|
||||
#endif /* not lint */
|
||||
|
||||
@ -55,22 +56,22 @@ nllookup( address )
|
||||
register long low;
|
||||
register long middle;
|
||||
register long high;
|
||||
# ifdef DEBUG
|
||||
#ifdef DEBUG
|
||||
register int probes;
|
||||
|
||||
probes = 0;
|
||||
# endif DEBUG
|
||||
#endif /* DEBUG */
|
||||
for ( low = 0 , high = nname - 1 ; low != high ; ) {
|
||||
# ifdef DEBUG
|
||||
#ifdef DEBUG
|
||||
probes += 1;
|
||||
# endif DEBUG
|
||||
#endif /* DEBUG */
|
||||
middle = ( high + low ) >> 1;
|
||||
if ( nl[ middle ].value <= address && nl[ middle+1 ].value > address ) {
|
||||
# ifdef DEBUG
|
||||
#ifdef DEBUG
|
||||
if ( debug & LOOKUPDEBUG ) {
|
||||
printf( "[nllookup] %d (%d) probes\n" , probes , nname-1 );
|
||||
}
|
||||
# endif DEBUG
|
||||
#endif /* DEBUG */
|
||||
return &nl[ middle ];
|
||||
}
|
||||
if ( nl[ middle ].value > address ) {
|
||||
@ -79,12 +80,12 @@ nllookup( address )
|
||||
low = middle + 1;
|
||||
}
|
||||
}
|
||||
# ifdef DEBUG
|
||||
#ifdef DEBUG
|
||||
if ( debug & LOOKUPDEBUG ) {
|
||||
fprintf( stderr , "[nllookup] (%d) binary search fails\n" ,
|
||||
nname-1 );
|
||||
}
|
||||
# endif DEBUG
|
||||
#endif /* DEBUG */
|
||||
return 0;
|
||||
}
|
||||
|
||||
@ -99,20 +100,20 @@ arclookup( parentp , childp )
|
||||
fprintf( stderr, "[arclookup] parentp == 0 || childp == 0\n" );
|
||||
return 0;
|
||||
}
|
||||
# ifdef DEBUG
|
||||
#ifdef DEBUG
|
||||
if ( debug & LOOKUPDEBUG ) {
|
||||
printf( "[arclookup] parent %s child %s\n" ,
|
||||
parentp -> name , childp -> name );
|
||||
}
|
||||
# endif DEBUG
|
||||
#endif /* DEBUG */
|
||||
for ( arcp = parentp -> children ; arcp ; arcp = arcp -> arc_childlist ) {
|
||||
# ifdef DEBUG
|
||||
#ifdef DEBUG
|
||||
if ( debug & LOOKUPDEBUG ) {
|
||||
printf( "[arclookup]\t arc_parent %s arc_child %s\n" ,
|
||||
arcp -> arc_parentp -> name ,
|
||||
arcp -> arc_childp -> name );
|
||||
}
|
||||
# endif DEBUG
|
||||
#endif /* DEBUG */
|
||||
if ( arcp -> arc_childp == childp ) {
|
||||
return arcp;
|
||||
}
|
||||
|
@ -1,7 +1,8 @@
|
||||
/* $NetBSD: m68k.c,v 1.4 1995/04/19 07:16:07 cgd Exp $ */
|
||||
/* $NetBSD: m68k.c,v 1.5 1998/02/22 12:55:45 christos Exp $ */
|
||||
|
||||
#include <sys/cdefs.h>
|
||||
#ifndef lint
|
||||
static char rcsid[] = "$NetBSD: m68k.c,v 1.4 1995/04/19 07:16:07 cgd Exp $";
|
||||
__RCSID("$NetBSD: m68k.c,v 1.5 1998/02/22 12:55:45 christos Exp $");
|
||||
#endif /* not lint */
|
||||
|
||||
#include "gprof.h"
|
||||
@ -9,6 +10,7 @@ static char rcsid[] = "$NetBSD: m68k.c,v 1.4 1995/04/19 07:16:07 cgd Exp $";
|
||||
/*
|
||||
* gprof -c isn't currently supported...
|
||||
*/
|
||||
void
|
||||
findcall( parentp , p_lowpc , p_highpc )
|
||||
nltype *parentp;
|
||||
unsigned long p_lowpc;
|
||||
|
@ -1,4 +1,4 @@
|
||||
/* $NetBSD: mips.c,v 1.4 1995/04/19 07:16:11 cgd Exp $ */
|
||||
/* $NetBSD: mips.c,v 1.5 1998/02/22 12:55:45 christos Exp $ */
|
||||
|
||||
/*
|
||||
* Copyright (c) 1992, 1993
|
||||
@ -39,11 +39,12 @@
|
||||
* From: sparc.c 5.1 (Berkeley) 7/7/92
|
||||
*/
|
||||
|
||||
#include <sys/cdefs.h>
|
||||
#ifndef lint
|
||||
#if 0
|
||||
static char sccsid[] = "@(#)mips.c 8.1 (Berkeley) 6/6/93";
|
||||
#else
|
||||
static char rcsid[] = "$NetBSD: mips.c,v 1.4 1995/04/19 07:16:11 cgd Exp $";
|
||||
__RCSID("$NetBSD: mips.c,v 1.5 1998/02/22 12:55:45 christos Exp $");
|
||||
#endif
|
||||
#endif /* not lint */
|
||||
|
||||
@ -76,6 +77,7 @@ nltype indirectchild = {
|
||||
(arctype *) 0 /* list of callee arcs */
|
||||
};
|
||||
|
||||
void
|
||||
findcall(parentp, p_lowpc, p_highpc)
|
||||
nltype *parentp;
|
||||
unsigned long p_lowpc;
|
||||
|
@ -1,7 +1,8 @@
|
||||
/* $NetBSD: ns32k.c,v 1.3 1995/04/19 07:16:13 cgd Exp $ */
|
||||
/* $NetBSD: ns32k.c,v 1.4 1998/02/22 12:55:45 christos Exp $ */
|
||||
|
||||
#include <sys/cdefs.h>
|
||||
#ifndef lint
|
||||
static char rcsid[] = "$NetBSD: ns32k.c,v 1.3 1995/04/19 07:16:13 cgd Exp $";
|
||||
__RCSID("$NetBSD: ns32k.c,v 1.4 1998/02/22 12:55:45 christos Exp $");
|
||||
#endif /* not lint */
|
||||
|
||||
#include "gprof.h"
|
||||
@ -9,6 +10,7 @@ static char rcsid[] = "$NetBSD: ns32k.c,v 1.3 1995/04/19 07:16:13 cgd Exp $";
|
||||
/*
|
||||
* gprof -c isn't currently supported...
|
||||
*/
|
||||
void
|
||||
findcall( parentp , p_lowpc , p_highpc )
|
||||
nltype *parentp;
|
||||
unsigned long p_lowpc;
|
||||
|
@ -1,4 +1,4 @@
|
||||
/* $NetBSD: pmax.c,v 1.3 1995/04/19 07:16:18 cgd Exp $ */
|
||||
/* $NetBSD: pmax.c,v 1.4 1998/02/22 12:55:45 christos Exp $ */
|
||||
|
||||
/*
|
||||
* Copyright (c) 1992, 1993
|
||||
@ -39,11 +39,12 @@
|
||||
* From: sparc.c 5.1 (Berkeley) 7/7/92
|
||||
*/
|
||||
|
||||
#include <sys/cdefs.h>
|
||||
#ifndef lint
|
||||
#if 0
|
||||
static char sccsid[] = "@(#)mips.c 8.1 (Berkeley) 6/6/93";
|
||||
#else
|
||||
static char rcsid[] = "$NetBSD: pmax.c,v 1.3 1995/04/19 07:16:18 cgd Exp $";
|
||||
__RCSID("$NetBSD: pmax.c,v 1.4 1998/02/22 12:55:45 christos Exp $");
|
||||
#endif
|
||||
#endif /* not lint */
|
||||
|
||||
@ -76,6 +77,7 @@ nltype indirectchild = {
|
||||
(arctype *) 0 /* list of callee arcs */
|
||||
};
|
||||
|
||||
void
|
||||
findcall(parentp, p_lowpc, p_highpc)
|
||||
nltype *parentp;
|
||||
unsigned long p_lowpc;
|
||||
|
@ -1,4 +1,4 @@
|
||||
/* $NetBSD: printgprof.c,v 1.6 1997/01/30 09:20:56 matthias Exp $ */
|
||||
/* $NetBSD: printgprof.c,v 1.7 1998/02/22 12:55:46 christos Exp $ */
|
||||
|
||||
/*
|
||||
* Copyright (c) 1983, 1993
|
||||
@ -33,22 +33,24 @@
|
||||
* SUCH DAMAGE.
|
||||
*/
|
||||
|
||||
#include <sys/cdefs.h>
|
||||
#ifndef lint
|
||||
#if 0
|
||||
static char sccsid[] = "@(#)printgprof.c 8.1 (Berkeley) 6/6/93";
|
||||
#else
|
||||
static char rcsid[] = "$NetBSD: printgprof.c,v 1.6 1997/01/30 09:20:56 matthias Exp $";
|
||||
__RCSID("$NetBSD: printgprof.c,v 1.7 1998/02/22 12:55:46 christos Exp $");
|
||||
#endif
|
||||
#endif /* not lint */
|
||||
|
||||
#include "gprof.h"
|
||||
#include "pathnames.h"
|
||||
|
||||
void
|
||||
printprof()
|
||||
{
|
||||
register nltype *np;
|
||||
nltype **sortednlp;
|
||||
int index, timecmp();
|
||||
int index;
|
||||
|
||||
actime = 0.0;
|
||||
printf( "\f\n" );
|
||||
@ -72,9 +74,11 @@ printprof()
|
||||
free( sortednlp );
|
||||
}
|
||||
|
||||
timecmp( npp1 , npp2 )
|
||||
nltype **npp1, **npp2;
|
||||
int
|
||||
timecmp( v1 , v2 )
|
||||
const void *v1, *v2;
|
||||
{
|
||||
const nltype *const *npp1 = v1, *const *npp2 = v2;
|
||||
double timediff;
|
||||
long calldiff;
|
||||
|
||||
@ -94,13 +98,14 @@ timecmp( npp1 , npp2 )
|
||||
/*
|
||||
* header for flatprofline
|
||||
*/
|
||||
void
|
||||
flatprofheader()
|
||||
{
|
||||
|
||||
if ( bflag ) {
|
||||
printblurb( _PATH_FLAT_BLURB );
|
||||
}
|
||||
printf( "\ngranularity: each sample hit covers %d byte(s)" ,
|
||||
printf( "\ngranularity: each sample hit covers %ld byte(s)" ,
|
||||
(long) scale * sizeof(UNIT) );
|
||||
if ( totime > 0.0 ) {
|
||||
printf( " for %.2f%% of %.2f seconds\n\n" ,
|
||||
@ -119,6 +124,7 @@ flatprofheader()
|
||||
"ms/call" , "ms/call" , "name" );
|
||||
}
|
||||
|
||||
void
|
||||
flatprofline( np )
|
||||
register nltype *np;
|
||||
{
|
||||
@ -132,7 +138,7 @@ flatprofline( np )
|
||||
printf( "%5.1f %10.2f %8.2f" ,
|
||||
100 * np -> time / totime , actime / hz , np -> time / hz );
|
||||
if ( np -> ncall != 0 ) {
|
||||
printf( " %8d %8.2f %8.2f " , np -> ncall ,
|
||||
printf( " %8ld %8.2f %8.2f " , np -> ncall ,
|
||||
1000 * np -> time / hz / np -> ncall ,
|
||||
1000 * ( np -> time + np -> childtime ) / hz / np -> ncall );
|
||||
} else {
|
||||
@ -142,13 +148,14 @@ flatprofline( np )
|
||||
printf( "\n" );
|
||||
}
|
||||
|
||||
void
|
||||
gprofheader()
|
||||
{
|
||||
|
||||
if ( bflag ) {
|
||||
printblurb( _PATH_CALLG_BLURB );
|
||||
}
|
||||
printf( "\ngranularity: each sample hit covers %d byte(s)" ,
|
||||
printf( "\ngranularity: each sample hit covers %ld byte(s)" ,
|
||||
(long) scale * sizeof(UNIT) );
|
||||
if ( printtime > 0.0 ) {
|
||||
printf( " for %.2f%% of %.2f seconds\n\n" ,
|
||||
@ -170,6 +177,7 @@ gprofheader()
|
||||
printf( "\n" );
|
||||
}
|
||||
|
||||
void
|
||||
gprofline( np )
|
||||
register nltype *np;
|
||||
{
|
||||
@ -182,9 +190,9 @@ gprofline( np )
|
||||
np -> propself / hz ,
|
||||
np -> propchild / hz );
|
||||
if ( ( np -> ncall + np -> selfcalls ) != 0 ) {
|
||||
printf( " %7d" , np -> npropcall );
|
||||
printf( " %7ld" , np -> npropcall );
|
||||
if ( np -> selfcalls != 0 ) {
|
||||
printf( "+%-7d " , np -> selfcalls );
|
||||
printf( "+%-7ld " , np -> selfcalls );
|
||||
} else {
|
||||
printf( " %7.7s " , "" );
|
||||
}
|
||||
@ -195,6 +203,7 @@ gprofline( np )
|
||||
printf( "\n" );
|
||||
}
|
||||
|
||||
void
|
||||
printgprof(timesortnlp)
|
||||
nltype **timesortnlp;
|
||||
{
|
||||
@ -244,12 +253,13 @@ printgprof(timesortnlp)
|
||||
* all else being equal, sort by names.
|
||||
*/
|
||||
int
|
||||
totalcmp( npp1 , npp2 )
|
||||
nltype **npp1;
|
||||
nltype **npp2;
|
||||
totalcmp( v1 , v2 )
|
||||
const void *v1, *v2;
|
||||
{
|
||||
register nltype *np1 = *npp1;
|
||||
register nltype *np2 = *npp2;
|
||||
const nltype *const *npp1 = v1;
|
||||
const nltype *const *npp2 = v2;
|
||||
const nltype *np1 = *npp1;
|
||||
const nltype *np2 = *npp2;
|
||||
double diff;
|
||||
|
||||
diff = ( np1 -> propself + np1 -> propchild )
|
||||
@ -277,6 +287,7 @@ totalcmp( npp1 , npp2 )
|
||||
return strcmp( np1 -> name , np2 -> name );
|
||||
}
|
||||
|
||||
void
|
||||
printparents( childp )
|
||||
nltype *childp;
|
||||
{
|
||||
@ -302,7 +313,7 @@ printparents( childp )
|
||||
/*
|
||||
* selfcall or call among siblings
|
||||
*/
|
||||
printf( "%6.6s %5.5s %7.7s %11.11s %7d %7.7s " ,
|
||||
printf( "%6.6s %5.5s %7.7s %11.11s %7ld %7.7s " ,
|
||||
"" , "" , "" , "" ,
|
||||
arcp -> arc_count , "" );
|
||||
printname( parentp );
|
||||
@ -311,7 +322,7 @@ printparents( childp )
|
||||
/*
|
||||
* regular parent of child
|
||||
*/
|
||||
printf( "%6.6s %5.5s %7.2f %11.2f %7d/%-7d " ,
|
||||
printf( "%6.6s %5.5s %7.2f %11.2f %7ld/%-7ld " ,
|
||||
"" , "" ,
|
||||
arcp -> arc_time / hz , arcp -> arc_childtime / hz ,
|
||||
arcp -> arc_count , cycleheadp -> npropcall );
|
||||
@ -321,6 +332,7 @@ printparents( childp )
|
||||
}
|
||||
}
|
||||
|
||||
void
|
||||
printchildren( parentp )
|
||||
nltype *parentp;
|
||||
{
|
||||
@ -336,7 +348,7 @@ printchildren( parentp )
|
||||
/*
|
||||
* self call or call to sibling
|
||||
*/
|
||||
printf( "%6.6s %5.5s %7.7s %11.11s %7d %7.7s " ,
|
||||
printf( "%6.6s %5.5s %7.7s %11.11s %7ld %7.7s " ,
|
||||
"" , "" , "" , "" , arcp -> arc_count , "" );
|
||||
printname( childp );
|
||||
printf( "\n" );
|
||||
@ -344,7 +356,7 @@ printchildren( parentp )
|
||||
/*
|
||||
* regular child of parent
|
||||
*/
|
||||
printf( "%6.6s %5.5s %7.2f %11.2f %7d/%-7d " ,
|
||||
printf( "%6.6s %5.5s %7.2f %11.2f %7ld/%-7ld " ,
|
||||
"" , "" ,
|
||||
arcp -> arc_time / hz , arcp -> arc_childtime / hz ,
|
||||
arcp -> arc_count , childp -> cyclehead -> npropcall );
|
||||
@ -354,20 +366,21 @@ printchildren( parentp )
|
||||
}
|
||||
}
|
||||
|
||||
void
|
||||
printname( selfp )
|
||||
nltype *selfp;
|
||||
{
|
||||
|
||||
if ( selfp -> name != 0 ) {
|
||||
printf( "%s" , selfp -> name );
|
||||
# ifdef DEBUG
|
||||
#ifdef DEBUG
|
||||
if ( debug & DFNDEBUG ) {
|
||||
printf( "{%d} " , selfp -> toporder );
|
||||
}
|
||||
if ( debug & PROPDEBUG ) {
|
||||
printf( "%5.2f%% " , selfp -> propfraction );
|
||||
}
|
||||
# endif DEBUG
|
||||
#endif /* DEBUG */
|
||||
}
|
||||
if ( selfp -> cycleno != 0 ) {
|
||||
printf( " <cycle %d>" , selfp -> cycleno );
|
||||
@ -381,6 +394,7 @@ printname( selfp )
|
||||
}
|
||||
}
|
||||
|
||||
void
|
||||
sortchildren( parentp )
|
||||
nltype *parentp;
|
||||
{
|
||||
@ -398,9 +412,10 @@ sortchildren( parentp )
|
||||
* *prevp arc before the arc you are comparing.
|
||||
*/
|
||||
sorted.arc_childlist = 0;
|
||||
for ( (arcp = parentp -> children)&&(detachedp = arcp -> arc_childlist);
|
||||
arcp ;
|
||||
(arcp = detachedp)&&(detachedp = detachedp -> arc_childlist)) {
|
||||
for ((void) ((arcp = parentp->children) &&
|
||||
(detachedp = arcp->arc_childlist));
|
||||
arcp ;
|
||||
(void) ((arcp = detachedp) && (detachedp = detachedp->arc_childlist))) {
|
||||
/*
|
||||
* consider *arcp as disconnected
|
||||
* insert it into sorted
|
||||
@ -421,6 +436,7 @@ sortchildren( parentp )
|
||||
parentp -> children = sorted.arc_childlist;
|
||||
}
|
||||
|
||||
void
|
||||
sortparents( childp )
|
||||
nltype *childp;
|
||||
{
|
||||
@ -438,9 +454,10 @@ sortparents( childp )
|
||||
* *prevp arc before the arc you are comparing.
|
||||
*/
|
||||
sorted.arc_parentlist = 0;
|
||||
for ( (arcp = childp -> parents)&&(detachedp = arcp -> arc_parentlist);
|
||||
arcp ;
|
||||
(arcp = detachedp)&&(detachedp = detachedp -> arc_parentlist)) {
|
||||
for ((void) ((arcp = childp->parents) &&
|
||||
(detachedp = arcp->arc_parentlist));
|
||||
arcp ;
|
||||
(void) ((arcp = detachedp) && (detachedp = detachedp->arc_parentlist))){
|
||||
/*
|
||||
* consider *arcp as disconnected
|
||||
* insert it into sorted
|
||||
@ -464,20 +481,21 @@ sortparents( childp )
|
||||
/*
|
||||
* print a cycle header
|
||||
*/
|
||||
void
|
||||
printcycle( cyclep )
|
||||
nltype *cyclep;
|
||||
{
|
||||
char kirkbuffer[ BUFSIZ ];
|
||||
|
||||
sprintf( kirkbuffer , "[%d]" , cyclep -> index );
|
||||
printf( "%-6.6s %5.1f %7.2f %11.2f %7d" ,
|
||||
printf( "%-6.6s %5.1f %7.2f %11.2f %7ld" ,
|
||||
kirkbuffer ,
|
||||
100 * ( cyclep -> propself + cyclep -> propchild ) / printtime ,
|
||||
cyclep -> propself / hz ,
|
||||
cyclep -> propchild / hz ,
|
||||
cyclep -> npropcall );
|
||||
if ( cyclep -> selfcalls != 0 ) {
|
||||
printf( "+%-7d" , cyclep -> selfcalls );
|
||||
printf( "+%-7ld" , cyclep -> selfcalls );
|
||||
} else {
|
||||
printf( " %7.7s" , "" );
|
||||
}
|
||||
@ -488,6 +506,7 @@ printcycle( cyclep )
|
||||
/*
|
||||
* print the members of a cycle
|
||||
*/
|
||||
void
|
||||
printmembers( cyclep )
|
||||
nltype *cyclep;
|
||||
{
|
||||
@ -495,11 +514,11 @@ printmembers( cyclep )
|
||||
|
||||
sortmembers( cyclep );
|
||||
for ( memberp = cyclep -> cnext ; memberp ; memberp = memberp -> cnext ) {
|
||||
printf( "%6.6s %5.5s %7.2f %11.2f %7d" ,
|
||||
printf( "%6.6s %5.5s %7.2f %11.2f %7ld" ,
|
||||
"" , "" , memberp -> propself / hz , memberp -> propchild / hz ,
|
||||
memberp -> npropcall );
|
||||
if ( memberp -> selfcalls != 0 ) {
|
||||
printf( "+%-7d" , memberp -> selfcalls );
|
||||
printf( "+%-7ld" , memberp -> selfcalls );
|
||||
} else {
|
||||
printf( " %7.7s" , "" );
|
||||
}
|
||||
@ -512,6 +531,7 @@ printmembers( cyclep )
|
||||
/*
|
||||
* sort members of a cycle
|
||||
*/
|
||||
void
|
||||
sortmembers( cyclep )
|
||||
nltype *cyclep;
|
||||
{
|
||||
@ -525,9 +545,9 @@ sortmembers( cyclep )
|
||||
*/
|
||||
todo = cyclep -> cnext;
|
||||
cyclep -> cnext = 0;
|
||||
for ( (doing = todo)&&(todo = doing -> cnext);
|
||||
doing ;
|
||||
(doing = todo )&&(todo = doing -> cnext )){
|
||||
for ((void) ((doing = todo) && (todo = doing->cnext));
|
||||
doing;
|
||||
(void) ((doing = todo ) && (todo = doing->cnext))) {
|
||||
for ( prev = cyclep ; prev -> cnext ; prev = prev -> cnext ) {
|
||||
if ( membercmp( doing , prev -> cnext ) == GREATERTHAN ) {
|
||||
break;
|
||||
@ -543,10 +563,11 @@ sortmembers( cyclep )
|
||||
* next is sort on ncalls + selfcalls.
|
||||
*/
|
||||
int
|
||||
membercmp( this , that )
|
||||
nltype *this;
|
||||
nltype *that;
|
||||
membercmp( v1 , v2 )
|
||||
const void *v1, *v2;
|
||||
{
|
||||
const nltype *this = v1;
|
||||
const nltype *that = v2;
|
||||
double thistime = this -> propself + this -> propchild;
|
||||
double thattime = that -> propself + that -> propchild;
|
||||
long thiscalls = this -> ncall + this -> selfcalls;
|
||||
@ -576,10 +597,11 @@ membercmp( this , that )
|
||||
* arc count as minor key
|
||||
*/
|
||||
int
|
||||
arccmp( thisp , thatp )
|
||||
arctype *thisp;
|
||||
arctype *thatp;
|
||||
arccmp( v1 , v2 )
|
||||
const void *v1, *v2;
|
||||
{
|
||||
const arctype *thisp = v1;
|
||||
const arctype *thatp = v2;
|
||||
nltype *thisparentp = thisp -> arc_parentp;
|
||||
nltype *thischildp = thisp -> arc_childp;
|
||||
nltype *thatparentp = thatp -> arc_parentp;
|
||||
@ -587,7 +609,7 @@ arccmp( thisp , thatp )
|
||||
double thistime;
|
||||
double thattime;
|
||||
|
||||
# ifdef DEBUG
|
||||
#ifdef DEBUG
|
||||
if ( debug & TIMEDEBUG ) {
|
||||
printf( "[arccmp] " );
|
||||
printname( thisparentp );
|
||||
@ -605,7 +627,7 @@ arccmp( thisp , thatp )
|
||||
thatp -> arc_count , thatchildp -> ncall );
|
||||
printf( "\n" );
|
||||
}
|
||||
# endif DEBUG
|
||||
#endif /* DEBUG */
|
||||
if ( thisparentp == thischildp ) {
|
||||
/* this is a self call */
|
||||
return LESSTHAN;
|
||||
@ -654,6 +676,7 @@ arccmp( thisp , thatp )
|
||||
}
|
||||
}
|
||||
|
||||
void
|
||||
printblurb( blurbname )
|
||||
char *blurbname;
|
||||
{
|
||||
@ -672,12 +695,14 @@ printblurb( blurbname )
|
||||
}
|
||||
|
||||
int
|
||||
namecmp( npp1 , npp2 )
|
||||
nltype **npp1, **npp2;
|
||||
namecmp( v1 , v2 )
|
||||
const void *v1, *v2;
|
||||
{
|
||||
const nltype *const *npp1 = v1, *const *npp2 = v2;
|
||||
return( strcmp( (*npp1) -> name , (*npp2) -> name ) );
|
||||
}
|
||||
|
||||
void
|
||||
printindex()
|
||||
{
|
||||
nltype **namesortnlp;
|
||||
|
@ -1,4 +1,4 @@
|
||||
/* $NetBSD: printlist.c,v 1.5 1995/04/19 07:16:23 cgd Exp $ */
|
||||
/* $NetBSD: printlist.c,v 1.6 1998/02/22 12:55:46 christos Exp $ */
|
||||
|
||||
/*
|
||||
* Copyright (c) 1983, 1993
|
||||
@ -33,11 +33,12 @@
|
||||
* SUCH DAMAGE.
|
||||
*/
|
||||
|
||||
#include <sys/cdefs.h>
|
||||
#ifndef lint
|
||||
#if 0
|
||||
static char sccsid[] = "@(#)printlist.c 8.1 (Berkeley) 6/6/93";
|
||||
#else
|
||||
static char rcsid[] = "$NetBSD: printlist.c,v 1.5 1995/04/19 07:16:23 cgd Exp $";
|
||||
__RCSID("$NetBSD: printlist.c,v 1.6 1998/02/22 12:55:46 christos Exp $");
|
||||
#endif
|
||||
#endif /* not lint */
|
||||
|
||||
@ -62,6 +63,7 @@ struct stringlist *elist = &ehead;
|
||||
struct stringlist Ehead = { 0 , 0 };
|
||||
struct stringlist *Elist = &Ehead;
|
||||
|
||||
void
|
||||
addlist( listp , funcname )
|
||||
struct stringlist *listp;
|
||||
char *funcname;
|
||||
|
@ -1,4 +1,4 @@
|
||||
/* $NetBSD: sparc.c,v 1.4 1995/04/19 07:16:24 cgd Exp $ */
|
||||
/* $NetBSD: sparc.c,v 1.5 1998/02/22 12:55:46 christos Exp $ */
|
||||
|
||||
/*
|
||||
* Copyright (c) 1992, 1993
|
||||
@ -37,11 +37,12 @@
|
||||
* SUCH DAMAGE.
|
||||
*/
|
||||
|
||||
#include <sys/cdefs.h>
|
||||
#ifndef lint
|
||||
#if 0
|
||||
static char sccsid[] = "@(#)sparc.c 8.1 (Berkeley) 6/6/93";
|
||||
#else
|
||||
static char rcsid[] = "$NetBSD: sparc.c,v 1.4 1995/04/19 07:16:24 cgd Exp $";
|
||||
__RCSID("$NetBSD: sparc.c,v 1.5 1998/02/22 12:55:46 christos Exp $");
|
||||
#endif
|
||||
#endif /* not lint */
|
||||
|
||||
@ -74,6 +75,7 @@ nltype indirectchild = {
|
||||
(arctype *) 0 /* list of callee arcs */
|
||||
};
|
||||
|
||||
void
|
||||
findcall(parentp, p_lowpc, p_highpc)
|
||||
nltype *parentp;
|
||||
unsigned long p_lowpc;
|
||||
|
@ -1,4 +1,4 @@
|
||||
/* $NetBSD: tahoe.c,v 1.5 1995/04/19 07:16:27 cgd Exp $ */
|
||||
/* $NetBSD: tahoe.c,v 1.6 1998/02/22 12:55:46 christos Exp $ */
|
||||
|
||||
/*
|
||||
* Copyright (c) 1983, 1993
|
||||
@ -33,11 +33,12 @@
|
||||
* SUCH DAMAGE.
|
||||
*/
|
||||
|
||||
#include <sys/cdefs.h>
|
||||
#ifndef lint
|
||||
#if 0
|
||||
static char sccsid[] = "@(#)tahoe.c 8.1 (Berkeley) 6/6/93";
|
||||
#else
|
||||
static char rcsid[] = "$NetBSD: tahoe.c,v 1.5 1995/04/19 07:16:27 cgd Exp $";
|
||||
__RCSID("$NetBSD: tahoe.c,v 1.6 1998/02/22 12:55:46 christos Exp $");
|
||||
#endif
|
||||
#endif /* not lint */
|
||||
|
||||
@ -67,6 +68,12 @@ nltype indirectchild = {
|
||||
(arctype *) 0 /* list of callee arcs */
|
||||
};
|
||||
|
||||
|
||||
operandenum operandmode __P((unsigned char *));
|
||||
char *operandname __P((operandenum));
|
||||
long operandlength __P((unsigned char *));
|
||||
unsigned long reladdr __P((char *));
|
||||
|
||||
operandenum
|
||||
operandmode( modep )
|
||||
unsigned char *modep;
|
||||
@ -225,6 +232,7 @@ reladdr( modep )
|
||||
}
|
||||
}
|
||||
|
||||
void
|
||||
findcall( parentp , p_lowpc , p_highpc )
|
||||
nltype *parentp;
|
||||
unsigned long p_lowpc;
|
||||
@ -246,12 +254,12 @@ findcall( parentp , p_lowpc , p_highpc )
|
||||
if ( p_highpc > s_highpc ) {
|
||||
p_highpc = s_highpc;
|
||||
}
|
||||
# ifdef DEBUG
|
||||
#ifdef DEBUG
|
||||
if ( debug & CALLDEBUG ) {
|
||||
printf( "[findcall] %s: 0x%x to 0x%x\n" ,
|
||||
parentp -> name , p_lowpc , p_highpc );
|
||||
}
|
||||
# endif DEBUG
|
||||
#endif /* DEBUG */
|
||||
for ( instructp = textspace + p_lowpc ;
|
||||
instructp < textspace + p_highpc ;
|
||||
instructp += length ) {
|
||||
@ -261,11 +269,11 @@ findcall( parentp , p_lowpc , p_highpc )
|
||||
* maybe a callf, better check it out.
|
||||
* skip the count of the number of arguments.
|
||||
*/
|
||||
# ifdef DEBUG
|
||||
#ifdef DEBUG
|
||||
if ( debug & CALLDEBUG ) {
|
||||
printf( "[findcall]\t0x%x:callf" , instructp - textspace );
|
||||
}
|
||||
# endif DEBUG
|
||||
#endif /* DEBUG */
|
||||
firstmode = operandmode( instructp+length );
|
||||
switch ( firstmode ) {
|
||||
case literal:
|
||||
@ -276,12 +284,12 @@ findcall( parentp , p_lowpc , p_highpc )
|
||||
}
|
||||
length += operandlength( instructp+length );
|
||||
mode = operandmode( instructp + length );
|
||||
# ifdef DEBUG
|
||||
#ifdef DEBUG
|
||||
if ( debug & CALLDEBUG ) {
|
||||
printf( "\tfirst operand is %s", operandname( firstmode ) );
|
||||
printf( "\tsecond operand is %s\n" , operandname( mode ) );
|
||||
}
|
||||
# endif DEBUG
|
||||
#endif /* DEBUG */
|
||||
switch ( mode ) {
|
||||
case regdef:
|
||||
case bytedispdef:
|
||||
@ -313,14 +321,14 @@ findcall( parentp , p_lowpc , p_highpc )
|
||||
- (unsigned long) textspace;
|
||||
if ( destpc >= s_lowpc && destpc <= s_highpc ) {
|
||||
childp = nllookup( destpc );
|
||||
# ifdef DEBUG
|
||||
#ifdef DEBUG
|
||||
if ( debug & CALLDEBUG ) {
|
||||
printf( "[findcall]\tdestpc 0x%x" , destpc );
|
||||
printf( " childp->name %s" , childp -> name );
|
||||
printf( " childp->value 0x%x\n" ,
|
||||
childp -> value );
|
||||
}
|
||||
# endif DEBUG
|
||||
#endif /* DEBUG */
|
||||
if ( childp -> value == destpc ) {
|
||||
/*
|
||||
* a hit
|
||||
@ -342,11 +350,11 @@ findcall( parentp , p_lowpc , p_highpc )
|
||||
/*
|
||||
* something funny going on.
|
||||
*/
|
||||
# ifdef DEBUG
|
||||
#ifdef DEBUG
|
||||
if ( debug & CALLDEBUG ) {
|
||||
printf( "[findcall]\tbut it's a botch\n" );
|
||||
}
|
||||
# endif DEBUG
|
||||
#endif /* DEBUG */
|
||||
length = 1;
|
||||
continue;
|
||||
}
|
||||
|
@ -1,4 +1,4 @@
|
||||
/* $NetBSD: vax.c,v 1.6 1996/04/20 14:56:37 ragge Exp $ */
|
||||
/* $NetBSD: vax.c,v 1.7 1998/02/22 12:55:46 christos Exp $ */
|
||||
|
||||
/*
|
||||
* Copyright (c) 1983, 1993
|
||||
@ -33,11 +33,12 @@
|
||||
* SUCH DAMAGE.
|
||||
*/
|
||||
|
||||
#include <sys/cdefs.h>
|
||||
#ifndef lint
|
||||
#if 0
|
||||
static char sccsid[] = "@(#)vax.c 8.1 (Berkeley) 6/6/93";
|
||||
#else
|
||||
static char rcsid[] = "$NetBSD: vax.c,v 1.6 1996/04/20 14:56:37 ragge Exp $";
|
||||
__RCSID("$NetBSD: vax.c,v 1.7 1998/02/22 12:55:46 christos Exp $");
|
||||
#endif
|
||||
#endif /* not lint */
|
||||
|
||||
@ -70,6 +71,12 @@ nltype indirectchild = {
|
||||
(arctype *) 0 /* list of callee arcs */
|
||||
};
|
||||
|
||||
|
||||
operandenum operandmode __P((unsigned char *));
|
||||
char *operandname __P((operandenum));
|
||||
long operandlength __P((unsigned char *));
|
||||
unsigned long reladdr __P((char *));
|
||||
|
||||
operandenum
|
||||
operandmode( modep )
|
||||
struct modebyte *modep;
|
||||
@ -224,6 +231,7 @@ reladdr( modep )
|
||||
}
|
||||
}
|
||||
|
||||
void
|
||||
findcall( parentp , p_lowpc , p_highpc )
|
||||
nltype *parentp;
|
||||
unsigned long p_lowpc;
|
||||
@ -245,12 +253,12 @@ findcall( parentp , p_lowpc , p_highpc )
|
||||
if ( p_highpc > s_highpc ) {
|
||||
p_highpc = s_highpc;
|
||||
}
|
||||
# ifdef DEBUG
|
||||
#ifdef DEBUG
|
||||
if ( debug & CALLDEBUG ) {
|
||||
printf( "[findcall] %s: 0x%x to 0x%x\n" ,
|
||||
parentp -> name , p_lowpc , p_highpc );
|
||||
}
|
||||
# endif DEBUG
|
||||
#endif /* DEBUG */
|
||||
for ( instructp = textspace + p_lowpc ;
|
||||
instructp < textspace + p_highpc ;
|
||||
instructp += length ) {
|
||||
@ -260,11 +268,11 @@ findcall( parentp , p_lowpc , p_highpc )
|
||||
* maybe a calls, better check it out.
|
||||
* skip the count of the number of arguments.
|
||||
*/
|
||||
# ifdef DEBUG
|
||||
#ifdef DEBUG
|
||||
if ( debug & CALLDEBUG ) {
|
||||
printf( "[findcall]\t0x%x:calls" , instructp - textspace );
|
||||
}
|
||||
# endif DEBUG
|
||||
#endif /* DEBUG */
|
||||
firstmode = operandmode( (struct modebyte *) (instructp+length) );
|
||||
switch ( firstmode ) {
|
||||
case literal:
|
||||
@ -275,12 +283,12 @@ findcall( parentp , p_lowpc , p_highpc )
|
||||
}
|
||||
length += operandlength( (struct modebyte *) (instructp+length) );
|
||||
mode = operandmode( (struct modebyte *) ( instructp + length ) );
|
||||
# ifdef DEBUG
|
||||
#ifdef DEBUG
|
||||
if ( debug & CALLDEBUG ) {
|
||||
printf( "\tfirst operand is %s", operandname( firstmode ) );
|
||||
printf( "\tsecond operand is %s\n" , operandname( mode ) );
|
||||
}
|
||||
# endif DEBUG
|
||||
#endif /* DEBUG */
|
||||
switch ( mode ) {
|
||||
case regdef:
|
||||
case bytedispdef:
|
||||
@ -313,14 +321,14 @@ findcall( parentp , p_lowpc , p_highpc )
|
||||
- (unsigned long) textspace;
|
||||
if ( destpc >= s_lowpc && destpc <= s_highpc ) {
|
||||
childp = nllookup( destpc );
|
||||
# ifdef DEBUG
|
||||
#ifdef DEBUG
|
||||
if ( debug & CALLDEBUG ) {
|
||||
printf( "[findcall]\tdestpc 0x%x" , destpc );
|
||||
printf( " childp->name %s" , childp -> name );
|
||||
printf( " childp->value 0x%x\n" ,
|
||||
childp -> value );
|
||||
}
|
||||
# endif DEBUG
|
||||
#endif /* DEBUG */
|
||||
if ( childp -> value == destpc ) {
|
||||
/*
|
||||
* a hit
|
||||
@ -343,11 +351,11 @@ findcall( parentp , p_lowpc , p_highpc )
|
||||
/*
|
||||
* something funny going on.
|
||||
*/
|
||||
# ifdef DEBUG
|
||||
#ifdef DEBUG
|
||||
if ( debug & CALLDEBUG ) {
|
||||
printf( "[findcall]\tbut it's a botch\n" );
|
||||
}
|
||||
# endif DEBUG
|
||||
#endif /* DEBUG */
|
||||
length = 1;
|
||||
continue;
|
||||
}
|
||||
|
@ -1,6 +1,5 @@
|
||||
# $NetBSD: Makefile,v 1.4 1997/10/19 14:05:48 lukem Exp $
|
||||
# $NetBSD: Makefile,v 1.5 1998/02/22 13:33:48 christos Exp $
|
||||
|
||||
WARNS= 0
|
||||
PROG= patch
|
||||
SRCS= patch.c pch.c inp.c version.c util.c backupfile.c
|
||||
|
||||
|
@ -1,4 +1,4 @@
|
||||
/* $NetBSD: backupfile.c,v 1.4 1996/09/19 06:27:07 thorpej Exp $ */
|
||||
/* $NetBSD: backupfile.c,v 1.5 1998/02/22 13:33:48 christos Exp $ */
|
||||
|
||||
/* backupfile.c -- make Emacs style backup file names
|
||||
Copyright (C) 1990 Free Software Foundation, Inc.
|
||||
@ -13,8 +13,9 @@
|
||||
/* David MacKenzie <djm@ai.mit.edu>.
|
||||
Some algorithms adapted from GNU Emacs. */
|
||||
|
||||
#include <sys/cdefs.h>
|
||||
#ifndef lint
|
||||
static char rcsid[] = "$NetBSD: backupfile.c,v 1.4 1996/09/19 06:27:07 thorpej Exp $";
|
||||
__RCSID("$NetBSD: backupfile.c,v 1.5 1998/02/22 13:33:48 christos Exp $");
|
||||
#endif /* not lint */
|
||||
|
||||
#include <stdio.h>
|
||||
@ -72,13 +73,17 @@ enum backup_type backup_type = none;
|
||||
to numbered) backup file name. */
|
||||
char *simple_backup_suffix = "~";
|
||||
|
||||
char *basename ();
|
||||
char *dirname ();
|
||||
static char *concat ();
|
||||
char *find_backup_file_name ();
|
||||
static char *make_version_name ();
|
||||
static int max_backup_version ();
|
||||
static int version_number ();
|
||||
/* backupfile.c */
|
||||
char *find_backup_file_name __P((char *));
|
||||
static int max_backup_version __P((char *, char *));
|
||||
static char *make_version_name __P((char *, int));
|
||||
static int version_number __P((char *, char *, int));
|
||||
static char *concat __P((char *, char *));
|
||||
char *basename __P((char *));
|
||||
char *dirname __P((char *));
|
||||
int argmatch __P((char *, char **));
|
||||
void invalid_arg __P((char *, char *, int));
|
||||
enum backup_type get_version __P((char *));
|
||||
|
||||
#ifndef NODIR
|
||||
/* Return the name of the new backup file for file FILE,
|
||||
|
@ -1,4 +1,4 @@
|
||||
/* $NetBSD: common.h,v 1.7 1997/11/22 22:27:12 augustss Exp $ */
|
||||
/* $NetBSD: common.h,v 1.8 1998/02/22 13:33:48 christos Exp $ */
|
||||
|
||||
#define DEBUGGING
|
||||
|
||||
@ -158,6 +158,7 @@ EXT char *revision INIT(Nullch); /* prerequisite revision, if any */
|
||||
extern int errno;
|
||||
#endif
|
||||
|
||||
#ifndef __STDC__
|
||||
FILE *popen();
|
||||
char *malloc();
|
||||
char *realloc();
|
||||
@ -173,6 +174,7 @@ char *sprintf();
|
||||
int sprintf();
|
||||
#endif
|
||||
#endif
|
||||
#endif
|
||||
|
||||
#if !defined(S_ISDIR) && defined(S_IFDIR)
|
||||
#define S_ISDIR(m) (((m) & S_IFMT) == S_IFDIR)
|
||||
@ -180,3 +182,6 @@ int sprintf();
|
||||
#if !defined(S_ISREG) && defined(S_IFREG)
|
||||
#define S_ISREG(m) (((m) & S_IFMT) == S_IFREG)
|
||||
#endif
|
||||
|
||||
void my_exit __P((int)) __attribute__((__noreturn__));
|
||||
char *basename __P((char *));
|
||||
|
@ -1,4 +1,4 @@
|
||||
/* $NetBSD: config.h,v 1.3 1996/09/19 06:27:09 thorpej Exp $ */
|
||||
/* $NetBSD: config.h,v 1.4 1998/02/22 13:33:49 christos Exp $ */
|
||||
|
||||
/* config.h
|
||||
* This file was produced by running the config.h.SH script, which
|
||||
@ -22,8 +22,8 @@
|
||||
* This symbol, if defined, indicates that the program is running under
|
||||
* VMS. It is currently only set in conjunction with the EUNICE symbol.
|
||||
*/
|
||||
#/*undef EUNICE /**/
|
||||
#/*undef VMS /**/
|
||||
#undef EUNICE
|
||||
#undef VMS
|
||||
|
||||
/* CPPSTDIN:
|
||||
* This symbol contains the first part of the string which will invoke
|
||||
@ -45,13 +45,13 @@
|
||||
* is up to the package author to declare sprintf correctly based on the
|
||||
* symbol.
|
||||
*/
|
||||
/* # CHARSPRINTF /**/
|
||||
#undef CHARSPRINTF
|
||||
|
||||
/* FLEXFILENAMES:
|
||||
* This symbol, if defined, indicates that the system supports filenames
|
||||
* longer than 14 characters.
|
||||
*/
|
||||
#define FLEXFILENAMES /**/
|
||||
#define FLEXFILENAMES
|
||||
|
||||
/* index:
|
||||
* This preprocessor symbol is defined, along with rindex, if the system
|
||||
@ -61,8 +61,10 @@
|
||||
* This preprocessor symbol is defined, along with index, if the system
|
||||
* uses the strchr and strrchr routines instead.
|
||||
*/
|
||||
#/*undef index strchr /* cultural */
|
||||
#/*undef rindex strrchr /* differences? */
|
||||
#if 0
|
||||
#define index strchr /* cultural */
|
||||
#define rindex strrchr /* differences? */
|
||||
#endif
|
||||
|
||||
/* VOIDSIG:
|
||||
* This symbol is defined if this system declares "void (*signal())()" in
|
||||
|
@ -1,5 +1,7 @@
|
||||
/* $NetBSD: inp.c,v 1.4 1998/02/22 13:33:49 christos Exp $ */
|
||||
#include <sys/cdefs.h>
|
||||
#ifndef lint
|
||||
static char rcsid[] = "$NetBSD: inp.c,v 1.3 1996/09/19 06:27:10 thorpej Exp $";
|
||||
__RCSID("$NetBSD: inp.c,v 1.4 1998/02/22 13:33:49 christos Exp $");
|
||||
#endif /* not lint */
|
||||
|
||||
#include "EXTERN.h"
|
||||
@ -9,6 +11,10 @@ static char rcsid[] = "$NetBSD: inp.c,v 1.3 1996/09/19 06:27:10 thorpej Exp $";
|
||||
#include "INTERN.h"
|
||||
#include "inp.h"
|
||||
|
||||
#include <stdlib.h>
|
||||
#include <unistd.h>
|
||||
#include <fcntl.h>
|
||||
|
||||
/* Input-file-with-indexable-lines abstract type */
|
||||
|
||||
static long i_size; /* size of the input file */
|
||||
@ -102,8 +108,9 @@ char *filename;
|
||||
strncpy(s, filename, pathlen);
|
||||
|
||||
#define try(f, a1, a2) (Sprintf(s + pathlen, f, a1, a2), stat(s, &cstat) == 0)
|
||||
#define try1(f, a1) (Sprintf(s + pathlen, f, a1), stat(s, &cstat) == 0)
|
||||
if ( try("RCS/%s%s", filebase, RCSSUFFIX)
|
||||
|| try("RCS/%s" , filebase, 0)
|
||||
|| try1("RCS/%s" , filebase)
|
||||
|| try( "%s%s", filebase, RCSSUFFIX)) {
|
||||
Sprintf(buf, CHECKOUT, filename);
|
||||
Sprintf(lbuf, RCSDIFF, filename);
|
||||
|
@ -1,12 +1,11 @@
|
||||
/* $NetBSD: inp.h,v 1.3 1996/09/19 06:27:10 thorpej Exp $ */
|
||||
/* $NetBSD: inp.h,v 1.4 1998/02/22 13:33:49 christos Exp $ */
|
||||
|
||||
EXT LINENUM input_lines INIT(0); /* how long is input file in lines */
|
||||
EXT LINENUM last_frozen_line INIT(0); /* how many input lines have been */
|
||||
/* irretractibly output */
|
||||
|
||||
bool rev_in_string();
|
||||
void scan_input();
|
||||
bool plan_a(); /* returns false if insufficient memory */
|
||||
void plan_b();
|
||||
char *ifetch();
|
||||
|
||||
void re_input __P((void));
|
||||
void scan_input __P((char *));
|
||||
bool plan_a __P((char *));
|
||||
void plan_b __P((char *));
|
||||
char *ifetch __P((Reg1 LINENUM, int));
|
||||
bool rev_in_string __P((char *));
|
||||
|
@ -1,4 +1,4 @@
|
||||
/* $NetBSD: patch.c,v 1.5 1997/03/22 03:38:06 lukem Exp $ */
|
||||
/* $NetBSD: patch.c,v 1.6 1998/02/22 13:33:49 christos Exp $ */
|
||||
|
||||
/* patch - a program to apply diffs to original files
|
||||
*
|
||||
@ -8,8 +8,9 @@
|
||||
* money off of it, or pretend that you wrote it.
|
||||
*/
|
||||
|
||||
#include <sys/cdefs.h>
|
||||
#ifndef lint
|
||||
static char rcsid[] = "$NetBSD: patch.c,v 1.5 1997/03/22 03:38:06 lukem Exp $";
|
||||
__RCSID("$NetBSD: patch.c,v 1.6 1998/02/22 13:33:49 christos Exp $");
|
||||
#endif /* not lint */
|
||||
|
||||
#include "INTERN.h"
|
||||
@ -22,23 +23,27 @@ static char rcsid[] = "$NetBSD: patch.c,v 1.5 1997/03/22 03:38:06 lukem Exp $";
|
||||
#include "backupfile.h"
|
||||
|
||||
#include <stdlib.h>
|
||||
#include <unistd.h>
|
||||
|
||||
int main __P((int, char **));
|
||||
|
||||
/* procedures */
|
||||
|
||||
void reinitialize_almost_everything();
|
||||
void get_some_switches();
|
||||
LINENUM locate_hunk();
|
||||
void abort_hunk();
|
||||
void apply_hunk();
|
||||
void init_output();
|
||||
void init_reject();
|
||||
void copy_till();
|
||||
void spew_output();
|
||||
void dump_line();
|
||||
bool patch_match();
|
||||
bool similar();
|
||||
void re_input();
|
||||
void my_exit();
|
||||
static void reinitialize_almost_everything __P((void));
|
||||
static char *nextarg __P((void));
|
||||
struct option;
|
||||
static int optcmp __P((const void *, const void *));
|
||||
static char decode_long_option __P((char *));
|
||||
static void get_some_switches __P((void));
|
||||
static LINENUM locate_hunk __P((LINENUM));
|
||||
static void abort_hunk __P((void));
|
||||
static void apply_hunk __P((LINENUM));
|
||||
static void init_output __P((char *));
|
||||
static void init_reject __P((char *));
|
||||
static void copy_till __P((Reg1 LINENUM));
|
||||
static void spew_output __P((void));
|
||||
static void dump_line __P((LINENUM));
|
||||
static bool patch_match __P((LINENUM, LINENUM, LINENUM));
|
||||
static bool similar __P((Reg1 char *, Reg2 char *, Reg3 int));
|
||||
|
||||
/* TRUE if -E was specified on command line. */
|
||||
static int remove_empty_files = FALSE;
|
||||
@ -53,7 +58,7 @@ main(argc,argv)
|
||||
int argc;
|
||||
char **argv;
|
||||
{
|
||||
LINENUM where;
|
||||
LINENUM where = 0;
|
||||
LINENUM newwhere;
|
||||
LINENUM fuzz;
|
||||
LINENUM mymaxfuzz;
|
||||
@ -333,7 +338,7 @@ char **argv;
|
||||
|
||||
/* Prepare to find the next patch to do in the patch file. */
|
||||
|
||||
void
|
||||
static void
|
||||
reinitialize_almost_everything()
|
||||
{
|
||||
re_patch();
|
||||
@ -386,16 +391,17 @@ struct option {
|
||||
char short_opt;
|
||||
};
|
||||
|
||||
int
|
||||
optcmp(a, b)
|
||||
struct option *a, *b;
|
||||
static int
|
||||
optcmp(va, vb)
|
||||
const void *va, *vb;
|
||||
{
|
||||
const struct option *a = va, *b = vb;
|
||||
return strcmp (a->long_opt, b->long_opt);
|
||||
}
|
||||
|
||||
/* Decode Long options beginning with "--" to their short equivalents. */
|
||||
|
||||
char
|
||||
static char
|
||||
decode_long_option(opt)
|
||||
char *opt;
|
||||
{
|
||||
@ -442,7 +448,7 @@ decode_long_option(opt)
|
||||
|
||||
/* Process switches and filenames up to next '+' or end of list. */
|
||||
|
||||
void
|
||||
static void
|
||||
get_some_switches()
|
||||
{
|
||||
Reg1 char *s;
|
||||
@ -577,7 +583,7 @@ Options:\n\
|
||||
|
||||
/* Attempt to find the right place to apply this hunk of patch. */
|
||||
|
||||
LINENUM
|
||||
static LINENUM
|
||||
locate_hunk(fuzz)
|
||||
LINENUM fuzz;
|
||||
{
|
||||
@ -622,7 +628,7 @@ LINENUM fuzz;
|
||||
|
||||
/* We did not find the pattern, dump out the hunk so they can handle it. */
|
||||
|
||||
void
|
||||
static void
|
||||
abort_hunk()
|
||||
{
|
||||
Reg1 LINENUM i;
|
||||
@ -668,7 +674,7 @@ abort_hunk()
|
||||
|
||||
/* We found where to apply it (we hope), so do it. */
|
||||
|
||||
void
|
||||
static void
|
||||
apply_hunk(where)
|
||||
LINENUM where;
|
||||
{
|
||||
@ -788,7 +794,7 @@ LINENUM where;
|
||||
|
||||
/* Open the new file. */
|
||||
|
||||
void
|
||||
static void
|
||||
init_output(name)
|
||||
char *name;
|
||||
{
|
||||
@ -799,7 +805,7 @@ char *name;
|
||||
|
||||
/* Open a file to put hunks we can't locate. */
|
||||
|
||||
void
|
||||
static void
|
||||
init_reject(name)
|
||||
char *name;
|
||||
{
|
||||
@ -810,7 +816,7 @@ char *name;
|
||||
|
||||
/* Copy input file to output, up to wherever hunk is to be applied. */
|
||||
|
||||
void
|
||||
static void
|
||||
copy_till(lastline)
|
||||
Reg1 LINENUM lastline;
|
||||
{
|
||||
@ -826,7 +832,7 @@ Reg1 LINENUM lastline;
|
||||
|
||||
/* Finish copying the input file to the output file. */
|
||||
|
||||
void
|
||||
static void
|
||||
spew_output()
|
||||
{
|
||||
#ifdef DEBUGGING
|
||||
@ -841,7 +847,7 @@ spew_output()
|
||||
|
||||
/* Copy one line from input to output. */
|
||||
|
||||
void
|
||||
static void
|
||||
dump_line(line)
|
||||
LINENUM line;
|
||||
{
|
||||
@ -854,7 +860,7 @@ LINENUM line;
|
||||
|
||||
/* Does the patch pattern match at line base+offset? */
|
||||
|
||||
bool
|
||||
static bool
|
||||
patch_match(base, offset, fuzz)
|
||||
LINENUM base;
|
||||
LINENUM offset;
|
||||
@ -881,7 +887,7 @@ LINENUM fuzz;
|
||||
|
||||
/* Do two lines match with canonicalized white space? */
|
||||
|
||||
bool
|
||||
static bool
|
||||
similar(a,b,len)
|
||||
Reg1 char *a;
|
||||
Reg2 char *b;
|
||||
|
@ -1,5 +1,7 @@
|
||||
/* $NetBSD: pch.c,v 1.5 1998/02/22 13:33:50 christos Exp $ */
|
||||
#include <sys/cdefs.h>
|
||||
#ifndef lint
|
||||
static char rcsid[] = "$NetBSD: pch.c,v 1.4 1997/07/29 19:49:35 phil Exp $";
|
||||
__RCSID("$NetBSD: pch.c,v 1.5 1998/02/22 13:33:50 christos Exp $");
|
||||
#endif /* not lint */
|
||||
|
||||
#include "EXTERN.h"
|
||||
@ -8,6 +10,9 @@ static char rcsid[] = "$NetBSD: pch.c,v 1.4 1997/07/29 19:49:35 phil Exp $";
|
||||
#include "INTERN.h"
|
||||
#include "pch.h"
|
||||
|
||||
#include <stdlib.h>
|
||||
#include <unistd.h>
|
||||
|
||||
/* Patch (diff listing) abstract type. */
|
||||
|
||||
static long p_filesize; /* size of the patch file */
|
||||
@ -33,6 +38,7 @@ static LINENUM p_efake = -1; /* end of faked up lines--don't free */
|
||||
static LINENUM p_bfake = -1; /* beg of faked up lines */
|
||||
|
||||
/* Prepare to look for the next patch in the patch file. */
|
||||
static void malformed __P((void));
|
||||
|
||||
void
|
||||
re_patch()
|
||||
@ -180,7 +186,7 @@ intuit_diff_type()
|
||||
Reg4 long this_line = 0;
|
||||
Reg5 long previous_line;
|
||||
Reg6 long first_command_line = -1;
|
||||
long fcl_line;
|
||||
long fcl_line = -1;
|
||||
Reg7 bool last_line_was_command = FALSE;
|
||||
Reg8 bool this_is_a_command = FALSE;
|
||||
Reg9 bool stars_last_line = FALSE;
|
||||
@ -426,15 +432,15 @@ another_hunk()
|
||||
/* file pos of the current line */
|
||||
LINENUM repl_beginning = 0; /* index of --- line */
|
||||
Reg4 LINENUM fillcnt = 0; /* #lines of missing ptrn or repl */
|
||||
Reg5 LINENUM fillsrc; /* index of first line to copy */
|
||||
Reg6 LINENUM filldst; /* index of first missing line */
|
||||
Reg5 LINENUM fillsrc = 0; /* index of first line to copy */
|
||||
Reg6 LINENUM filldst = 0; /* index of first missing line */
|
||||
bool ptrn_spaces_eaten = FALSE; /* ptrn was slightly misformed */
|
||||
Reg9 bool repl_could_be_missing = TRUE;
|
||||
/* no + or ! lines in this hunk */
|
||||
bool repl_missing = FALSE; /* we are now backtracking */
|
||||
long repl_backtrack_position = 0;
|
||||
/* file pos of first repl line */
|
||||
LINENUM repl_patch_line; /* input line number for same */
|
||||
LINENUM repl_patch_line = 0; /* input line number for same */
|
||||
Reg7 LINENUM ptrn_copiable = 0;
|
||||
/* # of copiable lines in ptrn */
|
||||
|
||||
@ -1220,7 +1226,7 @@ do_ed_script()
|
||||
Reg1 char *t;
|
||||
Reg2 long beginning_of_this_line;
|
||||
Reg3 bool this_line_is_command = FALSE;
|
||||
Reg4 FILE *pipefp;
|
||||
Reg4 FILE *pipefp = NULL;
|
||||
|
||||
if (!skip_rest_of_patch) {
|
||||
Unlink(TMPOUTNAME);
|
||||
|
@ -1,27 +1,26 @@
|
||||
/* $NetBSD: pch.h,v 1.3 1996/09/19 06:27:15 thorpej Exp $ */
|
||||
/* $NetBSD: pch.h,v 1.4 1998/02/22 13:33:50 christos Exp $ */
|
||||
|
||||
EXT FILE *pfp INIT(Nullfp); /* patch file pointer */
|
||||
|
||||
void re_patch();
|
||||
void open_patch_file();
|
||||
void set_hunkmax();
|
||||
void grow_hunkmax();
|
||||
bool there_is_another_patch();
|
||||
int intuit_diff_type();
|
||||
void next_intuit_at();
|
||||
void skip_to();
|
||||
bool another_hunk();
|
||||
bool pch_swap();
|
||||
char *pfetch();
|
||||
short pch_line_len();
|
||||
LINENUM pch_first();
|
||||
LINENUM pch_ptrn_lines();
|
||||
LINENUM pch_newfirst();
|
||||
LINENUM pch_repl_lines();
|
||||
LINENUM pch_end();
|
||||
LINENUM pch_context();
|
||||
LINENUM pch_hunk_beg();
|
||||
char pch_char();
|
||||
char *pfetch();
|
||||
char *pgets();
|
||||
void do_ed_script();
|
||||
void re_patch __P((void));
|
||||
void open_patch_file __P((char *));
|
||||
void set_hunkmax __P((void));
|
||||
void grow_hunkmax __P((void));
|
||||
bool there_is_another_patch __P((void));
|
||||
int intuit_diff_type __P((void));
|
||||
void next_intuit_at __P((long, long));
|
||||
void skip_to __P((long, long));
|
||||
bool another_hunk __P((void));
|
||||
char *pgets __P((char *, int, FILE *));
|
||||
bool pch_swap __P((void));
|
||||
LINENUM pch_first __P((void));
|
||||
LINENUM pch_ptrn_lines __P((void));
|
||||
LINENUM pch_newfirst __P((void));
|
||||
LINENUM pch_repl_lines __P((void));
|
||||
LINENUM pch_end __P((void));
|
||||
LINENUM pch_context __P((void));
|
||||
short pch_line_len __P((LINENUM));
|
||||
char pch_char __P((LINENUM));
|
||||
char *pfetch __P((LINENUM));
|
||||
LINENUM pch_hunk_beg __P((void));
|
||||
void do_ed_script __P((void));
|
||||
|
@ -1,5 +1,7 @@
|
||||
/* $NetBSD: util.c,v 1.5 1998/02/22 13:33:50 christos Exp $ */
|
||||
#include <sys/cdefs.h>
|
||||
#ifndef lint
|
||||
static char rcsid[] = "$NetBSD: util.c,v 1.4 1996/09/19 06:27:16 thorpej Exp $";
|
||||
__RCSID("$NetBSD: util.c,v 1.5 1998/02/22 13:33:50 christos Exp $");
|
||||
#endif /* not lint */
|
||||
|
||||
#include "EXTERN.h"
|
||||
@ -7,8 +9,15 @@ static char rcsid[] = "$NetBSD: util.c,v 1.4 1996/09/19 06:27:16 thorpej Exp $";
|
||||
#include "INTERN.h"
|
||||
#include "util.h"
|
||||
#include "backupfile.h"
|
||||
#ifdef __STDC__
|
||||
#include <stdarg.h>
|
||||
#else
|
||||
#include <varargs.h>
|
||||
#endif
|
||||
|
||||
void my_exit();
|
||||
#include <stdlib.h>
|
||||
#include <unistd.h>
|
||||
#include <fcntl.h>
|
||||
|
||||
/* Rename a file, copying it if necessary. */
|
||||
|
||||
@ -175,7 +184,7 @@ Reg1 char *s;
|
||||
}
|
||||
else {
|
||||
t = rv;
|
||||
while (*t++ = *s++);
|
||||
while ((*t++ = *s++) != '\0');
|
||||
}
|
||||
return rv;
|
||||
}
|
||||
@ -196,53 +205,106 @@ ask(pat) char *pat; { ; }
|
||||
/* Vanilla terminal output (buffered). */
|
||||
|
||||
void
|
||||
say(pat,arg1,arg2,arg3)
|
||||
char *pat;
|
||||
long arg1,arg2,arg3;
|
||||
#ifdef __STDC__
|
||||
say(const char *pat, ...)
|
||||
#else
|
||||
say(va_alist)
|
||||
va_dcl
|
||||
#endif
|
||||
{
|
||||
fprintf(stderr, pat, arg1, arg2, arg3);
|
||||
va_list ap;
|
||||
#ifdef __STDC__
|
||||
va_start(ap, pat);
|
||||
#else
|
||||
const char *pat;
|
||||
|
||||
va_start(ap);
|
||||
pat = va_arg(ap, const char *);
|
||||
#endif
|
||||
|
||||
vfprintf(stderr, pat, ap);
|
||||
va_end(ap);
|
||||
Fflush(stderr);
|
||||
}
|
||||
|
||||
/* Terminal output, pun intended. */
|
||||
|
||||
void /* very void */
|
||||
fatal(pat,arg1,arg2,arg3)
|
||||
char *pat;
|
||||
long arg1,arg2,arg3;
|
||||
#ifdef __STDC__
|
||||
fatal(const char *pat, ...)
|
||||
#else
|
||||
fatal(va_alist)
|
||||
va_dcl
|
||||
#endif
|
||||
{
|
||||
va_list ap;
|
||||
#ifdef __STDC__
|
||||
va_start(ap, pat);
|
||||
#else
|
||||
const char *pat;
|
||||
|
||||
va_start(ap);
|
||||
pat = va_arg(ap, const char *);
|
||||
#endif
|
||||
|
||||
fprintf(stderr, "patch: **** ");
|
||||
fprintf(stderr, pat, arg1, arg2, arg3);
|
||||
vfprintf(stderr, pat, ap);
|
||||
va_end(ap);
|
||||
my_exit(1);
|
||||
}
|
||||
|
||||
/* Say something from patch, something from the system, then silence . . . */
|
||||
|
||||
void /* very void */
|
||||
pfatal(pat,arg1,arg2,arg3)
|
||||
char *pat;
|
||||
long arg1,arg2,arg3;
|
||||
#ifdef __STDC__
|
||||
pfatal(const char *pat, ...)
|
||||
#else
|
||||
pfatal(va_alist)
|
||||
va_dcl
|
||||
#endif
|
||||
{
|
||||
va_list ap;
|
||||
int errnum = errno;
|
||||
#ifdef __STDC__
|
||||
va_start(ap, pat);
|
||||
#else
|
||||
const char *pat;
|
||||
|
||||
va_start(ap);
|
||||
pat = va_arg(ap, const char *);
|
||||
#endif
|
||||
|
||||
fprintf(stderr, "patch: **** ");
|
||||
fprintf(stderr, pat, arg1, arg2, arg3);
|
||||
vfprintf(stderr, pat, ap);
|
||||
fprintf(stderr, ": %s\n", strerror(errnum));
|
||||
va_end(ap);
|
||||
my_exit(1);
|
||||
}
|
||||
|
||||
/* Get a response from the user, somehow or other. */
|
||||
|
||||
void
|
||||
ask(pat,arg1,arg2,arg3)
|
||||
char *pat;
|
||||
long arg1,arg2,arg3;
|
||||
#ifdef __STDC__
|
||||
ask(const char *pat, ...)
|
||||
#else
|
||||
ask(va_alist)
|
||||
va_dcl
|
||||
#endif
|
||||
{
|
||||
int ttyfd;
|
||||
int r;
|
||||
bool tty2 = isatty(2);
|
||||
va_list ap;
|
||||
#ifdef __STDC__
|
||||
va_start(ap, pat);
|
||||
#else
|
||||
const char *pat;
|
||||
|
||||
Sprintf(buf, pat, arg1, arg2, arg3);
|
||||
va_start(ap);
|
||||
pat = va_arg(ap, const char *);
|
||||
#endif
|
||||
|
||||
(void) vsprintf(buf, pat, ap);
|
||||
va_end(ap);
|
||||
Fflush(stderr);
|
||||
write(2, buf, strlen(buf));
|
||||
if (tty2) { /* might be redirected to a file */
|
||||
@ -285,9 +347,9 @@ int reset;
|
||||
{
|
||||
#ifndef lint
|
||||
#ifdef VOIDSIG
|
||||
static void (*hupval)(),(*intval)();
|
||||
static void (*hupval) __P((int)),(*intval) __P((int));
|
||||
#else
|
||||
static int (*hupval)(),(*intval)();
|
||||
static int (*hupval) __P((int)),(*intval)__P((int));
|
||||
#endif
|
||||
|
||||
if (!reset) {
|
||||
@ -296,14 +358,14 @@ int reset;
|
||||
#ifdef VOIDSIG
|
||||
hupval = my_exit;
|
||||
#else
|
||||
hupval = (int(*)())my_exit;
|
||||
hupval = (int(*) __P((int)))my_exit;
|
||||
#endif
|
||||
intval = signal(SIGINT, SIG_IGN);
|
||||
if (intval != SIG_IGN)
|
||||
#ifdef VOIDSIG
|
||||
intval = my_exit;
|
||||
#else
|
||||
intval = (int(*)())my_exit;
|
||||
intval = (int(*) __P((int)))my_exit;
|
||||
#endif
|
||||
}
|
||||
Signal(SIGHUP, hupval);
|
||||
@ -427,8 +489,9 @@ int assume_exists;
|
||||
strncpy(tmpbuf, name, pathlen);
|
||||
|
||||
#define try(f, a1, a2) (Sprintf(tmpbuf + pathlen, f, a1, a2), stat(tmpbuf, &filestat) == 0)
|
||||
#define try1(f, a1) (Sprintf(tmpbuf + pathlen, f, a1), stat(tmpbuf, &filestat) == 0)
|
||||
if ( try("RCS/%s%s", filebase, RCSSUFFIX)
|
||||
|| try("RCS/%s" , filebase, 0)
|
||||
|| try1("RCS/%s" , filebase)
|
||||
|| try( "%s%s", filebase, RCSSUFFIX)
|
||||
|| try("SCCS/%s%s", SCCSPREFIX, filebase)
|
||||
|| try( "%s%s", SCCSPREFIX, filebase))
|
||||
|
@ -1,4 +1,4 @@
|
||||
/* $NetBSD: util.h,v 1.3 1996/09/19 06:27:17 thorpej Exp $ */
|
||||
/* $NetBSD: util.h,v 1.4 1998/02/22 13:33:50 christos Exp $ */
|
||||
|
||||
/* and for those machine that can't handle a variable argument list */
|
||||
|
||||
@ -68,15 +68,14 @@
|
||||
|
||||
EXT char serrbuf[BUFSIZ]; /* buffer for stderr */
|
||||
|
||||
char *fetchname();
|
||||
int move_file();
|
||||
void copy_file();
|
||||
void say();
|
||||
void fatal();
|
||||
void pfatal();
|
||||
void ask();
|
||||
char *savestr();
|
||||
void set_signals();
|
||||
void ignore_signals();
|
||||
void makedirs();
|
||||
char *basename();
|
||||
int move_file __P((char *, char *));
|
||||
void copy_file __P((char *, char *));
|
||||
char *savestr __P((Reg1 char *));
|
||||
void say __P((const char *, ...));
|
||||
void fatal __P((const char *, ...));
|
||||
void pfatal __P((const char *, ...));
|
||||
void ask __P((const char *, ...));
|
||||
void set_signals __P((int));
|
||||
void ignore_signals __P((void));
|
||||
void makedirs __P((Reg1 char *, bool));
|
||||
char *fetchname __P((char *, int, int));
|
||||
|
@ -1,5 +1,7 @@
|
||||
/* $NetBSD: version.c,v 1.4 1998/02/22 13:33:51 christos Exp $ */
|
||||
#include <sys/cdefs.h>
|
||||
#ifndef lint
|
||||
static char rcsid[] = "$NetBSD: version.c,v 1.3 1996/09/19 06:27:18 thorpej Exp $";
|
||||
__RCSID("$NetBSD: version.c,v 1.4 1998/02/22 13:33:51 christos Exp $");
|
||||
#endif /* not lint */
|
||||
|
||||
#include "EXTERN.h"
|
||||
@ -9,8 +11,6 @@ static char rcsid[] = "$NetBSD: version.c,v 1.3 1996/09/19 06:27:18 thorpej Exp
|
||||
#include "patchlevel.h"
|
||||
#include "version.h"
|
||||
|
||||
void my_exit();
|
||||
|
||||
/* Print out the version number and die. */
|
||||
|
||||
void
|
||||
|
@ -1,3 +1,3 @@
|
||||
/* $NetBSD: version.h,v 1.3 1996/09/19 06:27:18 thorpej Exp $ */
|
||||
/* $NetBSD: version.h,v 1.4 1998/02/22 13:33:51 christos Exp $ */
|
||||
|
||||
void version();
|
||||
void version __P((void));
|
||||
|
Loading…
Reference in New Issue
Block a user