OOPS - build and access database of paths to systems on map
Don Steiny
steiny at scc.UUCP
Tue Sep 18 10:27:04 AEST 1984
-----
I did not include the following routines in the alpath stuff.
Sorry. I am new at this!!
----------------------- Cut here -------------------------------------
: This is a shar archieve. Extract with sh, not csh.
: The rest of this file will extract:
: strsave.c strbrk.c
echo extracting - strsave.c
sed 's/^X//' > strsave.c << '~FUNKY STUFF~'
X/* save string s and return pointer to space
X From "The C Programming Langauge"
X */
X# include <stdio.h>
X
Xchar *strsave(s)
Xchar *s;
X{
X char *p, *malloc();
X if((p = malloc(strlen(s) + 1)) != NULL)
X strcpy(p,s);
X return(p);
X}
~FUNKY STUFF~
echo extracting - strbrk.c
sed 's/^X//' > strbrk.c << '~FUNKY STUFF~'
X/* this routine takes the first argument and breaks it into
X parts at non-null characters. The argument 0 means any space.
X Spaces are space, tab, newline, return, or
X vertical tab. The second argument must be an array of pointers
X with enough pointers to point to the resultant list.
X
X The routine returns the number of items in the array.
X
X 1983, Donald Steiny
X
X */
X# include <ctype.h>
X
Xstrbrk(li,av,ch)
Xchar *li, *av[], ch;
X{
X register char *t, *p;
X char buf[256];
X int ht = 0;
X t = buf;
X p = li;
X while(*p)
X {
X *t = *p;
X if((ch == 0 && isspace(*t)) || (ch && *p == ch))
X {
X *t = (char) 0;
X if(!*buf)
X {
X ++p;
X continue;
X }
X av[ht++] = (char *) strsave(buf);
X strcpy(buf,"");
X t = buf;
X ++p;
X continue;
X }
X ++t;
X ++p;
X }
X *t = (char) 0;
X av[ht++] = (char *) strsave(buf);
X av[ht] = (char *) 0;
X return(ht);
X}
~FUNKY STUFF~
exit 0;
--
scc!steiny
Don Steiny - Personetics @ (408) 425-0382
109 Torrey Pine Terr.
Santa Cruz, Calif. 95060
ihnp4!pesnta -\
fortune!idsvax -> scc!steiny
ucbvax!twg -/
More information about the Comp.sources.unix
mailing list