Skip to content
Merged
Show file tree
Hide file tree
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
8 changes: 7 additions & 1 deletion src/xsct.c
Original file line number Diff line number Diff line change
Expand Up @@ -189,6 +189,7 @@ int main(int argc, char **argv)
struct temp_status temp;
int fdebug = 0, fdelta = 0, fhelp = 0, toggle = 0;
Display *dpy = XOpenDisplay(NULL);
int failed = 0;

if (!dpy)
{
Expand Down Expand Up @@ -217,6 +218,7 @@ int main(int argc, char **argv)
screen_specified = atoi(argv[i]);
} else {
fprintf(stderr, "ERROR! Required value for screen not specified!\n");
failed = 1;
fhelp = 1;
}
}
Expand All @@ -228,6 +230,7 @@ int main(int argc, char **argv)
crtc_specified = atoi(argv[i]);
} else {
fprintf(stderr, "ERROR! Required value for crtc not specified!\n");
failed = 1;
fhelp = 1;
}
}
Expand All @@ -236,6 +239,7 @@ int main(int argc, char **argv)
else
{
fprintf(stderr, "ERROR! Unknown parameter: %s\n!", argv[i]);
failed = 1;
fhelp = 1;
}
}
Expand All @@ -247,6 +251,7 @@ int main(int argc, char **argv)
else if (screen_specified >= screens)
{
fprintf(stderr, "ERROR! Invalid screen index: %d!\n", screen_specified);
failed = 1;
}
else
{
Expand Down Expand Up @@ -307,6 +312,7 @@ int main(int argc, char **argv)
if (temp.temp == DELTA_MIN || temp.brightness == DELTA_MIN)
{
fprintf(stderr, "ERROR! Temperature and brightness delta must both be specified!\n");
failed = 1;
}
else
{
Expand All @@ -328,6 +334,6 @@ int main(int argc, char **argv)

XCloseDisplay(dpy);

return EXIT_SUCCESS;
return failed ? EXIT_FAILURE : EXIT_SUCCESS;
}

3 changes: 3 additions & 0 deletions xsct.1
Original file line number Diff line number Diff line change
Expand Up @@ -41,6 +41,9 @@ If no arguments are passed, xsct estimates the current display temperature and b
.I [brightness]
Linear brightness between 0.0 (inclusive) and 1.0 (inclusive). The default value is 1.0 if no parameter is passed.

.SH EXIT STATUS
xsct exits with an exit status of 0 on success and a non-zero value 0 on failure.

.SH AUTHOR
xsct is based on sct by Ted Unangst <[email protected]>

Expand Down