home *** CD-ROM | disk | FTP | other *** search
- #include <ndbm.h>
- #include "GSgopherobj.h"
- #include "Malloc.h"
- #include "string.h"
-
- void
- GSmodLine(gs, inputline)
- GopherObj *gs;
- char *inputline;
- {
-
- if (strncmp(inputline, "Type=", 5)==0) {
- GSsetType(gs, inputline[5]);
- if (inputline[5] == '7') {
- /*** Might as well set the path too... ***/
- *(GSgetPath(gs)) = '7';
- }
- }
-
- else if (strncmp(inputline, "Name=", 5)==0) {
- GSsetTitle(gs, inputline+5);
- }
-
- else if (strncmp(inputline, "Host=", 5)==0) {
- GSsetHost(gs, inputline+5);
- }
-
- else if (strncmp(inputline, "Port=", 5)==0) {
- GSsetPort(gs, atoi(inputline+5));
- }
-
- else if (strncmp(inputline, "Path=", 5)==0) {
- GSsetPath(gs, inputline+5);
- }
-
- else if (strncmp(inputline, "Numb=", 5)==0) {
- GSsetNum(gs, atoi(inputline+5));
- }
-
- else if (strncmp(inputline, "Name=", 5)==0) {
- GSsetTitle(gs, inputline+5);
- }
-
- }
-
-
-
- /*
- * Given a
- */
-
- GSfromdbm(gs, db, inode)
- GopherObj *gs;
- DBM *db;
- int inode;
- {
- datum thekey, thedata;
- char *lineptr;
-
-
- /*** Try keying on the inode # (file might have been renamed) ***/
-
- thekey.dptr = (char *) &inode;
- thekey.dsize = sizeof(inode);
-
- thedata = dbm_fetch(db, thekey);
-
- if (thedata.dptr == NULL)
- return;
-
- /*** Try keying on the name. ***/
-
- thekey.dptr = GSgetTitle(gs);
- thekey.dsize = strlen(thekey.dptr);
-
- thedata = dbm_fetch(db, thekey);
-
- if (thedata.dptr == NULL)
- return;
-
- /*** Hmm, otherwise something's afoot ***/
-
- lineptr = thedata.dptr;
-
- while (lineptr != NULL) {
- char *tempptr;
-
- tempptr = strchr(lineptr, '\n');
-
- GSmodLine(gs, lineptr);
- if (tempptr == NULL)
- lineptr = NULL;
- else
- lineptr = tempptr + 1;
- }
- }
-
-
-