diff options
Diffstat (limited to 'Source/Library/Userland/App')
-rw-r--r-- | Source/Library/Userland/App/ShellApp.proto.cpp | 5 | ||||
-rw-r--r-- | Source/Library/Userland/App/StreamApp.proto.cpp | 5 |
2 files changed, 6 insertions, 4 deletions
diff --git a/Source/Library/Userland/App/ShellApp.proto.cpp b/Source/Library/Userland/App/ShellApp.proto.cpp index 840e985..123eb73 100644 --- a/Source/Library/Userland/App/ShellApp.proto.cpp +++ b/Source/Library/Userland/App/ShellApp.proto.cpp @@ -16,7 +16,8 @@ ShellApp::~ShellApp() { void ShellApp::init() { //Parse flags u32int argc = pr.argc(); - for (u32int i = 0; i < argc; i++) { + args.clear(); + for (u32int i = 1; i < argc; i++) { String arg = pr.argv(i); if (arg.empty()) continue; if (arg == "-") { @@ -89,7 +90,7 @@ void ShellApp::init() { //Eventually show help screen if (bFlag("help")) { outvt << appName << ": " << appDesc << "\n"; - outvt << "Usage: \t" << appName << " <flags> [-] <arguments>\n\n"; + outvt << "Usage: \t" << pr.argv(0) << " <flags> [-] <arguments>\n\n"; outvt << "Possible flags :\n"; for (u32int i = 0; i < flags.size(); i++) { outvt << " --" << flags[i].lName << "\t" << (flags[i].sName != 0 ? "-" : "") << String(flags[i].sName) << "\t"; diff --git a/Source/Library/Userland/App/StreamApp.proto.cpp b/Source/Library/Userland/App/StreamApp.proto.cpp index 97f473e..b1dc7dd 100644 --- a/Source/Library/Userland/App/StreamApp.proto.cpp +++ b/Source/Library/Userland/App/StreamApp.proto.cpp @@ -6,6 +6,7 @@ StreamApp::StreamApp(const String& name, const String& desc) : ShellApp(name, desc) { addFlag("o", "output", "Set the output to a file instead of the text output", FT_STR, ""); addFlag("e", "encoding", "Set the encoding for files (input and output)", FT_STR, "utf8"); + addFlag("a", "append", "When writing to a file, append instead of truncating", FT_BOOL, ""); } StreamApp::~StreamApp() { @@ -13,7 +14,7 @@ StreamApp::~StreamApp() { void StreamApp::init() { ShellApp::init(); - + u8int encoding = UE_UTF8; if (sFlag("encoding") == "utf8") encoding = UE_UTF8; if (sFlag("encoding") == "utf16be") encoding = UE_UTF16_BE; @@ -24,7 +25,7 @@ void StreamApp::init() { if (sFlag("output") == "") { out = &outvt; } else { - out = new FileOStream(sFlag("output"), FM_TRUNCATE, encoding, FS::cwdNode()); + out = new FileOStream(sFlag("output"), (bFlag("append") ? FM_APPEND : FM_TRUNCATE), encoding, FS::cwdNode()); } if (args.size() == 0) { |