lynx-dev
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

LYNX-DEV set of inews patches that I am currently using


From: Larry W. Virden, x2487
Subject: LYNX-DEV set of inews patches that I am currently using
Date: Sat, 1 Feb 1997 23:16:26 -0500

I have to warn you; I am not sure in some cases whether the ifdef
should be against USG, __STDC__, or some other symbol.
Some of the Makefile changes are general; some are specific in all likelihood
to my local setup.

In some cases, I made explicit some previously perfectly valid notations
that took advantage of implicit.  I was trying to make sure that I had
told the compiler all I could.  Being explicit should not hurt a thing
in these cases.

Even with these changes, inews _still_ doesn't get the right NNTP server.

--- Makefile-dist       Sat Feb  1 15:17:40 1997
+++ Makefile    Sat Feb  1 22:41:48 1997
@@ -20,12 +20,12 @@
 # General definitions here which apply to all -- form -DDEF
-DEFS   = -DFOR_NN
+DEFS   = -DUSG # -DFOR_NN
 # Link libraries -- form -lLIB
-LIBS   = -lsocket -lnsl -lucb
-# Lint definitions -- same as DEFS, but form -D DEF
-LDEFS  = -D lint -D FOR_NN
-# Lint libraries -- same as LIBS, but form -l LIB
-LLIBS  =
+LIBS   = -lsocket -lnsl # -lucb
+# Lint definitions -- same as DEFS, but form -DDEF
+LDEFS  = $(DEFS) # -DFOR_NN
+# Lint libraries -- same as LIBS, but form -lLIB
+LLIBS  = $(LIBS)
 # Set to -g for debugging, -O for optimise, or both if compiler handles it
-DEBUG  = -O
-CFLAGS = $(DEBUG) $(DEFS) -I.. -I../conf -L/usr/ucblib
+DEBUG  = -fast -xO4 -xdepend
+CFLAGS = $(DEBUG) $(DEFS) # -L/usr/ucblib
 
@@ -61,3 +61,3 @@
 lint:  $(SRCS)
-       lint -D lint $(LLIBES) $(LDEFS) $(SRCS) > lint
+       $(LINT) -Dlint $(LLIBES) $(LDEFS) $(SRCS) > lint 2>&1
 
--- clientlib.c-dist    Sat Feb  1 22:36:10 1997
+++ clientlib.c Sat Feb  1 23:04:03 1997
@@ -18,3 +18,3 @@
 #include "../config.h"
-#endif NNTPSRC
+#endif /* NNTPSRC */
 
@@ -34,3 +34,3 @@
 # include <netdb.h>
-#endif not EXCELAN
+#endif /* not EXCELAN */
 
@@ -38,2 +38,5 @@
 #ifdef USG
+#include <unistd.h>
+#include <stdlib.h>
+#include <string.h>
 # define       index   strchr
@@ -41,3 +44,3 @@
 # define        bzero(a,b)     memset(a,'\0',b)
-#endif USG
+#endif /* USG */
 #endif
@@ -51,3 +54,10 @@
 #include <netdnet/dnetdb.h>
-#endif DECNET
+#endif /* DECNET */
+
+#ifdef sun
+#include <sys/types.h>
+#include <sys/socket.h>
+#include <netinet/in.h>
+#include <arpa/inet.h>
+#endif
 
@@ -55,2 +65,4 @@
 
+int get_tcp_socket(), get_server();
+
 FILE   *ser_rd_fp = NULL;
@@ -79,2 +91,3 @@
        static char     buf[256];
+#ifndef        __STDC__
        char            *index();
@@ -82,4 +95,5 @@
        char            *strcpy();
+#endif
 
