Let lpr build with -Wmissing-variable-declarations.

Mark variables static where possible and place the uid/euid variables in
lp.h, so that we can compile-time enforce that these variables have the
same type.
This commit is contained in:
Ed Schouten 2012-10-25 20:16:38 +00:00
parent 1e0706fdf7
commit 6511bcb8c0
7 changed files with 14 additions and 21 deletions

View File

@ -70,8 +70,6 @@ __FBSDID("$FreeBSD$");
char line[BUFSIZ];
const char *progname; /* program name */
extern uid_t uid, euid;
static int compar(const void *_p1, const void *_p2);
/*

View File

@ -75,8 +75,6 @@ __FBSDID("$FreeBSD$");
/*
* Stuff for handling job specifications
*/
extern uid_t uid, euid;
static int col; /* column on screen */
static char current[MAXNAMLEN+1]; /* current file being printed */
static char file[MAXNAMLEN+1]; /* print file name */

View File

@ -252,6 +252,9 @@ typedef enum { TR_SENDING, TR_RECVING, TR_PRINTING } tr_sendrecv;
/*
* seteuid() macros.
*/
extern uid_t uid, euid;
#define PRIV_START { \
if (seteuid(euid) != 0) err(1, "seteuid failed"); \
}

View File

@ -80,8 +80,6 @@ u_char family = PF_UNSPEC;
u_char family = PF_INET;
#endif
extern uid_t uid, euid;
/*
* Create a TCP connection to host "rhost" at port "rport".
* If rport == 0, then use the printer service port.

View File

@ -69,8 +69,6 @@ static int all = 0; /* eliminate all files (root only) */
static int cur_daemon; /* daemon's pid */
static char current[7+MAXHOSTNAMELEN]; /* active control file name */
extern uid_t uid, euid; /* real and effective user id's */
static void alarmhandler(int _signo);
static void do_unlink(char *_file);
static int isowner(char *_owner, char *_file, const char *_cfhost);

View File

@ -49,8 +49,6 @@ __FBSDID("$FreeBSD$");
#include "lp.h"
#include "pathnames.h"
extern uid_t uid, euid;
/*
* Tell the printer daemon that there are new files in the spool directory.
*/

View File

@ -60,17 +60,17 @@ __FBSDID("$FreeBSD$");
#define MAXWIDTH 132
#define MAXREP 10
char buf[MAXREP][MAXWIDTH];
int maxcol[MAXREP] = {-1};
int lineno;
int width = 132; /* default line length */
int length = 66; /* page length */
int indent; /* indentation length */
int npages = 1;
int literal; /* print control characters */
char *name; /* user's login name */
char *host; /* user's machine name */
char *acctfile; /* accounting information file */
static char buf[MAXREP][MAXWIDTH];
static int maxcol[MAXREP] = {-1};
static int lineno;
static int width = 132; /* default line length */
static int length = 66; /* page length */
static int indent; /* indentation length */
static int npages = 1;
static int literal; /* print control characters */
static char *name; /* user's login name */
static char *host; /* user's machine name */
static char *acctfile; /* accounting information file */
int
main(int argc, char *argv[])