2 Unix SMB/CIFS implementation.
3 simple registry frontend
5 Copyright (C) Jelmer Vernooij 2004
7 This program is free software; you can redistribute it and/or modify
8 it under the terms of the GNU General Public License as published by
9 the Free Software Foundation; either version 2 of the License, or
10 (at your option) any later version.
12 This program is distributed in the hope that it will be useful,
13 but WITHOUT ANY WARRANTY; without even the implied warranty of
14 MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
15 GNU General Public License for more details.
17 You should have received a copy of the GNU General Public License
18 along with this program; if not, write to the Free Software
19 Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
24 void print_tree(int l, REG_KEY *p, int fullpath, int novals)
26 int num_subkeys, i, num_values;
28 for(i = 0; i < l; i++) putchar(' ');
29 if(fullpath) printf("%s\n", reg_key_get_path(p));
30 else printf("%s\n", reg_key_name(p));
32 num_subkeys = reg_key_num_subkeys(p);
33 for(i = 0; i < num_subkeys; i++) {
34 REG_KEY *subkey = reg_key_get_subkey_by_index(p, i);
35 print_tree(l+1, subkey, fullpath, novals);
40 num_values = reg_key_num_values(p);
41 for(i = 0; i < num_values; i++) {
44 REG_VAL *value = reg_key_get_value_by_index(p, i);
45 for(j = 0; j < l+1; j++) putchar(' ');
46 desc = reg_val_description(value);
54 int main (int argc, char **argv)
56 uint32 setparms, checkparms;
58 char *backend = "dir";
62 int fullpath = 0, no_values = 0;
63 struct poptOption long_options[] = {
65 {"backend", 'b', POPT_ARG_STRING, &backend, 0, "backend to use", NULL},
66 {"fullpath", 'f', POPT_ARG_NONE, &fullpath, 0, "show full paths", NULL},
67 {"no-values", 'V', POPT_ARG_NONE, &no_values, 0, "don't show values", NULL},
71 pc = poptGetContext(argv[0], argc, (const char **) argv, long_options,0);
73 while((opt = poptGetNextOpt(pc)) != -1) {
76 setup_logging("regtree", True);
78 h = reg_open(backend, poptPeekArg(pc), True);
80 fprintf(stderr, "Unable to open '%s' with backend '%s'\n", poptGetArg(pc), backend);
85 root = reg_get_root(h);
88 print_tree(0, root, fullpath, no_values);