forked from KolibriOS/kolibrios
libc.obj:
strtol.с - removed existing definitions; fgets.c - uses fread() to read; gets.c - added additional check; git-svn-id: svn://kolibrios.org@9081 a494cfbc-eb01-0410-851d-a64ba20cac60
This commit is contained in:
parent
2976cecf4e
commit
8fa851ddb6
@ -11,13 +11,7 @@ char *fgets(char *str, int n, FILE *stream)
|
||||
return NULL;
|
||||
}
|
||||
|
||||
while (i<n-1){
|
||||
sym_code = fgetc(stream);
|
||||
if(sym_code =='\n' || sym_code == EOF){ break; }
|
||||
str[i]=(char)sym_code;
|
||||
i++;
|
||||
}
|
||||
|
||||
i = fread(str, n-1, sizeof(char), stream);
|
||||
if(i<1){ return NULL; }
|
||||
return str;
|
||||
}
|
||||
|
@ -11,6 +11,10 @@ char *gets(char* str)
|
||||
errno = EIO;
|
||||
return NULL;
|
||||
}
|
||||
str[strlen(str)-1]='\0';
|
||||
|
||||
int str_len = strlen(str);
|
||||
if(str[str_len-1]=='\n'){
|
||||
str[str_len-1]='\0';
|
||||
}
|
||||
return str;
|
||||
}
|
@ -2,11 +2,6 @@
|
||||
#include <stdio.h>
|
||||
#include <ctype.h>
|
||||
|
||||
#define LONG_MIN (-2147483647L-1)
|
||||
#define LONG_MAX (2147483647L)
|
||||
#define ULONG_MAX (4294967295UL)
|
||||
|
||||
|
||||
int getdigit(char ch, int base)
|
||||
{
|
||||
if (isdigit(ch)) ch-= '0';
|
||||
|
Loading…
Reference in New Issue
Block a user