mirror of
https://github.com/gryf/wmaker.git
synced 2025-12-19 12:28:22 +01:00
103 lines
2.2 KiB
C
103 lines
2.2 KiB
C
/* setstyle.c - loads style related options to wmaker
|
|
*
|
|
* WindowMaker window manager
|
|
*
|
|
* Copyright (c) 1997, 1998 Alfredo K. Kojima
|
|
*
|
|
* This program is free software; you can redistribute it and/or modify
|
|
* it under the terms of the GNU General Public License as published by
|
|
* the Free Software Foundation; either version 2 of the License, or
|
|
* (at your option) any later version.
|
|
*
|
|
* This program is distributed in the hope that it will be useful,
|
|
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
|
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
|
* GNU General Public License for more details.
|
|
*
|
|
* You should have received a copy of the GNU General Public License
|
|
* along with this program; if not, write to the Free Software
|
|
* Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307,
|
|
* USA.
|
|
*/
|
|
|
|
|
|
#include <stdlib.h>
|
|
#include <stdio.h>
|
|
#include <proplist.h>
|
|
|
|
#include <string.h>
|
|
|
|
#include "../src/wconfig.h"
|
|
|
|
char *ProgName;
|
|
|
|
char*
|
|
defaultsPathForDomain(char *domain)
|
|
{
|
|
char path[1024];
|
|
char *gspath, *tmp;
|
|
|
|
gspath = getenv("GNUSTEP_USER_ROOT");
|
|
if (gspath) {
|
|
strcpy(path, gspath);
|
|
strcat(path, "/");
|
|
} else {
|
|
char *home;
|
|
|
|
home = getenv("HOME");
|
|
if (!home) {
|
|
printf("%s:could not get HOME environment variable!\n", ProgName);
|
|
exit(0);
|
|
}
|
|
|
|
strcpy(path, home);
|
|
strcat(path, "/GNUstep/");
|
|
}
|
|
strcat(path, DEFAULTS_DIR);
|
|
strcat(path, "/");
|
|
strcat(path, domain);
|
|
|
|
tmp = malloc(strlen(path)+2);
|
|
strcpy(tmp, path);
|
|
|
|
return tmp;
|
|
}
|
|
|
|
|
|
int
|
|
main(int argc, char **argv)
|
|
{
|
|
proplist_t prop, style;
|
|
char *path;
|
|
|
|
ProgName = argv[0];
|
|
|
|
if (argc!=2) {
|
|
printf("Syntax:\n%s <style file>\n", argv[0]);
|
|
exit(1);
|
|
}
|
|
|
|
path = defaultsPathForDomain("WindowMaker");
|
|
|
|
prop = PLGetProplistWithPath(path);
|
|
if (!prop) {
|
|
printf("%s:could not load WindowMaker configuration file \"%s\".\n",
|
|
ProgName, path);
|
|
exit(1);
|
|
}
|
|
|
|
style = PLGetProplistWithPath(argv[1]);
|
|
if (!style) {
|
|
printf("%s:could not load style file \"%s\".\n", ProgName, argv[1]);
|
|
exit(1);
|
|
}
|
|
|
|
PLMergeDictionaries(prop, style);
|
|
|
|
PLSave(prop, YES);
|
|
|
|
exit(0);
|
|
}
|
|
|
|
|