From owner-svn-src-all@FreeBSD.ORG Tue Feb 22 09:11:47 2011 Return-Path: Delivered-To: svn-src-all@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34]) by hub.freebsd.org (Postfix) with ESMTP id BE67C1065670; Tue, 22 Feb 2011 09:11:47 +0000 (UTC) (envelope-from sobomax@FreeBSD.org) Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:4f8:fff6::2c]) by mx1.freebsd.org (Postfix) with ESMTP id 93FFC8FC19; Tue, 22 Feb 2011 09:11:47 +0000 (UTC) Received: from svn.freebsd.org (localhost [127.0.0.1]) by svn.freebsd.org (8.14.3/8.14.3) with ESMTP id p1M9Bl16001206; Tue, 22 Feb 2011 09:11:47 GMT (envelope-from sobomax@svn.freebsd.org) Received: (from sobomax@localhost) by svn.freebsd.org (8.14.3/8.14.3/Submit) id p1M9BlQn001204; Tue, 22 Feb 2011 09:11:47 GMT (envelope-from sobomax@svn.freebsd.org) Message-Id: <201102220911.p1M9BlQn001204@svn.freebsd.org> From: Maxim Sobolev Date: Tue, 22 Feb 2011 09:11:47 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org X-SVN-Group: head MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Cc: Subject: svn commit: r218944 - head/usr.sbin/newsyslog X-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: "SVN commit messages for the entire src tree \(except for " user" and " projects" \)" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Tue, 22 Feb 2011 09:11:47 -0000 Author: sobomax Date: Tue Feb 22 09:11:47 2011 New Revision: 218944 URL: http://svn.freebsd.org/changeset/base/218944 Log: 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. Modified: head/usr.sbin/newsyslog/newsyslog.c Modified: head/usr.sbin/newsyslog/newsyslog.c ============================================================================== --- head/usr.sbin/newsyslog/newsyslog.c Tue Feb 22 08:21:22 2011 (r218943) +++ head/usr.sbin/newsyslog/newsyslog.c Tue Feb 22 09:11:47 2011 (r218944) @@ -1450,6 +1450,7 @@ delete_oldest_timelog(const struct conf_ 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_ 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,