> void mfgets(char * buf, size_t len, FILE * fp) > { > fgets(buf, len, fp); > if (*buf) > buf[strlen(buf) - 1] = '\0'; > } > > And replace all the calls of "fgets" with "mfgets" (simple search and > replace; except for the one call in mfgets, of course). Why does it > use "wstr2", anyway? If you load into "wstr", why do you copy it to > "wstr2"? Not sure. wstr2 is just used internally in the function, and looks like it could've been left as wstr w/o affecting anything. There's lots of code oddiities in Dikued. :) Below is one function, used for a "(yes/no)" prompt, that originally had a call to gets() /* Ask for Yes or No */ int AskYesNo(char *wstr) { char wstr2[DU_MAXSTRLEN]; gets(wstr2); if((*wstr2 != '\0') && (!strnccmp(wstr, wstr2, strlen(wstr2) ))) return(1); else return(0); } I had originally just changed the call to fgets(wstr2, DU_MAXSTRLEN, stdin); although specifying DU_MAXSTRLEN as the max allowable size twice seems redundant. But encapsulating fgets() in my own mfgets() sounds like a good idea at the moment, thanks. I'll compare that to George's read_line suggestion too, and see which'll work better for the situation. Thanks, guys. :) -- -AxL, axl@wpcr.plymouth.edu - SysOp, RPM Director, WPCR Plymouth, 91.7 FM "Discriminate against the next fashion sucker you meet....it's a raver!" - Ec8or, Digital Hardcore Records +------------------------------------------------------------+ | 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