diff options
author | Christopher Faylor <me@cgf.cx> | 2002-08-13 15:37:32 +0000 |
---|---|---|
committer | Christopher Faylor <me@cgf.cx> | 2002-08-13 15:37:32 +0000 |
commit | 403985a49836754cca1ecc3de526f983c71a2dc0 (patch) | |
tree | 38dad5ab6d08b484f9dc44342f2fccb2f717cc38 | |
parent | 9b6947db55dce8345816d74e0f0204e0736cf47f (diff) | |
download | cygnal-403985a49836754cca1ecc3de526f983c71a2dc0.tar.gz cygnal-403985a49836754cca1ecc3de526f983c71a2dc0.tar.bz2 cygnal-403985a49836754cca1ecc3de526f983c71a2dc0.zip |
* regtool.cc (find_key): Add support for custom key separator.
(usage): Document it.
-rw-r--r-- | winsup/utils/ChangeLog | 5 | ||||
-rw-r--r-- | winsup/utils/regtool.cc | 17 |
2 files changed, 19 insertions, 3 deletions
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 <pechtcha@cs.nyu.edu> + + * regtool.cc (find_key): Add support for custom key separator. + (usage): Document it. + 2002-08-02 Corinna Vinschen <corinna@vinschen.de> * 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 <getopt.h> #include <windows.h> +#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<c>, --key-separator[=]<c> set key separator to <c> 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 (); } |