Moved tutils
This commit is contained in:
parent
ad30290598
commit
0582f9189e
3
Makefile
3
Makefile
|
@ -6,7 +6,8 @@ EXE=bin/ped
|
|||
|
||||
all: install
|
||||
$(CC) src/tty.c -o tty.o -c
|
||||
$(CC) $(FLAGS) -o $(EXE) src/ped.c tty.o
|
||||
$(CC) src/utils.c -o utils.o -c
|
||||
$(CC) $(FLAGS) -o $(EXE) src/ped.c tty.o utils.o
|
||||
|
||||
test: clean all
|
||||
./bin/ped test
|
||||
|
|
12
src/ped.c
12
src/ped.c
|
@ -40,18 +40,6 @@ int main(int argc, char** args)
|
|||
return EXIT_SUCCESS;
|
||||
}
|
||||
|
||||
void output(char* string, unsigned int length)
|
||||
{
|
||||
write(0, string, length);
|
||||
}
|
||||
|
||||
char getChar()
|
||||
{
|
||||
char character;
|
||||
int b = read(0, &character, 1);
|
||||
return character;
|
||||
}
|
||||
|
||||
void redraw(struct Session* session)
|
||||
{
|
||||
/* Move cursor back home */
|
||||
|
|
|
@ -0,0 +1,30 @@
|
|||
#include<string.h>
|
||||
#include<unistd.h>
|
||||
|
||||
/**
|
||||
* Writes a null-terminated string to the tty
|
||||
*/
|
||||
void writeStr(char* ntString)
|
||||
{
|
||||
write(0, ntString, strlen(ntString));
|
||||
}
|
||||
|
||||
/**
|
||||
* Writes bytes from buffer `string` of length
|
||||
* `length` to the tty
|
||||
*/
|
||||
void output(char* string, unsigned int length)
|
||||
{
|
||||
write(0, string, length);
|
||||
}
|
||||
|
||||
/**
|
||||
* Reads and returns the single byte
|
||||
* read from the tty.
|
||||
*/
|
||||
char getChar()
|
||||
{
|
||||
char character;
|
||||
int b = read(0, &character, 1);
|
||||
return character;
|
||||
}
|
Loading…
Reference in New Issue