From owner-svn-src-all@FreeBSD.ORG Sat May 2 07:02:31 2009 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 CBC32106564A; Sat, 2 May 2009 07:02:31 +0000 (UTC) (envelope-from rdivacky@FreeBSD.org) Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:4f8:fff6::2c]) by mx1.freebsd.org (Postfix) with ESMTP id B89448FC14; Sat, 2 May 2009 07:02:31 +0000 (UTC) (envelope-from rdivacky@FreeBSD.org) Received: from svn.freebsd.org (localhost [127.0.0.1]) by svn.freebsd.org (8.14.3/8.14.3) with ESMTP id n4272VFD075499; Sat, 2 May 2009 07:02:31 GMT (envelope-from rdivacky@svn.freebsd.org) Received: (from rdivacky@localhost) by svn.freebsd.org (8.14.3/8.14.3/Submit) id n4272VGS075497; Sat, 2 May 2009 07:02:31 GMT (envelope-from rdivacky@svn.freebsd.org) Message-Id: <200905020702.n4272VGS075497@svn.freebsd.org> From: Roman Divacky Date: Sat, 2 May 2009 07:02:31 +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: r191737 - head/usr.bin/ncal 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: Sat, 02 May 2009 07:02:32 -0000 Author: rdivacky Date: Sat May 2 07:02:31 2009 New Revision: 191737 URL: http://svn.freebsd.org/changeset/base/191737 Log: Mention -h in usage() and manpage. Rename term_{r,e} to term_{so,se}. Suggested by: ru Approved by: ed (mentor) Modified: head/usr.bin/ncal/ncal.1 head/usr.bin/ncal/ncal.c Modified: head/usr.bin/ncal/ncal.1 ============================================================================== --- head/usr.bin/ncal/ncal.1 Sat May 2 06:25:51 2009 (r191736) +++ head/usr.bin/ncal/ncal.1 Sat May 2 07:02:31 2009 (r191737) @@ -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 Modified: head/usr.bin/ncal/ncal.c ============================================================================== --- head/usr.bin/ncal/ncal.c Sat May 2 06:25:51 2009 (r191736) +++ head/usr.bin/ncal/ncal.c Sat May 2 07:02:31 2009 (r191737) @@ -161,7 +161,7 @@ char jdaystr[] = " 1 2 3 4 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, struc 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, struc 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, stru 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, stru 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) {