Source-Changes-HG archive
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index][Old Index]
[src/trunk]: src/usr.bin/calendar reorganize to make clear variable use.
details: https://anonhg.NetBSD.org/src/rev/63350b46e43d
branches: trunk
changeset: 791227:63350b46e43d
user: christos <christos%NetBSD.org@localhost>
date: Sat Nov 09 15:57:15 2013 +0000
description:
reorganize to make clear variable use.
diffstat:
usr.bin/calendar/calendar.c | 15 +++++++--------
1 files changed, 7 insertions(+), 8 deletions(-)
diffs (48 lines):
diff -r 0af65261bc65 -r 63350b46e43d usr.bin/calendar/calendar.c
--- a/usr.bin/calendar/calendar.c Sat Nov 09 13:10:35 2013 +0000
+++ b/usr.bin/calendar/calendar.c Sat Nov 09 15:57:15 2013 +0000
@@ -1,4 +1,4 @@
-/* $NetBSD: calendar.c,v 1.49 2012/04/03 12:03:04 matthias Exp $ */
+/* $NetBSD: calendar.c,v 1.50 2013/11/09 15:57:15 christos Exp $ */
/*
* Copyright (c) 1989, 1993, 1994
@@ -39,7 +39,7 @@
#if 0
static char sccsid[] = "@(#)calendar.c 8.4 (Berkeley) 1/7/95";
#endif
-__RCSID("$NetBSD: calendar.c,v 1.49 2012/04/03 12:03:04 matthias Exp $");
+__RCSID("$NetBSD: calendar.c,v 1.50 2013/11/09 15:57:15 christos Exp $");
#endif /* not lint */
#include <sys/param.h>
@@ -383,24 +383,23 @@
static FILE *
opencal(FILE **in)
{
- int fd;
+ int fd = -1;
int pdes[2];
- const char **name;
/* open up calendar file as stdin */
if (fname == NULL) {
- for (name = defaultnames; *name != NULL; name++) {
- if ((fd = open(*name, O_RDONLY)) < 0)
+ for (const char **name = defaultnames; *name != NULL; name++) {
+ if ((fd = open(*name, O_RDONLY)) == -1)
continue;
else
break;
}
- if (*name == NULL) {
+ if (fd == -1) {
if (doall)
return NULL;
err(EXIT_FAILURE, "Cannot open calendar file");
}
- } else if ((fd = open(fname, O_RDONLY)) < 0) {
+ } else if ((fd = open(fname, O_RDONLY)) == -1) {
if (doall)
return NULL;
err(EXIT_FAILURE, "Cannot open `%s'", fname);
Home |
Main Index |
Thread Index |
Old Index