Screenshot command line arguments :

* make Screenshot exit gracefully if no argument is given in combination of -d parameter
* honor the delay parameter when also used with the --silent parameter



git-svn-id: file:///srv/svn/repos/haiku/haiku/trunk@32431 a95241bf-73f2-0310-859d-f6bbb57e9c96
This commit is contained in:
Philippe Saint-Pierre 2009-08-16 00:51:05 +00:00
parent 085f6827a9
commit fcafc3a5bb
2 changed files with 10 additions and 2 deletions

View File

@ -91,11 +91,17 @@ Screenshot::ArgvReceived(int32 argc, char** argv)
else if (strcmp(argv[i], "-d") == 0
|| strncmp(argv[i], "--delay", 7) == 0
|| strncmp(argv[i], "--delay=", 8) == 0) {
int32 seconds = atoi(argv[i + 1]);
if (seconds > 0) {
int32 seconds = -1;
if (argc > i + 1)
seconds = atoi(argv[i + 1]);
if (seconds >= 0) {
delay = seconds * 1000000;
i++;
}
else {
printf("Screenshot: option requires an argument -- %s\n", argv[i]);
exit(0);
}
}
}
fArgvReceived = true;

View File

@ -638,6 +638,8 @@ ScreenshotWindow::_TakeScreenshot()
{
if (fDelayControl)
snooze((atoi(fDelayControl->Text()) * 1000000) + 50000);
else if (fDelay > 0)
snooze(fDelay);
BRect frame;
delete fScreenshot;