From 403985a49836754cca1ecc3de526f983c71a2dc0 Mon Sep 17 00:00:00 2001 From: Christopher Faylor Date: Tue, 13 Aug 2002 15:37:32 +0000 Subject: * regtool.cc (find_key): Add support for custom key separator. (usage): Document it. --- winsup/utils/ChangeLog | 5 +++++ winsup/utils/regtool.cc | 17 ++++++++++++++--- 2 files changed, 19 insertions(+), 3 deletions(-) (limited to 'winsup') diff --git a/winsup/utils/ChangeLog b/winsup/utils/ChangeLog index 0833bc389..04a4c3a24 100644 --- a/winsup/utils/ChangeLog +++ b/winsup/utils/ChangeLog @@ -1,3 +1,8 @@ +2002-08-07 Igor Pechtchanski + + * regtool.cc (find_key): Add support for custom key separator. + (usage): Document it. + 2002-08-02 Corinna Vinschen * mkgroup.c (main): Don't print an entry for "Everyone". diff --git a/winsup/utils/regtool.cc b/winsup/utils/regtool.cc index ffaab6a7b..49b1fa5a7 100644 --- a/winsup/utils/regtool.cc +++ b/winsup/utils/regtool.cc @@ -14,11 +14,15 @@ details. */ #include #include +#define DEFAULT_KEY_SEPARATOR '\\' + enum { KT_AUTO, KT_INT, KT_STRING, KT_EXPAND, KT_MULTI } key_type = KT_AUTO; +char key_sep = DEFAULT_KEY_SEPARATOR; + #define LIST_KEYS 0x01 #define LIST_VALS 0x02 #define LIST_ALL (LIST_KEYS | LIST_VALS) @@ -39,10 +43,11 @@ static struct option longopts[] = {"string", no_argument, NULL, 's'}, {"verbose", no_argument, NULL, 'v'}, {"version", no_argument, NULL, 'V'}, + {"key-separator", required_argument, NULL, 'K'}, {NULL, 0, NULL, 0} }; -static char opts[] = "ehiklmpqsvV"; +static char opts[] = "ehiklmpqsvVK::"; int listwhat = 0; int postfix = 0; @@ -83,6 +88,9 @@ usage (FILE *where = stderr) " -m, --multi-string set type to REG_MULTI_SZ\n" " -s, --string set type to REG_SZ\n" "\n" + "Options for 'set' and 'unset' Actions:\n" + " -K, --key-separator[=] set key separator to instead of '\\'\n" + "\n" "Other Options:\n" " -h, --help output usage information and exit\n" " -q, --quiet no error output, just nonzero return if KEY/VALUE missing\n" @@ -308,9 +316,9 @@ find_key (int howmanyparts, REGSAM access) e = n + strlen (n); if (howmanyparts > 1) { - while (n < e && *e != '\\') + while (n < e && *e != key_sep) e--; - if (*e != '\\') + if (*e != key_sep) { key = wkprefixes[i].key; value = n; @@ -661,6 +669,9 @@ main (int argc, char **_argv) case 'V': print_version (); exit (0); + case 'K': + key_sep = *optarg; + break; default : usage (); } -- cgit v1.2.3