Update BFile information + add some common std functions

This commit is contained in:
Yatis 2021-02-01 11:49:31 +01:00
parent 7a68070bac
commit 01f5f883e7
4 changed files with 43 additions and 0 deletions

View File

@ -105,6 +105,21 @@ struct BFile_FileInfo
/* Address of first fragment (do not use directly) */
void *address;
};
enum BFile_FileType
{
BFile_Type_Directory = 0x0000,
BFile_Type_File = 0x0001,
BFile_Type_Addin = 0x0002,
BFile_Type_Eact = 0x0003,
BFile_Type_Language = 0x0004,
BFile_Type_Bitmap = 0x0005,
BFile_Type_MainMem = 0x0006,
BFile_Type_Temp = 0x0007,
BFile_Type_Dot = 0x0008,
BFile_Type_DotDot = 0x0009,
BFile_Type_Volume = 0x000a,
BFile_Type_Archived = 0x0041,
};
int BFile_FindFirst(uint16_t const *search, int *shandle, uint16_t *foundfile,
struct BFile_FileInfo *fileinfo);

View File

@ -27,4 +27,7 @@ void srand(unsigned int seed);
/* rand(): Generate a pseudo-random number between 0 and RAND_MAX */
int rand(void);
/* atoi(): Convert string into decimal */
extern int atoi(const char *restrict s);
#endif /* GINT_STD_STDLIB */

View File

@ -31,4 +31,13 @@ char *strcat(char *dest, const char *src);
/* strcmp(): Compare NUL-terminated strings */
int strcmp(char const *s1, char const *s2);
/* strchr(): returns a pointer to the first occurrence of the character c */
extern char *strchr(const char *s1, int c);
/* strchrnull(): returns a pointer to the first occurrence of the character c*/
extern char *strchrnull(const char *s1, int c);
/* strchr(): returns a pointer to the first occurrence of the character c */
extern char *strrchr(const char *s1, int c);
#endif /* GINT_STD_STRING */

16
src/std/stdlib.c Normal file
View File

@ -0,0 +1,16 @@
#include <gint/defs/types.h>
#include <gint/defs/attributes.h>
GWEAK int atoi(const char *restrict s)
{
if (s == NULL)
return (0);
int nb = 0;
for (int i = 0; s[i] != '\0'; ++i) {
if (s[i] < '0' || s[i] > '9')
return (nb);
nb = (nb * 10) + (s[i] - '0');
}
return (nb);
}