aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorGravatar Jonas Gunz <himself@jonasgunz.de> 2019-05-21 10:26:32 +0200
committerGravatar Jonas Gunz <himself@jonasgunz.de> 2019-05-21 10:26:32 +0200
commit8174a4aeaf2da4e452b2a735541420151c820349 (patch)
tree7a1f850a81d1e2cfc9d14af10e6a88dffc037490
parentae108d4500ac2b179462e0f33587a1e53e50e8a3 (diff)
downloadbbs-8174a4aeaf2da4e452b2a735541420151c820349.tar.gz
asdf
-rw-r--r--src/main.c24
-rw-r--r--src/main.h3
2 files changed, 27 insertions, 0 deletions
diff --git a/src/main.c b/src/main.c
index f583d63..b2847ee 100644
--- a/src/main.c
+++ b/src/main.c
@@ -33,6 +33,15 @@ struct prog_params parse_args(int argc, char* argv[])
ret.serial_port = argv[i_cpy + 1];
i++;
break;
+ case 'b':
+ ret.serial = 1;
+ ret.serial_baudrate = atoi(argv[i_cpy + 1]);
+ i++;
+ break;
+ case 'f'://PID file for spawned children
+ ret.pidfile = argv[i_cpy + 1];
+ i++;
+ break;
default:
printf("Unrecognized Option: '%c'\n", argv[i_cpy][o]);
break;
@@ -83,6 +92,8 @@ void handle_connection(int _socket, struct sockaddr_in _addr)
//RUUNNNN!
execl("/usr/bin/whoami", "/usr/bin/whoami", NULL);
+ PRINT_ERROR("EXEC failed");
+
close(_socket);
exit(0);
}
@@ -91,6 +102,19 @@ void handle_connection(int _socket, struct sockaddr_in _addr)
int main(int argc, char* argv[])
{
signal(SIGCHLD,SIG_IGN); //Ignore sigchld
+ struct prog_params params = parse_args(argc, argv);
+
+ FILE* pidfile = fopen(prog_params.pidfile == NULL ? "pidfile" : prog_params.pidfile, "w");
+
+ close (pidfile);
+
+ return 0;
+}
+
+
+int main__q(int argc, char* argv[])
+{
+ signal(SIGCHLD,SIG_IGN); //Ignore sigchld
struct prog_params params = parse_args(argc, argv);
int server_socket, client_socket;
diff --git a/src/main.h b/src/main.h
index 6f84d85..78329c6 100644
--- a/src/main.h
+++ b/src/main.h
@@ -41,6 +41,9 @@ struct prog_params
uint8_t serial;
char* serial_port;
+ uint32_t serial_baudrate;
+
+ char* pidfile;
};
struct prog_params parse_args(int argc, char* argv[]);