diff options
author | Alexis211 <alexis211@gmail.com> | 2009-12-19 12:52:26 +0100 |
---|---|---|
committer | Alexis211 <alexis211@gmail.com> | 2009-12-19 12:52:26 +0100 |
commit | b079ac88df4c2580310e44fda6a2a4ac5f0f840f (patch) | |
tree | 67d4ed5d2cbe1e0be1414a7eae4b7555acefd169 /Source/Applications/PaperWork | |
parent | b2e3fc19bdad4c4d5c650e9ca759883db54b2e41 (diff) | |
parent | 6dc28352073c473a35a9d51796b02361c6c6486c (diff) | |
download | Melon-b079ac88df4c2580310e44fda6a2a4ac5f0f840f.tar.gz Melon-b079ac88df4c2580310e44fda6a2a4ac5f0f840f.zip |
Merge branch 'framework'
Diffstat (limited to 'Source/Applications/PaperWork')
-rw-r--r-- | Source/Applications/PaperWork/Makefile | 2 | ||||
-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); |