first commit
This commit is contained in:
commit
fc95f21311
1
.gitignore
vendored
Normal file
1
.gitignore
vendored
Normal file
@ -0,0 +1 @@
|
|||||||
|
fwled
|
10
Makefile
Normal file
10
Makefile
Normal file
@ -0,0 +1,10 @@
|
|||||||
|
fwled: main.c
|
||||||
|
gcc --std=c99 main.c -o fwled
|
||||||
|
sudo chown root fwled
|
||||||
|
sudo chmod u+s fwled
|
||||||
|
|
||||||
|
install: fwled
|
||||||
|
sudo mv fwled /usr/bin/
|
||||||
|
|
||||||
|
clean:
|
||||||
|
rm -f fwled
|
8
README.md
Normal file
8
README.md
Normal file
@ -0,0 +1,8 @@
|
|||||||
|
# fwled
|
||||||
|
|
||||||
|
```bash
|
||||||
|
make install
|
||||||
|
|
||||||
|
fwled power green
|
||||||
|
fwled power auto
|
||||||
|
```
|
23
main.c
Normal file
23
main.c
Normal file
@ -0,0 +1,23 @@
|
|||||||
|
#define _POSIX_C_SOURCE 200112L
|
||||||
|
#include <sys/types.h>
|
||||||
|
#include <stdlib.h>
|
||||||
|
#include <stdio.h>
|
||||||
|
#include <unistd.h>
|
||||||
|
|
||||||
|
|
||||||
|
int main(int argc, char* argv[]) {
|
||||||
|
char *args[argc+3];
|
||||||
|
args[0] = "fw-ectool";
|
||||||
|
args[1] = "led";
|
||||||
|
|
||||||
|
for (int i=0; i < argc; i++) {
|
||||||
|
args[i+2] = argv[i+1];
|
||||||
|
}
|
||||||
|
args[argc+2] = NULL;
|
||||||
|
|
||||||
|
seteuid(0);
|
||||||
|
setuid(0);
|
||||||
|
execvp("fw-ectool", args);
|
||||||
|
|
||||||
|
return 0;
|
||||||
|
}
|
Loading…
Reference in New Issue
Block a user