mirror of
https://github.com/gryf/wmaker.git
synced 2025-12-19 12:28:22 +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:
@@ -22,7 +22,6 @@
|
||||
|
||||
#define PROG_VERSION "geticonset (Window Maker) 0.1"
|
||||
|
||||
|
||||
#include <stdlib.h>
|
||||
#include <stdio.h>
|
||||
#include <string.h>
|
||||
@@ -31,110 +30,97 @@
|
||||
|
||||
#include "../src/wconfig.h"
|
||||
|
||||
|
||||
|
||||
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);
|
||||
}
|
||||
strcpy(path, home);
|
||||
strcat(path, "/GNUstep/");
|
||||
}
|
||||
strcat(path, DEFAULTS_DIR);
|
||||
strcat(path, "/");
|
||||
strcat(path, domain);
|
||||
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);
|
||||
|
||||
return path;
|
||||
return path;
|
||||
}
|
||||
|
||||
void
|
||||
print_help()
|
||||
void print_help()
|
||||
{
|
||||
printf("Usage: %s [OPTIONS] [FILE]\n", ProgName);
|
||||
puts("Retrieves program icon configuration and output to FILE or to stdout");
|
||||
puts("");
|
||||
puts(" --help display this help and exit");
|
||||
puts(" --version output version information and exit");
|
||||
printf("Usage: %s [OPTIONS] [FILE]\n", ProgName);
|
||||
puts("Retrieves program icon configuration and output to FILE or to stdout");
|
||||
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;
|
||||
char *path;
|
||||
int i;
|
||||
WMPropList *window_name, *icon_key, *window_attrs, *icon_value;
|
||||
WMPropList *all_windows, *iconset, *keylist;
|
||||
char *path;
|
||||
int i;
|
||||
|
||||
ProgName = argv[0];
|
||||
|
||||
ProgName = argv[0];
|
||||
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);
|
||||
}
|
||||
}
|
||||
|
||||
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);
|
||||
}
|
||||
}
|
||||
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 = WMCreatePLDictionary(NULL, NULL);
|
||||
|
||||
iconset = WMCreatePLDictionary(NULL, NULL);
|
||||
keylist = WMGetPLDictionaryKeys(all_windows);
|
||||
icon_key = WMCreatePLString("Icon");
|
||||
|
||||
keylist = WMGetPLDictionaryKeys(all_windows);
|
||||
icon_key = WMCreatePLString("Icon");
|
||||
for (i = 0; i < WMGetPropListItemCount(keylist); i++) {
|
||||
WMPropList *icondic;
|
||||
|
||||
for (i=0; i<WMGetPropListItemCount(keylist); i++) {
|
||||
WMPropList *icondic;
|
||||
window_name = WMGetFromPLArray(keylist, i);
|
||||
if (!WMIsPLString(window_name))
|
||||
continue;
|
||||
|
||||
window_name = WMGetFromPLArray(keylist, i);
|
||||
if (!WMIsPLString(window_name))
|
||||
continue;
|
||||
window_attrs = WMGetFromPLDictionary(all_windows, window_name);
|
||||
if (window_attrs && WMIsPLDictionary(window_attrs)) {
|
||||
icon_value = WMGetFromPLDictionary(window_attrs, icon_key);
|
||||
if (icon_value) {
|
||||
icondic = WMCreatePLDictionary(icon_key, icon_value, NULL);
|
||||
WMPutInPLDictionary(iconset, window_name, icondic);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
window_attrs = WMGetFromPLDictionary(all_windows, window_name);
|
||||
if (window_attrs && WMIsPLDictionary(window_attrs)) {
|
||||
icon_value = WMGetFromPLDictionary(window_attrs, icon_key);
|
||||
if (icon_value) {
|
||||
icondic = WMCreatePLDictionary(icon_key, icon_value, NULL);
|
||||
WMPutInPLDictionary(iconset, window_name, icondic);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
if (argc==2) {
|
||||
WMWritePropListToFile(iconset, argv[1], False);
|
||||
} else {
|
||||
puts(WMGetPropListDescription(iconset, True));
|
||||
}
|
||||
exit(0);
|
||||
if (argc == 2) {
|
||||
WMWritePropListToFile(iconset, argv[1], False);
|
||||
} else {
|
||||
puts(WMGetPropListDescription(iconset, True));
|
||||
}
|
||||
exit(0);
|
||||
}
|
||||
|
||||
|
||||
|
||||
Reference in New Issue
Block a user