62 lines
1.4 KiB
C
62 lines
1.4 KiB
C
// this code is licenced under Wrathmark licence
|
|
// © 2026 wullie wulliestudio.com
|
|
// please see attached licence for full usage and rights
|
|
#include "LocalHeader.h"
|
|
#include "stdWullie.h"
|
|
|
|
int main(int argc, char *argv[]){
|
|
|
|
if(argc != 2){
|
|
print.nl("to many or to few arguments were provided");
|
|
print.nl("the test functions for StdWullie use 1 - 7");
|
|
return 0;
|
|
}
|
|
|
|
long argNumb = convert.toInt(argv[1]);
|
|
|
|
switch(argNumb){
|
|
case 1:
|
|
print.text("look Ma no stdlib\n");
|
|
print.colour("NOW WITH COLOURS\n", RED);
|
|
print.background("and with backgrounds\n", BBLUE);
|
|
break;
|
|
|
|
case 2:
|
|
print.nl("test for safe exit, should close the program");
|
|
safeError(NULL);
|
|
break;
|
|
|
|
case 3:
|
|
print.nl("sleeps for 2 seconds: program will terminate like other test cases");
|
|
sleeper(2);
|
|
break;
|
|
|
|
case 4:
|
|
char string[] = "converts to upper then to lower\n";
|
|
convert.toUpper(string);
|
|
print.text(string);
|
|
convert.toLower(string);
|
|
print.text(string);
|
|
break;
|
|
|
|
default:
|
|
print.nl("args is out or range or is NAN please check avaible args with ./stdwullie");
|
|
break;
|
|
}
|
|
return 0;
|
|
}
|
|
|
|
// #I say softly to my self "FUCK your STDLIB"#
|
|
// hadles the entry point of code and calls main when registary is set
|
|
__attribute__((naked)) void _start(){
|
|
__asm__ __volatile(
|
|
"xor %ebp, %ebp\n"
|
|
"mov (%rsp), %rdi\n"
|
|
"lea 8(%rsp), %rsi\n"
|
|
"and $-16, %rsp\n"
|
|
"call main\n"
|
|
"mov %rax, %rdi\n"
|
|
"call exit\n"
|
|
);
|
|
}
|