Fix argument check in main function and update usage message; modify addPersonToList return values; add file_operations header

This commit is contained in:
2025-04-22 20:56:42 +02:00
parent 58e02ad54c
commit 53867532c0
4 changed files with 12 additions and 6 deletions
+6
View File
@@ -0,0 +1,6 @@
#ifndef __FILE_OPERATIONS_H__
#define __FILE_OPERATIONS_H__
#endif
BIN
View File
Binary file not shown.
+4 -4
View File
@@ -11,12 +11,13 @@
#include "users.h" #include "users.h"
#include "tui.h" #include "tui.h"
#include "rfid_handler.h" #include "rfid_handler.h"
#include "file_operations.h"
int main(int argc, char const **argv) int main(int argc, char const **argv)
{ {
if (argc != 1) if (argc != 2)
{ {
printf("Usage: %s <Address of RFID reader>\n", argv[0]); printf("filename argument required\nUsage: %s [User database]\n", argv[0]);
return EXIT_FAILURE; return EXIT_FAILURE;
} }
@@ -45,8 +46,7 @@ int main(int argc, char const **argv)
erase(); erase();
refresh(); refresh();
// uartDialog(uart_address, x_max, y_max); uartDialog(uart_address, x_max, y_max);
strcpy(uart_address, argv[1]);
pthread_create(&uart_thread, NULL, uartListener, uart_address); pthread_create(&uart_thread, NULL, uartListener, uart_address);
+2 -2
View File
@@ -48,7 +48,7 @@ int addPersonToList(
if (*_head == NULL) if (*_head == NULL)
{ {
*_head = new_node; *_head = new_node;
return; return 0;
} }
node_t *current = *_head; node_t *current = *_head;
@@ -58,5 +58,5 @@ int addPersonToList(
} }
current->next = new_node; current->next = new_node;
return 0; return 1;
} }