enum opt_t {opt_unknown, opt_list, opt_delete, opt_edit, opt_replace, opt_hostset, opt_hostget};
#if DEBUGGING
-static char *Options[] = {"???", "list", "delete", "edit", "replace", "hostset", "hostget"};
+static const char *Options[] = {"???", "list", "delete", "edit", "replace", "hostset", "hostget"};
# ifdef WITH_SELINUX
-static char *getoptargs = "u:lerisncx:";
+static const char *getoptargs = "u:lerisncx:";
# else
-static char *getoptargs = "u:lerincx:";
+static const char *getoptargs = "u:lerincx:";
# endif
#else
# ifdef WITH_SELINUX
-static char *getoptargs = "u:lerisnc";
+static const char *getoptargs = "u:lerisnc";
# else
-static char *getoptargs = "u:lerinc";
+static const char *getoptargs = "u:lerinc";
# endif
#endif
#ifdef WITH_SELINUX
poke_daemon(void),
check_error(const char *), parse_args(int c, char *v[]), die(int);
static int replace_cmd(void), hostset_cmd(void), hostget_cmd(void);
-static char *host_specific_filename(char *filename, int prefix);
+static char *host_specific_filename(const char *filename, int prefix);
static char *tmp_path(void);
static void usage(const char *msg) {
int main(int argc, char *argv[]) {
int exitstatus;
- char *n = "-"; /*set the n string to - so we have a valid string to use */
+ const char *n = "-"; /*set the n string to - so we have a valid string to use */
if ((ProgramName=strrchr(argv[0], '/')) == NULL) {
ProgramName = argv[0];
}
static char *tmp_path() {
- char *tmpdir = NULL;
+ const char *tmpdir = NULL;
if ((getuid() == geteuid()) && (getgid() == getegid())) {
tmpdir = getenv("TMPDIR");
return tmpdir ? tmpdir : "/tmp";
}
-static char *host_specific_filename(char *filename, int prefix)
+static char *host_specific_filename(const char *filename, int prefix)
{
/*
* For cluster-wide use, where there is otherwise risk of the same
}
static void edit_cmd(void) {
- char n[MAX_FNAME], q[MAX_TEMPSTR], *editor;
+ char n[MAX_FNAME], q[MAX_TEMPSTR];
+ const char *editor;
FILE *f;
int ch = '\0', t;
struct stat statbuf;
static int not_a_crontab(DIR_T * dp);
/* return 1 if we should skip this file */
-static void max_mtime(char *dir_name, struct stat *max_st);
+static void max_mtime(const char *dir_name, struct stat *max_st);
/* record max mtime of any file under dir_name in max_st */
static int
return (0);
}
-static void max_mtime(char *dir_name, struct stat *max_st) {
+static void max_mtime(const char *dir_name, struct stat *max_st) {
DIR *dir;
DIR_T *dp;
struct stat st;
job_runqueue(void),
set_debug_flags(const char *),
get_char(FILE *),
- get_string(char *, int, FILE *, char *),
+ get_string(char *, int, FILE *, const char *),
swap_uids(void),
swap_uids_back(void),
load_env(char *, FILE *),
size_t strlens(const char *, ...);
-char *env_get(char *, char **),
+char *env_get(const char *, char **),
*arpadate(time_t *),
*mkprints(unsigned char *, unsigned int),
- *first_word(char *, char *),
+ *first_word(const char *, const char *),
**env_init(void),
**env_copy(char **),
**env_set(char **, char *);
* (3) uses get_char() so LineNumber will be accurate
* (4) returns EOF or terminating character, whichever
*/
-int get_string(char *string, int size, FILE * file, char *terms) {
+int get_string(char *string, int size, FILE * file, const char *terms) {
int ch;
while (EOF != (ch = get_char(file)) && !strchr(terms, ch)) {
* (1) this routine is fairly slow
* (2) it returns a pointer to static storage
*/
-char *first_word(char *s, char *t) {
+char *first_word(const char *s, const char *t) {
static char retbuf[2][MAX_TEMPSTR + 1]; /* sure wish C had GC */
static int retsel = 0;
char *rb, *rp;