cal: Removed unused "day" variable

This commit is contained in:
Greg Reagle 2015-01-06 15:14:56 -05:00 committed by sin
parent c6f1e8aa20
commit 83616df6fc
2 changed files with 5 additions and 10 deletions

3
cal.1
View File

@ -14,8 +14,7 @@ cal \- print calendar
.IR firstday ] .IR firstday ]
.RB [ \-n .RB [ \-n
.IR nmonths ] .IR nmonths ]
.RB [ [ [ .RB [ [
.IR day ]
.IR month ] .IR month ]
.IR year ] .IR year ]
.SH DESCRIPTION .SH DESCRIPTION

12
cal.c
View File

@ -56,7 +56,7 @@ printgrid(int year, int month, int fday, int line)
} }
static void 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", char *smon[] = {" January", " February", " March", " April",
" May", " June", " July", " August", " May", " June", " July", " August",
@ -103,14 +103,14 @@ static void
usage(void) usage(void)
{ {
eprintf("usage: %s [-1] [-3] [-m] [-s] [-y] [-c columns]" 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); argv0);
} }
int int
main(int argc, char *argv[]) main(int argc, char *argv[])
{ {
int year, month, day, ncols, nmons, fday; int year, month, ncols, nmons, fday;
struct tm *ltime; struct tm *ltime;
time_t now; time_t now;
@ -118,7 +118,6 @@ main(int argc, char *argv[])
ltime = localtime(&now); ltime = localtime(&now);
year = ltime->tm_year + 1900; year = ltime->tm_year + 1900;
month = ltime->tm_mon + 1; month = ltime->tm_mon + 1;
day = ltime->tm_mday;
fday = 0; fday = 0;
ncols = 3; ncols = 3;
@ -160,9 +159,6 @@ main(int argc, char *argv[])
} ARGEND; } ARGEND;
switch (argc) { switch (argc) {
case 3:
day = estrtol(argv[0], 0);
argv++;
case 2: case 2:
month = estrtol(argv[0], 0); month = estrtol(argv[0], 0);
argv++; argv++;
@ -179,7 +175,7 @@ main(int argc, char *argv[])
usage(); usage();
} }
drawcal(year, month-1, day, ncols, nmons, fday); drawcal(year, month-1, ncols, nmons, fday);
return 0; return 0;
} }