[TS] TP3 - working on basic message reader CLI

This commit is contained in:
Lucas Verdelho 2024-05-12 21:15:06 +01:00
parent 35cde3e290
commit 3c769cce47
2 changed files with 145 additions and 6 deletions

View file

@ -57,14 +57,19 @@ int send_message(unsigned int receiver,int isgroup) {
return 0;
}
// Function to read messages
void read_messages() {
}
// Function to print usage information
void printUsage() {
printf("Usage: message_cli [options]\n");
printf("Options:\n");
printf(" -h, --help Display this help message\n");
printf(" -g, --group Send message to a group\n");
printf(" -s, --sync Send message synchronously\n");
printf(" -u, --uid <uid> Specify the UID of the receiver\n");
printf("Usage: message_cli [options]\n");
printf("Options:\n");
printf(" -h, --help Display this help message\n");
printf(" -g, --group Send message to a group\n");
printf(" -s, --sync Send message synchronously\n");
printf(" -u, --uid <uid> Specify the UID of the receiver\n");
printf(" -r, --read Read messages\n"); // New flag for reading messages
}
int main(int argc, char *argv[]) {
@ -99,6 +104,8 @@ int main(int argc, char *argv[]) {
printUsage();
exit(1);
}
} else if (strcmp(argv[i], "-r") == 0 || strcmp(argv[i], "--read") == 0) {
read_messages();
} else {
fprintf(stderr, "Error: Unknown option %s\n", argv[i]);
printUsage();