diff options
author | Mattias Andrée <maandree@operamail.com> | 2014-01-25 19:21:20 +0100 |
---|---|---|
committer | Mattias Andrée <maandree@operamail.com> | 2014-01-25 19:21:20 +0100 |
commit | 9395c78ac556c0458bb01e32d6c58d59ed53ec12 (patch) | |
tree | a0085e14ebc649e6449ba8384b16586d7d6a87cc /src/adjbacklight.c | |
parent | m (diff) | |
download | adjbacklight-9395c78ac556c0458bb01e32d6c58d59ed53ec12.tar.gz adjbacklight-9395c78ac556c0458bb01e32d6c58d59ed53ec12.tar.bz2 adjbacklight-9395c78ac556c0458bb01e32d6c58d59ed53ec12.tar.xz |
fix bugs
Signed-off-by: Mattias Andrée <maandree@operamail.com>
Diffstat (limited to '')
-rw-r--r-- | src/adjbacklight.c | 20 |
1 files changed, 10 insertions, 10 deletions
diff --git a/src/adjbacklight.c b/src/adjbacklight.c index 0fa3ab9..31e4811 100644 --- a/src/adjbacklight.c +++ b/src/adjbacklight.c @@ -37,7 +37,7 @@ /** * Forking method */ -#define FORK vfork +#define FORK fork /** @@ -237,7 +237,7 @@ int main(int argc, char** argv) fflush(stdout); /* stty -icanon -echo */ - if (tcgetattr(STDIN_FILENO, &saved_stty)) + if (tcgetattr(STDIN_FILENO, &stty)) { perror(*argv); return 1; @@ -263,18 +263,17 @@ int main(int argc, char** argv) waitpid(pid, NULL, 0); else { - line = malloc(cols * 4 * sizeof(char)); + line = malloc(cols * 3 * sizeof(char)); space = malloc(cols * sizeof(char)); for (i = 0; i < cols; i++) { - *(line + i * 4 + 0) = 0xE2; - *(line + i * 4 + 1) = 0x94; - *(line + i * 4 + 2) = 0x80; - *(line + i * 4 + 3) = 0x0A; + *(line + i * 3 + 0) = 0xE2; + *(line + i * 3 + 1) = 0x94; + *(line + i * 3 + 2) = 0x80; *(space + i) = ' '; } *(space + cols - 1) = 0; - *(line + (cols - 2) * 4) = 0; + *(line + (cols - 2) * 3) = 0; if (ndevices) { @@ -303,7 +302,8 @@ int main(int argc, char** argv) { device = ent->d_name; if (all || (strstr(device, forbidden) != forbidden)) - adjust(cols, device); + if (*device && (*device != '.')) + adjust(cols, device); } closedir(dir); } @@ -315,7 +315,7 @@ int main(int argc, char** argv) /* `stty icanon echo` */ - tcsetattr(STDIN_FILENO, TCSAFLUSH, &saved_stty); + if (tcsetattr(STDIN_FILENO, TCSAFLUSH, &saved_stty)) { perror(*argv); return 1; |