summarylogtreecommitdiffstats
diff options
context:
space:
mode:
authorneeshy2021-02-13 15:00:39 -0500
committerneeshy2021-02-13 15:00:51 -0500
commitdb741de71a21a1b1346bcbb55333d566b2042f67 (patch)
treef39f8bad1ef23583ead7fa87999678bbfb6da8e8
parent52616fdc08491f2ff7a647e9b84899ed43fea288 (diff)
downloadaur-db741de71a21a1b1346bcbb55333d566b2042f67.tar.gz
mem-suspend: style
-rw-r--r--.SRCINFO2
-rw-r--r--PKGBUILD2
-rw-r--r--mem-suspend.c29
3 files changed, 16 insertions, 17 deletions
diff --git a/.SRCINFO b/.SRCINFO
index 9399bae90ff4..35d2a5b5bea4 100644
--- a/.SRCINFO
+++ b/.SRCINFO
@@ -5,7 +5,7 @@ pkgbase = mem-suspend
arch = x86_64
license = custom:WTFPL
source = mem-suspend.c
- sha256sums = e0b58463e54d2b34c0a852daaddc50db120ecb9f52fd15bafa863abf6f122700
+ sha256sums = eeb52c2efe5896d6001cf9c710d0c9824f9e60342ab3297edcdfaf3aa7329ef8
pkgname = mem-suspend
diff --git a/PKGBUILD b/PKGBUILD
index b884fbeebe6b..9d08865074f7 100644
--- a/PKGBUILD
+++ b/PKGBUILD
@@ -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;
}