aboutsummaryrefslogtreecommitdiffstats
path: root/P3
diff options
context:
space:
mode:
authorMatt Strapp <strap012@umn.edu>2020-11-15 18:12:12 -0600
committerMatt Strapp <strap012@umn.edu>2020-11-15 18:12:12 -0600
commit3b1d19c735275b9fb0390f64e8ba213c96ef3918 (patch)
tree7317660e4a5ddb838f7274ff90c69c45e6f2ff1b /P3
parentadd s p a c i n g (diff)
downloadcsci4061-3b1d19c735275b9fb0390f64e8ba213c96ef3918.tar
csci4061-3b1d19c735275b9fb0390f64e8ba213c96ef3918.tar.gz
csci4061-3b1d19c735275b9fb0390f64e8ba213c96ef3918.tar.bz2
csci4061-3b1d19c735275b9fb0390f64e8ba213c96ef3918.tar.lz
csci4061-3b1d19c735275b9fb0390f64e8ba213c96ef3918.tar.xz
csci4061-3b1d19c735275b9fb0390f64e8ba213c96ef3918.tar.zst
csci4061-3b1d19c735275b9fb0390f64e8ba213c96ef3918.zip
Change perror to printf
Diffstat (limited to 'P3')
-rw-r--r--P3/server.c14
1 files changed, 7 insertions, 7 deletions
diff --git a/P3/server.c b/P3/server.c
index d709198..06e289a 100644
--- a/P3/server.c
+++ b/P3/server.c
@@ -148,7 +148,7 @@ int main(int argc, char **argv) {
int workers = argv[6];
//Dynamic worker flag
- bool dynFlag = argv[7];
+ int dynFlag = argv[7];
//Queue Length
int qLen = argv[8];
@@ -158,19 +158,19 @@ int main(int argc, char **argv) {
// Perform error checks on the input arguments
if (port < 1025 || port > 65535) {
- perror("Invalid port. Port must be greater than 1024 or less than 65536.\n");
+ printf("Invalid port. Port must be greater than 1024 or less than 65536.\n");
return -1;
}
if (dispatchers > MAX_THREADS || dispatchers < 1) {
- perror("Number of dispatchers is invalid. It must be greater than 0 or less than 101.\n");
+ printf("Number of dispatchers is invalid. It must be greater than 0 or less than 101.\n");
return -1;
}
if (workers > MAX_THREADS || workers < 1) {
- perror("Number of dispatchers is invalid. It must be greater than 0 or less than 101.\n");
+ printf("Number of dispatchers is invalid. It must be greater than 0 or less than 101.\n");
return -1;
}
if (qLen > MAX_queue_len || qLen <= 0) {
- perror("Queue length is invalid.\n");
+ printf("Queue length is invalid.\n");
return -1;
}
// Change SIGINT action for grace termination
@@ -180,14 +180,14 @@ int main(int argc, char **argv) {
act.sa_flags = 0;
if (sigemptyset(&act.sa_mask) == -1 ||
sigaction(SIGINT, &act, NULL) == -1) {
- perror("SIGINT handler failed.\n");
+ printf("SIGINT handler failed.\n");
return -1;
}
// Open log file
FILE* logfile = fopen("serverlog.txt", "a+");
// Change the current working directory to server root directory
if (chdir("testing") == -1) {
- perror("Could not find root webserver directory testing. Exiting\n");
+ printf("Could not find root webserver \"directory testing\". Exiting\n");
return -1;
}
// Initialize cache (extra credit B)