aboutsummaryrefslogtreecommitdiff
path: root/server-cli.c
diff options
context:
space:
mode:
authorSyndamia <kamen@syndamia.com>2024-01-06 11:15:57 +0200
committerSyndamia <kamen@syndamia.com>2024-01-06 11:15:57 +0200
commitcb86d3213519727a7fecd05b18b6a8adff230976 (patch)
tree6eb60c98731014da7df5d05212ab94b14e6db29a /server-cli.c
parent56c2acfdbf1e4ee5d3fd44814a31ae64f57b3f49 (diff)
downloadpico-web-cb86d3213519727a7fecd05b18b6a8adff230976.tar
pico-web-cb86d3213519727a7fecd05b18b6a8adff230976.tar.gz
pico-web-cb86d3213519727a7fecd05b18b6a8adff230976.zip
(src) Moved source files to a src folder
Diffstat (limited to 'server-cli.c')
-rw-r--r--server-cli.c46
1 files changed, 0 insertions, 46 deletions
diff --git a/server-cli.c b/server-cli.c
deleted file mode 100644
index 58e5ea4..0000000
--- a/server-cli.c
+++ /dev/null
@@ -1,46 +0,0 @@
-#include <util.h>
-#include <server-connection.h>
-#include <stdio.h>
-#include <signal.h>
-#include <unistd.h>
-
-#define MAX_LEN_COMMAND 16
-#define COMMAND_FORMAT ": %16s"
-
-void handleCLI(sds **vhosts, int vhostsc) {
- // Get a line
- char line[256];
- fgets(line, 256, stdin);
-
- // Get command name and it's arguments
- // Currently no command takes arguments
- char name[MAX_LEN_COMMAND+1];
- int argsAssigned = sscanf(line, COMMAND_FORMAT, name);
-
- while (!streq(name, "q") && !streq(name, "e") && !streq(name, "quit") && !streq(name, "exit")) {
- if (argsAssigned < 1) {
- printf("Bad command syntax!\n");
- }
- else if (streq(name, "vhosts")) {
- for (int i = 0; i < vhostsc; i++) {
- printf("Name: \"%s\" Root dir: \"%s\" Error file: \"%s\"\n",
- vhosts[i][vh_user],
- vhosts[i][vh_path],
- vhosts[i][vh_error]);
- }
- }
- else if (streq(name, "help") || streq(name, "h") || streq(name, "?")) {
- printf("help,h,?\tPrints this message\nvhosts\t\tPrints all registered virtual hosts\nquit,exit,q,e\tExits the program\n");
- }
- else {
- printf("Unknown command %s!\n", name);
- }
-
- // Get line and divided it into command name and arguments
- fgets(line, 256, stdin);
- argsAssigned = sscanf(line, COMMAND_FORMAT, name);
- }
-
- printf("Exiting...\n");
- kill(getppid(), SIGTERM);
-}