svn commit: r242091 - in head/usr.sbin/lpr: common_source filters
Ed Schouten
ed at FreeBSD.org
Thu Oct 25 20:16:39 UTC 2012
Author: ed
Date: Thu Oct 25 20:16:38 2012
New Revision: 242091
URL: http://svn.freebsd.org/changeset/base/242091
Log:
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.
Modified:
head/usr.sbin/lpr/common_source/common.c
head/usr.sbin/lpr/common_source/displayq.c
head/usr.sbin/lpr/common_source/lp.h
head/usr.sbin/lpr/common_source/net.c
head/usr.sbin/lpr/common_source/rmjob.c
head/usr.sbin/lpr/common_source/startdaemon.c
head/usr.sbin/lpr/filters/lpf.c
Modified: head/usr.sbin/lpr/common_source/common.c
==============================================================================
--- head/usr.sbin/lpr/common_source/common.c Thu Oct 25 19:30:58 2012 (r242090)
+++ head/usr.sbin/lpr/common_source/common.c Thu Oct 25 20:16:38 2012 (r242091)
@@ -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);
/*
Modified: head/usr.sbin/lpr/common_source/displayq.c
==============================================================================
--- head/usr.sbin/lpr/common_source/displayq.c Thu Oct 25 19:30:58 2012 (r242090)
+++ head/usr.sbin/lpr/common_source/displayq.c Thu Oct 25 20:16:38 2012 (r242091)
@@ -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 */
Modified: head/usr.sbin/lpr/common_source/lp.h
==============================================================================
--- head/usr.sbin/lpr/common_source/lp.h Thu Oct 25 19:30:58 2012 (r242090)
+++ head/usr.sbin/lpr/common_source/lp.h Thu Oct 25 20:16:38 2012 (r242091)
@@ -252,6 +252,9 @@ typedef enum { TR_SENDING, TR_RECVING, T
/*
* seteuid() macros.
*/
+
+extern uid_t uid, euid;
+
#define PRIV_START { \
if (seteuid(euid) != 0) err(1, "seteuid failed"); \
}
Modified: head/usr.sbin/lpr/common_source/net.c
==============================================================================
--- head/usr.sbin/lpr/common_source/net.c Thu Oct 25 19:30:58 2012 (r242090)
+++ head/usr.sbin/lpr/common_source/net.c Thu Oct 25 20:16:38 2012 (r242091)
@@ -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.
Modified: head/usr.sbin/lpr/common_source/rmjob.c
==============================================================================
--- head/usr.sbin/lpr/common_source/rmjob.c Thu Oct 25 19:30:58 2012 (r242090)
+++ head/usr.sbin/lpr/common_source/rmjob.c Thu Oct 25 20:16:38 2012 (r242091)
@@ -69,8 +69,6 @@ static int all = 0; /* eliminate all fi
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);
Modified: head/usr.sbin/lpr/common_source/startdaemon.c
==============================================================================
--- head/usr.sbin/lpr/common_source/startdaemon.c Thu Oct 25 19:30:58 2012 (r242090)
+++ head/usr.sbin/lpr/common_source/startdaemon.c Thu Oct 25 20:16:38 2012 (r242091)
@@ -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.
*/
Modified: head/usr.sbin/lpr/filters/lpf.c
==============================================================================
--- head/usr.sbin/lpr/filters/lpf.c Thu Oct 25 19:30:58 2012 (r242090)
+++ head/usr.sbin/lpr/filters/lpf.c Thu Oct 25 20:16:38 2012 (r242091)
@@ -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[])
More information about the svn-src-head
mailing list