[dev] [PATCH] cal: Removed unused "day" variable

From: Greg Reagle <greg.reagle_AT_umbc.edu>
Date: Tue, 6 Jan 2015 15:14:56 -0500

---
 cal.1 |  3 +--
 cal.c | 12 ++++--------
 2 files changed, 5 insertions(+), 10 deletions(-)
diff --git a/cal.1 b/cal.1
index a679350..c215340 100644
--- a/cal.1
+++ b/cal.1
_AT_@ -14,8 +14,7 @@ cal \- print calendar
 .IR firstday ]
 .RB [ \-n
 .IR nmonths ]
-.RB [ [ [
-.IR day ]
+.RB [ [
 .IR month ]
 .IR year ]
 .SH DESCRIPTION
diff --git a/cal.c b/cal.c
index 28e58fe..53c6022 100644
--- a/cal.c
+++ b/cal.c
_AT_@ -56,7 +56,7 @@ printgrid(int year, int month, int fday, int line)
 }
 
 static void
-drawcal(int year, int month, int day, int ncols, int nmons, int fday)
+drawcal(int year, int month, int ncols, int nmons, int fday)
 {
 	char *smon[] = {"  January", " February", "    March", "    April",
 	                "      May", "     June", "     July", "   August",
_AT_@ -103,14 +103,14 @@ static void
 usage(void)
 {
 	eprintf("usage: %s [-1] [-3] [-m] [-s] [-y] [-c columns]"
-		" [-f firstday] [-n nmonths] [ [ [day] month] year]\n",
+		" [-f firstday] [-n nmonths] [ [month] year]\n",
 			argv0);
 }
 
 int
 main(int argc, char *argv[])
 {
-	int year, month, day, ncols, nmons, fday;
+	int year, month, ncols, nmons, fday;
 	struct tm *ltime;
 	time_t now;
 
_AT_@ -118,7 +118,6 @@ main(int argc, char *argv[])
 	ltime = localtime(&now);
 	year = ltime->tm_year + 1900;
 	month = ltime->tm_mon + 1;
-	day = ltime->tm_mday;
 	fday = 0;
 
 	ncols = 3;
_AT_@ -160,9 +159,6 @@ main(int argc, char *argv[])
 	} ARGEND;
 
 	switch (argc) {
-	case 3:
-		day = estrtol(argv[0], 0);
-		argv++;
 	case 2:
 		month = estrtol(argv[0], 0);
 		argv++;
_AT_@ -179,7 +175,7 @@ main(int argc, char *argv[])
 		usage();
 	}
 
-	drawcal(year, month-1, day, ncols, nmons, fday);
+	drawcal(year, month-1, ncols, nmons, fday);
 
 	return 0;
 }
-- 
2.2.1
Received on Tue Jan 06 2015 - 21:14:56 CET

This archive was generated by hypermail 2.3.0 : Tue Jan 06 2015 - 21:24:08 CET