1 /* wdwrite.c - write key/value to defaults database
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,
25 * WindowMaker defaults DB writer
29 #include "../src/wconfig.h"
45 char *home
= getenv("HOME");
51 user
= getpwuid(getuid());
72 printf("Syntax:\n%s <domain> <option> <value>\n", ProgName
);
77 int main(int argc
, char **argv
)
80 proplist_t dom
, key
, value
, dict
;
89 dom
= PLMakeString(argv
[1]);
90 key
= PLMakeString(argv
[2]);
91 value
= PLGetProplistWithDescription(argv
[3]);
93 printf("%s:syntax error in value \"%s\"", ProgName
, argv
[3]);
96 gsdir
= getenv("GNUSTEP_USER_ROOT");
100 strcpy(path
, gethomedir());
101 strcat(path
, "/GNUstep");
104 strcat(path
, DEFAULTS_DIR
);
106 strcat(path
, argv
[1]);
108 dict
= PLGetProplistWithPath(path
);
110 dict
= PLMakeDictionaryFromEntries(key
, value
, NULL
);
111 PLSetFilename(dict
, PLMakeString(path
));
113 PLRemoveDictionaryEntry(dict
, key
);
114 PLInsertDictionaryEntry(dict
, key
, value
);