diff --git a/usr.bin/calendar/Makefile b/usr.bin/calendar/Makefile index 13cc6763944a..1473d04009d9 100644 --- a/usr.bin/calendar/Makefile +++ b/usr.bin/calendar/Makefile @@ -3,7 +3,8 @@ PROG= calendar SRCS= calendar.c io.c day.c ostern.c paskha.c -CFLAGS+= -Wall +WARNS?= 2 +NO_WERROR= yes INTER= de_DE.ISO8859-1 hr_HR.ISO8859-2 ru_RU.KOI8-R DE_LINKS= de_DE.ISO_8859-1 de_DE.ISO8859-15 de_DE.ISO_8859-15 HR_LINKS= hr_HR.ISO_8859-2 diff --git a/usr.bin/calendar/calendar.c b/usr.bin/calendar/calendar.c index 197b82d7d0b7..8a900f9512e4 100644 --- a/usr.bin/calendar/calendar.c +++ b/usr.bin/calendar/calendar.c @@ -29,19 +29,21 @@ * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF * SUCH DAMAGE. - * - * $FreeBSD$ */ +#include + +__FBSDID("$FreeBSD$"); + #ifndef lint static const char copyright[] = "@(#) Copyright (c) 1989, 1993\n\ The Regents of the University of California. All rights reserved.\n"; -#endif /* not lint */ +#endif #ifndef lint static const char sccsid[] = "@(#)calendar.c 8.3 (Berkeley) 3/25/94"; -#endif /* not lint */ +#endif #include #include diff --git a/usr.bin/calendar/calendar.h b/usr.bin/calendar/calendar.h index 2e7adfa15d21..e8622109ee23 100644 --- a/usr.bin/calendar/calendar.h +++ b/usr.bin/calendar/calendar.h @@ -38,7 +38,7 @@ extern struct passwd *pw; extern int doall; extern struct iovec header[]; extern struct tm *tp; -extern char *calendarFile; +extern const char *calendarFile; extern char *optarg; void cal __P((void)); diff --git a/usr.bin/calendar/day.c b/usr.bin/calendar/day.c index 16b17d73f7df..44f8bb400368 100644 --- a/usr.bin/calendar/day.c +++ b/usr.bin/calendar/day.c @@ -29,21 +29,22 @@ * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF * SUCH DAMAGE. - * - * $FreeBSD$ */ +#include +__FBSDID("$FreeBSD$"); + +#include +#include #include +#include #include #include -#include -#include -#include -#include -#include #include -#include +#include +#include +#include #include "pathnames.h" #include "calendar.h" @@ -59,11 +60,11 @@ int daytab[][14] = { { 0, -1, 30, 59, 90, 120, 151, 181, 212, 243, 273, 304, 334, 365 }, }; -static char *days[] = { +static char const *days[] = { "sun", "mon", "tue", "wed", "thu", "fri", "sat", NULL, }; -static char *months[] = { +static const char *months[] = { "jan", "feb", "mar", "apr", "may", "jun", "jul", "aug", "sep", "oct", "nov", "dec", NULL, }; @@ -391,9 +392,9 @@ isnow(endp, monthp, dayp, varp) int getmonth(s) - register char *s; + char *s; { - register char **p; + const char **p; struct fixs *n; for (n = fnmonths; n->name; ++n) @@ -411,9 +412,9 @@ getmonth(s) int getday(s) - register char *s; + char *s; { - register char **p; + const char **p; struct fixs *n; for (n = fndays; n->name; ++n) @@ -435,24 +436,24 @@ getday(s) */ int getdayvar(s) - register char *s; + char *s; { - register int offset; + int offs; - offset = strlen(s); + offs = strlen(s); /* Sun+1 or Wednesday-2 * ^ ^ */ - /* fprintf(stderr, "x: %s %s %d\n", s, s + offset - 2, offset); */ - switch(*(s + offset - 2)) { + /* fprintf(stderr, "x: %s %s %d\n", s, s + offs - 2, offs); */ + switch(*(s + offs - 2)) { case '-': - return(-(atoi(s + offset - 1))); + return(-(atoi(s + offs - 1))); break; case '+': - return(atoi(s + offset - 1)); + return(atoi(s + offs - 1)); break; } @@ -462,15 +463,15 @@ getdayvar(s) */ /* last */ - if (offset > 4 && !strcasecmp(s + offset - 4, "last")) + if (offs > 4 && !strcasecmp(s + offs - 4, "last")) return(-1); - else if (offset > 5 && !strcasecmp(s + offset - 5, "first")) + else if (offs > 5 && !strcasecmp(s + offs - 5, "first")) return(+1); - else if (offset > 6 && !strcasecmp(s + offset - 6, "second")) + else if (offs > 6 && !strcasecmp(s + offs - 6, "second")) return(+2); - else if (offset > 5 && !strcasecmp(s + offset - 5, "third")) + else if (offs > 5 && !strcasecmp(s + offs - 5, "third")) return(+3); - else if (offset > 6 && !strcasecmp(s + offset - 6, "fourth")) + else if (offs > 6 && !strcasecmp(s + offs - 6, "fourth")) return(+4); diff --git a/usr.bin/calendar/io.c b/usr.bin/calendar/io.c index 91e3f514a766..51b539c75ed5 100644 --- a/usr.bin/calendar/io.c +++ b/usr.bin/calendar/io.c @@ -29,44 +29,46 @@ * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF * SUCH DAMAGE. - * - * $FreeBSD$ */ +#include + +__FBSDID("$FreeBSD$"); + #ifndef lint static const char copyright[] = "@(#) Copyright (c) 1989, 1993\n\ The Regents of the University of California. All rights reserved.\n"; -#endif /* not lint */ +#endif #ifndef lint static const char sccsid[] = "@(#)calendar.c 8.3 (Berkeley) 3/25/94"; -#endif /* not lint */ +#endif -#include -#include -#include #include +#include #include -#include +#include +#include +#include +#include #include #include #include #include -#include -#include -#include -#include #include -#include +#include +#include +#include +#include #include "pathnames.h" #include "calendar.h" -char *calendarFile = "calendar"; /* default calendar file */ -char *calendarHome = ".calendar"; /* HOME */ -char *calendarNoMail = "nomail"; /* don't sent mail if this file exist */ +const char *calendarFile = "calendar"; /* default calendar file */ +const char *calendarHome = ".calendar"; /* HOME */ +const char *calendarNoMail = "nomail"; /* don't sent mail if this file exist */ struct fixs neaster, npaskha; @@ -84,8 +86,8 @@ struct iovec header[] = { void cal() { - register int printing; - register char *p; + int printing; + char *p; FILE *fp; int ch, l; int month; diff --git a/usr.bin/calendar/ostern.c b/usr.bin/calendar/ostern.c index 21c6c739799a..bf7f366a81a5 100644 --- a/usr.bin/calendar/ostern.c +++ b/usr.bin/calendar/ostern.c @@ -22,10 +22,12 @@ * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF * SUCH DAMAGE. - * - * $FreeBSD$ */ +#include + +__FBSDID("$FreeBSD$"); + #include #include #include @@ -76,7 +78,7 @@ geteaster(s, year) char *s; int year; { - register int offset = 0; + int offset = 0; extern struct fixs neaster; #define EASTER "easter" diff --git a/usr.bin/calendar/paskha.c b/usr.bin/calendar/paskha.c index e107e18df329..c5b31ba5008f 100644 --- a/usr.bin/calendar/paskha.c +++ b/usr.bin/calendar/paskha.c @@ -22,10 +22,12 @@ * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF * SUCH DAMAGE. - * - * $FreeBSD$ */ +#include + +__FBSDID("$FreeBSD$"); + #include #include #include @@ -36,6 +38,8 @@ #define PASKHA "paskha" #define PASKHALEN (sizeof(PASKHA) - 1) +static int paskha (int); + /* return year day for Orthodox Easter using Gauss formula */ /* (old style result) */