diff options
author | charnier <charnier@FreeBSD.org> | 1997-07-10 06:45:02 +0000 |
---|---|---|
committer | charnier <charnier@FreeBSD.org> | 1997-07-10 06:45:02 +0000 |
commit | 3e5d2f9ca56d4333f70c1ca8d3b4c882ace01e89 (patch) | |
tree | 54a9925733c8cac2abef93a67a8af5379fe30126 /usr.bin/gprof | |
parent | fecd0ac4cdef9377593fc851182a346a94294b0e (diff) | |
download | FreeBSD-src-3e5d2f9ca56d4333f70c1ca8d3b4c882ace01e89.zip FreeBSD-src-3e5d2f9ca56d4333f70c1ca8d3b4c882ace01e89.tar.gz |
Use err(3).
Diffstat (limited to 'usr.bin/gprof')
-rw-r--r-- | usr.bin/gprof/arcs.c | 20 | ||||
-rw-r--r-- | usr.bin/gprof/gprof.c | 46 | ||||
-rw-r--r-- | usr.bin/gprof/gprof.h | 5 | ||||
-rw-r--r-- | usr.bin/gprof/printgprof.c | 7 | ||||
-rw-r--r-- | usr.bin/gprof/printlist.c | 7 |
5 files changed, 42 insertions, 43 deletions
diff --git a/usr.bin/gprof/arcs.c b/usr.bin/gprof/arcs.c index 2c22469..2a06220 100644 --- a/usr.bin/gprof/arcs.c +++ b/usr.bin/gprof/arcs.c @@ -32,9 +32,14 @@ */ #ifndef lint -static char sccsid[] = "@(#)arcs.c 8.1 (Berkeley) 6/6/93"; +#if 0 +static char sccsid[] = "@(#)arcs.c 8.1 (Berkeley) 6/6/93";Q +#endif +static const char rcsid[] = + "$Id$"; #endif /* not lint */ +#include <err.h> #include "gprof.h" #ifdef DEBUG @@ -235,7 +240,7 @@ doarcs() */ timesortnlp = (nltype **) calloc( nname + ncycle , sizeof(nltype *) ); if ( timesortnlp == (nltype **) 0 ) { - fprintf( stderr , "%s: ran out of memory for sorting\n" , whoami ); + warnx("ran out of memory for sorting"); } for ( index = 0 ; index < nname ; index++ ) { timesortnlp[index] = &nl[index]; @@ -374,8 +379,7 @@ cyclelink() */ cyclenl = (nltype *) calloc( ncycle + 1 , sizeof( nltype ) ); if ( cyclenl == 0 ) { - fprintf( stderr , "%s: No room for %d bytes of cycle headers\n" , - whoami , ( ncycle + 1 ) * sizeof( nltype ) ); + warnx("no room for %d bytes of cycle headers", (ncycle+1)*sizeof(nltype) ); done(); } /* @@ -478,8 +482,7 @@ cycleanalyze() done = FALSE; cyclestack = (arctype **) calloc( size + 1 , sizeof( arctype *) ); if ( cyclestack == 0 ) { - fprintf( stderr , "%s: No room for %d bytes of cycle stack\n" , - whoami , ( size + 1 ) * sizeof( arctype * ) ); + warnx("no room for %d bytes of cycle stack", (size+1)*sizeof(arctype *) ); return; } # ifdef DEBUG @@ -595,8 +598,8 @@ addcycle( stkstart , stkend ) clp = (cltype *) calloc( 1 , sizeof ( cltype ) + ( size - 1 ) * sizeof( arctype * ) ); if ( clp == 0 ) { - fprintf( stderr , "%s: No room for %d bytes of subcycle storage\n" , - whoami , sizeof ( cltype ) + ( size - 1 ) * sizeof( arctype * ) ); + warnx("no room for %d bytes of subcycle storage", + sizeof ( cltype ) + ( size - 1 ) * sizeof( arctype * ) ); return( FALSE ); } stkp = stkloc; @@ -641,7 +644,6 @@ compresslist() int maxexitcnt; int maxwithparentcnt; int maxnoparentcnt; - char *type; maxexitcnt = 0; maxwithparentcnt = 0; diff --git a/usr.bin/gprof/gprof.c b/usr.bin/gprof/gprof.c index 0dbb187..eba73ad 100644 --- a/usr.bin/gprof/gprof.c +++ b/usr.bin/gprof/gprof.c @@ -32,19 +32,22 @@ */ #ifndef lint -static char copyright[] = +static const char 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"; +#endif +static const char rcsid[] = + "$Id$"; #endif /* not lint */ +#include <err.h> #include "gprof.h" -char *whoami = "gprof"; - /* * things which get -E excluded by default. */ @@ -83,8 +86,7 @@ main(argc, argv) #if defined(vax) || defined(tahoe) cflag = TRUE; #else - fprintf(stderr, "gprof: -c isn't supported on this architecture yet\n"); - exit(1); + errx(1, "-c isn't supported on this architecture yet"); #endif break; case 'd': @@ -95,7 +97,7 @@ main(argc, argv) # ifdef DEBUG printf("[main] debug = %d\n", debug); # else not DEBUG - printf("%s: -d ignored\n", whoami); + printf("gprof: -d ignored\n"); # endif DEBUG break; case 'E': @@ -237,7 +239,7 @@ getnfile() } fread(&xbuf, 1, sizeof(xbuf), nfile); if (N_BADMAG(xbuf)) { - fprintf(stderr, "%s: %s: bad format\n", whoami , a_outname ); + warnx("%s: bad format", a_outname ); done(); } getstrtab(nfile); @@ -262,19 +264,16 @@ getstrtab(nfile) fseek(nfile, (long)(N_SYMOFF(xbuf) + xbuf.a_syms), 0); if (fread(&ssiz, sizeof (ssiz), 1, nfile) == 0) { - fprintf(stderr, "%s: %s: no string table (old format?)\n" , - whoami , a_outname ); + warnx("%s: no string table (old format?)" , a_outname ); done(); } strtab = calloc(ssiz, 1); if (strtab == NULL) { - fprintf(stderr, "%s: %s: no room for %d bytes of string table\n", - whoami , a_outname , ssiz); + warnx("%s: no room for %d bytes of string table", a_outname , ssiz); done(); } if (fread(strtab+sizeof(ssiz), ssiz-sizeof(ssiz), 1, nfile) != 1) { - fprintf(stderr, "%s: %s: error reading string table\n", - whoami , a_outname ); + warnx("%s: error reading string table", a_outname ); done(); } } @@ -300,14 +299,13 @@ getsymtab(nfile) nname++; } if (nname == 0) { - fprintf(stderr, "%s: %s: no symbols\n", whoami , a_outname ); + warnx("%s: no symbols", a_outname ); done(); } askfor = nname + 1; nl = (nltype *) calloc( askfor , sizeof(nltype) ); if (nl == 0) { - fprintf(stderr, "%s: No room for %d bytes of symbol table\n", - whoami, askfor * sizeof(nltype) ); + warnx("no room for %d bytes of symbol table", askfor * sizeof(nltype) ); done(); } @@ -352,15 +350,12 @@ gettextspace( nfile ) } textspace = (u_char *) malloc( xbuf.a_text ); if ( textspace == 0 ) { - fprintf( stderr , "%s: ran out room for %d bytes of text space: " , - whoami , xbuf.a_text ); - fprintf( stderr , "can't do -c\n" ); + warnx("ran out room for %d bytes of text space: can't do -c" , xbuf.a_text ); return; } (void) fseek( nfile , N_TXTOFF( xbuf ) , 0 ); if ( fread( textspace , 1 , xbuf.a_text , nfile ) != xbuf.a_text ) { - fprintf( stderr , "%s: couldn't read text space: " , whoami ); - fprintf( stderr , "can't do -c\n" ); + warnx("couldn't read text space: can't do -c"); free( textspace ); textspace = 0; return; @@ -415,7 +410,7 @@ openpfile(filename) fread(&tmp, sizeof(struct gmonhdr), 1, pfile); if ( s_highpc != 0 && ( tmp.lpc != gmonhdr.lpc || tmp.hpc != gmonhdr.hpc || tmp.ncnt != gmonhdr.ncnt ) ) { - fprintf(stderr, "%s: incompatible with first gmon file\n", filename); + warnx("%s: incompatible with first gmon file", filename); done(); } gmonhdr = tmp; @@ -556,8 +551,7 @@ readsamples(pfile) if (samples == 0) { samples = (UNIT *) calloc(sampbytes, sizeof (UNIT)); if (samples == 0) { - fprintf( stderr , "%s: No room for %d sample pc's\n", - whoami , sampbytes / sizeof (UNIT)); + warnx("no room for %d sample pc's", sampbytes / sizeof (UNIT)); done(); } } @@ -568,9 +562,7 @@ readsamples(pfile) samples[i] += sample; } if (i != nsamples) { - fprintf(stderr, - "%s: unexpected EOF after reading %d/%d samples\n", - whoami , --i , nsamples ); + warnx("unexpected EOF after reading %d/%d samples", --i , nsamples ); done(); } } diff --git a/usr.bin/gprof/gprof.h b/usr.bin/gprof/gprof.h index 27808d2..4dc053e 100644 --- a/usr.bin/gprof/gprof.h +++ b/usr.bin/gprof/gprof.h @@ -65,11 +65,6 @@ /* - * who am i, for error messages. - */ -char *whoami; - - /* * booleans */ typedef int bool; diff --git a/usr.bin/gprof/printgprof.c b/usr.bin/gprof/printgprof.c index 0b039df..9c122bb 100644 --- a/usr.bin/gprof/printgprof.c +++ b/usr.bin/gprof/printgprof.c @@ -32,9 +32,14 @@ */ #ifndef lint +#if 0 static char sccsid[] = "@(#)printgprof.c 8.1 (Berkeley) 6/6/93"; +#endif +static const char rcsid[] = + "$Id$"; #endif /* not lint */ +#include <err.h> #include "gprof.h" #include "pathnames.h" @@ -698,7 +703,7 @@ printindex() */ namesortnlp = (nltype **) calloc( nname + ncycle , sizeof(nltype *) ); if ( namesortnlp == (nltype **) 0 ) { - fprintf( stderr , "%s: ran out of memory for sorting\n" , whoami ); + warnx("ran out of memory for sorting"); } for ( index = 0 , nnames = 0 ; index < nname ; index++ ) { if ( zflag == 0 && nl[index].ncall == 0 && nl[index].time == 0 ) diff --git a/usr.bin/gprof/printlist.c b/usr.bin/gprof/printlist.c index f29ecc9..15af8e1 100644 --- a/usr.bin/gprof/printlist.c +++ b/usr.bin/gprof/printlist.c @@ -32,9 +32,14 @@ */ #ifndef lint +#if 0 static char sccsid[] = "@(#)printlist.c 8.1 (Berkeley) 6/6/93"; +#endif +static const char rcsid[] = + "$Id$"; #endif /* not lint */ +#include <err.h> #include "gprof.h" /* @@ -64,7 +69,7 @@ addlist( listp , funcname ) slp = (struct stringlist *) malloc( sizeof(struct stringlist)); if ( slp == (struct stringlist *) 0 ) { - fprintf( stderr, "gprof: ran out room for printlist\n" ); + warnx("ran out room for printlist"); done(); } slp -> next = listp -> next; |