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) {
_______________________________________________
svn-src-all@freebsd.org mailing list
http://lists.freebsd.org/mailman/listinfo/svn-src-all
To unsubscribe, send any mail to "svn-src-all-unsubscr...@freebsd.org"

Reply via email to