summaryrefslogtreecommitdiffstats
path: root/usr.bin/calendar
diff options
context:
space:
mode:
authormarkm <markm@FreeBSD.org>2001-12-02 22:44:14 +0000
committermarkm <markm@FreeBSD.org>2001-12-02 22:44:14 +0000
commit18cc007439fd4537b38b0a18777997e42808118b (patch)
treecdf9c2578aa28f8e4998863c56d35764b6ec1500 /usr.bin/calendar
parentc73844e02d229e510b00a5df2f361eb43b38c8de (diff)
downloadFreeBSD-src-18cc007439fd4537b38b0a18777997e42808118b.zip
FreeBSD-src-18cc007439fd4537b38b0a18777997e42808118b.tar.gz
WARNS=2 fixup (mostly. Some are Hard To Fix(tm), so NO_WERROR is set)
Use __FBSDID(). Sort some headers.
Diffstat (limited to 'usr.bin/calendar')
-rw-r--r--usr.bin/calendar/Makefile3
-rw-r--r--usr.bin/calendar/calendar.c10
-rw-r--r--usr.bin/calendar/calendar.h2
-rw-r--r--usr.bin/calendar/day.c51
-rw-r--r--usr.bin/calendar/io.c38
-rw-r--r--usr.bin/calendar/ostern.c8
-rw-r--r--usr.bin/calendar/paskha.c8
7 files changed, 66 insertions, 54 deletions
diff --git a/usr.bin/calendar/Makefile b/usr.bin/calendar/Makefile
index 13cc676..1473d04 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 197b82d..8a900f9 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 <sys/cdefs.h>
+
+__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 <err.h>
#include <errno.h>
diff --git a/usr.bin/calendar/calendar.h b/usr.bin/calendar/calendar.h
index 2e7adfa..e862210 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 16b17d7..44f8bb4 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 <sys/cdefs.h>
+
+__FBSDID("$FreeBSD$");
+#include <sys/types.h>
+#include <sys/uio.h>
#include <ctype.h>
+#include <err.h>
#include <locale.h>
#include <stdio.h>
+#include <stdlib.h>
#include <string.h>
-#include <sys/types.h>
-#include <time.h>
-#include <sys/uio.h>
#include <string.h>
-#include <stdlib.h>
-#include <err.h>
+#include <time.h>
#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 91e3f51..51b539c 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 <sys/cdefs.h>
+
+__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 <sys/param.h>
-#include <stdio.h>
-#include <ctype.h>
#include <sys/types.h>
+#include <sys/param.h>
#include <sys/stat.h>
-#include <unistd.h>
+#include <sys/time.h>
+#include <sys/uio.h>
+#include <sys/wait.h>
+#include <ctype.h>
#include <err.h>
#include <errno.h>
#include <langinfo.h>
#include <locale.h>
-#include <string.h>
-#include <sys/uio.h>
-#include <sys/time.h>
-#include <stdlib.h>
#include <pwd.h>
-#include <sys/wait.h>
+#include <stdio.h>
+#include <stdlib.h>
+#include <string.h>
+#include <unistd.h>
#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 21c6c73..bf7f366 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 <sys/cdefs.h>
+
+__FBSDID("$FreeBSD$");
+
#include <stdio.h>
#include <stdlib.h>
#include <string.h>
@@ -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 e107e18..c5b31ba 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 <sys/cdefs.h>
+
+__FBSDID("$FreeBSD$");
+
#include <stdio.h>
#include <stdlib.h>
#include <string.h>
@@ -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) */
OpenPOWER on IntegriCloud