matos/userspace/libc.h

43 lines
1.5 KiB
C
Raw Normal View History

2021-11-05 23:02:23 +01:00
#pragma once
#include "assert.h"
#include "stdarg.h"
#include "minmax.h"
#define islower(c) (('a' <= (c)) && ((c) <= 'z'))
#define isupper(c) (('A' <= (c)) && ((c) <= 'Z'))
#define isdigit(c) (('0' <= (c)) && ((c) <= '9'))
#define isspace(c) \
(((c) == ' ') || ((c) == '\t') || ((c) == '\f') || ((c) == '\n') || ((c) == '\r') || \
((c) == '\v'))
#define isprint(c) ((' ' <= (c)) && ((c) <= '~'))
int memcmp(const void *s1, const void *s2, size_t n);
void *memcpy(void *dest, const void *src, size_t n);
void *memset(void *s, int c, size_t n);
char *itoa(long long int value, char *str, int base);
void reverse(char s[]);
int strlen(const char s[]);
unsigned int strnlen(const char *s, size_t count);
int strcmp(const char s1[], const char s2[]);
char *strzcpy(char *dst, const char *src, int len);
int puts(const char *str);
int putc(const int c);
int vsnprintf(char *str, size_t size, const char *format, va_list ap);
int vprintf(const char *format, va_list ap);
int printf(const char *format, ...);
// Could be used after malloc is available
int asprintf(char **strp, const char *fmt, ...);
int vasprintf(char **strp, const char *fmt, va_list ap);
int syscall3(int id, unsigned int arg1, unsigned int arg2, unsigned int arg3);
int syscall2(int id, unsigned int arg1, unsigned int arg2);
int syscall1(int id, unsigned int arg1);
int syscall0(int id);
void _exit(int status);
void yolo();
2021-11-06 00:13:40 +01:00
char readc();
char readcBlock();
int readline(char *buf, int size);