Kernel/userspace: Implement KD_LOADFONT and loadfont program
This commit is contained in:
@@ -11,6 +11,7 @@ set(USERSPACE_PROJECTS
|
||||
id
|
||||
image
|
||||
init
|
||||
loadfont
|
||||
loadkeys
|
||||
ls
|
||||
meminfo
|
||||
|
||||
@@ -101,6 +101,8 @@ struct str_list
|
||||
#define I_SWROPT 28
|
||||
#define I_UNLINK 29
|
||||
|
||||
#define KD_LOADFONT 30
|
||||
|
||||
#define FLUSHR 1
|
||||
#define FLUSHRW 2
|
||||
#define FLUSHW 3
|
||||
|
||||
9
userspace/loadfont/CMakeLists.txt
Normal file
9
userspace/loadfont/CMakeLists.txt
Normal file
@@ -0,0 +1,9 @@
|
||||
set(SOURCES
|
||||
main.cpp
|
||||
)
|
||||
|
||||
add_executable(loadfont ${SOURCES})
|
||||
banan_link_library(loadfont ban)
|
||||
banan_link_library(loadfont libc)
|
||||
|
||||
install(TARGETS loadfont)
|
||||
30
userspace/loadfont/main.cpp
Normal file
30
userspace/loadfont/main.cpp
Normal file
@@ -0,0 +1,30 @@
|
||||
#include <stdio.h>
|
||||
#include <stropts.h>
|
||||
#include <unistd.h>
|
||||
|
||||
int usage(int ret, const char* argv0)
|
||||
{
|
||||
FILE* fout = ret ? stderr : stdout;
|
||||
fprintf(fout, "usage: %s FILE\n", argv0);
|
||||
return ret;
|
||||
}
|
||||
|
||||
int main(int argc, char** argv)
|
||||
{
|
||||
if (argc != 2)
|
||||
return usage(1, argv[0]);
|
||||
|
||||
if (!isatty(STDOUT_FILENO))
|
||||
{
|
||||
fprintf(stderr, "stdout is not tty\n");
|
||||
return 1;
|
||||
}
|
||||
|
||||
if (ioctl(STDOUT_FILENO, KD_LOADFONT, argv[1]) == -1)
|
||||
{
|
||||
perror("ioctl");
|
||||
return 1;
|
||||
}
|
||||
|
||||
return 0;
|
||||
}
|
||||
Reference in New Issue
Block a user