From cea771722e07808fbbb1858cc71030218e44ea26 Mon Sep 17 00:00:00 2001 From: Nathan Bryant Date: Mon, 27 Mar 2000 00:46:12 +0000 Subject: [PATCH] * First cut at Solaris fixes. There may still be some *printf("%s", NULL) type of issues lurking in the shadows. --- citadel/ChangeLog | 5 +- citadel/Makefile.in | 4 +- citadel/auth.c | 6 +- citadel/citadel.h | 2 +- citadel/citmail.c | 10 +- citadel/citserver.c | 2 +- citadel/configure.in | 23 +- citadel/ipc_c_tcp.c | 10 +- citadel/msgbase.c | 2 +- citadel/parsedate.c | 1332 ++++++++++++++++++++++++++---------------- citadel/rcit.c | 2 +- citadel/routines.c | 17 +- citadel/serv_vcard.c | 19 +- citadel/setup.c | 9 +- citadel/sysdep.c | 5 +- citadel/user_ops.c | 2 +- 16 files changed, 896 insertions(+), 554 deletions(-) diff --git a/citadel/ChangeLog b/citadel/ChangeLog index 013014618..dc1b02b55 100644 --- a/citadel/ChangeLog +++ b/citadel/ChangeLog @@ -1,4 +1,8 @@ $Log$ + Revision 570.5 2000/03/27 00:46:10 nbryant + * First cut at Solaris fixes. There may still be some *printf("%s", NULL) + type of issues lurking in the shadows. + Revision 570.4 2000/03/25 18:29:58 nbryant changed my email address @@ -1780,4 +1784,3 @@ Sat Jul 11 00:20:48 EDT 1998 Nathan Bryant Fri Jul 10 1998 Art Cancro * Initial CVS import - diff --git a/citadel/Makefile.in b/citadel/Makefile.in index 8e50562cb..60ce94983 100644 --- a/citadel/Makefile.in +++ b/citadel/Makefile.in @@ -220,7 +220,7 @@ netproc: netproc.o config.o ipc_c_tcp.o tools.o $(LIBOBJS) $(LIBOBJS) $(LDFLAGS) -o netproc $(NETLIBS) $(GDBM) citmail: citmail.o config.o - $(CC) citmail.o config.o $(LDFLAGS) -o citmail + $(CC) citmail.o config.o $(LDFLAGS) -o citmail $(NETLIBS) mailinglist: mailinglist.o config.o internetmail.o $(CC) mailinglist.o config.o internetmail.o $(LDFLAGS) -o mailinglist @@ -287,7 +287,7 @@ install-data: install-doc: @./mkinstalldirs $(root)$(prefix)/techdoc - @for i in *.txt `find techdoc -type f | grep -v CVS`; do \ + @for i in `find techdoc -type f | grep -v CVS`; do \ echo $(INSTALL_DATA) $$i $(root)$(prefix)/$$i; \ $(INSTALL_DATA) $$i $(root)$(prefix)/$$i; \ done diff --git a/citadel/auth.c b/citadel/auth.c index 927c6ddb9..37b989aff 100644 --- a/citadel/auth.c +++ b/citadel/auth.c @@ -5,9 +5,9 @@ * $Id$ */ -#ifdef linux -#define _XOPEN_SOURCE /* needed for crypt() */ -#define _XOPEN_SOURCE_EXTENDED /* needed for strdup() */ +#if defined(__linux) || defined(__sun) /* needed for crypt(): */ +#define _XOPEN_SOURCE +#define _XOPEN_SOURCE_EXTENDED 1 #endif #include diff --git a/citadel/citadel.h b/citadel/citadel.h index 72819f61e..10d89bb27 100644 --- a/citadel/citadel.h +++ b/citadel/citadel.h @@ -52,7 +52,7 @@ struct config { char c_fqdn[64]; /* Fully Qualified Domain Name */ char c_humannode[21]; /* Long name of system */ char c_phonenum[16]; /* Dialup number of system */ - int c_bbsuid; /* UID of the bbs-only user */ + uid_t c_bbsuid; /* UID of the bbs-only user */ char c_creataide; /* room creator = room aide flag */ int c_sleeping; /* watchdog timer setting */ char c_initax; /* initial access level */ diff --git a/citadel/citmail.c b/citadel/citmail.c index 6eab7a773..a484e6bd2 100644 --- a/citadel/citmail.c +++ b/citadel/citmail.c @@ -53,11 +53,11 @@ void timeout(int signum) int uds_connectsock(char *sockpath) { int s; - struct sockaddr_un sun; + struct sockaddr_un addr; - memset(&sun, 0, sizeof(sun)); - sun.sun_family = AF_UNIX; - strncpy(sun.sun_path, sockpath, sizeof sun.sun_path); + memset(&addr, 0, sizeof(addr)); + addr.sun_family = AF_UNIX; + strncpy(addr.sun_path, sockpath, sizeof addr.sun_path); s = socket(AF_UNIX, SOCK_STREAM, 0); if (s < 0) { @@ -66,7 +66,7 @@ int uds_connectsock(char *sockpath) exit(3); } - if (connect(s, (struct sockaddr *) &sun, sizeof(sun)) < 0) { + if (connect(s, (struct sockaddr *) &addr, sizeof(addr)) < 0) { fprintf(stderr, "can't connect: %s\n", strerror(errno)); exit(3); diff --git a/citadel/citserver.c b/citadel/citserver.c index 28656d017..7acaa6701 100644 --- a/citadel/citserver.c +++ b/citadel/citserver.c @@ -421,7 +421,7 @@ void cmd_iden(char *argbuf) lprintf(9, "Looking up hostname '%s'\n", from_host); if ((strlen(from_host)>0) && ( (CC->is_local_socket) || (is_public_client(CC->cs_host)))) { - if ((addr.s_addr = inet_addr(from_host)) != INADDR_NONE) + if ((addr.s_addr = inet_addr(from_host)) != -1) locate_host(CC->cs_host, &addr); else { safestrncpy(CC->cs_host, from_host, sizeof CC->cs_host); diff --git a/citadel/configure.in b/citadel/configure.in index 7b2e8963f..61f80d182 100644 --- a/citadel/configure.in +++ b/citadel/configure.in @@ -66,6 +66,9 @@ case "$host" in PTHREAD_DEFS=-pthread LINK_SHARED="ld -x -Bshareable" ;; + *-*-solaris*) + PTHREAD_DEFS="-D_REENTRANT -D_PTHREADS" + ;; esac dnl Checks for programs. @@ -73,14 +76,20 @@ AC_PROG_CC dnl Set up system-dependent compiler flags. if test "$GCC" = yes; then - CFLAGS="$CFLAGS -Wall -Wstrict-prototypes" case "$host" in *-*-bsdi[123]*) + CFLAGS="$CFLAGS -Wall -Wstrict-prototypes" ;; mips*-sgi-irix*) + CFLAGS="$CFLAGS -Wall -Wstrict-prototypes" + PICFLAGS=-fPIC + ;; + *-*-solaris*) + CFLAGS="$CFLAGS -Wall -Wno-char-subscripts" PICFLAGS=-fPIC ;; *) + CFLAGS="$CFLAGS -Wall -Wstrict-prototypes" SERVER_LDFLAGS="$SERVER_LDFLAGS -rdynamic" PICFLAGS=-fPIC ;; @@ -162,10 +171,10 @@ test -f /usr/local/lib/libresolv.a && LDFLAGS="$LDFLAGS -L/usr/local/lib" AC_CHECK_LIB(resolv, res_query, RESOLV="$RESOLV -lresolv") save_LIBS=$LIBS -AC_CHECK_LIB(termcap, tgetent, [LIBS="$LIBS -ltermcap" - CURSES=-ltermcap]) -AC_CHECK_LIB(curses, initscr, CURSES="-lcurses $CURSES", [ - AC_CHECK_LIB(ncurses, initscr, CURSES="-lncurses")]) +LIBS=$CURSES +AC_SEARCH_LIBS(tgetent, [curses termcap]) +AC_SEARCH_LIBS(initscr, [curses ncurses]) +CURSES=$LIBS LIBS=$save_LIBS dnl Check for libpthread(s) if we're not using Digital UNIX or FreeBSD. (On @@ -182,7 +191,7 @@ AC_HEADER_DIRENT AC_HEADER_STDC AC_HEADER_SYS_WAIT test -f /usr/local/include/gdbm.h && CPPFLAGS="$CPPFLAGS -I/usr/local/include" -AC_CHECK_HEADERS(curses.h fcntl.h limits.h termios.h strings.h sys/ioctl.h sys/select.h sys/time.h syslog.h unistd.h gdbm.h utmp.h paths.h) +AC_CHECK_HEADERS(curses.h fcntl.h limits.h termios.h strings.h sys/ioctl.h sys/select.h sys/time.h syslog.h unistd.h gdbm.h utmp.h utmpx.h paths.h) dnl some systems require -pthread, -D_REENTRANT, etc to be passed to cc if we dnl include pthread.h: @@ -219,7 +228,7 @@ AC_FUNC_GETPGRP AC_PROG_GCC_TRADITIONAL AC_TYPE_SIGNAL AC_FUNC_VPRINTF -AC_CHECK_FUNCS(getspnam mkdir mkfifo mktime rmdir select socket strerror) +AC_CHECK_FUNCS(getspnam getutxline mkdir mkfifo mktime rmdir select socket strerror) dnl Now check for pthreads -- set up variables so that the compiler will be run dnl with proper flags for pthread programs diff --git a/citadel/ipc_c_tcp.c b/citadel/ipc_c_tcp.c index 009c69722..a56adb2b4 100644 --- a/citadel/ipc_c_tcp.c +++ b/citadel/ipc_c_tcp.c @@ -128,12 +128,12 @@ int connectsock(char *host, char *service, char *protocol) int uds_connectsock(char *sockpath) { - struct sockaddr_un sun; + struct sockaddr_un addr; int s; - memset(&sun, 0, sizeof(sun)); - sun.sun_family = AF_UNIX; - strncpy(sun.sun_path, sockpath, sizeof sun.sun_path); + memset(&addr, 0, sizeof(addr)); + addr.sun_family = AF_UNIX; + strncpy(addr.sun_path, sockpath, sizeof addr.sun_path); s = socket(AF_UNIX, SOCK_STREAM, 0); if (s < 0) { @@ -142,7 +142,7 @@ int uds_connectsock(char *sockpath) logoff(3); } - if (connect(s, (struct sockaddr *) &sun, sizeof(sun)) < 0) { + if (connect(s, (struct sockaddr *) &addr, sizeof(addr)) < 0) { fprintf(stderr, "can't connect: %s\n", strerror(errno)); logoff(3); diff --git a/citadel/msgbase.c b/citadel/msgbase.c index 88d1484df..486e89323 100644 --- a/citadel/msgbase.c +++ b/citadel/msgbase.c @@ -2192,7 +2192,7 @@ int CtdlDeleteMessages(char *room_name, /* which room */ struct SuppMsgInfo smi; lprintf(9, "CtdlDeleteMessages(%s, %ld, %s)\n", - room_name, dmsgnum, content_type); + room_name, dmsgnum, content_type ? content_type : "NULL"); /* get room record, obtaining a lock... */ if (lgetroom(&qrbuf, room_name) != 0) { diff --git a/citadel/parsedate.c b/citadel/parsedate.c index f2927093e..284dbac83 100644 --- a/citadel/parsedate.c +++ b/citadel/parsedate.c @@ -1,14 +1,5 @@ -#ifndef lint -static char yysccsid[] = "@(#)yaccpar 1.9 (Berkeley) 02/21/93"; -#endif -#define YYBYACC 1 -#define YYMAJOR 1 -#define YYMINOR 9 -#define yyclearin (yychar=(-1)) -#define yyerrok (yyerrflag=0) -#define YYRECOVERING (yyerrflag!=0) -#define YYPREFIX "yy" -#line 2 "parsedate.y" + +# line 2 "parsedate.y" /* $Revision$ ** ** Originally written by Steven M. Bellovin while @@ -105,196 +96,80 @@ static time_t yyRelSeconds; static void date_error(char *); -#line 100 "parsedate.y" -typedef union { + +# line 100 "parsedate.y" +typedef union +#ifdef __cplusplus + YYSTYPE +#endif + { time_t Number; enum _MERIDIAN Meridian; } YYSTYPE; -#line 114 "y.tab.c" -#define tDAY 257 -#define tDAYZONE 258 -#define tMERIDIAN 259 -#define tMONTH 260 -#define tMONTH_UNIT 261 -#define tSEC_UNIT 262 -#define tSNUMBER 263 -#define tUNUMBER 264 -#define tZONE 265 -#define YYERRCODE 256 -short yylhs[] = { -1, - 0, 0, 4, 4, 4, 4, 5, 5, 5, 5, - 5, 2, 2, 2, 2, 1, 6, 6, 6, 6, - 6, 6, 6, 7, 7, 7, 7, 3, 3, -}; -short yylen[] = { 2, - 0, 2, 1, 2, 1, 1, 2, 4, 4, 6, - 6, 1, 1, 2, 1, 1, 3, 5, 2, 4, - 2, 3, 5, 2, 2, 2, 2, 0, 1, -}; -short yydefred[] = { 1, - 0, 0, 0, 0, 0, 2, 0, 5, 6, 0, - 0, 26, 24, 29, 0, 27, 25, 0, 0, 7, - 13, 16, 0, 15, 4, 0, 0, 22, 0, 0, - 14, 0, 20, 0, 9, 8, 0, 23, 0, 18, - 11, 10, -}; -short yydgoto[] = { 1, - 24, 25, 20, 6, 7, 8, 9, -}; -short yysindex[] = { 0, - -239, -36, -248, -255, -47, 0, -232, 0, 0, -247, - -25, 0, 0, 0, -237, 0, 0, -235, -234, 0, - 0, 0, -231, 0, 0, -226, -229, 0, -56, -11, - 0, -227, 0, -225, 0, 0, -224, 0, -250, 0, - 0, 0, -}; -short yyrindex[] = { 0, - 0, 0, 0, 0, 1, 0, 22, 0, 0, 0, - 12, 0, 0, 0, 28, 0, 0, 0, 0, 0, - 0, 0, 23, 0, 0, 0, 0, 0, 3, 14, - 0, 0, 0, 0, 0, 0, 0, 0, 3, 0, - 0, 0, -}; -short yygindex[] = { 0, - -19, 0, -24, 0, 0, 0, 0, -}; -#define YYTABLESIZE 291 -short yytable[] = { 19, - 28, 34, 28, 31, 36, 12, 13, 10, 14, 35, - 18, 19, 22, 17, 42, 11, 26, 2, 27, 41, - 3, 3, 12, 4, 5, 21, 28, 21, 29, 30, - 22, 22, 23, 32, 33, 37, 38, 0, 39, 40, - 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, - 0, 0, 14, 0, 0, 0, 22, 0, 0, 0, - 0, 14, 15, 16, 17, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 0, 0, 0, 28, 28, 28, - 28, 0, 28, 28, 28, 28, 28, 28, 19, 0, - 17, 19, 0, 17, 19, 19, 17, 17, 3, 12, - 0, 3, 12, 0, 21, 3, 12, 21, 0, 0, - 21, -}; -short yycheck[] = { 47, - 0, 58, 0, 23, 29, 261, 262, 44, 259, 29, - 58, 0, 263, 0, 39, 264, 264, 257, 44, 39, - 260, 0, 0, 263, 264, 258, 264, 0, 264, 264, - 263, 263, 265, 260, 264, 47, 264, -1, 264, 264, - -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, - -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, - -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, - -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, - -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, - -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, - -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, - -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, - -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, - -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, - -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, - -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, - -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, - -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, - -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, - -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, - -1, -1, 259, -1, -1, -1, 263, -1, -1, -1, - -1, 259, 260, 261, 262, -1, -1, -1, -1, -1, - -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, - -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, - -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, - -1, -1, -1, -1, -1, -1, -1, 257, 258, 257, - 258, -1, 260, 263, 264, 265, 264, 265, 257, -1, - 257, 260, -1, 260, 263, 264, 263, 264, 257, 257, - -1, 260, 260, -1, 257, 264, 264, 260, -1, -1, - 263, -}; -#define YYFINAL 1 -#ifndef YYDEBUG -#define YYDEBUG 0 +# define tDAY 257 +# define tDAYZONE 258 +# define tMERIDIAN 259 +# define tMONTH 260 +# define tMONTH_UNIT 261 +# define tSEC_UNIT 262 +# define tSNUMBER 263 +# define tUNUMBER 264 +# define tZONE 265 + +#include + +#ifdef __STDC__ +#include +#include +#else +#include +#include #endif -#define YYMAXTOKEN 265 -#if YYDEBUG -char *yyname[] = { -"end-of-file",0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0, -0,0,0,0,0,0,0,0,0,0,"','",0,0,"'/'",0,0,0,0,0,0,0,0,0,0,"':'",0,0,0,0,0,0,0,0,0, -0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0, -0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0, -0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0, -0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0, -0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,"tDAY","tDAYZONE", -"tMERIDIAN","tMONTH","tMONTH_UNIT","tSEC_UNIT","tSNUMBER","tUNUMBER","tZONE", -}; -char *yyrule[] = { -"$accept : spec", -"spec :", -"spec : spec item", -"item : time", -"item : time zone", -"item : date", -"item : rel", -"time : tUNUMBER o_merid", -"time : tUNUMBER ':' tUNUMBER o_merid", -"time : tUNUMBER ':' tUNUMBER numzone", -"time : tUNUMBER ':' tUNUMBER ':' tUNUMBER o_merid", -"time : tUNUMBER ':' tUNUMBER ':' tUNUMBER numzone", -"zone : tZONE", -"zone : tDAYZONE", -"zone : tZONE numzone", -"zone : numzone", -"numzone : tSNUMBER", -"date : tUNUMBER '/' tUNUMBER", -"date : tUNUMBER '/' tUNUMBER '/' tUNUMBER", -"date : tMONTH tUNUMBER", -"date : tMONTH tUNUMBER ',' tUNUMBER", -"date : tUNUMBER tMONTH", -"date : tUNUMBER tMONTH tUNUMBER", -"date : tDAY ',' tUNUMBER tMONTH tUNUMBER", -"rel : tSNUMBER tSEC_UNIT", -"rel : tUNUMBER tSEC_UNIT", -"rel : tSNUMBER tMONTH_UNIT", -"rel : tUNUMBER tMONTH_UNIT", -"o_merid :", -"o_merid : tMERIDIAN", -}; + +#include + +#if defined(__cplusplus) || defined(__STDC__) + +#if defined(__cplusplus) && defined(__EXTERN_C__) +extern "C" { #endif -#ifdef YYSTACKSIZE -#undef YYMAXDEPTH -#define YYMAXDEPTH YYSTACKSIZE -#else -#ifdef YYMAXDEPTH -#define YYSTACKSIZE YYMAXDEPTH -#else -#define YYSTACKSIZE 500 -#define YYMAXDEPTH 500 +#ifndef yyerror +#if defined(__cplusplus) + void yyerror(const char *); #endif #endif -int yydebug; -int yynerrs; -int yyerrflag; -int yychar; -short *yyssp; -YYSTYPE *yyvsp; -YYSTYPE yyval; +#ifndef yylex + int yylex(void); +#endif + int yyparse(void); +#if defined(__cplusplus) && defined(__EXTERN_C__) +} +#endif + +#endif + +#define yyclearin yychar = -1 +#define yyerrok yyerrflag = 0 +extern int yychar; +extern int yyerrflag; YYSTYPE yylval; -short yyss[YYSTACKSIZE]; -YYSTYPE yyvs[YYSTACKSIZE]; -#define yystacksize YYSTACKSIZE -#line 287 "parsedate.y" +YYSTYPE yyval; +typedef int yytabelem; +#ifndef YYMAXDEPTH +#define YYMAXDEPTH 150 +#endif +#if YYMAXDEPTH > 0 +int yy_yys[YYMAXDEPTH], *yys = yy_yys; +YYSTYPE yy_yyv[YYMAXDEPTH], *yyv = yy_yyv; +#else /* user does initial allocation */ +int *yys; +YYSTYPE *yyv; +#endif +static int yymaxdepth = YYMAXDEPTH; +# define YYERRCODE 256 + +# line 286 "parsedate.y" + /* Month and day table. */ static TABLE MonthDayTable[] = { @@ -801,149 +676,663 @@ main(int ac, char *av[]) /* NOTREACHED */ } #endif /* TEST */ -#line 805 "y.tab.c" -#define YYABORT goto yyabort -#define YYREJECT goto yyabort -#define YYACCEPT goto yyaccept -#define YYERROR goto yyerrlab -int -yyparse() -{ - register int yym, yyn, yystate; +static const yytabelem yyexca[] ={ +-1, 1, + 0, -1, + -2, 0, + }; +# define YYNPROD 30 +# define YYLAST 216 +static const yytabelem yyact[]={ + + 17, 12, 34, 40, 39, 21, 14, 8, 11, 14, + 7, 16, 38, 9, 6, 36, 31, 29, 28, 27, + 22, 14, 25, 24, 37, 35, 30, 23, 13, 15, + 5, 4, 3, 2, 1, 10, 0, 0, 0, 0, + 26, 0, 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 33, 32, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 42, 41, 0, + 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 21, 0, 0, 0, 14, 0, 0, + 0, 0, 21, 18, 20, 19 }; +static const yytabelem yypact[]={ + +-10000000, -250,-10000000, -257,-10000000,-10000000, -47, -244, -17, -239, +-10000000, -242,-10000000,-10000000,-10000000,-10000000, -245, -246, -247,-10000000, +-10000000,-10000000, -18, -248,-10000000,-10000000,-10000000, -56, -22,-10000000, + -249, -236,-10000000,-10000000, -252, -260,-10000000, -261, -254,-10000000, +-10000000,-10000000,-10000000 }; +static const yytabelem yypgo[]={ + + 0, 28, 35, 29, 34, 33, 32, 31, 30 }; +static const yytabelem yyr1[]={ + + 0, 4, 4, 5, 5, 5, 5, 6, 6, 6, + 6, 6, 2, 2, 2, 2, 1, 7, 7, 7, + 7, 7, 7, 7, 8, 8, 8, 8, 3, 3 }; +static const yytabelem yyr2[]={ + + 0, 0, 4, 3, 5, 3, 3, 5, 9, 9, + 13, 13, 3, 3, 5, 3, 3, 7, 11, 5, + 9, 5, 7, 11, 5, 5, 5, 5, 1, 3 }; +static const yytabelem yychk[]={ + +-10000000, -4, -5, -6, -7, -8, 264, 260, 257, 263, + -2, 265, 258, -1, 263, -3, 58, 47, 260, 262, + 261, 259, 264, 44, 262, 261, -1, 264, 264, 264, + 44, 264, -3, -1, 58, 47, 264, 260, 264, 264, + 264, -3, -1 }; +static const yytabelem yydef[]={ + + 1, -2, 2, 3, 5, 6, 28, 0, 0, 0, + 4, 12, 13, 15, 16, 7, 0, 0, 21, 25, + 27, 29, 19, 0, 24, 26, 14, 28, 17, 22, + 0, 0, 8, 9, 0, 0, 20, 0, 28, 18, + 23, 10, 11 }; +typedef struct +#ifdef __cplusplus + yytoktype +#endif +{ char *t_name; int t_val; } yytoktype; +#ifndef YYDEBUG +# define YYDEBUG 0 /* don't allow debugging */ +#endif + #if YYDEBUG - register char *yys; - extern char *getenv(); - - if (yys = getenv("YYDEBUG")) - { - yyn = *yys; - if (yyn >= '0' && yyn <= '9') - yydebug = yyn - '0'; - } + +yytoktype yytoks[] = +{ + "tDAY", 257, + "tDAYZONE", 258, + "tMERIDIAN", 259, + "tMONTH", 260, + "tMONTH_UNIT", 261, + "tSEC_UNIT", 262, + "tSNUMBER", 263, + "tUNUMBER", 264, + "tZONE", 265, + "-unknown-", -1 /* ends search */ +}; + +char * yyreds[] = +{ + "-no such reduction-", + "spec : /* empty */", + "spec : spec item", + "item : time", + "item : time zone", + "item : date", + "item : rel", + "time : tUNUMBER o_merid", + "time : tUNUMBER ':' tUNUMBER o_merid", + "time : tUNUMBER ':' tUNUMBER numzone", + "time : tUNUMBER ':' tUNUMBER ':' tUNUMBER o_merid", + "time : tUNUMBER ':' tUNUMBER ':' tUNUMBER numzone", + "zone : tZONE", + "zone : tDAYZONE", + "zone : tZONE numzone", + "zone : numzone", + "numzone : tSNUMBER", + "date : tUNUMBER '/' tUNUMBER", + "date : tUNUMBER '/' tUNUMBER '/' tUNUMBER", + "date : tMONTH tUNUMBER", + "date : tMONTH tUNUMBER ',' tUNUMBER", + "date : tUNUMBER tMONTH", + "date : tUNUMBER tMONTH tUNUMBER", + "date : tDAY ',' tUNUMBER tMONTH tUNUMBER", + "rel : tSNUMBER tSEC_UNIT", + "rel : tUNUMBER tSEC_UNIT", + "rel : tSNUMBER tMONTH_UNIT", + "rel : tUNUMBER tMONTH_UNIT", + "o_merid : /* empty */", + "o_merid : tMERIDIAN", +}; +#endif /* YYDEBUG */ +# line 1 "/usr/ccs/bin/yaccpar" +/* + * Copyright (c) 1993 by Sun Microsystems, Inc. + */ + +#pragma ident "@(#)yaccpar 6.15 97/12/08 SMI" + +/* +** Skeleton parser driver for yacc output +*/ + +/* +** yacc user known macros and defines +*/ +#define YYERROR goto yyerrlab +#define YYACCEPT return(0) +#define YYABORT return(1) +#define YYBACKUP( newtoken, newvalue )\ +{\ + if ( yychar >= 0 || ( yyr2[ yytmp ] >> 1 ) != 1 )\ + {\ + yyerror( "syntax error - cannot backup" );\ + goto yyerrlab;\ + }\ + yychar = newtoken;\ + yystate = *yyps;\ + yylval = newvalue;\ + goto yynewstate;\ +} +#define YYRECOVERING() (!!yyerrflag) +#define YYNEW(type) malloc(sizeof(type) * yynewmax) +#define YYCOPY(to, from, type) \ + (type *) memcpy(to, (char *) from, yymaxdepth * sizeof (type)) +#define YYENLARGE( from, type) \ + (type *) realloc((char *) from, yynewmax * sizeof(type)) +#ifndef YYDEBUG +# define YYDEBUG 1 /* make debugging available */ #endif - yynerrs = 0; - yyerrflag = 0; - yychar = (-1); +/* +** user known globals +*/ +int yydebug; /* set to 1 to get debugging */ - yyssp = yyss; - yyvsp = yyvs; - *yyssp = yystate = 0; +/* +** driver internal defines +*/ +#define YYFLAG (-10000000) -yyloop: - if (yyn = yydefred[yystate]) goto yyreduce; - if (yychar < 0) - { - if ((yychar = yylex()) < 0) yychar = 0; -#if YYDEBUG - if (yydebug) - { - yys = 0; - if (yychar <= YYMAXTOKEN) yys = yyname[yychar]; - if (!yys) yys = "illegal-symbol"; - printf("%sdebug: state %d, reading %d (%s)\n", - YYPREFIX, yystate, yychar, yys); - } +/* +** global variables used by the parser +*/ +YYSTYPE *yypv; /* top of value stack */ +int *yyps; /* top of state stack */ + +int yystate; /* current state */ +int yytmp; /* extra var (lasts between blocks) */ + +int yynerrs; /* number of errors */ +int yyerrflag; /* error recovery flag */ +int yychar; /* current input token number */ + + + +#ifdef YYNMBCHARS +#define YYLEX() yycvtok(yylex()) +/* +** yycvtok - return a token if i is a wchar_t value that exceeds 255. +** If i<255, i itself is the token. If i>255 but the neither +** of the 30th or 31st bit is on, i is already a token. +*/ +#if defined(__STDC__) || defined(__cplusplus) +int yycvtok(int i) +#else +int yycvtok(i) int i; #endif - } - if ((yyn = yysindex[yystate]) && (yyn += yychar) >= 0 && - yyn <= YYTABLESIZE && yycheck[yyn] == yychar) - { -#if YYDEBUG - if (yydebug) - printf("%sdebug: state %d, shifting to state %d\n", - YYPREFIX, yystate, yytable[yyn]); +{ + int first = 0; + int last = YYNMBCHARS - 1; + int mid; + wchar_t j; + + if(i&0x60000000){/*Must convert to a token. */ + if( yymbchars[last].character < i ){ + return i;/*Giving up*/ + } + while ((last>=first)&&(first>=0)) {/*Binary search loop*/ + mid = (first+last)/2; + j = yymbchars[mid].character; + if( j==i ){/*Found*/ + return yymbchars[mid].tvalue; + }else if( j= yyss + yystacksize - 1) - { - goto yyoverflow; - } - *++yyssp = yystate = yytable[yyn]; - *++yyvsp = yylval; - yychar = (-1); - if (yyerrflag > 0) --yyerrflag; - goto yyloop; - } - if ((yyn = yyrindex[yystate]) && (yyn += yychar) >= 0 && - yyn <= YYTABLESIZE && yycheck[yyn] == yychar) - { - yyn = yytable[yyn]; - goto yyreduce; - } - if (yyerrflag) goto yyinrecovery; -#ifdef lint - goto yynewerror; +{ + register YYSTYPE *yypvt = 0; /* top of value stack for $vars */ + +#if defined(__cplusplus) || defined(lint) +/* + hacks to please C++ and lint - goto's inside + switch should never be executed +*/ + static int __yaccpar_lint_hack__ = 0; + switch (__yaccpar_lint_hack__) + { + case 1: goto yyerrlab; + case 2: goto yynewstate; + } #endif -yynewerror: - yyerror("syntax error"); -#ifdef lint - goto yyerrlab; + + /* + ** Initialize externals - yyparse may be called more than once + */ + yypv = &yyv[-1]; + yyps = &yys[-1]; + yystate = 0; + yytmp = 0; + yynerrs = 0; + yyerrflag = 0; + yychar = -1; + +#if YYMAXDEPTH <= 0 + if (yymaxdepth <= 0) + { + if ((yymaxdepth = YYEXPAND(0)) <= 0) + { + yyerror("yacc initialization error"); + YYABORT; + } + } #endif -yyerrlab: - ++yynerrs; -yyinrecovery: - if (yyerrflag < 3) - { - yyerrflag = 3; - for (;;) - { - if ((yyn = yysindex[*yyssp]) && (yyn += YYERRCODE) >= 0 && - yyn <= YYTABLESIZE && yycheck[yyn] == YYERRCODE) - { + + { + register YYSTYPE *yy_pv; /* top of value stack */ + register int *yy_ps; /* top of state stack */ + register int yy_state; /* current state */ + register int yy_n; /* internal state number info */ + goto yystack; /* moved from 6 lines above to here to please C++ */ + + /* + ** get globals into registers. + ** branch to here only if YYBACKUP was called. + */ + yynewstate: + yy_pv = yypv; + yy_ps = yyps; + yy_state = yystate; + goto yy_newstate; + + /* + ** get globals into registers. + ** either we just started, or we just finished a reduction + */ + yystack: + yy_pv = yypv; + yy_ps = yyps; + yy_state = yystate; + + /* + ** top of for (;;) loop while no reductions done + */ + yy_stack: + /* + ** put a state and value onto the stacks + */ #if YYDEBUG - if (yydebug) - printf("%sdebug: state %d, error recovery shifting\ - to state %d\n", YYPREFIX, *yyssp, yytable[yyn]); + /* + ** if debugging, look up token value in list of value vs. + ** name pairs. 0 and negative (-1) are special values. + ** Note: linear search is used since time is not a real + ** consideration while debugging. + */ + if ( yydebug ) + { + register int yy_i; + + printf( "State %d, token ", yy_state ); + if ( yychar == 0 ) + printf( "end-of-file\n" ); + else if ( yychar < 0 ) + printf( "-none-\n" ); + else + { + for ( yy_i = 0; yytoks[yy_i].t_val >= 0; + yy_i++ ) + { + if ( yytoks[yy_i].t_val == yychar ) + break; + } + printf( "%s\n", yytoks[yy_i].t_name ); + } + } +#endif /* YYDEBUG */ + if ( ++yy_ps >= &yys[ yymaxdepth ] ) /* room on stack? */ + { + /* + ** reallocate and recover. Note that pointers + ** have to be reset, or bad things will happen + */ + long yyps_index = (yy_ps - yys); + long yypv_index = (yy_pv - yyv); + long yypvt_index = (yypvt - yyv); + int yynewmax; +#ifdef YYEXPAND + yynewmax = YYEXPAND(yymaxdepth); +#else + yynewmax = 2 * yymaxdepth; /* double table size */ + if (yymaxdepth == YYMAXDEPTH) /* first time growth */ + { + char *newyys = (char *)YYNEW(int); + char *newyyv = (char *)YYNEW(YYSTYPE); + if (newyys != 0 && newyyv != 0) + { + yys = YYCOPY(newyys, yys, int); + yyv = YYCOPY(newyyv, yyv, YYSTYPE); + } + else + yynewmax = 0; /* failed */ + } + else /* not first time */ + { + yys = YYENLARGE(yys, int); + yyv = YYENLARGE(yyv, YYSTYPE); + if (yys == 0 || yyv == 0) + yynewmax = 0; /* failed */ + } #endif - if (yyssp >= yyss + yystacksize - 1) - { - goto yyoverflow; - } - *++yyssp = yystate = yytable[yyn]; - *++yyvsp = yylval; - goto yyloop; - } - else - { + if (yynewmax <= yymaxdepth) /* tables not expanded */ + { + yyerror( "yacc stack overflow" ); + YYABORT; + } + yymaxdepth = yynewmax; + + yy_ps = yys + yyps_index; + yy_pv = yyv + yypv_index; + yypvt = yyv + yypvt_index; + } + *yy_ps = yy_state; + *++yy_pv = yyval; + + /* + ** we have a new state - find out what to do + */ + yy_newstate: + if ( ( yy_n = yypact[ yy_state ] ) <= YYFLAG ) + goto yydefault; /* simple state */ #if YYDEBUG - if (yydebug) - printf("%sdebug: error recovery discarding state %d\n", - YYPREFIX, *yyssp); + /* + ** if debugging, need to mark whether new token grabbed + */ + yytmp = yychar < 0; #endif - if (yyssp <= yyss) goto yyabort; - --yyssp; - --yyvsp; - } - } - } - else - { - if (yychar == 0) goto yyabort; + if ( ( yychar < 0 ) && ( ( yychar = YYLEX() ) < 0 ) ) + yychar = 0; /* reached EOF */ +#if YYDEBUG + if ( yydebug && yytmp ) + { + register int yy_i; + + printf( "Received token " ); + if ( yychar == 0 ) + printf( "end-of-file\n" ); + else if ( yychar < 0 ) + printf( "-none-\n" ); + else + { + for ( yy_i = 0; yytoks[yy_i].t_val >= 0; + yy_i++ ) + { + if ( yytoks[yy_i].t_val == yychar ) + break; + } + printf( "%s\n", yytoks[yy_i].t_name ); + } + } +#endif /* YYDEBUG */ + if ( ( ( yy_n += yychar ) < 0 ) || ( yy_n >= YYLAST ) ) + goto yydefault; + if ( yychk[ yy_n = yyact[ yy_n ] ] == yychar ) /*valid shift*/ + { + yychar = -1; + yyval = yylval; + yy_state = yy_n; + if ( yyerrflag > 0 ) + yyerrflag--; + goto yy_stack; + } + + yydefault: + if ( ( yy_n = yydef[ yy_state ] ) == -2 ) + { #if YYDEBUG - if (yydebug) - { - yys = 0; - if (yychar <= YYMAXTOKEN) yys = yyname[yychar]; - if (!yys) yys = "illegal-symbol"; - printf("%sdebug: state %d, error recovery discards token %d (%s)\n", - YYPREFIX, yystate, yychar, yys); - } + yytmp = yychar < 0; #endif - yychar = (-1); - goto yyloop; - } -yyreduce: + if ( ( yychar < 0 ) && ( ( yychar = YYLEX() ) < 0 ) ) + yychar = 0; /* reached EOF */ +#if YYDEBUG + if ( yydebug && yytmp ) + { + register int yy_i; + + printf( "Received token " ); + if ( yychar == 0 ) + printf( "end-of-file\n" ); + else if ( yychar < 0 ) + printf( "-none-\n" ); + else + { + for ( yy_i = 0; + yytoks[yy_i].t_val >= 0; + yy_i++ ) + { + if ( yytoks[yy_i].t_val + == yychar ) + { + break; + } + } + printf( "%s\n", yytoks[yy_i].t_name ); + } + } +#endif /* YYDEBUG */ + /* + ** look through exception table + */ + { + register const int *yyxi = yyexca; + + while ( ( *yyxi != -1 ) || + ( yyxi[1] != yy_state ) ) + { + yyxi += 2; + } + while ( ( *(yyxi += 2) >= 0 ) && + ( *yyxi != yychar ) ) + ; + if ( ( yy_n = yyxi[1] ) < 0 ) + YYACCEPT; + } + } + + /* + ** check for syntax error + */ + if ( yy_n == 0 ) /* have an error */ + { + /* no worry about speed here! */ + switch ( yyerrflag ) + { + case 0: /* new error */ + yyerror( "syntax error" ); + goto skip_init; + yyerrlab: + /* + ** get globals into registers. + ** we have a user generated syntax type error + */ + yy_pv = yypv; + yy_ps = yyps; + yy_state = yystate; + skip_init: + yynerrs++; + /* FALLTHRU */ + case 1: + case 2: /* incompletely recovered error */ + /* try again... */ + yyerrflag = 3; + /* + ** find state where "error" is a legal + ** shift action + */ + while ( yy_ps >= yys ) + { + yy_n = yypact[ *yy_ps ] + YYERRCODE; + if ( yy_n >= 0 && yy_n < YYLAST && + yychk[yyact[yy_n]] == YYERRCODE) { + /* + ** simulate shift of "error" + */ + yy_state = yyact[ yy_n ]; + goto yy_stack; + } + /* + ** current state has no shift on + ** "error", pop stack + */ +#if YYDEBUG +# define _POP_ "Error recovery pops state %d, uncovers state %d\n" + if ( yydebug ) + printf( _POP_, *yy_ps, + yy_ps[-1] ); +# undef _POP_ +#endif + yy_ps--; + yy_pv--; + } + /* + ** there is no state on stack with "error" as + ** a valid shift. give up. + */ + YYABORT; + case 3: /* no shift yet; eat a token */ +#if YYDEBUG + /* + ** if debugging, look up token in list of + ** pairs. 0 and negative shouldn't occur, + ** but since timing doesn't matter when + ** debugging, it doesn't hurt to leave the + ** tests here. + */ + if ( yydebug ) + { + register int yy_i; + + printf( "Error recovery discards " ); + if ( yychar == 0 ) + printf( "token end-of-file\n" ); + else if ( yychar < 0 ) + printf( "token -none-\n" ); + else + { + for ( yy_i = 0; + yytoks[yy_i].t_val >= 0; + yy_i++ ) + { + if ( yytoks[yy_i].t_val + == yychar ) + { + break; + } + } + printf( "token %s\n", + yytoks[yy_i].t_name ); + } + } +#endif /* YYDEBUG */ + if ( yychar == 0 ) /* reached EOF. quit */ + YYABORT; + yychar = -1; + goto yy_newstate; + } + }/* end if ( yy_n == 0 ) */ + /* + ** reduction by production yy_n + ** put stack tops, etc. so things right after switch + */ #if YYDEBUG - if (yydebug) - printf("%sdebug: state %d, reducing by rule %d (%s)\n", - YYPREFIX, yystate, yyn, yyrule[yyn]); + /* + ** if debugging, print the string that is the user's + ** specification of the reduction which is just about + ** to be done. + */ + if ( yydebug ) + printf( "Reduce by (%d) \"%s\"\n", + yy_n, yyreds[ yy_n ] ); #endif - yym = yylen[yyn]; - yyval = yyvsp[1-yym]; - switch (yyn) - { + yytmp = yy_n; /* value to switch over */ + yypvt = yy_pv; /* $vars top of value stack */ + /* + ** Look in goto table for next state + ** Sorry about using yy_state here as temporary + ** register variable, but why not, if it works... + ** If yyr2[ yy_n ] doesn't have the low order bit + ** set, then there is no action to be done for + ** this reduction. So, no saving & unsaving of + ** registers done. The only difference between the + ** code just after the if and the body of the if is + ** the goto yy_stack in the body. This way the test + ** can be made before the choice of what to do is needed. + */ + { + /* length of production doubled with extra bit */ + register int yy_len = yyr2[ yy_n ]; + + if ( !( yy_len & 01 ) ) + { + yy_len >>= 1; + yyval = ( yy_pv -= yy_len )[1]; /* $$ = $1 */ + yy_state = yypgo[ yy_n = yyr1[ yy_n ] ] + + *( yy_ps -= yy_len ) + 1; + if ( yy_state >= YYLAST || + yychk[ yy_state = + yyact[ yy_state ] ] != -yy_n ) + { + yy_state = yyact[ yypgo[ yy_n ] ]; + } + goto yy_stack; + } + yy_len >>= 1; + yyval = ( yy_pv -= yy_len )[1]; /* $$ = $1 */ + yy_state = yypgo[ yy_n = yyr1[ yy_n ] ] + + *( yy_ps -= yy_len ) + 1; + if ( yy_state >= YYLAST || + yychk[ yy_state = yyact[ yy_state ] ] != -yy_n ) + { + yy_state = yyact[ yypgo[ yy_n ] ]; + } + } + /* save until reenter driver code */ + yystate = yy_state; + yyps = yy_ps; + yypv = yy_pv; + } + /* + ** code supplied by user is placed in this switch + */ + switch( yytmp ) + { + case 3: -#line 118 "parsedate.y" +# line 118 "parsedate.y" { yyHaveTime++; #ifdef lint @@ -952,285 +1341,206 @@ case 3: YYERROR; } #endif /* lint */ - } -break; + } break; case 4: -#line 127 "parsedate.y" +# line 127 "parsedate.y" { yyHaveTime++; - yyTimezone = yyvsp[0].Number; - } -break; + yyTimezone = yypvt[-0].Number; + } break; case 5: -#line 131 "parsedate.y" +# line 131 "parsedate.y" { yyHaveDate++; - } -break; + } break; case 6: -#line 134 "parsedate.y" +# line 134 "parsedate.y" { yyHaveRel = 1; - } -break; + } break; case 7: -#line 139 "parsedate.y" +# line 139 "parsedate.y" { - if (yyvsp[-1].Number < 100) { - yyHour = yyvsp[-1].Number; + if (yypvt[-1].Number < 100) { + yyHour = yypvt[-1].Number; yyMinutes = 0; } else { - yyHour = yyvsp[-1].Number / 100; - yyMinutes = yyvsp[-1].Number % 100; + yyHour = yypvt[-1].Number / 100; + yyMinutes = yypvt[-1].Number % 100; } yySeconds = 0; - yyMeridian = yyvsp[0].Meridian; - } -break; + yyMeridian = yypvt[-0].Meridian; + } break; case 8: -#line 151 "parsedate.y" +# line 151 "parsedate.y" { - yyHour = yyvsp[-3].Number; - yyMinutes = yyvsp[-1].Number; + yyHour = yypvt[-3].Number; + yyMinutes = yypvt[-1].Number; yySeconds = 0; - yyMeridian = yyvsp[0].Meridian; - } -break; + yyMeridian = yypvt[-0].Meridian; + } break; case 9: -#line 157 "parsedate.y" +# line 157 "parsedate.y" { - yyHour = yyvsp[-3].Number; - yyMinutes = yyvsp[-1].Number; - yyTimezone = yyvsp[0].Number; + yyHour = yypvt[-3].Number; + yyMinutes = yypvt[-1].Number; + yyTimezone = yypvt[-0].Number; yyMeridian = MER24; yyDSTmode = DSToff; - } -break; + } break; case 10: -#line 164 "parsedate.y" +# line 164 "parsedate.y" { - yyHour = yyvsp[-5].Number; - yyMinutes = yyvsp[-3].Number; - yySeconds = yyvsp[-1].Number; - yyMeridian = yyvsp[0].Meridian; - } -break; + yyHour = yypvt[-5].Number; + yyMinutes = yypvt[-3].Number; + yySeconds = yypvt[-1].Number; + yyMeridian = yypvt[-0].Meridian; + } break; case 11: -#line 170 "parsedate.y" +# line 170 "parsedate.y" { - yyHour = yyvsp[-5].Number; - yyMinutes = yyvsp[-3].Number; - yySeconds = yyvsp[-1].Number; - yyTimezone = yyvsp[0].Number; + yyHour = yypvt[-5].Number; + yyMinutes = yypvt[-3].Number; + yySeconds = yypvt[-1].Number; + yyTimezone = yypvt[-0].Number; yyMeridian = MER24; yyDSTmode = DSToff; - } -break; + } break; case 12: -#line 180 "parsedate.y" +# line 180 "parsedate.y" { - yyval.Number = yyvsp[0].Number; + yyval.Number = yypvt[-0].Number; yyDSTmode = DSToff; - } -break; + } break; case 13: -#line 184 "parsedate.y" +# line 184 "parsedate.y" { - yyval.Number = yyvsp[0].Number; + yyval.Number = yypvt[-0].Number; yyDSTmode = DSTon; - } -break; + } break; case 14: -#line 188 "parsedate.y" +# line 188 "parsedate.y" { /* Only allow "GMT+300" and "GMT-0800" */ - if (yyvsp[-1].Number != 0) { + if (yypvt[-1].Number != 0) { YYABORT; } - yyval.Number = yyvsp[0].Number; + yyval.Number = yypvt[-0].Number; yyDSTmode = DSToff; - } -break; + } break; case 15: -#line 196 "parsedate.y" +# line 196 "parsedate.y" { - yyval.Number = yyvsp[0].Number; + yyval.Number = yypvt[-0].Number; yyDSTmode = DSToff; - } -break; + } break; case 16: -#line 202 "parsedate.y" +# line 202 "parsedate.y" { int i; /* Unix and GMT and numeric timezones -- a little confusing. */ - if (yyvsp[0].Number < 0) { + if (yypvt[-0].Number < 0) { /* Don't work with negative modulus. */ - yyvsp[0].Number = -yyvsp[0].Number; - if (yyvsp[0].Number > 9999 || (i = yyvsp[0].Number % 100) >= 60) { + yypvt[-0].Number = -yypvt[-0].Number; + if (yypvt[-0].Number > 9999 || (i = yypvt[-0].Number % 100) >= 60) { YYABORT; } - yyval.Number = (yyvsp[0].Number / 100) * 60 + i; + yyval.Number = (yypvt[-0].Number / 100) * 60 + i; } else { - if (yyvsp[0].Number > 9999 || (i = yyvsp[0].Number % 100) >= 60) { + if (yypvt[-0].Number > 9999 || (i = yypvt[-0].Number % 100) >= 60) { YYABORT; } - yyval.Number = -((yyvsp[0].Number / 100) * 60 + i); + yyval.Number = -((yypvt[-0].Number / 100) * 60 + i); } - } -break; + } break; case 17: -#line 223 "parsedate.y" +# line 223 "parsedate.y" { - yyMonth = yyvsp[-2].Number; - yyDay = yyvsp[0].Number; - } -break; + yyMonth = yypvt[-2].Number; + yyDay = yypvt[-0].Number; + } break; case 18: -#line 227 "parsedate.y" +# line 227 "parsedate.y" { - if (yyvsp[-4].Number > 100) { - yyYear = yyvsp[-4].Number; - yyMonth = yyvsp[-2].Number; - yyDay = yyvsp[0].Number; + if (yypvt[-4].Number > 100) { + yyYear = yypvt[-4].Number; + yyMonth = yypvt[-2].Number; + yyDay = yypvt[-0].Number; } else { - yyMonth = yyvsp[-4].Number; - yyDay = yyvsp[-2].Number; - yyYear = yyvsp[0].Number; + yyMonth = yypvt[-4].Number; + yyDay = yypvt[-2].Number; + yyYear = yypvt[-0].Number; } - } -break; + } break; case 19: -#line 239 "parsedate.y" +# line 239 "parsedate.y" { - yyMonth = yyvsp[-1].Number; - yyDay = yyvsp[0].Number; - } -break; + yyMonth = yypvt[-1].Number; + yyDay = yypvt[-0].Number; + } break; case 20: -#line 243 "parsedate.y" +# line 243 "parsedate.y" { - yyMonth = yyvsp[-3].Number; - yyDay = yyvsp[-2].Number; - yyYear = yyvsp[0].Number; - } -break; + yyMonth = yypvt[-3].Number; + yyDay = yypvt[-2].Number; + yyYear = yypvt[-0].Number; + } break; case 21: -#line 248 "parsedate.y" +# line 248 "parsedate.y" { - yyDay = yyvsp[-1].Number; - yyMonth = yyvsp[0].Number; - } -break; + yyDay = yypvt[-1].Number; + yyMonth = yypvt[-0].Number; + } break; case 22: -#line 252 "parsedate.y" +# line 252 "parsedate.y" { - yyDay = yyvsp[-2].Number; - yyMonth = yyvsp[-1].Number; - yyYear = yyvsp[0].Number; - } -break; + yyDay = yypvt[-2].Number; + yyMonth = yypvt[-1].Number; + yyYear = yypvt[-0].Number; + } break; case 23: -#line 257 "parsedate.y" +# line 257 "parsedate.y" { - yyDay = yyvsp[-2].Number; - yyMonth = yyvsp[-1].Number; - yyYear = yyvsp[0].Number; - } -break; + yyDay = yypvt[-2].Number; + yyMonth = yypvt[-1].Number; + yyYear = yypvt[-0].Number; + } break; case 24: -#line 264 "parsedate.y" +# line 264 "parsedate.y" { - yyRelSeconds += yyvsp[-1].Number * yyvsp[0].Number; - } -break; + yyRelSeconds += yypvt[-1].Number * yypvt[-0].Number; + } break; case 25: -#line 267 "parsedate.y" +# line 267 "parsedate.y" { - yyRelSeconds += yyvsp[-1].Number * yyvsp[0].Number; - } -break; + yyRelSeconds += yypvt[-1].Number * yypvt[-0].Number; + } break; case 26: -#line 270 "parsedate.y" +# line 270 "parsedate.y" { - yyRelMonth += yyvsp[-1].Number * yyvsp[0].Number; - } -break; + yyRelMonth += yypvt[-1].Number * yypvt[-0].Number; + } break; case 27: -#line 273 "parsedate.y" +# line 273 "parsedate.y" { - yyRelMonth += yyvsp[-1].Number * yyvsp[0].Number; - } -break; + yyRelMonth += yypvt[-1].Number * yypvt[-0].Number; + } break; case 28: -#line 278 "parsedate.y" +# line 278 "parsedate.y" { yyval.Meridian = MER24; - } -break; + } break; case 29: -#line 281 "parsedate.y" +# line 281 "parsedate.y" { - yyval.Meridian = yyvsp[0].Meridian; + yyval.Meridian = yypvt[-0].Meridian; + } break; +# line 531 "/usr/ccs/bin/yaccpar" } -break; -#line 1181 "y.tab.c" - } - yyssp -= yym; - yystate = *yyssp; - yyvsp -= yym; - yym = yylhs[yyn]; - if (yystate == 0 && yym == 0) - { -#if YYDEBUG - if (yydebug) - printf("%sdebug: after reduction, shifting from state 0 to\ - state %d\n", YYPREFIX, YYFINAL); -#endif - yystate = YYFINAL; - *++yyssp = YYFINAL; - *++yyvsp = yyval; - if (yychar < 0) - { - if ((yychar = yylex()) < 0) yychar = 0; -#if YYDEBUG - if (yydebug) - { - yys = 0; - if (yychar <= YYMAXTOKEN) yys = yyname[yychar]; - if (!yys) yys = "illegal-symbol"; - printf("%sdebug: state %d, reading %d (%s)\n", - YYPREFIX, YYFINAL, yychar, yys); - } -#endif - } - if (yychar == 0) goto yyaccept; - goto yyloop; - } - if ((yyn = yygindex[yym]) && (yyn += yystate) >= 0 && - yyn <= YYTABLESIZE && yycheck[yyn] == yystate) - yystate = yytable[yyn]; - else - yystate = yydgoto[yym]; -#if YYDEBUG - if (yydebug) - printf("%sdebug: after reduction, shifting from state %d \ -to state %d\n", YYPREFIX, *yyssp, yystate); -#endif - if (yyssp >= yyss + yystacksize - 1) - { - goto yyoverflow; - } - *++yyssp = yystate; - *++yyvsp = yyval; - goto yyloop; -yyoverflow: - yyerror("yacc stack overflow"); -yyabort: - return (1); -yyaccept: - return (0); + goto yystack; /* reset registers in driver code */ } + diff --git a/citadel/rcit.c b/citadel/rcit.c index 7da660408..a5f6f9acf 100644 --- a/citadel/rcit.c +++ b/citadel/rcit.c @@ -34,7 +34,7 @@ int main(int argc, char **argv) char spool_only = 0; get_config(); - sprintf(flnm,"./network/spoolin/rcit.%d", getpid()); + sprintf(flnm,"./network/spoolin/rcit.%ld", (long)getpid()); sprintf(tname, tmpnam(NULL)); for (a=1; a #endif +#ifdef HAVE_UTMPX_H +#include +#endif #ifndef HAVE_GETUTLINE struct utmp *getutline(struct utmp *ut); @@ -429,7 +432,11 @@ void locate_host(char *hbuf) else strncpy(hbuf,buf,24); #else char *tty = ttyname(0); +#ifdef HAVE_GETUTXLINE + struct utmpx ut, *put; +#else struct utmp ut, *put; +#endif if (tty == NULL) { fail: @@ -442,19 +449,23 @@ void locate_host(char *hbuf) safestrncpy(ut.ut_line, &tty[5], sizeof ut.ut_line); +#ifdef HAVE_GETUTXLINE /* Solaris uses this */ + if ((put = getutxline(&ut)) == NULL) +#else if ((put = getutline(&ut)) == NULL) +#endif goto fail; -#ifdef HAVE_UT_TYPE +#if defined(HAVE_UT_TYPE) || defined(HAVE_GETUTXLINE) if (put->ut_type == USER_PROCESS) { #endif -#ifdef HAVE_UT_HOST +#if defined(HAVE_UT_HOST) || defined(HAVE_GETUTXLINE) if (*put->ut_host) safestrncpy(hbuf, put->ut_host, 24); else #endif safestrncpy(hbuf, put->ut_line, 24); -#ifdef HAVE_UT_TYPE +#if defined(HAVE_UT_TYPE) || defined(HAVE_GETUTXLINE) } else goto fail; #endif diff --git a/citadel/serv_vcard.c b/citadel/serv_vcard.c index 707cdb7b0..46bb37791 100644 --- a/citadel/serv_vcard.c +++ b/citadel/serv_vcard.c @@ -324,7 +324,7 @@ void cmd_greg(char *argbuf) { struct usersupp usbuf; struct vCard *v; - char *tel; + char *s; char who[256]; char adr[256]; char buf[256]; @@ -354,9 +354,11 @@ void cmd_greg(char *argbuf) cprintf("%d %s\n", LISTING_FOLLOWS, usbuf.fullname); cprintf("%ld\n", usbuf.usernum); cprintf("%s\n", usbuf.password); - cprintf("%s\n", vcard_get_prop(v, "n", 0)); /* name */ + s = vcard_get_prop(v, "n", 0); + cprintf("%s\n", s ? s : " "); /* name */ - sprintf(adr, "%s", vcard_get_prop(v, "adr", 0));/* address... */ + s = vcard_get_prop(v, "adr", 0); + sprintf(adr, "%s", s ? s : " ");/* address... */ extract_token(buf, adr, 2, ';'); cprintf("%s\n", buf); /* street */ @@ -367,10 +369,10 @@ void cmd_greg(char *argbuf) extract_token(buf, adr, 5, ';'); cprintf("%s\n", buf); /* zip */ - tel = vcard_get_prop(v, "tel;home", 0); - if (tel == NULL) tel = vcard_get_prop(v, "tel", 1); - if (tel != NULL) { - cprintf("%s\n", tel); + s = vcard_get_prop(v, "tel;home", 0); + if (s == NULL) s = vcard_get_prop(v, "tel", 1); + if (s != NULL) { + cprintf("%s\n", s); } else { cprintf(" \n"); @@ -378,7 +380,8 @@ void cmd_greg(char *argbuf) cprintf("%d\n", usbuf.axlevel); - cprintf("%s\n", vcard_get_prop(v, "email;internet", 0)); + s = vcard_get_prop(v, "email;internet", 0); + cprintf("%s\n", s ? s : " "); cprintf("000\n"); } diff --git a/citadel/setup.c b/citadel/setup.c index 15a859396..fe1867e85 100644 --- a/citadel/setup.c +++ b/citadel/setup.c @@ -604,6 +604,7 @@ void set_long_val(int msgpos, long int *ip) void edit_value(int curr) { int a; + long l; switch (curr) { @@ -612,7 +613,9 @@ void edit_value(int curr) break; case 2: - set_int_val(curr, &config.c_bbsuid); + l = config.c_bbsuid; + set_long_val(curr, &l); + config.c_bbsuid = l; break; case 3: @@ -925,8 +928,8 @@ NEW_INST: progress("Setting file permissions", 1, 5); chown("citadel.config", config.c_bbsuid, gid); progress("Setting file permissions", 2, 5); - sprintf(aaa, "find . | grep -v chkpwd | xargs chown %d:%d 2>/dev/null", - config.c_bbsuid, gid); + sprintf(aaa, "find . | grep -v chkpwd | xargs chown %ld:%ld 2>/dev/null", + (long)config.c_bbsuid, (long)gid); system(aaa); progress("Setting file permissions", 3, 5); chmod("citadel.config", S_IRUSR | S_IWUSR); diff --git a/citadel/sysdep.c b/citadel/sysdep.c index c3fde152e..bbb30eee2 100644 --- a/citadel/sysdep.c +++ b/citadel/sysdep.c @@ -1096,7 +1096,10 @@ SETUP_FD: memcpy(&readfds, &masterfds, sizeof(fd_set) ); * thread that the &readfds needs to be refreshed with more * current data. */ - if (!time_to_die) if (FD_ISSET(rescan[0], &readfds)) { + if (time_to_die) + break; + + if (FD_ISSET(rescan[0], &readfds)) { read(rescan[0], &junk, 1); goto SETUP_FD; } diff --git a/citadel/user_ops.c b/citadel/user_ops.c index 7c94c1da9..6e69ef068 100644 --- a/citadel/user_ops.c +++ b/citadel/user_ops.c @@ -417,7 +417,7 @@ static int validpw(uid_t uid, const char *pass) } close(pipev[0]); - write(pipev[1], buf, sprintf(buf, "%u\n", uid)); + write(pipev[1], buf, sprintf(buf, "%lu\n", (unsigned long)uid)); write(pipev[1], pass, strlen(pass)); write(pipev[1], "\n", 1); close(pipev[1]); -- 2.30.2