mirror of
https://github.com/gryf/wmaker.git
synced 2026-02-24 03:05:48 +01:00
Idle fixes
- add new wglobaldefaultspathfordomain() to wings (replaces several hand-rolled individual implementations in utils/) - make all of 'em handle -h|--help, -v|--version - try making them not to nothing silently - change various ways of knowing thyselves to using __progname - generally try to make them feel similar (NOT right, similar -- right is a completely different matter)
This commit is contained in:
committed by
Carlos R. Mafra
parent
9dadfe7a68
commit
118a93808a
@@ -44,23 +44,23 @@ char *FontOptions[] = {
|
||||
NULL
|
||||
};
|
||||
|
||||
char *ProgName;
|
||||
extern char *__progname;
|
||||
|
||||
extern char *convertFont(char *font, Bool keepXLFD);
|
||||
|
||||
void print_help()
|
||||
{
|
||||
printf("\nUsage: %s <style_file>\n\n", ProgName);
|
||||
printf("\nUsage: %s <style_file>\n\n", __progname);
|
||||
puts("Converts fonts in a style file into fontconfig format");
|
||||
puts("");
|
||||
puts(" --help display this help and exit");
|
||||
puts(" --version output version information and exit");
|
||||
puts(" --keep-xlfd preserve the original xlfd by appending a ':xlfd=<xlfd>' hint");
|
||||
puts(" to the font name. This property is not used by the fontconfig");
|
||||
puts(" matching engine to find the font, but it is useful as a hint");
|
||||
puts(" about what the original font was to allow hand tuning the");
|
||||
puts(" result or restoring the xlfd. The default is to not add it");
|
||||
puts(" as it results in long, unreadable and confusing names.");
|
||||
puts(" -h, --help display this help and exit");
|
||||
puts(" -v, --version output version information and exit");
|
||||
puts(" --keep-xlfd preserve the original xlfd by appending a ':xlfd=<xlfd>' hint");
|
||||
puts(" to the font name. This property is not used by the fontconfig");
|
||||
puts(" matching engine to find the font, but it is useful as a hint");
|
||||
puts(" about what the original font was to allow hand tuning the");
|
||||
puts(" result or restoring the xlfd. The default is to not add it");
|
||||
puts(" as it results in long, unreadable and confusing names.");
|
||||
puts("");
|
||||
}
|
||||
|
||||
@@ -72,25 +72,23 @@ int main(int argc, char **argv)
|
||||
Bool keepXLFD = False;
|
||||
int i;
|
||||
|
||||
ProgName = argv[0];
|
||||
|
||||
if (argc < 2) {
|
||||
print_help();
|
||||
exit(0);
|
||||
}
|
||||
|
||||
for (i = 1; i < argc; i++) {
|
||||
if (strcmp("--version", argv[i]) == 0) {
|
||||
if (strcmp("-v", argv[i]) == 0 || strcmp("--version", argv[i]) == 0) {
|
||||
puts(PROG_VERSION);
|
||||
exit(0);
|
||||
} else if (strcmp("--help", argv[i]) == 0) {
|
||||
} else if (strcmp("-h", argv[i]) == 0 || strcmp("--help", argv[i]) == 0) {
|
||||
print_help();
|
||||
exit(0);
|
||||
} else if (strcmp("--keep-xlfd", argv[i]) == 0) {
|
||||
keepXLFD = True;;
|
||||
} else if (argv[i][0] == '-') {
|
||||
printf("%s: invalid argument '%s'\n", ProgName, argv[i]);
|
||||
printf("Try '%s --help' for more information\n", ProgName);
|
||||
printf("%s: invalid argument '%s'\n", __progname, argv[i]);
|
||||
printf("Try '%s --help' for more information\n", __progname);
|
||||
exit(1);
|
||||
} else {
|
||||
file = argv[i];
|
||||
@@ -110,12 +108,12 @@ int main(int argc, char **argv)
|
||||
style = WMReadPropListFromFile(file);
|
||||
if (!style) {
|
||||
perror(file);
|
||||
printf("%s: could not load style file.\n", ProgName);
|
||||
printf("%s: could not load style file.\n", __progname);
|
||||
exit(1);
|
||||
}
|
||||
|
||||
if (!WMIsPLDictionary(style)) {
|
||||
printf("%s: '%s' is not a well formatted style file\n", ProgName, file);
|
||||
printf("%s: '%s' is not a well formatted style file\n", __progname, file);
|
||||
exit(1);
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user