[code] input limits

From: Sammy (samedi@DHC.NET)
Date: 09/04/97


Every once in a while I hear complaints about the circle editor (this
would apply to improved_edit too) about the problems with long lines.
Some people like to type away without using linefeeds and they either have
the line truncated for them, or if their input is bigger than
MAX_RAW_INPUT_LENGTH - 1 they get dumped from the mud without knowing why
(ack!).

Here's a patch to allow unlimited linefeed-free input while in the editor.
The only problem with it I've run into is that if you enter more than
MAX_RAW_INPUT_LENGTH - 1 characters without a linefeed, it inserts one for
you.  This could be solved by setting a dont_append_linefeed flag so
string_add knows when to skip it.  You might consider adding an automatic
80-column format function to string_add so the text looks pretty.

Btw, it would probably be a good thing if the input overflow disconnect
was fixed in a better way.  I haven't figured out how to do that yet.

"If Sears sold TCP sockets, how fast could they replace a broken one?"
  - Weird thought of the day

Sam

*** comm.c      Sun Apr 14 13:28:46 1996
--- comm.c.new  Thu Sep  4 10:14:04 1997
***************
*** 1160,1165 ****
    do {
      if (space_left <= 0) {
!       log("process_input: about to close connection: input overflow");
!       return -1;
      }
  #ifdef CIRCLE_WINDOWS
--- 1160,1171 ----
    do {
      if (space_left <= 0) {
!       if(!t->str) {
!       log("process_input: about to close connection: input overflow");
!       return -1;
!       } else {
!       string_add(t, t->inbuf);
!       *t->inbuf = '\0';
!       return 1;
!       }
      }
  #ifdef CIRCLE_WINDOWS
***************
*** 1247,1255 ****

      if ((space_left <= 0) && (ptr < nl_pos)) {
!       char buffer[MAX_INPUT_LENGTH + 64];

!       sprintf(buffer, "Line too long.  Truncated to:\r\n%s\r\n", tmp);
!       if (write_to_descriptor(t->descriptor, buffer) < 0)
!       return -1;
      }
      if (t->snoop_by) {
--- 1253,1267 ----

      if ((space_left <= 0) && (ptr < nl_pos)) {
!       if(!t->str) {
!       char buffer[MAX_INPUT_LENGTH + 64];

!       sprintf(buffer, "Line too long.  Truncated to:\r\n%s\r\n", tmp);
!       if (write_to_descriptor(t->descriptor, buffer) < 0)
!         return -1;
!       } else {
!       string_add(t, tmp);
!       *t->inbuf = '\0';
!       return 1;
!       }
      }
      if (t->snoop_by) {


     +------------------------------------------------------------+
     | 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/08/00 PST