


     FFFFGGGGEEEETTTTSSSSMMMMOOOODDDD((((3333SSSS))))	  XXXXEEEENNNNIIIIXXXX	3333....0000 ((((11111111	MMMMaaaayyyy 1111999988886666))))	  FFFFGGGGEEEETTTTSSSSMMMMOOOODDDD((((3333SSSS))))



     NNNNAAAAMMMMEEEE
	  fgetsmod - get a line from a stream, truncating it if it is too long

     SSSSYYYYNNNNOOOOPPPPSSSSIIIISSSS
	  ####iiiinnnncccclllluuuuddddeeee <<<<ssssttttddddiiiioooo....hhhh>>>>
	  ####ddddeeeeffffiiiinnnneeee TTTTOOOOOOOOLLLLOOOONNNNGGGG ----2222

	  iiiinnnntttt ****ffffggggeeeettttssss((((ssss,,,,	nnnn,,,, ssssttttrrrreeeeaaaammmm))))
	  cccchhhhaaaarrrr ****ssss;;;;
	  FFFFIIIILLLLEEEE ****ssssttttrrrreeeeaaaammmm;;;;

     DDDDEEEESSSSCCCCRRRRIIIIPPPPTTTTIIIIOOOONNNN
	  _F_g_e_t_s_m_o_d is a	modified version of _f_g_e_t_s, which truncates
	  lines	longer than the	size of	the array into which they are
	  being	read.  It reads	_n-2 characters,	or up to a newline
	  character, whichever comes first, from the _s_t_r_e_a_m into the
	  string _s.  If	no newline is found after reading the first
	  _n-2 characters, _f_g_e_t_s_m_o_d will	add a newline and null
	  character, then read and discard characters from the input
	  stream up to a newline.  In other words, it will discard
	  characters in	excess of the capacity of _s.  The last
	  character read into _s	is followed by a null character.
	  _F_g_e_t_s_m_o_d returns the number of characters read if it can
	  read the whole line.

     SSSSEEEEEEEE AAAALLLLSSSSOOOO
	  gets(3S), puts(3S), getc(3S),	scanf(3S), fread(3S),
	  ferror(3S)

     AAAAUUUUTTTTHHHHOOOORRRR
	  Mohamed el Lozy, Harvard Health Sciences Computing Faility

     DDDDIIIIAAAAGGGGNNNNOOOOSSSSTTTTIIIICCCCSSSS
	  _F_g_e_t_s_m_o_d return the integer zero upon	end of file or read
	  error.  It returns -2	(to avoid confusion with EEEEOOOOFFFF) if the
	  line is too long.

     BBBBUUUUGGGGSSSS
	  _F_g_e_t_s_m_o_d returns an _i_n_t, unlike _f_g_e_t_s, which returns a _c_h_a_r.
	  It should therefore probably return EEEEOOOOFFFF on end of file, but
	  returning zero makes it more similar to _f_g_e_t_s.













     Page 1					     (printed 11/4/94)



