/***************************************************************************\ [*] ___ ____ ____ __ __ ____ [*] ROGUE: ROM With Attitude [*] [*] /#/ ) /#/ ) /#/ ) /#/ /#/ /#/ [*] All rights reserved [*] [*] /#/ < /#/ / /#/ _ /#/ /#/ /#/-- [*] Copyright(C) 2000-2003 [*] [*] /#/ \(#(__/ (#(__/ (#(__/#/ (#(___ [*] Kenneth Conley (Mendanbar) [*] [*] Expression of Digital Creativity.. [*] roguemud@yahoogroups.com [*] [-]---------------------------------------+-+-----------------------------[-] [*] File: utils.cpp [*] [*] Usage: Various internal functions of a utility nature [*] \***************************************************************************/ #include "merc.h" #include "buffer.h" int get_line(FILE *fl, char *buf) { int lines = 0; char *temp = get_buffer(256); do { lines++; fgets(temp, 256, fl); if (*temp) temp[strlen(temp) - 1] = '\0'; } while (!feof(fl) && (!*temp)); if (feof(fl)) { *buf = '\0'; lines = 0; } else strcpy(buf, temp); release_buffer(temp); return lines; }