1 /* getstyle.c - outputs style related options from WindowMaker to stdout
3 * WindowMaker window manager
5 * Copyright (c) 1997, 1998 Alfredo K. Kojima
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., 59 Temple Place - Suite 330, Boston, MA 02111-1307,
29 #include "../src/wconfig.h"
31 /* table of style related options */
32 static char *options
[] = {
60 /* table of theme related options */
61 static char *theme_options
[] = {
75 printf("usage: %s [-options] [<style file>]\n", ProgName
);
77 puts(" -h print help");
78 puts(" -t get theme options too");
83 defaultsPathForDomain(char *domain
)
88 gspath
= getenv("GNUSTEP_USER_ROOT");
95 home
= getenv("HOME");
97 printf("%s:could not get HOME environment variable!\n", ProgName
);
101 strcat(path
, "/GNUstep/");
103 strcat(path
, DEFAULTS_DIR
);
105 strcat(path
, domain
);
107 tmp
= malloc(strlen(path
)+2);
115 main(int argc
, char **argv
)
117 proplist_t prop
, style
, key
, val
;
120 char *style_file
= NULL
;
126 for (i
=1; i
<argc
; i
++) {
127 if (strcmp(argv
[i
], "-t")==0) {
129 } else if (argv
[i
][0] != '-') {
130 style_file
= argv
[i
];
138 path
= defaultsPathForDomain("WindowMaker");
140 prop
= PLGetProplistWithPath(path
);
142 printf("%s:could not load WindowMaker configuration file \"%s\".\n",
147 style
= PLMakeDictionaryFromEntries(NULL
, NULL
, NULL
);
150 for (i
=0; options
[i
]!=NULL
; i
++) {
151 key
= PLMakeString(options
[i
]);
153 val
= PLGetDictionaryEntry(prop
, key
);
155 PLInsertDictionaryEntry(style
, key
, val
);
159 for (i
=0; theme_options
[i
]!=NULL
; i
++) {
160 key
= PLMakeString(theme_options
[i
]);
162 val
= PLGetDictionaryEntry(prop
, key
);
164 PLInsertDictionaryEntry(style
, key
, val
);
169 val
= PLMakeString(style_file
);
170 PLSetFilename(style
, val
);
173 puts(PLGetDescriptionIndent(style
, 0));