mail/gprof/tip: tap with the ugly stick
The ugly stick here is this bit in the respective headers: #ifndef EXTERN #define EXTERN extern #endif with a follow-up #define EXTERN in a single .c file to push all of their definitions into one spot. A pass should be made over these three later to push these definitions into the correct files instead, but this will suffice for now and at a more leisurely pace. MFC after: 3 days
This commit is contained in:
parent
76fd19b0a2
commit
a86ddfe8c7
@ -49,6 +49,7 @@ __FBSDID("$FreeBSD$");
|
||||
#include <stdint.h>
|
||||
#include <string.h>
|
||||
|
||||
#define EXTERN
|
||||
#include "gprof.h"
|
||||
|
||||
static int valcmp(const void *, const void *);
|
||||
|
@ -75,18 +75,22 @@ typedef int bool;
|
||||
*/
|
||||
#define HISTORICAL_SCALE_2 2
|
||||
|
||||
#ifndef EXTERN
|
||||
#define EXTERN extern
|
||||
#endif
|
||||
|
||||
/*
|
||||
* ticks per second
|
||||
*/
|
||||
long hz;
|
||||
EXTERN long hz;
|
||||
|
||||
size_t histcounter_size;
|
||||
int histcounter_type;
|
||||
EXTERN size_t histcounter_size;
|
||||
EXTERN int histcounter_type;
|
||||
|
||||
char *a_outname;
|
||||
EXTERN char *a_outname;
|
||||
#define A_OUTNAME "a.out"
|
||||
|
||||
char *gmonname;
|
||||
EXTERN char *gmonname;
|
||||
#define GMONSUM "gmon.sum"
|
||||
|
||||
/*
|
||||
@ -146,9 +150,9 @@ struct nl {
|
||||
};
|
||||
typedef struct nl nltype;
|
||||
|
||||
nltype *nl; /* the whole namelist */
|
||||
nltype *npe; /* the virtual end of the namelist */
|
||||
int nname; /* the number of function names */
|
||||
EXTERN nltype *nl; /* the whole namelist */
|
||||
EXTERN nltype *npe; /* the virtual end of the namelist */
|
||||
EXTERN int nname; /* the number of function names */
|
||||
|
||||
#define HASCYCLEXIT 0x08 /* node has arc exiting from cycle */
|
||||
#define CYCLEHEAD 0x10 /* node marked as head of a cycle */
|
||||
@ -167,9 +171,9 @@ struct cl {
|
||||
};
|
||||
typedef struct cl cltype;
|
||||
|
||||
arctype *archead; /* the head of arcs in current cycle list */
|
||||
cltype *cyclehead; /* the head of the list */
|
||||
int cyclecnt; /* the number of cycles found */
|
||||
EXTERN arctype *archead; /* the head of arcs in current cycle list */
|
||||
EXTERN cltype *cyclehead; /* the head of the list */
|
||||
EXTERN int cyclecnt; /* the number of cycles found */
|
||||
#define CYCLEMAX 100 /* maximum cycles before cutting one of them */
|
||||
|
||||
/*
|
||||
@ -183,8 +187,8 @@ int cyclecnt; /* the number of cycles found */
|
||||
* namelist entries for cycle headers.
|
||||
* the number of discovered cycles.
|
||||
*/
|
||||
nltype *cyclenl; /* cycle header namelist */
|
||||
int ncycle; /* number of cycles discovered */
|
||||
EXTERN nltype *cyclenl; /* cycle header namelist */
|
||||
EXTERN int ncycle; /* number of cycles discovered */
|
||||
|
||||
/*
|
||||
* The header on the gmon.out file.
|
||||
@ -200,43 +204,46 @@ struct ophdr {
|
||||
int ncnt;
|
||||
};
|
||||
|
||||
int debug;
|
||||
EXTERN int debug;
|
||||
|
||||
/*
|
||||
* Each discretized pc sample has
|
||||
* a count of the number of samples in its range
|
||||
*/
|
||||
double *samples;
|
||||
EXTERN double *samples;
|
||||
|
||||
unsigned long s_lowpc; /* lowpc from the profile file */
|
||||
unsigned long s_highpc; /* highpc from the profile file */
|
||||
unsigned long lowpc, highpc; /* range profiled, in historical units */
|
||||
unsigned sampbytes; /* number of bytes of samples */
|
||||
int nsamples; /* number of samples */
|
||||
double actime; /* accumulated time thus far for putprofline */
|
||||
double totime; /* total time for all routines */
|
||||
double printtime; /* total of time being printed */
|
||||
double scale; /* scale factor converting samples to pc
|
||||
EXTERN unsigned long s_lowpc; /* lowpc from the profile file */
|
||||
EXTERN unsigned long s_highpc; /* highpc from the profile file */
|
||||
/* range profiled, in historical units */
|
||||
EXTERN unsigned long lowpc, highpc;
|
||||
EXTERN unsigned sampbytes; /* number of bytes of samples */
|
||||
EXTERN int nsamples; /* number of samples */
|
||||
/* accumulated time thus far for putprofline */
|
||||
EXTERN double actime;
|
||||
EXTERN double totime; /* total time for all routines */
|
||||
EXTERN double printtime; /* total of time being printed */
|
||||
EXTERN double scale; /* scale factor converting samples to pc
|
||||
values: each sample covers scale bytes */
|
||||
unsigned char *textspace; /* text space of a.out in core */
|
||||
int cyclethreshold; /* with -C, minimum cycle size to ignore */
|
||||
EXTERN unsigned char *textspace; /* text space of a.out in core */
|
||||
/* with -C, minimum cycle size to ignore */
|
||||
EXTERN int cyclethreshold;
|
||||
|
||||
/*
|
||||
* option flags, from a to z.
|
||||
*/
|
||||
bool aflag; /* suppress static functions */
|
||||
bool bflag; /* blurbs, too */
|
||||
bool Cflag; /* find cut-set to eliminate cycles */
|
||||
bool dflag; /* debugging options */
|
||||
bool eflag; /* specific functions excluded */
|
||||
bool Eflag; /* functions excluded with time */
|
||||
bool fflag; /* specific functions requested */
|
||||
bool Fflag; /* functions requested with time */
|
||||
bool kflag; /* arcs to be deleted */
|
||||
bool Kflag; /* use the running kernel for symbols */
|
||||
bool sflag; /* sum multiple gmon.out files */
|
||||
bool uflag; /* suppress symbols hidden from C */
|
||||
bool zflag; /* zero time/called functions, too */
|
||||
EXTERN bool aflag; /* suppress static functions */
|
||||
EXTERN bool bflag; /* blurbs, too */
|
||||
EXTERN bool Cflag; /* find cut-set to eliminate cycles */
|
||||
EXTERN bool dflag; /* debugging options */
|
||||
EXTERN bool eflag; /* specific functions excluded */
|
||||
EXTERN bool Eflag; /* functions excluded with time */
|
||||
EXTERN bool fflag; /* specific functions requested */
|
||||
EXTERN bool Fflag; /* functions requested with time */
|
||||
EXTERN bool kflag; /* arcs to be deleted */
|
||||
EXTERN bool Kflag; /* use the running kernel for symbols */
|
||||
EXTERN bool sflag; /* sum multiple gmon.out files */
|
||||
EXTERN bool uflag; /* suppress symbols hidden from C */
|
||||
EXTERN bool zflag; /* zero time/called functions, too */
|
||||
|
||||
/*
|
||||
* structure for various string lists
|
||||
@ -245,12 +252,12 @@ struct stringlist {
|
||||
struct stringlist *next;
|
||||
char *string;
|
||||
};
|
||||
struct stringlist *elist;
|
||||
struct stringlist *Elist;
|
||||
struct stringlist *flist;
|
||||
struct stringlist *Flist;
|
||||
struct stringlist *kfromlist;
|
||||
struct stringlist *ktolist;
|
||||
extern struct stringlist *elist;
|
||||
extern struct stringlist *Elist;
|
||||
extern struct stringlist *flist;
|
||||
extern struct stringlist *Flist;
|
||||
extern struct stringlist *kfromlist;
|
||||
extern struct stringlist *ktolist;
|
||||
|
||||
/*
|
||||
* function declarations
|
||||
|
@ -38,51 +38,51 @@
|
||||
* def.h must be included first.
|
||||
*/
|
||||
|
||||
int msgCount; /* Count of messages read in */
|
||||
int rcvmode; /* True if receiving mail */
|
||||
int sawcom; /* Set after first command */
|
||||
char *Tflag; /* -T temp file for netnews */
|
||||
int senderr; /* An error while checking */
|
||||
int edit; /* Indicates editing a file */
|
||||
int readonly; /* Will be unable to rewrite file */
|
||||
int noreset; /* String resets suspended */
|
||||
int sourcing; /* Currently reading variant file */
|
||||
int loading; /* Loading user definitions */
|
||||
int cond; /* Current state of conditional exc. */
|
||||
FILE *itf; /* Input temp file buffer */
|
||||
FILE *otf; /* Output temp file buffer */
|
||||
int image; /* File descriptor for image of msg */
|
||||
FILE *input; /* Current command input file */
|
||||
char mailname[PATHSIZE]; /* Name of current file */
|
||||
char prevfile[PATHSIZE]; /* Name of previous file */
|
||||
char *homedir; /* Path name of home directory */
|
||||
char *myname; /* My login name */
|
||||
off_t mailsize; /* Size of system mailbox */
|
||||
int lexnumber; /* Number of TNUMBER from scan() */
|
||||
char lexstring[STRINGLEN]; /* String from TSTRING, scan() */
|
||||
int regretp; /* Pointer to TOS of regret tokens */
|
||||
int regretstack[REGDEP]; /* Stack of regretted tokens */
|
||||
char *string_stack[REGDEP]; /* Stack of regretted strings */
|
||||
int numberstack[REGDEP]; /* Stack of regretted numbers */
|
||||
struct message *dot; /* Pointer to current message */
|
||||
struct message *message; /* The actual message structure */
|
||||
struct var *variables[HSHSIZE]; /* Pointer to active var list */
|
||||
struct grouphead *groups[HSHSIZE];/* Pointer to active groups */
|
||||
struct ignoretab ignore[2]; /* ignored and retained fields
|
||||
extern int msgCount; /* Count of messages read in */
|
||||
extern int rcvmode; /* True if receiving mail */
|
||||
extern int sawcom; /* Set after first command */
|
||||
extern char *Tflag; /* -T temp file for netnews */
|
||||
extern int senderr; /* An error while checking */
|
||||
extern int edit; /* Indicates editing a file */
|
||||
extern int readonly; /* Will be unable to rewrite file */
|
||||
extern int noreset; /* String resets suspended */
|
||||
extern int sourcing; /* Currently reading variant file */
|
||||
extern int loading; /* Loading user definitions */
|
||||
extern int cond; /* Current state of conditional exc. */
|
||||
extern FILE *itf; /* Input temp file buffer */
|
||||
extern FILE *otf; /* Output temp file buffer */
|
||||
extern int image; /* File descriptor for image of msg */
|
||||
extern FILE *input; /* Current command input file */
|
||||
extern char mailname[PATHSIZE]; /* Name of current file */
|
||||
extern char prevfile[PATHSIZE]; /* Name of previous file */
|
||||
extern char *homedir; /* Path name of home directory */
|
||||
extern char *myname; /* My login name */
|
||||
extern off_t mailsize; /* Size of system mailbox */
|
||||
extern int lexnumber; /* Number of TNUMBER from scan() */
|
||||
extern char lexstring[STRINGLEN]; /* String from TSTRING, scan() */
|
||||
extern int regretp; /* Pointer to TOS of regret tokens */
|
||||
extern int regretstack[REGDEP]; /* Stack of regretted tokens */
|
||||
extern char *string_stack[REGDEP]; /* Stack of regretted strings */
|
||||
extern int numberstack[REGDEP]; /* Stack of regretted numbers */
|
||||
extern struct message *dot; /* Pointer to current message */
|
||||
extern struct message *message; /* The actual message structure */
|
||||
extern struct var *variables[HSHSIZE]; /* Pointer to active var list */
|
||||
extern struct grouphead *groups[HSHSIZE];/* Pointer to active groups */
|
||||
extern struct ignoretab ignore[2]; /* ignored and retained fields
|
||||
0 is ignore, 1 is retain */
|
||||
struct ignoretab saveignore[2]; /* ignored and retained fields
|
||||
extern struct ignoretab saveignore[2]; /* ignored and retained fields
|
||||
on save to folder */
|
||||
struct ignoretab ignoreall[2]; /* special, ignore all headers */
|
||||
char **altnames; /* List of alternate names for user */
|
||||
int debug; /* Debug flag set */
|
||||
int screenwidth; /* Screen width, or best guess */
|
||||
int screenheight; /* Screen height, or best guess,
|
||||
extern struct ignoretab ignoreall[2]; /* special, ignore all headers */
|
||||
extern char **altnames; /* List of alternate names for user */
|
||||
extern int debug; /* Debug flag set */
|
||||
extern int screenwidth; /* Screen width, or best guess */
|
||||
extern int screenheight; /* Screen height, or best guess,
|
||||
for "header" command */
|
||||
int realscreenheight; /* the real screen height */
|
||||
extern int realscreenheight; /* the real screen height */
|
||||
|
||||
#include <setjmp.h>
|
||||
|
||||
jmp_buf srbuf;
|
||||
extern jmp_buf srbuf;
|
||||
|
||||
|
||||
/*
|
||||
@ -93,7 +93,7 @@ jmp_buf srbuf;
|
||||
*/
|
||||
|
||||
#define NSPACE 25 /* Total number of string spaces */
|
||||
struct strings {
|
||||
extern struct strings {
|
||||
char *s_topFree; /* Beginning of this area */
|
||||
char *s_nextFree; /* Next alloctable place here */
|
||||
unsigned s_nleft; /* Number of bytes left here */
|
||||
|
@ -52,6 +52,49 @@ __FBSDID("$FreeBSD$");
|
||||
*
|
||||
* Startup -- interface with user.
|
||||
*/
|
||||
int msgCount;
|
||||
int rcvmode;
|
||||
int sawcom;
|
||||
char *Tflag;
|
||||
int senderr;
|
||||
int edit;
|
||||
int readonly;
|
||||
int noreset;
|
||||
int sourcing;
|
||||
int loading;
|
||||
int cond;
|
||||
FILE *itf;
|
||||
FILE *otf;
|
||||
int image;
|
||||
FILE *input;
|
||||
char mailname[PATHSIZE];
|
||||
char prevfile[PATHSIZE];
|
||||
char *homedir;
|
||||
char *myname;
|
||||
off_t mailsize;
|
||||
int lexnumber;
|
||||
char lexstring[STRINGLEN];
|
||||
int regretp;
|
||||
int regretstack[REGDEP];
|
||||
char *string_stack[REGDEP];
|
||||
int numberstack[REGDEP];
|
||||
struct message *dot;
|
||||
struct message *message;
|
||||
struct var *variables[HSHSIZE];
|
||||
struct grouphead *groups[HSHSIZE];
|
||||
struct ignoretab ignore[2];
|
||||
|
||||
struct ignoretab saveignore[2];
|
||||
|
||||
struct ignoretab ignoreall[2];
|
||||
char **altnames;
|
||||
int debug;
|
||||
int screenwidth;
|
||||
int screenheight;
|
||||
|
||||
int realscreenheight;
|
||||
|
||||
jmp_buf srbuf;
|
||||
|
||||
static jmp_buf hdrjmp;
|
||||
|
||||
|
@ -48,6 +48,8 @@ __FBSDID("$FreeBSD$");
|
||||
#include "rcv.h"
|
||||
#include "extern.h"
|
||||
|
||||
struct strings stringdope[NSPACE];
|
||||
|
||||
/*
|
||||
* Allocate size more bytes of space and return the address of the
|
||||
* first byte to the caller. An even number of bytes are always
|
||||
|
@ -54,6 +54,7 @@ static const char rcsid[] = "$OpenBSD: tip.c,v 1.30 2006/08/18 03:06:18 jason Ex
|
||||
* or
|
||||
* cu phone-number [-s speed] [-l line] [-a acu]
|
||||
*/
|
||||
#define EXTERN
|
||||
#include "tip.h"
|
||||
#include "pathnames.h"
|
||||
|
||||
|
@ -58,40 +58,44 @@
|
||||
#include <errno.h>
|
||||
#include <limits.h>
|
||||
|
||||
#ifndef EXTERN
|
||||
#define EXTERN extern
|
||||
#endif
|
||||
|
||||
/*
|
||||
* Remote host attributes
|
||||
*/
|
||||
char *DV; /* UNIX device(s) to open */
|
||||
char *EL; /* chars marking an EOL */
|
||||
char *CM; /* initial connection message */
|
||||
char *IE; /* EOT to expect on input */
|
||||
char *OE; /* EOT to send to complete FT */
|
||||
char *CU; /* call unit if making a phone call */
|
||||
char *AT; /* acu type */
|
||||
char *PN; /* phone number(s) */
|
||||
char *DI; /* disconnect string */
|
||||
char *PA; /* parity to be generated */
|
||||
EXTERN char *DV; /* UNIX device(s) to open */
|
||||
EXTERN char *EL; /* chars marking an EOL */
|
||||
EXTERN char *CM; /* initial connection message */
|
||||
EXTERN char *IE; /* EOT to expect on input */
|
||||
EXTERN char *OE; /* EOT to send to complete FT */
|
||||
EXTERN char *CU; /* call unit if making a phone call */
|
||||
EXTERN char *AT; /* acu type */
|
||||
EXTERN char *PN; /* phone number(s) */
|
||||
EXTERN char *DI; /* disconnect string */
|
||||
EXTERN char *PA; /* parity to be generated */
|
||||
|
||||
char *PH; /* phone number file */
|
||||
char *RM; /* remote file name */
|
||||
char *HO; /* host name */
|
||||
EXTERN char *PH; /* phone number file */
|
||||
EXTERN char *RM; /* remote file name */
|
||||
EXTERN char *HO; /* host name */
|
||||
|
||||
long BR; /* line speed for conversation */
|
||||
long FS; /* frame size for transfers */
|
||||
EXTERN long BR; /* line speed for conversation */
|
||||
EXTERN long FS; /* frame size for transfers */
|
||||
|
||||
short DU; /* this host is dialed up */
|
||||
short HW; /* this device is hardwired, see hunt.c */
|
||||
char *ES; /* escape character */
|
||||
char *EX; /* exceptions */
|
||||
char *FO; /* force (literal next) char*/
|
||||
char *RC; /* raise character */
|
||||
char *RE; /* script record file */
|
||||
char *PR; /* remote prompt */
|
||||
long DL; /* line delay for file transfers to remote */
|
||||
long CL; /* char delay for file transfers to remote */
|
||||
long ET; /* echocheck timeout */
|
||||
long LD; /* line disc */
|
||||
short HD; /* this host is half duplex - do local echo */
|
||||
EXTERN short DU; /* this host is dialed up */
|
||||
EXTERN short HW; /* this device is hardwired, see hunt.c */
|
||||
EXTERN char *ES; /* escape character */
|
||||
EXTERN char *EX; /* exceptions */
|
||||
EXTERN char *FO; /* force (literal next) char*/
|
||||
EXTERN char *RC; /* raise character */
|
||||
EXTERN char *RE; /* script record file */
|
||||
EXTERN char *PR; /* remote prompt */
|
||||
EXTERN long DL; /* line delay for file transfers to remote */
|
||||
EXTERN long CL; /* char delay for file transfers to remote */
|
||||
EXTERN long ET; /* echocheck timeout */
|
||||
EXTERN long LD; /* line disc */
|
||||
EXTERN short HD; /* this host is half duplex - do local echo */
|
||||
|
||||
/*
|
||||
* String value table
|
||||
@ -237,39 +241,39 @@ extern value_t vtable[]; /* variable table */
|
||||
#define NOFILE ((FILE *)NULL)
|
||||
#define NOPWD ((struct passwd *)0)
|
||||
|
||||
struct termios term; /* current mode of terminal */
|
||||
struct termios defterm; /* initial mode of terminal */
|
||||
struct termios defchars; /* current mode with initial chars */
|
||||
int gotdefterm;
|
||||
EXTERN struct termios term; /* current mode of terminal */
|
||||
EXTERN struct termios defterm; /* initial mode of terminal */
|
||||
EXTERN struct termios defchars; /* current mode with initial chars */
|
||||
EXTERN int gotdefterm;
|
||||
|
||||
FILE *fscript; /* FILE for scripting */
|
||||
EXTERN FILE *fscript; /* FILE for scripting */
|
||||
|
||||
int fildes[2]; /* file transfer synchronization channel */
|
||||
int repdes[2]; /* read process sychronization channel */
|
||||
int FD; /* open file descriptor to remote host */
|
||||
int AC; /* open file descriptor to dialer (v831 only) */
|
||||
int vflag; /* print .tiprc initialization sequence */
|
||||
int noesc; /* no `~' escape char */
|
||||
int sfd; /* for ~< operation */
|
||||
pid_t tipin_pid; /* pid of tipin */
|
||||
pid_t tipout_pid; /* pid of tipout */
|
||||
uid_t uid, euid; /* real and effective user id's */
|
||||
gid_t gid, egid; /* real and effective group id's */
|
||||
int stop; /* stop transfer session flag */
|
||||
int quit; /* same; but on other end */
|
||||
int intflag; /* recognized interrupt */
|
||||
int stoprompt; /* for interrupting a prompt session */
|
||||
int timedout; /* ~> transfer timedout */
|
||||
int cumode; /* simulating the "cu" program */
|
||||
int bits8; /* terminal is 8-bit mode */
|
||||
EXTERN int fildes[2]; /* file transfer synchronization channel */
|
||||
EXTERN int repdes[2]; /* read process sychronization channel */
|
||||
EXTERN int FD; /* open file descriptor to remote host */
|
||||
EXTERN int AC; /* open file descriptor to dialer (v831 only) */
|
||||
EXTERN int vflag; /* print .tiprc initialization sequence */
|
||||
EXTERN int noesc; /* no `~' escape char */
|
||||
EXTERN int sfd; /* for ~< operation */
|
||||
EXTERN pid_t tipin_pid; /* pid of tipin */
|
||||
EXTERN pid_t tipout_pid; /* pid of tipout */
|
||||
EXTERN uid_t uid, euid; /* real and effective user id's */
|
||||
EXTERN gid_t gid, egid; /* real and effective group id's */
|
||||
EXTERN int stop; /* stop transfer session flag */
|
||||
EXTERN int quit; /* same; but on other end */
|
||||
EXTERN int intflag; /* recognized interrupt */
|
||||
EXTERN int stoprompt; /* for interrupting a prompt session */
|
||||
EXTERN int timedout; /* ~> transfer timedout */
|
||||
EXTERN int cumode; /* simulating the "cu" program */
|
||||
EXTERN int bits8; /* terminal is 8-bit mode */
|
||||
#define STRIP_PAR (bits8 ? 0377 : 0177)
|
||||
|
||||
char fname[PATH_MAX]; /* file name buffer for ~< */
|
||||
char copyname[PATH_MAX]; /* file name buffer for ~> */
|
||||
char ccc; /* synchronization character */
|
||||
char *uucplock; /* name of lock file for uucp's */
|
||||
EXTERN char fname[PATH_MAX]; /* file name buffer for ~< */
|
||||
EXTERN char copyname[PATH_MAX]; /* file name buffer for ~> */
|
||||
EXTERN char ccc; /* synchronization character */
|
||||
EXTERN char *uucplock; /* name of lock file for uucp's */
|
||||
|
||||
int odisc; /* initial tty line discipline */
|
||||
EXTERN int odisc; /* initial tty line discipline */
|
||||
extern int disc; /* current tty discpline */
|
||||
|
||||
extern char *__progname; /* program name */
|
||||
|
Loading…
Reference in New Issue
Block a user