svn commit: r204624 - user/edwin/ncal

Edwin Groothuis edwin at FreeBSD.org
Wed Mar 3 07:00:08 UTC 2010


Author: edwin
Date: Wed Mar  3 07:00:08 2010
New Revision: 204624
URL: http://svn.freebsd.org/changeset/base/204624

Log:
  Rename all non backwards compatible functions/variables/constants
  to regular (in other words, add the r prefix)

Modified:
  user/edwin/ncal/ncal.c

Modified: user/edwin/ncal/ncal.c
==============================================================================
--- user/edwin/ncal/ncal.c	Wed Mar  3 06:48:05 2010	(r204623)
+++ user/edwin/ncal/ncal.c	Wed Mar  3 07:00:08 2010	(r204624)
@@ -45,12 +45,12 @@ static const char rcsid[] =
 #include <term.h>
 #undef lines			/* term.h defines this */
 
-/* Width of one month with backward compatibility */
+/* Width of one month with backward compatibility and in regular mode*/
 #define MONTH_WIDTH_B_J 27
 #define MONTH_WIDTH_B 20
 
-#define MONTH_WIDTH_J 24
-#define MONTH_WIDTH 18
+#define MONTH_WIDTH_R_J 24
+#define MONTH_WIDTH_R 18
 
 #define MAX_WIDTH 64
 
@@ -165,22 +165,22 @@ int	nswitchb;		/* switch date for backwa
 const char	*term_so, *term_se;
 int	today;
 
-static char   *center(char *s, char *t, int w);
-static wchar_t *wcenter(wchar_t *s, wchar_t *t, int w);
-static void	mkmonth(int year, int month, int jd_flag, struct monthlines * monthl);
-static void    mkmonthb(int year, int month, int jd_flag, struct monthlines * monthl);
-static void    mkweekdays(struct weekdays * wds);
-static int     parsemonth(const char *s, int *m, int *y);
-static void    printcc(void);
-static void    printeaster(int year, int julian, int orthodox);
-static int	firstday(int y, int m);
-static date   *sdate(int ndays, struct date * d);
-static date   *sdateb(int ndays, struct date * d);
-static int     sndays(struct date * d);
-static int     sndaysb(struct date * d);
-static void usage(void);
-static void	monthrange(int year, int jd_flag, int m, int before, int after);
-static void	monthrangeb(int year, int jd_flag, int m, int before, int after);
+char	*center(char *s, char *t, int w);
+wchar_t *wcenter(wchar_t *s, wchar_t *t, int w);
+void	mkmonthr(int year, int month, int jd_flag, struct monthlines * monthl);
+void    mkmonthb(int year, int month, int jd_flag, struct monthlines * monthl);
+void    mkweekdays(struct weekdays * wds);
+int     parsemonth(const char *s, int *m, int *y);
+void    printcc(void);
+void    printeaster(int year, int julian, int orthodox);
+int	firstday(int y, int m);
+date	*sdater(int ndays, struct date * d);
+date	*sdateb(int ndays, struct date * d);
+int     sndaysr(struct date * d);
+int     sndaysb(struct date * d);
+static void	usage(void);
+void	monthranger(int year, int jd_flag, int m, int before, int after);
+void	monthrangeb(int year, int jd_flag, int m, int before, int after);
 
 int
 main(int argc, char *argv[])
@@ -403,7 +403,7 @@ main(int argc, char *argv[])
 		if (flag_backward)
 			monthrangeb(y, flag_julian_day, m, before, after);
 		else
-			monthrange(y, flag_julian_day, m, before, after);
+			monthranger(y, flag_julian_day, m, before, after);
 	return (0);
 }
 
@@ -550,7 +550,7 @@ monthrangeb(int y, int jd_flag, int m, i
 				    mw, wcenter(ws, year[i].name, mw));
 			else
 				wprintf(L"%-ls %-*d  ",
-				    wcenter(ws, year[i].name, mw - 4),
+				    wcenter(ws, year[i].name, mw - 10),
 				    mw - wcslen(year[i].name) - 1, M2Y(m + i));
 		printf("\n");
 
@@ -575,7 +575,7 @@ monthrangeb(int y, int jd_flag, int m, i
 }
 
 void
-monthrange(int y, int jd_flag, int m, int before, int after)
+monthranger(int y, int jd_flag, int m, int before, int after)
 {
 	struct monthlines year[12];
 	struct weekdays wds;
@@ -588,7 +588,7 @@ monthrange(int y, int jd_flag, int m, in
 	int	printyearheader;
 
 	mpl = jd_flag ? 3 : 4;
-	mw = jd_flag ? MONTH_WIDTH_J : MONTH_WIDTH;
+	mw = jd_flag ? MONTH_WIDTH_R_J : MONTH_WIDTH_R;
 
 	while (before != 0) {
 		DECREASEMONTH(m, y);
@@ -611,7 +611,7 @@ monthrange(int y, int jd_flag, int m, in
 	while (m <= m2) {
 		int count = 0;
 		for (i = 0; i != mpl && m + i <= m2; i++) {
-			mkmonth(M2Y(m + i), M2M(m + i) - 1, jd_flag, year + i);
+			mkmonthr(M2Y(m + i), M2M(m + i) - 1, jd_flag, year + i);
 			count++;
 		}
 
@@ -661,7 +661,7 @@ monthrange(int y, int jd_flag, int m, in
 }
 
 void
-mkmonth(int y, int m, int jd_flag, struct monthlines *mlines)
+mkmonthr(int y, int m, int jd_flag, struct monthlines *mlines)
 {
 
 	struct tm tm;		/* for strftime printing local names of
@@ -743,7 +743,7 @@ mkmonth(int y, int m, int jd_flag, struc
 				if (jd_flag)
 					dt.d = j - jan1 + 1;
 				else
-					sdate(j, &dt);
+					sdater(j, &dt);
 				memcpy(mlines->lines[i] + k + l,
 				       ds + dt.d * dw, dw);
 			} else
@@ -914,9 +914,9 @@ firstday(int y, int m)
 	dt.y = y;
 	dt.m = m;
 	dt.d = 1;
-	nd = sndays(&dt);
+	nd = sndaysr(&dt);
 	for (;;) {
-		sdate(nd, &dt);
+		sdater(nd, &dt);
 		if ((dt.m >= m && dt.y == y) || dt.y > y)
 			return (nd);
 		else
@@ -930,7 +930,7 @@ firstday(int y, int m)
  * Julian to Gregorian if specified by the user.
  */
 int
-sndays(struct date *d)
+sndaysr(struct date *d)
 {
 
 	if (nswitch != 0)
@@ -958,7 +958,7 @@ sndaysb(struct date *d)
 
 /* Inverse of sndays */
 struct date *
-sdate(int nd, struct date *d)
+sdater(int nd, struct date *d)
 {
 
 	if (nswitch < nd)


More information about the svn-src-user mailing list