--- WordNet/include/wn.h +++ WordNet/include/wn.h @@ -456,7 +456,7 @@ extern char *insert_line(char *, char *, FILE *); extern char **helptext[NUMPARTS + 1]; -static char *license = "\ +static const char license[] = "\ This software and database is being provided to you, the LICENSEE, by \n\ Princeton University under the following license. By obtaining, using \n\ and/or copying this software and database, you agree that you have \n\ @@ -488,7 +488,7 @@ any associated documentation shall at all times remain with \n\ Princeton University and LICENSEE agrees to preserve same. \n" ; -static char dblicense[] = "\ +static const char dblicense[] = "\ 1 This software and database is being provided to you, the LICENSEE, by \n\ 2 Princeton University under the following license. By obtaining, using \n\ 3 and/or copying this software and database, you agree that you have \n\ --- WordNet/lib/binsrch.c +++ WordNet/lib/binsrch.c @@ -7,7 +7,7 @@ #include #include -static char *Id = "$Id: binsrch.c,v 1.15 2005/02/01 16:46:43 wn Rel $"; +static const char Id[] = "$Id: binsrch.c,v 1.15 2005/02/01 16:46:43 wn Rel $"; /* Binary search - looks for the key passed at the start of a line in the file associated with open file descriptor fp, and returns @@ -31,7 +31,8 @@ char *read_index(long offset, FILE *fp) { line[0] = '\0'; fseek( fp, offset, SEEK_SET ); - fgets(linep, LINE_LEN, fp); + if (!fgets(linep, LINE_LEN, fp)) + linep[0] = '\0'; return(line); } @@ -56,7 +57,8 @@ char *bin_search(char *searchkey, FILE *fp) if(mid != 1) while((c = getc(fp)) != '\n' && c != EOF); last_bin_search_offset = ftell( fp ); - fgets(linep, LINE_LEN, fp); + if (!fgets(linep, LINE_LEN, fp)) + linep[0] = '\0'; length = (int)(strchr(linep, ' ') - linep); if (length > (sizeof(key) - 1)) return(NULL); @@ -189,11 +191,12 @@ char *replace_line(char *new_line, char *searchkey, FILE *fp) if ((tfp = tmpfile()) == NULL) return(NULL); /* could not create temp file */ fseek(fp, offset, 0); - fgets(line, LINE_LEN, fp); /* read original */ + if (!fgets(line, LINE_LEN, fp)) /* read original */ + line[0] = '\0'; copyfile(fp, tfp); if (fseek(fp, offset, 0) == -1) return(NULL); /* could not seek to offset */ - fprintf(fp, new_line); /* write line */ + fprintf(fp, "%s", new_line); /* write line */ rewind(tfp); copyfile(tfp, fp); @@ -220,7 +223,7 @@ char *insert_line(char *new_line, char *searchkey, FILE *fp) copyfile(fp, tfp); if (fseek(fp, offset, 0) == -1) return(NULL); /* could not seek to offset */ - fprintf(fp, new_line); /* write line */ + fprintf(fp, "%s", new_line); /* write line */ rewind(tfp); copyfile(tfp, fp); --- WordNet/lib/morph.c +++ WordNet/lib/morph.c @@ -21,7 +21,7 @@ #define EXCFILE "%s/%s.exc" #endif -static char *Id = "$Id: morph.c,v 1.67 2006/11/14 21:00:23 wn Exp $"; +static const char Id[] = "$Id: morph.c,v 1.67 2006/11/14 21:00:23 wn Exp $"; static char *sufx[] ={ /* Noun suffixes */ --- WordNet/lib/search.c +++ WordNet/lib/search.c @@ -17,7 +17,7 @@ #include "wn.h" -static char *Id = "$Id: search.c,v 1.166 2006/11/14 20:52:45 wn Exp $"; +static const char Id[] = "$Id: search.c,v 1.166 2006/11/14 20:52:45 wn Exp $"; /* For adjectives, indicates synset type */ @@ -1361,7 +1361,7 @@ char *findtheinfo(char *searchstr, int dbase, int ptrtyp, int whichsense) int i, offsetcnt; char *bufstart; unsigned long offsets[MAXSENSE]; - int skipit; + int skipit = 0; /* Initializations - clear output buffer, search results structure, flags */ --- WordNet/lib/wnrtl.c +++ WordNet/lib/wnrtl.c @@ -7,7 +7,7 @@ #include #include "wn.h" -static char *Id = "$Id: wnrtl.c,v 1.8 2005/01/27 17:33:54 wn Rel $"; +static const char Id[] = "$Id: wnrtl.c,v 1.8 2005/01/27 17:33:54 wn Rel $"; /* Search code variables and flags */ --- WordNet/src/wn.c +++ WordNet/src/wn.c @@ -9,7 +9,7 @@ #include #include "wn.h" -static char *Id = "$Id: wn.c,v 1.13 2005/01/31 19:19:09 wn Rel $"; +static const char Id[] = "$Id: wn.c,v 1.13 2005/01/31 19:19:09 wn Rel $"; static struct { char *option; /* user's search request */ @@ -286,7 +286,7 @@ static void printsearches(char *word, int dbase, unsigned long search) printf("\t"); printf(searchstr[j].template, partchars[dbase], partchars[dbase]); - printf(searchstr[j].helpstr); + printf("%s", searchstr[j].helpstr); printf("\n"); } } @@ -347,7 +347,7 @@ static int getoptidx(char *searchtype) static int error_message(char *msg) { - fprintf(stderr, msg); + fprintf(stderr, "%s", msg); return(0); }