summaryrefslogtreecommitdiffstats
path: root/usr.bin/ncal
diff options
context:
space:
mode:
authored <ed@FreeBSD.org>2012-10-19 14:49:42 +0000
committered <ed@FreeBSD.org>2012-10-19 14:49:42 +0000
commitaf31e8843c2cc0ba388a33f341de8da1b50de433 (patch)
treeddffe542a2e921ec48c73d322a2046f559a9d74f /usr.bin/ncal
parentb1462253851ab8c1f6dde48bb7796b15d3f38253 (diff)
downloadFreeBSD-src-af31e8843c2cc0ba388a33f341de8da1b50de433.zip
FreeBSD-src-af31e8843c2cc0ba388a33f341de8da1b50de433.tar.gz
More -Wmissing-variable-declarations fixes.
In addition to adding `static' where possible: - bin/date: Move `retval' into extern.h to make it visible to date.c. - bin/ed: Move globally used variables into ed.h. - sbin/camcontrol: Move `verbose' into camcontrol.h and fix shadow warnings. - usr.bin/calendar: Remove unneeded variables. - usr.bin/chat: Make `line' local instead of global. - usr.bin/elfdump: Comment out unneeded function. - usr.bin/rlogin: Use _Noreturn instead of __dead2. - usr.bin/tset: Pull `Ospeed' into extern.h. - usr.sbin/mfiutil: Put global variables in mfiutil.h. - usr.sbin/pkg: Remove unused `os_corres'. - usr.sbin/quotaon, usr.sbin/repquota: Remove unused `qfname'.
Diffstat (limited to 'usr.bin/ncal')
-rw-r--r--usr.bin/ncal/ncal.c172
1 files changed, 87 insertions, 85 deletions
diff --git a/usr.bin/ncal/ncal.c b/usr.bin/ncal/ncal.c
index 02eb587..48b8c1a 100644
--- a/usr.bin/ncal/ncal.c
+++ b/usr.bin/ncal/ncal.c
@@ -24,10 +24,8 @@
* SUCH DAMAGE.
*/
-#ifndef lint
-static const char rcsid[] =
- "$FreeBSD$";
-#endif /* not lint */
+#include <sys/cdefs.h>
+__FBSDID("$FreeBSD$");
#include <calendar.h>
#include <ctype.h>
@@ -111,77 +109,81 @@ static struct djswitch {
{"YU", "Yugoslavia", {1919, 3, 4}}
};
-struct djswitch *dftswitch =
+static struct djswitch *dftswitch =
switches + sizeof(switches) / sizeof(struct djswitch) - 2;
/* default switch (should be "US") */
/* Table used to print day of month and week numbers */
-char daystr[] = " 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15"
- " 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31"
- " 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47"
- " 48 49 50 51 52 53";
+static char daystr[] = " 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15"
+ " 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31"
+ " 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47"
+ " 48 49 50 51 52 53";
/* Table used to print day of year and week numbers */
-char jdaystr[] = " 1 2 3 4 5 6 7 8 9"
- " 10 11 12 13 14 15 16 17 18 19"
- " 20 21 22 23 24 25 26 27 28 29"
- " 30 31 32 33 34 35 36 37 38 39"
- " 40 41 42 43 44 45 46 47 48 49"
- " 50 51 52 53 54 55 56 57 58 59"
- " 60 61 62 63 64 65 66 67 68 69"
- " 70 71 72 73 74 75 76 77 78 79"
- " 80 81 82 83 84 85 86 87 88 89"
- " 90 91 92 93 94 95 96 97 98 99"
- " 100 101 102 103 104 105 106 107 108 109"
- " 110 111 112 113 114 115 116 117 118 119"
- " 120 121 122 123 124 125 126 127 128 129"
- " 130 131 132 133 134 135 136 137 138 139"
- " 140 141 142 143 144 145 146 147 148 149"
- " 150 151 152 153 154 155 156 157 158 159"
- " 160 161 162 163 164 165 166 167 168 169"
- " 170 171 172 173 174 175 176 177 178 179"
- " 180 181 182 183 184 185 186 187 188 189"
- " 190 191 192 193 194 195 196 197 198 199"
- " 200 201 202 203 204 205 206 207 208 209"
- " 210 211 212 213 214 215 216 217 218 219"
- " 220 221 222 223 224 225 226 227 228 229"
- " 230 231 232 233 234 235 236 237 238 239"
- " 240 241 242 243 244 245 246 247 248 249"
- " 250 251 252 253 254 255 256 257 258 259"
- " 260 261 262 263 264 265 266 267 268 269"
- " 270 271 272 273 274 275 276 277 278 279"
- " 280 281 282 283 284 285 286 287 288 289"
- " 290 291 292 293 294 295 296 297 298 299"
- " 300 301 302 303 304 305 306 307 308 309"
- " 310 311 312 313 314 315 316 317 318 319"
- " 320 321 322 323 324 325 326 327 328 329"
- " 330 331 332 333 334 335 336 337 338 339"
- " 340 341 342 343 344 345 346 347 348 349"
- " 350 351 352 353 354 355 356 357 358 359"
- " 360 361 362 363 364 365 366";
-
-int flag_nohighlight; /* user doesn't want a highlighted today */
-int flag_weeks; /* user wants number of week */
-int nswitch; /* user defined switch date */
-int nswitchb; /* switch date for backward compatibility */
-int highlightdate;
-
-char *center(char *s, char *t, int w);
-wchar_t *wcenter(wchar_t *s, wchar_t *t, int w);
-int firstday(int y, int m);
-void highlight(char *dst, char *src, int len, int *extraletters);
-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);
-void monthranger(int year, int m, int jd_flag, int before, int after);
-void monthrangeb(int year, int m, int jd_flag, int before, int after);
-int parsemonth(const char *s, int *m, int *y);
-void printcc(void);
-void printeaster(int year, int julian, int orthodox);
-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 char jdaystr[] = " 1 2 3 4 5 6 7 8 9"
+ " 10 11 12 13 14 15 16 17 18 19"
+ " 20 21 22 23 24 25 26 27 28 29"
+ " 30 31 32 33 34 35 36 37 38 39"
+ " 40 41 42 43 44 45 46 47 48 49"
+ " 50 51 52 53 54 55 56 57 58 59"
+ " 60 61 62 63 64 65 66 67 68 69"
+ " 70 71 72 73 74 75 76 77 78 79"
+ " 80 81 82 83 84 85 86 87 88 89"
+ " 90 91 92 93 94 95 96 97 98 99"
+ " 100 101 102 103 104 105 106 107 108 109"
+ " 110 111 112 113 114 115 116 117 118 119"
+ " 120 121 122 123 124 125 126 127 128 129"
+ " 130 131 132 133 134 135 136 137 138 139"
+ " 140 141 142 143 144 145 146 147 148 149"
+ " 150 151 152 153 154 155 156 157 158 159"
+ " 160 161 162 163 164 165 166 167 168 169"
+ " 170 171 172 173 174 175 176 177 178 179"
+ " 180 181 182 183 184 185 186 187 188 189"
+ " 190 191 192 193 194 195 196 197 198 199"
+ " 200 201 202 203 204 205 206 207 208 209"
+ " 210 211 212 213 214 215 216 217 218 219"
+ " 220 221 222 223 224 225 226 227 228 229"
+ " 230 231 232 233 234 235 236 237 238 239"
+ " 240 241 242 243 244 245 246 247 248 249"
+ " 250 251 252 253 254 255 256 257 258 259"
+ " 260 261 262 263 264 265 266 267 268 269"
+ " 270 271 272 273 274 275 276 277 278 279"
+ " 280 281 282 283 284 285 286 287 288 289"
+ " 290 291 292 293 294 295 296 297 298 299"
+ " 300 301 302 303 304 305 306 307 308 309"
+ " 310 311 312 313 314 315 316 317 318 319"
+ " 320 321 322 323 324 325 326 327 328 329"
+ " 330 331 332 333 334 335 336 337 338 339"
+ " 340 341 342 343 344 345 346 347 348 349"
+ " 350 351 352 353 354 355 356 357 358 359"
+ " 360 361 362 363 364 365 366";
+
+static int flag_nohighlight; /* user doesn't want a highlighted today */
+static int flag_weeks; /* user wants number of week */
+static int nswitch; /* user defined switch date */
+static int nswitchb; /* switch date for backward compatibility */
+static int highlightdate;
+
+static char *center(char *s, char *t, int w);
+static wchar_t *wcenter(wchar_t *s, wchar_t *t, int w);
+static int firstday(int y, int m);
+static void highlight(char *dst, char *src, int len, int *extraletters);
+static void mkmonthr(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 void monthranger(int year, int m, int jd_flag,
+ int before, int after);
+static void monthrangeb(int year, int m, int jd_flag,
+ int before, int after);
+static int parsemonth(const char *s, int *m, int *y);
+static void printcc(void);
+static void printeaster(int year, int julian, int orthodox);
+static date *sdater(int ndays, struct date * d);
+static date *sdateb(int ndays, struct date * d);
+static int sndaysr(struct date * d);
+static int sndaysb(struct date * d);
static void usage(void);
int
@@ -513,7 +515,7 @@ usage(void)
}
/* Print the assumed switches for all countries. */
-void
+static void
printcc(void)
{
struct djswitch *p;
@@ -534,7 +536,7 @@ printcc(void)
}
/* Print the date of easter sunday. */
-void
+static void
printeaster(int y, int julian, int orthodox)
{
date dt;
@@ -579,7 +581,7 @@ printeaster(int y, int julian, int orthodox)
#define M2M(m) (1 + (m) % 12)
/* Print all months for the period in the range [ before .. y-m .. after ]. */
-void
+static void
monthrangeb(int y, int m, int jd_flag, int before, int after)
{
struct monthlines year[12];
@@ -669,7 +671,7 @@ monthrangeb(int y, int m, int jd_flag, int before, int after)
}
}
-void
+static void
monthranger(int y, int m, int jd_flag, int before, int after)
{
struct monthlines year[12];
@@ -757,7 +759,7 @@ monthranger(int y, int m, int jd_flag, int before, int after)
return;
}
-void
+static void
mkmonthr(int y, int m, int jd_flag, struct monthlines *mlines)
{
@@ -848,7 +850,7 @@ mkmonthr(int y, int m, int jd_flag, struct monthlines *mlines)
}
}
-void
+static void
mkmonthb(int y, int m, int jd_flag, struct monthlines *mlines)
{
@@ -945,7 +947,7 @@ mkmonthb(int y, int m, int jd_flag, struct monthlines *mlines)
}
/* Put the local names of weekdays into the wds. */
-void
+static void
mkweekdays(struct weekdays *wds)
{
int i, len, width = 0;
@@ -973,7 +975,7 @@ mkweekdays(struct weekdays *wds)
* Compute the day number of the first existing date after the first day in
* month. (the first day in month and even the month might not exist!)
*/
-int
+static int
firstday(int y, int m)
{
date dt;
@@ -997,7 +999,7 @@ firstday(int y, int m)
* Compute the number of days from date, obey the local switch from
* Julian to Gregorian if specified by the user.
*/
-int
+static int
sndaysr(struct date *d)
{
@@ -1014,7 +1016,7 @@ sndaysr(struct date *d)
* Compute the number of days from date, obey the switch from
* Julian to Gregorian as used by UK and her colonies.
*/
-int
+static int
sndaysb(struct date *d)
{
@@ -1025,7 +1027,7 @@ sndaysb(struct date *d)
}
/* Inverse of sndays. */
-struct date *
+static struct date *
sdater(int nd, struct date *d)
{
@@ -1036,7 +1038,7 @@ sdater(int nd, struct date *d)
}
/* Inverse of sndaysb. */
-struct date *
+static struct date *
sdateb(int nd, struct date *d)
{
@@ -1047,7 +1049,7 @@ sdateb(int nd, struct date *d)
}
/* Center string t in string s of length w by putting enough leading blanks. */
-char *
+static char *
center(char *s, char *t, int w)
{
char blanks[MAX_WIDTH];
@@ -1058,7 +1060,7 @@ center(char *s, char *t, int w)
}
/* Center string t in string s of length w by putting enough leading blanks. */
-wchar_t *
+static wchar_t *
wcenter(wchar_t *s, wchar_t *t, int w)
{
char blanks[MAX_WIDTH];
@@ -1068,7 +1070,7 @@ wcenter(wchar_t *s, wchar_t *t, int w)
return (s);
}
-int
+static int
parsemonth(const char *s, int *m, int *y)
{
int nm, ny;
@@ -1101,7 +1103,7 @@ parsemonth(const char *s, int *m, int *y)
return (1);
}
-void
+static void
highlight(char *dst, char *src, int len, int *extralen)
{
static int first = 1;
OpenPOWER on IntegriCloud