Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Updated main.c with usage information displayed to stderr upon error and... #5

Open
wants to merge 2 commits into
base: master
Choose a base branch
from
Open
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
27 changes: 27 additions & 0 deletions main.c
Original file line number Diff line number Diff line change
Expand Up @@ -96,11 +96,38 @@ int main(int argc, const char *argv[]) {
}
}
}
} else if (strcmp(argv[1], "-help") == 0) {
// Send help information to stdout since it was requested
printf("\n screenresolution sets the screen resolution on Mac computers.\n\n");
printf(" screenresolution version %s\n", VERSION);
printf(" Licensed under GPLv2\n");
printf(" Copyright (C) 2011 John Ford <[email protected]>\n\n");
printf(" usage: screenresolution [get] - Show the resolution of all active displays\n");
printf(" screenresolution [list] - Show available resolutions of all active displays\n");
printf(" screenresolution [skip] [display1resolution] [display2resolution]\n");
printf(" - Sets display resolution and refresh rate\n");
printf(" screenresolution -version - Displays version information for screenresolution\n");
printf(" screenresolution -help - Displays this help information\n\n");
printf(" examples: screenresolution 800x600x32 - Sets main display to 800x600x32\n");
printf(" screenresolution 800x600x32 800x600x32 - Sets both displays to 800x600x32\n");
printf(" screenresolution skip 800x600x32 - Sets second display to 800x600x32\n\n");
} else if (strcmp(argv[1], "-version") == 0) {
printf("screenresolution version %s\nLicensed under GPLv2\n", VERSION);
keepgoing = 0;
} else {
NSLog(CFSTR("I'm sorry %s. I'm afraid I can't do that"), getlogin());
// Send help information to stderr
NSLog(CFSTR("%s"), " Error: unable to copy current display mode\n\n");
NSLog(CFSTR(" screenresolution version %s -- Licensed under GPLv2\n\n\n"), VERSION);
NSLog(CFSTR("%s"), " usage: screenresolution [get] - Show the resolution of all active displays");
NSLog(CFSTR("%s"), " screenresolution [list] - Show available resolutions of all active displays");
NSLog(CFSTR("%s"), " screenresolution [skip] [display1resolution] [display2resolution]");
NSLog(CFSTR("%s"), " - Sets display resolution and refresh rate");
NSLog(CFSTR("%s"), " screenresolution -version - Displays version information for screenresolution");
NSLog(CFSTR("%s"), " screenresolution -help - Displays this help information\n\n");
NSLog(CFSTR("%s"), " examples: screenresolution 800x600x32 - Sets main display to 800x600x32");
NSLog(CFSTR("%s"), " screenresolution 800x600x32 800x600x32 - Sets both displays to 800x600x32");
NSLog(CFSTR("%s"), " screenresolution skip 800x600x32 - Sets second display to 800x600x32\n\n");
exitcode++;
keepgoing = 0;
}
Expand Down