summaryrefslogtreecommitdiff
path: root/Source/Applications/PaperWork
diff options
context:
space:
mode:
Diffstat (limited to 'Source/Applications/PaperWork')
-rw-r--r--Source/Applications/PaperWork/Makefile2
-rw-r--r--Source/Applications/PaperWork/PaperWork.cpp (renamed from Source/Applications/PaperWork/main.cpp)31
2 files changed, 19 insertions, 14 deletions
diff --git a/Source/Applications/PaperWork/Makefile b/Source/Applications/PaperWork/Makefile
index fe8d564..d3203cf 100644
--- a/Source/Applications/PaperWork/Makefile
+++ b/Source/Applications/PaperWork/Makefile
@@ -6,7 +6,7 @@ CXXFLAGS = -nostartfiles -nostdlib -ffreestanding -fno-exceptions -fno-rtti -I .
LD = ld
LDFLAGS = -T ../../Library/Link.ld -L ../../Library
-Objects = main.o
+Objects = PaperWork.o
OutFile = PaperWork
all: $(OutFile)
diff --git a/Source/Applications/PaperWork/main.cpp b/Source/Applications/PaperWork/PaperWork.cpp
index 2fb40df..4f9cb0e 100644
--- a/Source/Applications/PaperWork/main.cpp
+++ b/Source/Applications/PaperWork/PaperWork.cpp
@@ -1,17 +1,22 @@
-#include <Binding/Process.class.h>
-#include <String.class.h>
+#include <App/ShellApp.proto.h>
#define DEFAULT_SHELL "/Applications/Shell/Shell.app"
-int main(Vector<String> args) {
- String act = "init";
- if (args.size() == 2) {
- if (args[1] == "login") {
- act = "login";
- } else if (args[1] == "init") {
- act = "init";
- }
+class PaperWork : public ShellApp {
+ public:
+ PaperWork() : ShellApp("PaperWork.app", "Melon's init/login manager") {
+ addFlag("s", "shell", "Define the default shell to launch", FT_STR, DEFAULT_SHELL);
+ addFlag("l", "login", "Act as a login manager");
+ addFlag("i", "init", "Act as a init manager", FT_BOOL, "on");
}
+ int run();
+};
+
+APP(PaperWork);
+
+int PaperWork::run() {
+ String act = "init";
+ if (bFlag("login")) act = "login";
if (act == "init") {
while (1) {
@@ -19,7 +24,7 @@ int main(Vector<String> args) {
if (p.valid()) {
p.setInVT(invt);
p.setOutVT(outvt);
- p.pushArg("login");
+ p.pushArg("--login");
p.start();
p.wait();
} else {
@@ -38,9 +43,9 @@ int main(Vector<String> args) {
outvt << "Authentication failed.\n\n";
continue;
}
- outvt << "What shell to run [" << DEFAULT_SHELL << "]? ";
+ outvt << "What shell to run [" << sFlag("shell") << "]? ";
String sh = invt.readLine();
- if (sh == "") sh = DEFAULT_SHELL;
+ if (sh == "") sh = sFlag("shell");
Process p = Process::run(sh);
if (p.valid()) {
p.setInVT(invt);