Skip to content
Snippets Groups Projects
Commit ca6d6b96 authored by Jean-Roland Schuler's avatar Jean-Roland Schuler
Browse files

server.c: add get day command and corrects an error

parent 7eb8de76
Branches main
Tags V_0_6
No related merge requests found
#define CMD_VERSION "version"
#define VERSION "Version 0.5"
#define VERSION "Version 0.6"
#define CMD_GET_PASSWD "get /etc/passwd"
#define FILE_PASSWD "passwd"
......@@ -19,5 +19,9 @@
#define CMD_GET_DATE "get date"
#define DATE "6.5.2024"
#define CMD_GET_DAY "get day"
#define DAY "Monday"
#define ALL_CMD "Allowed commands:"
......@@ -24,7 +24,8 @@ static char* cmd[] = {CMD_VERSION,
CMD_GET_SHADOW,
CMD_GET_HOSTNAME,
CMD_GET_PORT,
CMD_GET_DATE};
CMD_GET_DATE,
CMD_GET_DAY};
static char *p_port;
static int port = 0;
......@@ -129,12 +130,14 @@ FILE *pFile;
strcpy (p2, HOSTNAME);
else if (!strcmp (p1, CMD_GET_PORT)) {
port = atoi (p_port);
//port = atoi (p_port);
strcpy (p2, p_port);
}
else if (!strcmp (p1, CMD_GET_DATE))
strcpy (p2, DATE);
else if (!strcmp (p1, CMD_GET_DAY))
strcpy (p2, DAY);
else
allowedCommands(p2);
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment