comparison dmres.c @ 237:6d9d43bb68eb

Oops, another silly issue in dmfgets().
author Matti Hamalainen <ccr@tnsp.org>
date Tue, 09 Oct 2012 04:43:03 +0300
parents 8189be40ed7c
children 59045853853d
comparison
equal deleted inserted replaced
236:8189be40ed7c 237:6d9d43bb68eb
788 char *p = s, c; 788 char *p = s, c;
789 int n = 0; 789 int n = 0;
790 790
791 while ((c = f->fops->fgetc(f)) != EOF) 791 while ((c = f->fops->fgetc(f)) != EOF)
792 { 792 {
793 n++;
793 if (c == '\n') 794 if (c == '\n')
794 break; 795 break;
795 else 796 else
796 if (n < size - 1) 797 if (n < size - 1)
797 {
798 *p++ = c; 798 *p++ = c;
799 n++;
800 }
801 } 799 }
802 *p = 0; 800 *p = 0;
803 801
804 return (n > 0) ? s : NULL; 802 return (n > 0) ? s : NULL;
805 } 803 }