1
0
mirror of https://git.FreeBSD.org/src.git synced 2024-12-01 08:27:59 +00:00

Mention -h in usage() and manpage. Rename term_{r,e} to term_{so,se}.

Suggested by:	ru
Approved by:	ed (mentor)
This commit is contained in:
Roman Divacky 2009-05-02 07:02:31 +00:00
parent 7b89d46e0f
commit 7149aa0155
Notes: svn2git 2020-12-20 02:59:44 +00:00
svn path=/head/; revision=191737
2 changed files with 27 additions and 25 deletions

View File

@ -33,24 +33,24 @@
.Nd displays a calendar and the date of Easter
.Sh SYNOPSIS
.Nm
.Op Fl jy
.Op Fl hjy
.Oo
.Op Ar month
.Ar year
.Oc
.Nm
.Op Fl j
.Op Fl hj
.Fl m Ar month
.Op Ar year
.Nm ncal
.Op Fl jJpwy
.Op Fl hjJpwy
.Op Fl s Ar country_code
.Oo
.Op Ar month
.Ar year
.Oc
.Nm ncal
.Op Fl Jeo
.Op Fl hJeo
.Op Ar year
.Sh DESCRIPTION
The
@ -65,6 +65,8 @@ the current month is displayed.
.Pp
The options are as follows:
.Bl -tag -width indent
.It Fl h
Turns off highlighting of today.
.It Fl J
Display Julian Calendar, if combined with the
.Fl e

View File

@ -161,7 +161,7 @@ char jdaystr[] = " 1 2 3 4 5 6 7 8 9"
int flag_weeks; /* user wants number of week */
int nswitch; /* user defined switch date */
int nswitchb; /* switch date for backward compatibility */
const char *term_r, *term_e;
const char *term_so, *term_se;
int today;
char *center(char *s, char *t, int w);
@ -207,14 +207,14 @@ main(int argc, char *argv[])
time_t t;
struct tm *tm1;
term_e = term_r = NULL;
term_se = term_so = NULL;
today = 0;
if (isatty(STDOUT_FILENO) && tgetent(tbuf, NULL) == 1) {
date dt; /* handy date */
b = cbuf;
term_r = tgetstr("so", &b);
term_e = tgetstr("se", &b);
term_so = tgetstr("so", &b);
term_se = tgetstr("se", &b);
t = time(NULL);
tm1 = localtime(&t);
dt.y = tm1->tm_year + 1900;
@ -272,7 +272,7 @@ main(int argc, char *argv[])
flag_julian_cal = 1;
break;
case 'h':
term_r = term_e = NULL;
term_so = term_se = NULL;
break;
case 'e':
if (flag_backward)
@ -382,10 +382,10 @@ usage(void)
{
fputs(
"usage: cal [-jy] [[month] year]\n"
" cal [-j] [-m month] [year]\n"
" ncal [-Jjpwy] [-s country_code] [[month] year]\n"
" ncal [-Jeo] [year]\n", stderr);
"usage: cal [-hjy] [[month] year]\n"
" cal [-hj] [-m month] [year]\n"
" ncal [-hJjpwy] [-s country_code] [[month] year]\n"
" ncal [-hJeo] [year]\n", stderr);
exit(EX_USAGE);
}
@ -671,8 +671,8 @@ mkmonth(int y, int m, int jd_flag, struct monthlines *mlines)
for (i = 0; i != 7; i++) {
l = 0;
for (j = firstm + i, k = 0; j < last; j += 7, k += dw) {
if (j == today && (term_r != NULL && term_e != NULL)) {
l = strlen(term_r);
if (j == today && (term_so != NULL && term_se != NULL)) {
l = strlen(term_so);
if (jd_flag)
dt.d = j - jan1 + 1;
else
@ -683,11 +683,11 @@ mkmonth(int y, int m, int jd_flag, struct monthlines *mlines)
memcpy(mlines->lines[i] + k + l,
ds + dt.d * dw, dw);
/* highlight on */
memcpy(mlines->lines[i] + k + 1, term_r, l);
memcpy(mlines->lines[i] + k + 1, term_so, l);
/* highlight off */
memcpy(mlines->lines[i] + k + l + dw, term_e,
strlen(term_e));
l = strlen(term_e) + strlen(term_r);
memcpy(mlines->lines[i] + k + l + dw, term_se,
strlen(term_se));
l = strlen(term_se) + strlen(term_so);
continue;
}
if (j >= first) {
@ -790,8 +790,8 @@ mkmonthb(int y, int m, int jd_flag, struct monthlines *mlines)
l = 0;
for (j = firsts + 7 * i, k = 0; j < last && k != dw * 7;
j++, k += dw) {
if (j == today && (term_r != NULL && term_e != NULL)) {
l = strlen(term_r);
if (j == today && (term_so != NULL && term_se != NULL)) {
l = strlen(term_so);
if (jd_flag)
dt.d = j - jan1 + 1;
else
@ -802,11 +802,11 @@ mkmonthb(int y, int m, int jd_flag, struct monthlines *mlines)
memcpy(mlines->lines[i] + k + l,
ds + dt.d * dw, dw);
/* highlight on */
memcpy(mlines->lines[i] + k + 1, term_r, l);
memcpy(mlines->lines[i] + k + 1, term_so, l);
/* highlight off */
memcpy(mlines->lines[i] + k + l + dw, term_e,
strlen(term_e));
l = strlen(term_e) + strlen(term_r);
memcpy(mlines->lines[i] + k + l + dw, term_se,
strlen(term_se));
l = strlen(term_se) + strlen(term_so);
continue;
}
if (j >= first) {