Add missing static keywords to at(1).

While there, tidy up the privs.h part, where at.c has to #define to
declare some globals. Also group static and non-static global variables
in at.c.
This commit is contained in:
ed 2011-11-06 17:32:29 +00:00
parent 8fdc44b459
commit a2c6b647f1
3 changed files with 9 additions and 18 deletions

View File

@ -63,8 +63,6 @@ __FBSDID("$FreeBSD$");
#include "panic.h" #include "panic.h"
#include "parsetime.h" #include "parsetime.h"
#include "perm.h" #include "perm.h"
#define MAIN
#include "privs.h" #include "privs.h"
/* Macros */ /* Macros */
@ -90,22 +88,22 @@ enum { ATQ, ATRM, AT, BATCH, CAT }; /* what program we want to run */
/* File scope variables */ /* File scope variables */
const char *no_export[] = static const char *no_export[] = {
{
"TERM", "TERMCAP", "DISPLAY", "_" "TERM", "TERMCAP", "DISPLAY", "_"
} ; };
static int send_mail = 0; static int send_mail = 0;
static char *atinput = NULL; /* where to get input from */
static char atqueue = 0; /* which queue to examine for jobs (atq) */
/* External variables */ /* External variables */
extern char **environ; extern char **environ;
int fcreated; int fcreated;
char atfile[] = ATJOB_DIR "12345678901234"; char atfile[] = ATJOB_DIR "12345678901234";
char *atinput = (char*)0; /* where to get input from */
char atqueue = 0; /* which queue to examine for jobs (atq) */
char atverify = 0; /* verify time instead of queuing job */ char atverify = 0; /* verify time instead of queuing job */
char *namep; char *namep;
uid_t real_uid, effective_uid;
gid_t real_gid, effective_gid;
/* Function declarations */ /* Function declarations */

View File

@ -72,7 +72,7 @@ enum { /* symbols */
/* parse translation table - table driven parsers can be your FRIEND! /* parse translation table - table driven parsers can be your FRIEND!
*/ */
struct { static const struct {
const char *name; /* token name */ const char *name; /* token name */
int value; /* token id */ int value; /* token id */
int plural; /* is this plural? */ int plural; /* is this plural? */

View File

@ -59,15 +59,8 @@
* to the real userid before calling any of them. * to the real userid before calling any of them.
*/ */
#ifndef MAIN extern uid_t real_uid, effective_uid;
extern extern gid_t real_gid, effective_gid;
#endif
uid_t real_uid, effective_uid;
#ifndef MAIN
extern
#endif
gid_t real_gid, effective_gid;
#define RELINQUISH_PRIVS { \ #define RELINQUISH_PRIVS { \
real_uid = getuid(); \ real_uid = getuid(); \