On Wed, 4 Mar 1998, George wrote: > Have you run this? Nope. I shoulda mentioned it was mailer code. > I note that the room name is loaded via fread_string and the tilde is > always at the end of the string. With this change would it not seem to > fail to find the tilde to terminate? Right. > (Which is why I took the idea to kill tildes instead of the fread_string > part.) That's not a good reason to give up and use a bad hack. A couple small changes, and tildes on the end of a line are accomodated. Here's a new patch that terminates the editor if a tilde starts or ends a line, but allows them anywhere in between. It could be done better, but at least this one is tested :) diff -up src/db.c new/db.c --- src/db.c Wed Mar 4 23:06:21 1998 +++ new/db.c Wed Mar 4 23:06:07 1998 @@ -2059,11 +2059,19 @@ char *fread_string(FILE * fl, char *erro error); exit(1); } - /* If there is a '~', end the string; else put an "\r\n" over the '\n'. */ - if ((point = strchr(tmp, '~')) != NULL) { - *point = '\0'; + /* If there is a '~' at the beginning or end of the line, end the + string; else put an "\r\n" over the '\n'. + */ + if (*tmp == '~') { + *tmp = '\0'; done = 1; - } else { + } else if ((point = strrchr(tmp, '~')) != NULL) { + if(*(point + 1) == '\n' || *(point + 1) == '\r') { + *point = '\0'; + done = 1; + } + } + if(!done) { point = tmp + strlen(tmp) - 1; *(point++) = '\r'; *(point++) = '\n'; diff -up src/modify.c new/modify.c --- src/modify.c Wed Mar 4 23:06:29 1998 +++ new/modify.c Wed Mar 4 23:06:11 1998 @@ -56,14 +56,22 @@ void string_add(struct descriptor_data * { int terminator = 0; extern char *MENU; + char *point; /* determine if this is the terminal string, and truncate if so */ /* changed to only accept '@' at the beginning of line - J. Elson 1/17/94 */ delete_doubledollar(str); - if ((terminator = (*str == '@'))) + if ((terminator = (*str == '@' || *str == '~'))) *str = '\0'; + else if((point = strrchr(str, '~')) != NULL) + if(*(point + 1) == '\0' || *(point + 1) == '\r' || *(point + 1) == '\n') { + terminator = 1; + *(point++) = '\n'; + *(point++) = '\r'; + *point = '\0'; + } if (!(*d->str)) { if (strlen(str) > d->max_str) { Sam +------------------------------------------------------------+ | 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