aboutsummaryrefslogtreecommitdiff
path: root/usr.sbin/newsyslog
diff options
context:
space:
mode:
authorMaxim Sobolev <sobomax@FreeBSD.org>2011-02-22 09:11:47 +0000
committerMaxim Sobolev <sobomax@FreeBSD.org>2011-02-22 09:11:47 +0000
commit8c6269ba81bfce10d3266dbc9c112309dc3ae57f (patch)
tree2f362559a3f1ada9abb0de0943b99f7ec40e12d3 /usr.sbin/newsyslog
parent1bd8df43b843d5ba5dc18cdce01767e8c1071373 (diff)
downloadsrc-8c6269ba81bfce10d3266dbc9c112309dc3ae57f.tar.gz
src-8c6269ba81bfce10d3266dbc9c112309dc3ae57f.zip
Make code more friendly to the non-C99 compilers - don't allocate
local variables in the `for' loop declaration. This allows trunk newsyslog.c to be compiled on 7.x. This change should be no-op from the functional POV.
Notes
Notes: svn path=/head/; revision=218944
Diffstat (limited to 'usr.sbin/newsyslog')
-rw-r--r--usr.sbin/newsyslog/newsyslog.c12
1 files changed, 8 insertions, 4 deletions
diff --git a/usr.sbin/newsyslog/newsyslog.c b/usr.sbin/newsyslog/newsyslog.c
index b04cf1d7ccaa..a373c8182030 100644
--- a/usr.sbin/newsyslog/newsyslog.c
+++ b/usr.sbin/newsyslog/newsyslog.c
@@ -1450,6 +1450,7 @@ delete_oldest_timelog(const struct conf_entry *ent, const char *archive_dir)
const char *cdir;
struct tm tm;
DIR *dirp;
+ int c;
oldlogs = malloc(MAX_OLDLOGS * sizeof(struct oldlog_entry));
max_logcnt = MAX_OLDLOGS;
@@ -1514,7 +1515,7 @@ delete_oldest_timelog(const struct conf_entry *ent, const char *archive_dir)
continue;
}
- for (int c = 0; c < COMPRESS_TYPES; c++)
+ for (c = 0; c < COMPRESS_TYPES; c++)
if (strcmp(s, compress_type[c].suffix) == 0)
valid = 1;
if (valid != 1) {
@@ -1629,8 +1630,9 @@ get_logfile_suffix(const char *logfile)
{
struct stat st;
char zfile[MAXPATHLEN];
+ int c;
- for (int c = 0; c < COMPRESS_TYPES; c++) {
+ for (c = 0; c < COMPRESS_TYPES; c++) {
(void) strlcpy(zfile, logfile, MAXPATHLEN);
(void) strlcat(zfile, compress_type[c].suffix, MAXPATHLEN);
if (lstat(zfile, &st) == 0)
@@ -1653,6 +1655,7 @@ do_rotate(const struct conf_entry *ent)
struct stat st;
struct tm tm;
time_t now;
+ int c;
flags = ent->flags;
free_or_keep = FREE_ENT;
@@ -1703,7 +1706,7 @@ do_rotate(const struct conf_entry *ent)
delete_oldest_timelog(ent, dirpart);
else {
/* name of oldest log */
- for (int c = 0; c < COMPRESS_TYPES; c++) {
+ for (c = 0; c < COMPRESS_TYPES; c++) {
(void) snprintf(zfile1, sizeof(zfile1), "%s%s", file1,
compress_type[c].suffix);
if (noaction)
@@ -1889,12 +1892,13 @@ do_zipwork(struct zipwork_entry *zwork)
int errsav, fcount, zstatus;
pid_t pidzip, wpid;
char zresult[MAXPATHLEN];
+ int c;
pgm_path = NULL;
strlcpy(zresult, zwork->zw_fname, sizeof(zresult));
if (zwork != NULL && zwork->zw_conf != NULL &&
zwork->zw_conf->compress > COMPRESS_NONE)
- for (int c = 1; c < COMPRESS_TYPES; c++) {
+ for (c = 1; c < COMPRESS_TYPES; c++) {
if (zwork->zw_conf->compress == c) {
pgm_path = compress_type[c].path;
(void) strlcat(zresult,