I changed a small thing in this, assuming the way strings are saved is done the same way all the time. because what if someone does this something something else ~something else ~ ? eh? well, it still has the error. why not do what I did at the bottom (trust me, people are going to crash it if possible and what I changed won't stop them either.) The change will check to see if the '~' is on a line by itself. (since using fgets() it would look like this "~\n\0" > Two. The boards don't like tildes. Not even a little. So, you >might want to do the following: > >to db.c add the following function >char * >fread_string2(FILE * fl, char *error) >{ > char buf[MAX_STRING_LENGTH], tmp[512], *rslt; > register char *point; > int done = 0, length = 0, templength = 0; > > *buf = '\0'; > > do { > if (!fgets(tmp, 512, fl)) { > > fprintf(stderr, "SYSERR: fread_string2: format error at or near %s\n", > error); > exit(1); > } > /* If there is a '~' at the front, end; else put an "\r\n" over the > '\n'. */ > if ((point=strchr(tmp, '~')) && point==tmp) { change this line --^ to read : if ((point = strchr(tmp, '~')) && point == tmp && *(point+1) == '\n' && *(point + 2) == '\0') { > *point = '\0'; > done = 1; > } else { > point = tmp + strlen(tmp) - 1; > *(point++) = '\r'; > *(point++) = '\n'; > *point = '\0'; > } > > templength = strlen(tmp); > if (length + templength >= MAX_STRING_LENGTH) { > log("SYSERR: fread_string: string too large (db.c)"); > log(error); > exit(1); > } else { > strcat(buf + length, tmp); > length += templength; > } That would allow it only to kill if a ~ is on a line by itself. which means all you would need to do is go through the string and if any of the lines has a ~ on a line by itself, kill that line. Anyway, just adding my $((1 << 1)/100.0) worth Code On Akuma the Raging Coder PS -- I don't use this, I just use a hide_tilde funtion in the strip_string() function, and a show_tilde in the fread_string function. anyway, that's it all. +------------------------------------------------------------+ | "The poets talk about love, but what I talk about is DOOM, | | because in the end, DOOM is all that counts." - | | Alex Machine/George Stark/Stephen King, The Dark Half | | "Nothing is IMPOSSIBLE, Just IMPROBABLE" | | "Easier Said Than Done, But Better Done Than Said..." | +------------------------------------------------------------+ +------------------------------------------------------------+ | Ensure that you have read the CircleMUD Mailing List FAQ: | | http://democracy.queensu.ca/~fletcher/Circle/list-faq.html | +------------------------------------------------------------+
This archive was generated by hypermail 2b30 : 12/15/00 PST