code
This commit is contained in:
parent
665444d855
commit
917ba6b619
32
boot-lib.c
Normal file
32
boot-lib.c
Normal file
@ -0,0 +1,32 @@
|
||||
#include <stdio.h>
|
||||
#include <stdarg.h>
|
||||
|
||||
|
||||
int eprintf(const char format[], ...) {
|
||||
va_list args;
|
||||
va_start(args, format);
|
||||
int ret = vfprintf(stderr, format, args);
|
||||
va_end(args);
|
||||
return ret;
|
||||
}
|
||||
|
||||
void ungetchar(int ch) {
|
||||
ungetc(ch, stdin);
|
||||
}
|
||||
|
||||
int eof() {
|
||||
return feof(stdin);
|
||||
}
|
||||
|
||||
int CA_get(char array[], int index) {
|
||||
return array[index];
|
||||
}
|
||||
|
||||
void CA_set(char array[], int index, int value) {
|
||||
array[index] = value;
|
||||
}
|
||||
|
||||
// this may be unnecessary
|
||||
char* CA_offset(char array[], int offset) {
|
||||
return array + offset;
|
||||
}
|
18
boot-lib.h
Normal file
18
boot-lib.h
Normal file
@ -0,0 +1,18 @@
|
||||
#include <stdio.h>
|
||||
#include <stdlib.h>
|
||||
#include <string.h>
|
||||
|
||||
// std
|
||||
int printf(const char* format, ...);
|
||||
int getchar();
|
||||
int putchar(int ch);
|
||||
int strcmp(const char* s1, const char* s2);
|
||||
void exit(int status);
|
||||
|
||||
// ext
|
||||
void ungetchar(int ch);
|
||||
int eof();
|
||||
int CA_get(char array[], int index);
|
||||
void CA_set(char array[], int index, int value);
|
||||
char* CA_offset(char array[], int offset);
|
||||
int eprintf(const char* format, ...);
|
Loading…
Reference in New Issue
Block a user