diff options
author | neeshy | 2021-02-13 15:00:39 -0500 |
---|---|---|
committer | neeshy | 2021-02-13 15:00:51 -0500 |
commit | db741de71a21a1b1346bcbb55333d566b2042f67 (patch) | |
tree | f39f8bad1ef23583ead7fa87999678bbfb6da8e8 | |
parent | 52616fdc08491f2ff7a647e9b84899ed43fea288 (diff) | |
download | aur-db741de71a21a1b1346bcbb55333d566b2042f67.tar.gz |
mem-suspend: style
-rw-r--r-- | .SRCINFO | 2 | ||||
-rw-r--r-- | PKGBUILD | 2 | ||||
-rw-r--r-- | mem-suspend.c | 29 |
3 files changed, 16 insertions, 17 deletions
@@ -5,7 +5,7 @@ pkgbase = mem-suspend arch = x86_64 license = custom:WTFPL source = mem-suspend.c - sha256sums = e0b58463e54d2b34c0a852daaddc50db120ecb9f52fd15bafa863abf6f122700 + sha256sums = eeb52c2efe5896d6001cf9c710d0c9824f9e60342ab3297edcdfaf3aa7329ef8 pkgname = mem-suspend @@ -6,7 +6,7 @@ pkgdesc="A script for suspending to memory" arch=('x86_64') license=('custom:WTFPL') source=("mem-suspend.c") -sha256sums=('e0b58463e54d2b34c0a852daaddc50db120ecb9f52fd15bafa863abf6f122700') +sha256sums=('eeb52c2efe5896d6001cf9c710d0c9824f9e60342ab3297edcdfaf3aa7329ef8') build() { cd "$srcdir" diff --git a/mem-suspend.c b/mem-suspend.c index baeb7e64e5c4..a343db4df375 100644 --- a/mem-suspend.c +++ b/mem-suspend.c @@ -3,20 +3,19 @@ #include <fcntl.h> #include <errno.h> -static const char *state_path = "/sys/power/state"; - -int main(void) +int +main(void) { - int fd = open(state_path, O_WRONLY | O_TRUNC); - if (fd != -1) - { - write(fd, "mem", 3); - close(fd); - } - else - { - perror(state_path); - return errno; - } - return 0; + static const char *path = "/sys/power/state"; + int fd = open(path, O_WRONLY | O_TRUNC); + + if (fd != -1) { + write(fd, "mem", 3); + close(fd); + } else { + perror(path); + return errno; + } + + return 0; } |