summaryrefslogtreecommitdiffstats
path: root/tdesu
diff options
context:
space:
mode:
authorSlávek Banko <slavek.banko@axis.cz>2013-09-27 01:58:51 +0200
committerSlávek Banko <slavek.banko@axis.cz>2013-09-27 01:58:51 +0200
commit21cc8cea315af252bef40227c36e9492d6702cb7 (patch)
tree4b5a72814a396765a497f8f6385cf2b0eccc489f /tdesu
parent7bf342b15f593dd216403862fbb2f6da34ee2285 (diff)
downloadtdebase-21cc8cea315af252bef40227c36e9492d6702cb7.tar.gz
tdebase-21cc8cea315af252bef40227c36e9492d6702cb7.zip
Fix run tdesu with empty command
This relates to Bug 1494
Diffstat (limited to 'tdesu')
-rw-r--r--tdesu/tdesu/tdesu.cpp39
1 files changed, 15 insertions, 24 deletions
diff --git a/tdesu/tdesu/tdesu.cpp b/tdesu/tdesu/tdesu.cpp
index ede3b4df..eb1cbdcf 100644
--- a/tdesu/tdesu/tdesu.cpp
+++ b/tdesu/tdesu/tdesu.cpp
@@ -158,7 +158,7 @@ static int startApp()
TQString icon;
if ( args->isSet("i"))
- icon = args->getOption("i");
+ icon = args->getOption("i");
bool prompt = true;
if ( args->isSet("d"))
@@ -218,33 +218,24 @@ static int startApp()
}
// Get command
- if (args->isSet("c"))
- {
+ if (args->isSet("c")) {
command = args->getOption("c");
- for (int i=0; i<args->count(); i++)
- {
- TQString arg = TQFile::decodeName(args->arg(i));
- KRun::shellQuote(arg);
- command += " ";
- command += TQFile::encodeName(arg);
- }
}
- else
- {
- if( args->count() == 0 )
- {
- TDECmdLineArgs::usage(i18n("No command specified."));
- exit(1);
- }
- command = args->arg(0);
- for (int i=1; i<args->count(); i++)
- {
- TQString arg = TQFile::decodeName(args->arg(i));
- KRun::shellQuote(arg);
- command += " ";
- command += TQFile::encodeName(arg);
+ else {
+ if( args->count() ) {
+ command = args->arg(0);
}
}
+ if (command.stripWhiteSpace().isEmpty()) {
+ TDECmdLineArgs::usage(i18n("No command specified."));
+ exit(1);
+ }
+ for (int i= args->isSet("c") ? 0 : 1; i<args->count(); i++) {
+ TQString arg = TQFile::decodeName(args->arg(i));
+ KRun::shellQuote(arg);
+ command += " ";
+ command += TQFile::encodeName(arg);
+ }
// Don't change uid if we're don't need to.
if (!change_uid)