This can be useful when 100 is not divisible by (max - min).
Signed-off-by: Roman Donchenko <[email protected]>
---
xbacklight.c | 14 +++++++-------
1 file changed, 7 insertions(+), 7 deletions(-)
diff --git a/xbacklight.c b/xbacklight.c
index c054d26..f4d6e95 100644
--- a/xbacklight.c
+++ b/xbacklight.c
@@ -108,7 +108,7 @@ main (int argc, char **argv)
{
char *dpy_name = NULL;
op_t op = Get;
- int value = 0;
+ double value = 0;
int i;
int total_time = 200; /* ms */
int steps = 20;
@@ -138,39 +138,39 @@ main (int argc, char **argv)
{
if (++i >= argc) usage();
op = Set;
- value = atoi (argv[i]);
+ value = strtod (argv[i], NULL);
continue;
}
if (argv[i][0] == '=' && isdigit (argv[i][1]))
{
op = Set;
- value = atoi (argv[i] + 1);
+ value = strtod (argv[i] + 1, NULL);
continue;
}
if (!strcmp (argv[i], "-inc") || !strcmp (argv[i], "+"))
{
if (++i >= argc) usage();
op = Inc;
- value = atoi (argv[i]);
+ value = strtod (argv[i], NULL);
continue;
}
if (argv[i][0] == '+' && isdigit (argv[i][1]))
{
op = Inc;
- value = atoi (argv[i] + 1);
+ value = strtod (argv[i] + 1, NULL);
continue;
}
if (!strcmp (argv[i], "-dec") || !strcmp (argv[i], "-"))
{
if (++i >= argc) usage();
op = Dec;
- value = atoi (argv[i]);
+ value = strtod (argv[i], NULL);
continue;
}
if (argv[i][0] == '-' && isdigit (argv[i][1]))
{
op = Dec;
- value = atoi (argv[i] + 1);
+ value = strtod (argv[i] + 1, NULL);
continue;
}
if (!strcmp (argv[i], "-get") || !strcmp (argv[i], "-g"))
--
1.8.1.4
_______________________________________________
[email protected]: X.Org development
Archives: http://lists.x.org/archives/xorg-devel
Info: http://lists.x.org/mailman/listinfo/xorg-devel