-       if (cp = getenv("NNTPSERVER")) {
+       if ((cp = getenv("NNTPSERVER"))) {
                (void) strcpy(buf, cp);
@@ -123,3 +137,3 @@
 
-server_init(machine)
+int server_init(machine)
 char   *machine;
@@ -128,3 +142,5 @@
        char    line[256];
+#ifndef        USG
        char    *index();
+#endif
 #ifdef DECNET
@@ -185,10 +201,14 @@
 
-get_tcp_socket(machine)
+int get_tcp_socket(machine)
 char   *machine;
 {
-       int     s;
-       struct  sockaddr_in sin;
+       int     s=0;
+       struct  sockaddr_in sina;
 #ifndef EXCELAN
-       struct  servent *getservbyname(), *sp;
-       struct  hostent *gethostbyname(), *hp;
+#ifndef        __STDC__
+       struct  servent *getservbyname();
+       struct  hostent *gethostbyname();
+#endif
+       struct  servent  *sp;
+       struct  hostent *hp;
 #ifdef h_addr
@@ -196,3 +216,3 @@
        register char **cp;
-#endif h_addr
+#endif /* h_addr */
 
@@ -209,3 +229,5 @@
        if( (hp = gethostbyname( machine ) ) == NULL ) {
+#ifndef        __STDC__
                unsigned long inet_addr();
+#endif
                static struct hostent def;
@@ -215,3 +237,3 @@
                defaddr.s_addr = inet_addr( machine );
-               if( defaddr.s_addr != -1 ) {
+               if( defaddr.s_addr != (unsigned) -1 ) {
                        strcpy( namebuf, machine );
@@ -233,10 +255,10 @@
 
-       bzero((char *) &sin, sizeof(sin));
-       sin.sin_family = hp->h_addrtype;
-       sin.sin_port = sp->s_port;
-#else EXCELAN
-       bzero((char *) &sin, sizeof(sin));
-       sin.sin_family = AF_INET;
-       sin.sin_port = htons(IPPORT_NNTP);
-#endif EXCELAN
+       bzero((char *) &sina, sizeof(sina));
+       sina.sin_family = hp->h_addrtype;
+       sina.sin_port = sp->s_port;
+#else /* EXCELAN */
+       bzero((char *) &sina, sizeof(sina));
+       sina.sin_family = AF_INET;
+       sina.sin_port = htons(IPPORT_NNTP);
+#endif /* EXCELAN */
 
@@ -262,10 +284,10 @@
                }
-               bcopy(*cp, (char *)&sin.sin_addr, hp->h_length);
+               bcopy(*cp, (char *)&sina.sin_addr, hp->h_length);
 
                if (x < 0)
-                       fprintf(stderr, "trying %s\n", inet_ntoa(sin.sin_addr));
-               x = connect(s, (struct sockaddr *)&sin, sizeof (sin));
+                       fprintf(stderr, "trying %s\n", 
inet_ntoa(sina.sin_addr));
+               x = connect(s, (struct sockaddr *)&sina, sizeof (sina));
                if (x == 0)
                        break;
-                fprintf(stderr, "connection to %s: ", inet_ntoa(sin.sin_addr));
+                fprintf(stderr, "connection to %s: ", 
inet_ntoa(sina.sin_addr));
                perror("");
@@ -286,4 +308,4 @@
        /* set up addr for the connect */
-       sin.sin_addr.s_addr = rhost(machine);
-       if (sin.sin_addr.s_addr < 0){
+       sina.sin_addr.s_addr = rhost(machine);
+       if (sina.sin_addr.s_addr < 0){
                fprintf(stderr, "%s: Unknown host.\n", machine);
@@ -293,3 +315,3 @@
 
-       if (connect(s, &sin) < 0) {
+       if (connect(s, &sina) < 0) {
                perror("connect");
@@ -298,3 +320,3 @@
        }
-#else not EXCELAN
+#else /* not EXCELAN */
        if ((s = socket(AF_INET, SOCK_STREAM, 0)) < 0) {
@@ -306,4 +328,4 @@
 
-       bcopy(hp->h_addr, (char *) &sin.sin_addr, hp->h_length);
-       if (connect(s, (struct sockaddr *) &sin, sizeof(sin)) < 0) {
+       bcopy(hp->h_addr, (char *) &sina.sin_addr, hp->h_length);
+       if (connect(s, (struct sockaddr *) &sina, sizeof(sina)) < 0) {
                perror("connect");
@@ -313,3 +335,3 @@
 
-#endif not EXCELAN
+#endif /* not EXCELAN */
 #endif
@@ -410,3 +432,3 @@
 
-handle_server_response(response, server)
+int handle_server_response(response, server)
 int    response;
@@ -420,5 +442,9 @@
        "      Please don't waste your time trying.\n\n");
-
+               return (0);
+               /* NOTREACHED */
+               break;
+               
        case OK_CANPOST:
                return (0);
+               /* NOTREACHED */
                break;
@@ -430,2 +456,3 @@
                return (-1);
+               /* NOTREACHED */
                break;
@@ -436,2 +463,3 @@
                return (-1);
+               /* NOTREACHED */
                break;
@@ -485,3 +513,3 @@
 
-get_server(string, size)
+int get_server(string, size)
 char   *string;
@@ -490,3 +518,5 @@
        register char *cp;
+#ifndef        USG
        char    *index();
+#endif
 
--- clientlib.h-dist    Sat Feb  1 22:38:50 1997
+++ clientlib.h Sat Feb  1 22:39:04 1997
@@ -11 +11,2 @@
 extern void    close_server();
+extern int     handle_server_response();
--- inews.c-dist        Sat Feb  1 15:20:07 1997
+++ inews.c     Sat Feb  1 23:00:43 1997
@@ -22,8 +22,18 @@
 #include "nntp.h"
+#include "clientlib.h"
 #ifndef FOR_NN
 #ifdef USG
+#include <unistd.h>
+#include <stdlib.h>
 #include <string.h>
-#else not USG
+# define       index   strchr
+#else /* not USG */
 #include <strings.h>
-#endif not USG
+#endif /* not USG */
+#endif
+
+#ifdef __STDC__
+#include <unistd.h>
+#include <stdlib.h>
+#include <string.h>
 #endif
@@ -36,3 +46,7 @@
 
-main(argc, argv)
+void append_signature();
+void gen_frompath();
+int  valid_header(), strneql();
+
+int main(argc, argv)
 int    argc;
@@ -40,2 +54,3 @@
 {
+       int     gethostname();
        char    line[NNTP_STRLEN], s[NNTP_STRLEN];
@@ -58,3 +73,3 @@
                        perror(*argv);
-                       exit(1);
+                       return(1);
                }
@@ -71,3 +86,3 @@
               "Either fix this file, or put NNTPSERVER in your enviroment.\n");
-               exit(1);
+               return(1);
        }
@@ -78,3 +93,3 @@
                        server);
-               exit(1);
+               return(1);
        }
@@ -84,3 +99,3 @@
                close_server();
-               exit(1);
+               return(1);
        }
@@ -94,3 +109,3 @@
                                "Sorry, you can't post from this machine.\n");
-                       exit(1);
+                       return(1);
                } else {
@@ -98,3 +113,3 @@
                        fprintf(stderr, "Remote error: %s\n", line);
-                       exit(1);
+                       return(1);
                }
@@ -146,3 +161,3 @@
                                        putchar(*cp);
-                       exit(1);
+                       return(1);
                } else {
@@ -150,3 +165,3 @@
                        fprintf(stderr, "Remote error: %s\n", line);
-                       exit(1);
+                       return(1);
                }
@@ -161,3 +176,3 @@
 
-       exit(0);
+       return(0);
 }
@@ -170,3 +185,3 @@
 
-append_signature()
+void append_signature()
 {
@@ -176,3 +191,5 @@
        FILE    *fp;
+#ifndef        __STDC__
        char    *index(), *getenv();
+#endif
        int     count = 0;
@@ -223,3 +240,3 @@
                }
-               if (cp = index(line, '\n'))
+               if ((cp = index(line, '\n')))
                        *cp = '\0';
@@ -244,3 +261,3 @@
 
-gen_frompath()
+void gen_frompath()
 {
@@ -249,3 +266,5 @@
        struct  passwd *passwd;
+#ifndef        __STDC__
        char    *index(), *getenv();
+#endif
 
@@ -302,2 +321,4 @@
 #endif /* HIDDENNET */
+
+       return;
 }
@@ -318,3 +339,3 @@
 
-strneql(a, b, n)
+int strneql(a, b, n)
 register char *a, *b;
@@ -374,3 +395,5 @@
 {
+#ifndef        __STDC__
   char *index();
+#endif
   char *colon, *space;
-- 
Larry W. Virden                 INET: address@hidden
<URL:http://www.teraform.com/%7Elvirden/> <*> O- "We are all Kosh."
Unless explicitly stated to the contrary, nothing in this posting should 
be construed as representing my employer's opinions.
;
; To UNSUBSCRIBE:  Send a mail message to address@hidden
;                  with "unsubscribe lynx-dev" (without the
;                  quotation marks) on a line by itself.
;

reply via email to

[Prev in Thread] Current Thread [Next in Thread]