1
0
mirror of https://github.com/gryf/wmaker.git synced 2025-12-19 04:20:27 +01:00

Change to the linux kernel coding style

for arq in `git ls-files *.c`; do
    echo $arq;
    indent -linux -l115 $arq;
    done

The different line break at 115 columns is because
I use a widescreen monitor :-)
This commit is contained in:
Carlos R. Mafra
2009-08-20 00:59:40 +02:00
parent 59fc927dc9
commit 688a56e8ab
209 changed files with 87034 additions and 98138 deletions

View File

@@ -22,7 +22,6 @@
#define PROG_VERSION "seticons (Window Maker) 0.1"
#include <stdlib.h>
#include <stdio.h>
#include <string.h>
@@ -32,122 +31,111 @@
char *ProgName;
char*
defaultsPathForDomain(char *domain)
char *defaultsPathForDomain(char *domain)
{
static char path[1024];
char *gspath;
static char path[1024];
char *gspath;
gspath = getenv("GNUSTEP_USER_ROOT");
if (gspath) {
strcpy(path, gspath);
strcat(path, "/");
} else {
char *home;
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);
}
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);
strcpy(path, home);
strcat(path, "/GNUstep/");
}
strcat(path, DEFAULTS_DIR);
strcat(path, "/");
strcat(path, domain);
return path;
return path;
}
void
print_help()
void print_help()
{
printf("Usage: %s [OPTIONS] FILE\n", ProgName);
puts("Reads icon configuration from FILE and updates Window Maker.");
puts("");
puts(" --help display this help and exit");
puts(" --version output version information and exit");
printf("Usage: %s [OPTIONS] FILE\n", ProgName);
puts("Reads icon configuration from FILE and updates Window Maker.");
puts("");
puts(" --help display this help and exit");
puts(" --version output version information and exit");
}
int
main(int argc, char **argv)
int main(int argc, char **argv)
{
WMPropList *window_name, *icon_key, *window_attrs, *icon_value;
WMPropList *all_windows, *iconset, *keylist;
int i;
char *path = NULL;
WMPropList *window_name, *icon_key, *window_attrs, *icon_value;
WMPropList *all_windows, *iconset, *keylist;
int i;
char *path = NULL;
ProgName = argv[0];
ProgName = argv[0];
if (argc < 2) {
printf("%s: missing argument\n", ProgName);
printf("Try '%s --help' for more information\n", ProgName);
}
if (argc < 2) {
printf("%s: missing argument\n", ProgName);
printf("Try '%s --help' for more information\n", ProgName);
}
for (i = 1; i < argc; i++) {
if (strcmp(argv[i], "-h") == 0 || strcmp(argv[i], "--help") == 0) {
print_help();
exit(0);
} else if (strcmp(argv[i], "--version") == 0) {
puts(PROG_VERSION);
exit(0);
} else {
if (path) {
printf("%s: invalid argument '%s'\n", ProgName, argv[i]);
printf("Try '%s --help' for more information\n", ProgName);
exit(1);
}
path = argv[i];
}
}
for (i = 1; i < argc; i++) {
if (strcmp(argv[i], "-h")==0
|| strcmp(argv[i], "--help")==0) {
print_help();
exit(0);
} else if (strcmp(argv[i], "--version")==0) {
puts(PROG_VERSION);
exit(0);
} else {
if (path) {
printf("%s: invalid argument '%s'\n", ProgName, argv[i]);
printf("Try '%s --help' for more information\n", ProgName);
exit(1);
}
path = argv[i];
}
}
path = defaultsPathForDomain("WMWindowAttributes");
path = defaultsPathForDomain("WMWindowAttributes");
all_windows = WMReadPropListFromFile(path);
if (!all_windows) {
printf("%s:could not load WindowMaker configuration file \"%s\".\n", ProgName, path);
exit(1);
}
all_windows = WMReadPropListFromFile(path);
if (!all_windows) {
printf("%s:could not load WindowMaker configuration file \"%s\".\n",
ProgName, path);
exit(1);
}
iconset = WMReadPropListFromFile(argv[1]);
if (!iconset) {
printf("%s:could not load icon set file \"%s\".\n", ProgName, argv[1]);
exit(1);
}
iconset = WMReadPropListFromFile(argv[1]);
if (!iconset) {
printf("%s:could not load icon set file \"%s\".\n", ProgName, argv[1]);
exit(1);
}
keylist = WMGetPLDictionaryKeys(iconset);
icon_key = WMCreatePLString("Icon");
for (i = 0; i < WMGetPropListItemCount(keylist); i++) {
window_name = WMGetFromPLArray(keylist, i);
if (!WMIsPLString(window_name))
continue;
keylist = WMGetPLDictionaryKeys(iconset);
icon_key = WMCreatePLString("Icon");
icon_value = WMGetFromPLDictionary(iconset, window_name);
if (!icon_value || !WMIsPLDictionary(icon_value))
continue;
for (i=0; i<WMGetPropListItemCount(keylist); i++) {
window_name = WMGetFromPLArray(keylist, i);
if (!WMIsPLString(window_name))
continue;
window_attrs = WMGetFromPLDictionary(all_windows, window_name);
if (window_attrs) {
if (WMIsPLDictionary(window_attrs)) {
WMMergePLDictionaries(window_attrs, icon_value, True);
}
} else {
WMPutInPLDictionary(all_windows, window_name, icon_value);
}
}
icon_value = WMGetFromPLDictionary(iconset, window_name);
if (!icon_value || !WMIsPLDictionary(icon_value))
continue;
WMWritePropListToFile(all_windows, path, True);
window_attrs = WMGetFromPLDictionary(all_windows, window_name);
if (window_attrs) {
if (WMIsPLDictionary(window_attrs)) {
WMMergePLDictionaries(window_attrs, icon_value, True);
}
} else {
WMPutInPLDictionary(all_windows, window_name, icon_value);
}
}
WMWritePropListToFile(all_windows, path, True);
exit(0);
exit(0);
}