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,14 +11,8 @@ char *fgets(char *str, int n, FILE *stream)
|
|||||||
return NULL;
|
return NULL;
|
||||||
}
|
}
|
||||||
|
|
||||||
while (i<n-1){
|
i = fread(str, n-1, sizeof(char), stream);
|
||||||
sym_code = fgetc(stream);
|
|
||||||
if(sym_code =='\n' || sym_code == EOF){ break; }
|
|
||||||
str[i]=(char)sym_code;
|
|
||||||
i++;
|
|
||||||
}
|
|
||||||
|
|
||||||
if(i<1){ return NULL; }
|
if(i<1){ return NULL; }
|
||||||
return str;
|
return str;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -11,6 +11,10 @@ char *gets(char* str)
|
|||||||
errno = EIO;
|
errno = EIO;
|
||||||
return NULL;
|
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;
|
return str;
|
||||||
}
|
}
|
||||||
|
@ -2,11 +2,6 @@
|
|||||||
#include <stdio.h>
|
#include <stdio.h>
|
||||||
#include <ctype.h>
|
#include <ctype.h>
|
||||||
|
|
||||||
#define LONG_MIN (-2147483647L-1)
|
|
||||||
#define LONG_MAX (2147483647L)
|
|
||||||
#define ULONG_MAX (4294967295UL)
|
|
||||||
|
|
||||||
|
|
||||||
int getdigit(char ch, int base)
|
int getdigit(char ch, int base)
|
||||||
{
|
{
|
||||||
if (isdigit(ch)) ch-= '0';
|
if (isdigit(ch)) ch-= '0';
|
||||||
|
Loading…
Reference in New Issue
Block a user