/*
 * File:
 *   readline.h
 * Author:
 *   Samuel A. Rebelsky
 * Version:
 *   1.0 of March 2003
 * Summary:
 *   Declarations of procedures provided by readline.c
 */

#ifndef _READLINE_H_
#define _READLINE_H_

#include <stdio.h>

/*
 * Procedure:
 *   readLine
 * Parameters:
 *   file, a pointer to a FILE
 *   str, a string
 *   max, an integer
 * Purpose:
 *   Read one line or max-1 characters from file, whichever comes
 *   first.
 * Produces:
 *   read-all, an integer
 * Preconditions:
 *   file is open for reading.
 *   max >= 1.
 *   str points to at least max consecutive characters.
 * Postconditions:
 *   At most max characters have been read from file.
 *   Nothing beyond the first end-of-line at or after the cursor 
 *     has been read.
 *   str contains the characters read from the file in order.
 *   str does not contain end-of-line.
 *   str is terminated by 0.
 *   read-all is 1 if an end-of-line or end-of-file character was read.  
 *   read-all is 0 otherwise.
 *   file is open.
 */
extern int readLine(FILE *file, char *str, int max);

#endif /* _READLINE_H_ */
