home *** CD-ROM | disk | FTP | other *** search
- Path: sparky!uunet!gatech!destroyer!caen!batcomputer!munnari.oz.au!mel.dit.csiro.au!mineng.dmpe.CSIRO.AU!dmssyd.syd.dms.CSIRO.AU!metro!grivel!alsvid!mark
- From: mark@alsvid.une.edu.au (Mark Garrett Internet: mark@arvak.une.edu.au Phone: +61 66 20 3859)
- Newsgroups: comp.infosystems.gopher
- Subject: More bugs gopher1.1b1 (beta programmers as well as code)
- Message-ID: <BxrI8o.Ir0@alsvid.une.edu.au>
- Date: 15 Nov 92 14:43:36 GMT
- Organization: University of New England - Northern Rivers (Lismore)
- Lines: 658
-
-
- I feel like being abusive, I'll attempt not to be. I'd like to ask one question?
-
- Who has put in the work on gopher1.1b1 ?? One of you has not been
- coding in C for long. If there are some inexperienced programmers working on
- this software for my sake and others please vet their code changes.
-
- strlen returns the length of a string not counting the null
- terminator!!!!! please inscribe this into them... So that when they malloc
- space or whatever they allow for that one extra.
-
- Here is a diff of my 1.1b1 against the release version.
- I hope this helps somebody else with the code, which I might add has some
- major advantages despite my flame about coding.
-
- Cheers
- Mark :)
-
- diff -cr gopher1.1b1-DIST/Makefile gopher1.1b1/Makefile
- *** gopher1.1b1-DIST/Makefile Wed Oct 14 15:58:25 1992
- --- gopher1.1b1/Makefile Thu Nov 12 21:25:38 1992
- ***************
- *** 54,56 ****
- --- 54,57 ----
- HERE=`basename $$PWD`; \
- cd ..; tar cvf - $$HERE| compress - > $$HERE.tar.Z
-
- + # DO NOT DELETE THIS LINE -- make depend depends on it.
- diff -cr gopher1.1b1-DIST/Makefile.config gopher1.1b1/Makefile.config
- *** gopher1.1b1-DIST/Makefile.config Sat Oct 31 04:48:21 1992
- --- gopher1.1b1/Makefile.config Mon Nov 16 00:47:04 1992
- ***************
- *** 9,21 ****
- # Your favorite C compiler
- #
-
- ! CC = cc
-
- #------------------------------------------------
- # Optimization level.
- #
-
- ! OPT=-g
- #OPT=-O
-
- #------------------------------------------------
- --- 9,21 ----
- # Your favorite C compiler
- #
-
- ! CC = gcc2.3.1
-
- #------------------------------------------------
- # Optimization level.
- #
-
- ! OPT=-g -O2
- #OPT=-O
-
- #------------------------------------------------
- ***************
- *** 30,36 ****
- #
- # -DPTX for Sequent Dynix/ptx
-
- ! GSYSTYPE=
-
- #------------------------------------------------
- # The ranlib command on your system. A/UX (and probably other sysv's
- --- 30,36 ----
- #
- # -DPTX for Sequent Dynix/ptx
-
- ! GSYSTYPE= -DBSD
-
- #------------------------------------------------
- # The ranlib command on your system. A/UX (and probably other sysv's
- ***************
- *** 49,59 ****
- # Where shall we install stuff?
- #
-
- CLIENTDIR = /usr/local/bin
- ! CLIENTLIB = /usr/local/lib/
- ! SERVERDIR = /usr/local/etc
- ! MAN1DIR = /usr/local/man/man1
- ! MAN8DIR = /usr/local/man/man8
-
-
-
- --- 49,62 ----
- # Where shall we install stuff?
- #
-
- + #CLIENTDIR = /usr/local/bin
- + #CLIENTLIB = /usr/local/lib/
- + #SERVERDIR = /usr/local/etc
- CLIENTDIR = /usr/local/bin
- ! CLIENTLIB = /usr/local/gopher1.1/lib/
- ! SERVERDIR = /usr/local/gopher1.1/etc
- ! MAN1DIR = /usr/man/man1
- ! MAN8DIR = /usr/man/man8
-
-
-
- ***************
- *** 73,81 ****
- # admin.viccol.edu.au
- # pub/dl/describe-1.8.tar.Z or higher...
- #
- ! SERVEROPTS = #-DDL # -DLOADRESTRICT
- ! DLPATH = /home/mudhoney/lindner/src/describe
- ! #DLOBJS = $(DLPATH)/getdesc.o $(DLPATH)/enddesc.o
-
-
- #--------------------------------------------------
- --- 76,85 ----
- # admin.viccol.edu.au
- # pub/dl/describe-1.8.tar.Z or higher...
- #
- ! SERVEROPTS = -DDL # -DLOADRESTRICT
- ! #DLPATH = /home/mudhoney/lindner/src/describe
- ! DLPATH = /usr/users/cno/mark/cwis/gopher/dl
- ! DLOBJS = $(DLPATH)/getdesc.o $(DLPATH)/enddesc.o
-
-
- #--------------------------------------------------
- ***************
- *** 98,104 ****
-
- OTHERLIBS = $(HPLIBS) $(UMAXLIBS) $(SEQLIBS) $(PTXLIBS)
-
- ! CLIENTLIBS = -lcurses -ltermcap -lgopher $(OTHERLIBS)
- SERVERLIBS = -lm -lgopher $(OTHERLIBS) $(LOADLIBS)
-
-
- --- 102,108 ----
-
- OTHERLIBS = $(HPLIBS) $(UMAXLIBS) $(SEQLIBS) $(PTXLIBS)
-
- ! CLIENTLIBS = -lcursesX -ltermcap -lgopher $(OTHERLIBS)
- SERVERLIBS = -lm -lgopher $(OTHERLIBS) $(LOADLIBS)
-
-
- ***************
- *** 108,114 ****
- # the domain name a null string. Otherwise put in the rest of
- # your domain name that `hostname` doesn't return.
-
- ! DOMAIN = .micro.umn.edu
-
-
- #-----------------------------------------------------------------
- --- 112,119 ----
- # the domain name a null string. Otherwise put in the rest of
- # your domain name that `hostname` doesn't return.
-
- ! #DOMAIN = .micro.umn.edu
- ! DOMAIN = .une.edu.au
-
-
- #-----------------------------------------------------------------
- ***************
- *** 119,125 ****
- # overridden on the command line.
- #
-
- ! SERVERDATA = /home/mudhoney/gopher-data
- SERVERPORT = 70
-
-
- --- 124,130 ----
- # overridden on the command line.
- #
-
- ! SERVERDATA = /usr/local/gopher1.1/gopher-data
- SERVERPORT = 70
-
-
- diff -cr gopher1.1b1-DIST/conf.h gopher1.1b1/conf.h
- *** gopher1.1b1-DIST/conf.h Sat Oct 31 10:10:30 1992
- --- gopher1.1b1/conf.h Sun Nov 15 18:41:47 1992
- ***************
- *** 13,20 ****
- * CLIENT1_HOST or CLIENT2_HOST
- */
-
- ! #define CLIENT1_HOST "gopher.tc.umn.edu"
- ! #define CLIENT2_HOST "gopher2.tc.umn.edu"
-
- #define CLIENT1_PORT 70
- #define CLIENT2_PORT 70
- --- 13,22 ----
- * CLIENT1_HOST or CLIENT2_HOST
- */
-
- ! #define CLIENT1_HOST "alsvid.une.edu.au"
- ! #define CLIENT2_HOST "alsvid.une.edu.au"
- ! /* #define CLIENT1_HOST "gopher.tc.umn.edu" */
- ! /* #define CLIENT2_HOST "gopher2.tc.umn.edu" */
-
- #define CLIENT1_PORT 70
- #define CLIENT2_PORT 70
- ***************
- *** 70,76 ****
- #endif
-
- #ifndef IMAGE_COMMAND
- ! #define IMAGE_COMMAND "xloadimage -fork"
- #endif
-
- /****************** gopherd configuration ***********************/
- --- 72,78 ----
- #endif
-
- #ifndef IMAGE_COMMAND
- ! #define IMAGE_COMMAND "xv"
- #endif
-
- /****************** gopherd configuration ***********************/
- Common subdirectories: gopher1.1b1-DIST/doc and gopher1.1b1/doc
- Common subdirectories: gopher1.1b1-DIST/emacs and gopher1.1b1/emacs
- Common subdirectories: gopher1.1b1-DIST/examples and gopher1.1b1/examples
- Common subdirectories: gopher1.1b1-DIST/gopher and gopher1.1b1/gopher
- Common subdirectories: gopher1.1b1-DIST/gopherd and gopher1.1b1/gopherd
- Only in gopher1.1b1: ir
- Common subdirectories: gopher1.1b1-DIST/mindexd and gopher1.1b1/mindexd
- Common subdirectories: gopher1.1b1-DIST/misc and gopher1.1b1/misc
- Common subdirectories: gopher1.1b1-DIST/object and gopher1.1b1/object
- Only in gopher1.1b1: ui
- Only in gopher1.1b1/doc: gopger.1-DIST
- diff -cr gopher1.1b1-DIST/doc/gopher.1 gopher1.1b1/doc/gopher.1
- *** gopher1.1b1-DIST/doc/gopher.1 Sat Aug 1 03:34:16 1992
- --- gopher1.1b1/doc/gopher.1 Sun Nov 15 19:44:30 1992
- ***************
- *** 3,9 ****
- gopher \- connect to gopher document server
- .SH SYNOPSIS
- .B gopher
- ! .RI [ -sb ]
- .RI [ -t
- .IR title]
- .RI [ -p
- --- 3,9 ----
- gopher \- connect to gopher document server
- .SH SYNOPSIS
- .B gopher
- ! .RI [ -sSb ]
- .RI [ -t
- .IR title]
- .RI [ -p
- ***************
- *** 23,28 ****
- --- 23,31 ----
- .PP
- -s means "secure mode" which means that you can't save or print the
- files that you browse.
- + .PP
- + -S means "very secure mode" which means that you can't save, print or
- + mail the files that you browse.
- .PP
- -b starts the client on the bookmark page.
-
- Common subdirectories: gopher1.1b1-DIST/emacs/forms and gopher1.1b1/emacs/forms
- Common subdirectories: gopher1.1b1-DIST/examples/.cap and gopher1.1b1/examples/.cap
- Common subdirectories: gopher1.1b1-DIST/examples/Sample Directory and gopher1.1b1/examples/Sample Directory
- Common subdirectories: gopher1.1b1-DIST/examples/Sample Directory/.cap and gopher1.1b1/examples/Sample Directory/.cap
- Common subdirectories: gopher1.1b1-DIST/examples/Sample Directory/wais-index and gopher1.1b1/examples/Sample Directory/wais-index
- Only in gopher1.1b1/gopher: .gdbinit
- diff -cr gopher1.1b1-DIST/gopher/cso.c gopher1.1b1/gopher/cso.c
- *** gopher1.1b1-DIST/gopher/cso.c Sat Nov 7 03:14:11 1992
- --- gopher1.1b1/gopher/cso.c Mon Nov 16 00:59:36 1992
- ***************
- *** 58,64 ****
- else {
- Fields[numfields] = strdup(cp);
- }
- ! Responses[numfields] = (char *) malloc(sizeof(char)*80);
- *Responses[numfields] = '\0';
- *(Responses[numfields]+1) = '\0';
- numfields++;
- --- 58,64 ----
- else {
- Fields[numfields] = strdup(cp);
- }
- ! Responses[numfields] = (char *) malloc(sizeof(char)*80 + 1); /* allow 80 + terminator MG */
- *Responses[numfields] = '\0';
- *(Responses[numfields]+1) = '\0';
- numfields++;
- diff -cr gopher1.1b1-DIST/gopher/globals.h gopher1.1b1/gopher/globals.h
- *** gopher1.1b1-DIST/gopher/globals.h Wed Oct 14 18:07:16 1992
- --- gopher1.1b1/gopher/globals.h Sun Nov 15 19:40:12 1992
- ***************
- *** 79,81 ****
- --- 79,83 ----
- int Load_Index_or_Dir();
- void GetOneOption(/* */);
- void check_sock(/* int, char* */);
- +
- + #define VERY (-1)
- Only in gopher1.1b1/gopher: globals.h-DIST
- diff -cr gopher1.1b1-DIST/gopher/gopher.c gopher1.1b1/gopher/gopher.c
- *** gopher1.1b1-DIST/gopher/gopher.c Thu Nov 5 11:33:02 1992
- --- gopher1.1b1/gopher/gopher.c Mon Nov 16 01:00:18 1992
- ***************
- *** 93,99 ****
- static char *response[2];
-
- if (inputline == NULL) {
- ! inputline = (char *) malloc(sizeof(char)*256);
- if (inputline == NULL)
- perror("Out of memory"), exit(-1);
- *inputline = '\0';
- --- 93,99 ----
- static char *response[2];
-
- if (inputline == NULL) {
- ! inputline = (char *) malloc(sizeof(char)*256 + 1); /* allow 256 + terminator */
- if (inputline == NULL)
- perror("Out of memory"), exit(-1);
- *inputline = '\0';
- ***************
- *** 809,819 ****
-
- sTmp[0] = '\0';
-
- ! while ((c = getopt(argc, argv, "Dsbp:t:")) != -1)
- switch (c) {
- case 's':
- SecureMode = TRUE;
- break;
- case 'p':
- GSsetPath(RootGophers[0], optarg);
- GSsetPath(RootGophers[1], optarg);
- --- 809,822 ----
-
- sTmp[0] = '\0';
-
- ! while ((c = getopt(argc, argv, "DsSbp:t:")) != -1)
- switch (c) {
- case 's':
- SecureMode = TRUE;
- break;
- + case 'S':
- + SecureMode = VERY;
- + break;
- case 'p':
- GSsetPath(RootGophers[0], optarg);
- GSsetPath(RootGophers[1], optarg);
- ***************
- *** 834,840 ****
-
-
- if (errflag) {
- ! fprintf(stderr, "Usage: %s [-sb] [-p path] [-t title] [hostname port]+\n", argv[0]);
- exit(-1);
- }
-
- --- 837,843 ----
-
-
- if (errflag) {
- ! fprintf(stderr, "Usage: %s [-sSb] [-p path] [-t title] [hostname port]+\n", argv[0]);
- exit(-1);
- }
-
- Only in gopher1.1b1/gopher: gopher.c-DIST
- diff -cr gopher1.1b1-DIST/gopher/ourutils.c gopher1.1b1/gopher/ourutils.c
- *** gopher1.1b1-DIST/gopher/ourutils.c Sat Oct 31 07:48:38 1992
- --- gopher1.1b1/gopher/ourutils.c Sun Nov 15 19:31:25 1992
- ***************
- *** 131,138 ****
-
- if (!SecureMode)
- printf(", <m> to mail, <s> to save, or <p> to print:");
- ! else
- printf(", <m> to mail:");
-
- fflush(stdout);
- noecho();
- --- 131,142 ----
-
- if (!SecureMode)
- printf(", <m> to mail, <s> to save, or <p> to print:");
- ! else {
- ! if (SecureMode == VERY)
- ! printf(":");
- ! else
- printf(", <m> to mail:");
- + }
-
- fflush(stdout);
- noecho();
- ***************
- *** 153,158 ****
- --- 157,163 ----
- case ' ':
- break;
- case 'm':
- + if (SecureMode != VERY)
- mail_file(Filename, Realname);
- break;
-
- Common subdirectories: gopher1.1b1-DIST/misc/Indexing and gopher1.1b1/misc/Indexing
- Common subdirectories: gopher1.1b1-DIST/misc/Logging and gopher1.1b1/misc/Logging
- Common subdirectories: gopher1.1b1-DIST/misc/NeXT and gopher1.1b1/misc/NeXT
- Common subdirectories: gopher1.1b1-DIST/misc/Radio and gopher1.1b1/misc/Radio
- Common subdirectories: gopher1.1b1-DIST/misc/archie-gopher-gw and gopher1.1b1/misc/archie-gopher-gw
- Common subdirectories: gopher1.1b1-DIST/misc/beeper and gopher1.1b1/misc/beeper
- Common subdirectories: gopher1.1b1-DIST/misc/go500 and gopher1.1b1/misc/go500
- Common subdirectories: gopher1.1b1-DIST/misc/gopher2ftp and gopher1.1b1/misc/gopher2ftp
- Common subdirectories: gopher1.1b1-DIST/misc/gopherdist and gopher1.1b1/misc/gopherdist
- Common subdirectories: gopher1.1b1-DIST/misc/gopherhunt and gopher1.1b1/misc/gopherhunt
- Common subdirectories: gopher1.1b1-DIST/misc/gophertree and gopher1.1b1/misc/gophertree
- Common subdirectories: gopher1.1b1-DIST/misc/shell-utils and gopher1.1b1/misc/shell-utils
- Common subdirectories: gopher1.1b1-DIST/misc/tstb and gopher1.1b1/misc/tstb
- Common subdirectories: gopher1.1b1-DIST/misc/waisfetch and gopher1.1b1/misc/waisfetch
- Common subdirectories: gopher1.1b1-DIST/misc/Radio/radio and gopher1.1b1/misc/Radio/radio
- Common subdirectories: gopher1.1b1-DIST/misc/Radio/radiod and gopher1.1b1/misc/Radio/radiod
- diff -cr gopher1.1b1-DIST/object/Makefile gopher1.1b1/object/Makefile
- *** gopher1.1b1-DIST/object/Makefile Wed Sep 9 00:03:47 1992
- --- gopher1.1b1/object/Makefile Sun Nov 15 22:28:57 1992
- ***************
- *** 20,25 ****
- clean:
- rm -f $(TARGET) $(OBJS) *.out *~ core
-
- ! STRstring.o: STRstring.h
- ! GDgopherdir.o: GDgopherdir.h
- ! GSgopherobj.o: GSgopherobj.h
- --- 20,25 ----
- clean:
- rm -f $(TARGET) $(OBJS) *.out *~ core
-
- ! STRstring.o: STRstring.c STRstring.h
- ! GDgopherdir.o: GDgopherdir.c GDgopherdir.h
- ! GSgopherobj.o: GSgopherobj.c GSgopherobj.h
- Only in gopher1.1b1/object: RCS
- diff -cr gopher1.1b1-DIST/object/STRstring.c gopher1.1b1/object/STRstring.c
- *** gopher1.1b1-DIST/object/STRstring.c Sat Oct 31 07:18:46 1992
- --- gopher1.1b1/object/STRstring.c Mon Nov 16 01:03:50 1992
- ***************
- *** 1,6 ****
- --- 1,29 ----
- + static char RCSIDSTRstrings[] = "@(#) $Header: /usr/users/cno/mark/cwis/gopher/gopher1.1b1/object/RCS/STRstring.c,v 1.4 1992/11/15 11:05:02 mark Exp mark $";
- + /*
- + ** $Log: STRstring.c,v $
- + * Revision 1.4 1992/11/15 11:05:02 mark
- + * add sanity checks for st == NULL
- + *
- + * Revision 1.3 1992/11/15 10:32:03 mark
- + * fix STRcat need to pass st to STRset
- + *
- + * Revision 1.2 1992/11/15 10:30:38 mark
- + * fix STRnewSet need to allow for null terminator in malloc
- + *
- + * Revision 1.1 1992/11/15 10:29:20 mark
- + * Initial revision
- + *
- + **
- + ** Add RCS and start some buf fixes
- + **
- + */
- +
- #include "STRstring.h"
- #include "String.h"
- #include "Malloc.h"
- + #ifdef EBUG
- + #include <stdio.h>
- + #endif
-
- /*
- * Make a new string, however use supplied parameter to set it.
- ***************
- *** 18,24 ****
- if (in == NULL)
- return(temp);
-
- ! len = strlen(in);
-
- temp->data = (char *) malloc(len * sizeof(char*));
- strcpy(temp->data, in);
- --- 41,47 ----
- if (in == NULL)
- return(temp);
-
- ! len = strlen(in) + 1; /* allow for null termination.... MG */
-
- temp->data = (char *) malloc(len * sizeof(char*));
- strcpy(temp->data, in);
- ***************
- *** 50,59 ****
- --- 73,90 ----
- STRdestroy(st)
- String *st;
- {
- + if (st) { /* sanity check, never trust someone knocking at the door */
- if (st->data != NULL)
- free(st->data);
-
- free(st);
- + }
- + #ifdef EBUG
- + else {
- + fprintf(stderr,"STRdestroy:Attempt to destroy non existant st \n");
- + exit (1);
- + }
- + #endif
- }
-
-
- ***************
- *** 65,74 ****
- --- 96,120 ----
- STRinit(st)
- String *st;
- {
- + if (st) { /* sanity check, never trust someone knocking at the door */
- st->len = 0;
- + #ifdef EBUG
- + fprintf(stderr, "st = %08x\n", st);
- + fprintf(stderr,"%08x:", st->data);
- + if (st->data) fprintf(stderr,"%08x:\"%s\"\n", st->data, st->data);
- + else fprintf(stderr,"\"(null)\"\n");
- + #endif
- if (st->data != NULL)
- free(st->data);
- +
- st->data = NULL;
- + }
- + #ifdef EBUG
- + else {
- + fprintf(stderr,"STRinit:Attempt to destroy non existant st \n");
- + exit (1);
- + }
- + #endif
- }
-
- /*
- ***************
- *** 82,87 ****
- --- 128,134 ----
- {
- register int len;
-
- + if (st) { /* sanity check, never trust someone knocking at the door */
- if (str == NULL)
- return;
-
- ***************
- *** 112,117 ****
- --- 159,171 ----
- strcpy(st->data, str);
- }
- }
- + }
- + #ifdef EBUG
- + else {
- + fprintf(stderr,"STRset:Attempt to destroy non existant st \n");
- + exit (1);
- + }
- + #endif
- }
-
- /*
- ***************
- *** 126,131 ****
- --- 180,186 ----
- int len;
- char *temp;
-
- + if (st) { /* sanity check, never trust someone knocking at the door */
- if (cp == NULL)
- return(NULL);
-
- ***************
- *** 140,150 ****
- strcpy(temp, STRget(st));
- strcat(temp, cp);
-
- ! STRset(temp);
-
- free(temp);
-
- return(st);
- }
-
-
- --- 195,212 ----
- strcpy(temp, STRget(st));
- strcat(temp, cp);
-
- ! STRset(st,temp); /* original code did not pass st */
-
- free(temp);
-
- return(st);
- + }
- + #ifdef EBUG
- + else {
- + fprintf(stderr,"STRcat:Attempt to destroy non existant st \n");
- + exit (1);
- + }
- + #endif
- }
-
-
- Only in gopher1.1b1/object: STRstring.c-DIST
- Only in gopher1.1b1/object: STRstring.c.bak
- diff -cr gopher1.1b1-DIST/object/compatible.c gopher1.1b1/object/compatible.c
- *** gopher1.1b1-DIST/object/compatible.c Sat Nov 7 05:21:39 1992
- --- gopher1.1b1/object/compatible.c Mon Nov 16 00:39:36 1992
- ***************
- *** 9,19 ****
-
- /*** For machines that don't have strstr ***/
-
- ! #if defined(NOSTRSTR) || defined(mips) || defined(sequent) || defined(n16)
-
- char *
- strstr(host_name, cp)
- ! char host_name[256];
- char *cp;
- {
- int i, j;
- --- 9,19 ----
-
- /*** For machines that don't have strstr ***/
-
- ! #if defined(NOSTRSTR) || (defined(mips) && !defined(ultrix)) || defined(sequent) || defined(n16)
-
- char *
- strstr(host_name, cp)
- ! char host_name[256];
- char *cp;
- {
- int i, j;
- ***************
- *** 62,68 ****
- char *temp;
-
- if (str == NULL) return(NULL);
- ! len = strlen(str);
-
- temp = (char *) malloc(sizeof(char) * len);
-
- --- 62,68 ----
- char *temp;
-
- if (str == NULL) return(NULL);
- ! len = strlen(str) + 1; /* GOTCHA... must add 1 for null terminator */
-
- temp = (char *) malloc(sizeof(char) * len);
-
- Only in gopher1.1b1/object: diff
- --
- Mark Garrett Internet: mark@arvak.une.edu.au Phone: +61 66 20 3859
- University of New England, Northern Rivers, Lismore NSW Australia.
-