* `LICENSE' that comes with the fcron source distribution.
*/
- /* $Id: fileconf.c,v 1.77 2006-05-20 16:27:23 thib Exp $ */
+ /* $Id: fileconf.c,v 1.78 2007-01-23 22:48:15 thib Exp $ */
#include "fcrontab.h"
};
+#define GET_LINE_EOF 999
+
char *
get_string(char *ptr)
/* read string pointed by ptr, remove blanks and manage
*(str + i) = (char) '\0';
/* we couldn't return EOF ( equal to ERR by default )
* nor ERR, which is used for another error */
- return 999;
+ return GET_LINE_EOF;
default:
*(str + i) = (char) c;
while ( entries <= max_entries && line <= max_lines ) {
- if ( (ret = get_line(buf, sizeof(buf), file)) == ERR ) {
+ ret = get_line(buf, sizeof(buf), file);
+
+ if ( ret == ERR ) {
fprintf(stderr, "%s:%d: Line is too long (more than %d): skipping line.\n",
file_name, line, sizeof(buf));
continue;
case '#':
case '\0':
/* comments or empty line: skipping */
- line++;
- continue;
+ break;
case '@':
read_freq(ptr, cf);
entries++;
line++;
if ( ret != OK )
- /* in this case, ret == EOF : no more lines */
+ /* in this case, ret == GET_LINE_EOF :
+ * no more lines, so we exit the loop */
break;
}