BuildSystem: Cleanup userspace directory layout

userspace programs are now in userspace/programs
userspace tests are now in userspace/tests

This makes listing userspace projects much cleaner. Libraries were
already separated to their own directory, so other programs should also.
This commit is contained in:
2024-07-03 09:15:22 +03:00
parent 5dc441c4af
commit 8ddab05ed3
107 changed files with 78 additions and 67 deletions

View File

@@ -0,0 +1,8 @@
set(SOURCES
main.cpp
)
add_executable(echo ${SOURCES})
banan_link_library(echo libc)
install(TARGETS echo OPTIONAL)

View File

@@ -0,0 +1,40 @@
#include <stdio.h>
#include <stdlib.h>
void print_argument(const char* arg)
{
while (*arg)
{
if (*arg == '\\')
{
switch (*(++arg))
{
case 'a': fputc('\a', stdout); break;
case 'b': fputc('\b', stdout); break;
case 'c': exit(0);
case 'f': fputc('\f', stdout); break;
case 'n': fputc('\n', stdout); break;
case 'r': fputc('\r', stdout); break;
case 't': fputc('\t', stdout); break;
case 'v': fputc('\v', stdout); break;
case '\\': fputc('\\', stdout); break;
default: break;
}
}
else
fputc(*arg, stdout);
arg++;
}
}
int main(int argc, char** argv)
{
for (int i = 1; i < argc; i++)
{
print_argument(argv[i]);
if (i < argc - 1)
fputc(' ', stdout);
}
printf("\n");
return 0;
}