Mailinglist Archive: yast-commit (723 mails)

< Previous Next >
[yast-commit] r47262 - in /trunk/core: VERSION liby2/src/genericfrontend.cc package/yast2-core.changes
  • From: mvidner@xxxxxxxxxxxxxxxx
  • Date: Mon, 05 May 2008 11:09:14 -0000
  • Message-id: <20080505110914.A34E426F13@xxxxxxxxxxxxxxxx>
Author: mvidner
Date: Mon May 5 13:09:13 2008
New Revision: 47262

URL: http://svn.opensuse.org/viewcvs/yast?rev=47262&view=rev
Log:
Allow literal strings as arguments (bnc#382883):
Before: y2base foo '("\\t")' '("\"")' UI
Now also: y2base foo -S '(\t)' '(")' UI

Modified:
trunk/core/VERSION
trunk/core/liby2/src/genericfrontend.cc
trunk/core/package/yast2-core.changes

Modified: trunk/core/VERSION
URL:
http://svn.opensuse.org/viewcvs/yast/trunk/core/VERSION?rev=47262&r1=47261&r2=47262&view=diff
==============================================================================
--- trunk/core/VERSION (original)
+++ trunk/core/VERSION Mon May 5 13:09:13 2008
@@ -1 +1 @@
-2.16.48
+2.16.49

Modified: trunk/core/liby2/src/genericfrontend.cc
URL:
http://svn.opensuse.org/viewcvs/yast/trunk/core/liby2/src/genericfrontend.cc?rev=47262&r1=47261&r2=47262&view=diff
==============================================================================
--- trunk/core/liby2/src/genericfrontend.cc (original)
+++ trunk/core/liby2/src/genericfrontend.cc Mon May 5 13:09:13 2008
@@ -55,7 +55,7 @@
static void print_usage ();
static void print_help ();
static void print_error (const char*, ...) __attribute__ ((format (printf, 1,
2)));
-static bool is_ycp_value (const char* arg);
+static bool has_parens (const char* arg);
string demangle( const char * mangled );

static
@@ -258,6 +258,8 @@
void
parse_client_and_options (int argc, char ** argv, int& arg, char *&
client_name, YCPList& arglist)
{
+ bool args_are_ycp = true;
+
if (!argv[arg]) {
print_usage ();
exit (1);
@@ -279,6 +281,10 @@
// Logfile already done at program start --> ignore here
arg++; // skip filename
}
+ else if (!strcmp(argv[arg], "-S"))
+ {
+ args_are_ycp = false;
+ }
else if (!strcmp(argv[arg], "-s")) // Parse one value (YCPList of
options) from stdin
{
Parser parser (0, "<stdin>"); // set parser to stdin
@@ -346,8 +352,10 @@
exit(5);
}
}
- else if (is_ycp_value (argv[arg])) // option is a YCP value ->
parse it directly
+ else if (has_parens (argv[arg])) // client args
{
+ if (args_are_ycp) // bnc#382883
+ {
Parser parser (argv[arg]); // set parser to option

YCodePtr pc = parser.parse ();
@@ -359,6 +367,12 @@
}

arglist->add( pc->evaluate (true)); // add to arglist
+ }
+ else
+ {
+ string value(argv[arg] + 1, strlen (argv[arg]) - 2);
+ arglist->add (YCPString (value));
+ }
}
else break; // must be server name

@@ -436,7 +450,7 @@
exit(5);
}
}
- else if (is_ycp_value (argv[arg])) // option is a YCP value ->
parse it directly
+ else if (has_parens (argv[arg])) // option is a YCP value ->
parse it directly
{
Parser parser (argv[arg]); // set parser to option

@@ -740,7 +754,9 @@
"ClientOptions are:\n"
" -s : Get options as one YCPList from
stdin\n"
" -f FileName : Get YCPValue(s) from file\n"
- " '(any YCPValue)' : Parameter _IS_ a YCPValue\n"
+ " -S : Parameters are strings, not YCP
to be parsed\n"
+ " '(any YCPValue)...' : Parameter _IS_ a YCPValue\n"
+ " -S '(t1)' '(\\t2)' is equivalent
to '(\"t1\")' '(\"\\\\t2\")'\n"
"Generic ServerOptions are:\n"
" -p FileName : Evaluate YCPValue(s) from file
(preload)\n"
" '(any YCPValue)' : Parameter _IS_ a YCPValue to be
evaluated\n"
@@ -773,7 +789,7 @@


static bool
-is_ycp_value (const char* arg)
+has_parens (const char* arg)
{
return arg[0] == '(' && arg[strlen (arg) - 1] == ')';
}

Modified: trunk/core/package/yast2-core.changes
URL:
http://svn.opensuse.org/viewcvs/yast/trunk/core/package/yast2-core.changes?rev=47262&r1=47261&r2=47262&view=diff
==============================================================================
--- trunk/core/package/yast2-core.changes (original)
+++ trunk/core/package/yast2-core.changes Mon May 5 13:09:13 2008
@@ -1,4 +1,12 @@
-------------------------------------------------------------------
+Mon May 5 13:08:05 CEST 2008 - mvidner@xxxxxxx
+
+- Allow literal strings as arguments (bnc#382883):
+ Before: y2base foo '("\\t")' '("\"")' UI
+ Now also: y2base foo -S '(\t)' '(")' UI
+- 2.16.49
+
+-------------------------------------------------------------------
Mon Apr 14 20:47:27 CEST 2008 - mvidner@xxxxxxx

- If Y2DEBUGONCRASH is set, the crash handler will also print the

--
To unsubscribe, e-mail: yast-commit+unsubscribe@xxxxxxxxxxxx
For additional commands, e-mail: yast-commit+help@xxxxxxxxxxxx

< Previous Next >
This Thread
  • No further messages