mirror of
https://github.com/fumiama/simple-kanban.git
synced 2026-06-10 19:40:34 +08:00
fix: quit
This commit is contained in:
12
server.c
12
server.c
@@ -16,6 +16,7 @@
|
|||||||
#include <sys/types.h>
|
#include <sys/types.h>
|
||||||
#include <sys/wait.h>
|
#include <sys/wait.h>
|
||||||
#include <time.h>
|
#include <time.h>
|
||||||
|
#include <ctype.h>
|
||||||
#include <unistd.h>
|
#include <unistd.h>
|
||||||
#include "config.h"
|
#include "config.h"
|
||||||
|
|
||||||
@@ -548,17 +549,24 @@ static int s1_get(threadtimer_t *timer) { //get kanban
|
|||||||
timer->is_open = 0;
|
timer->is_open = 0;
|
||||||
close_file(timer);
|
close_file(timer);
|
||||||
int r = send_all(kanban_path, timer);
|
int r = send_all(kanban_path, timer);
|
||||||
if(!strncmp(timer->data, "quit", 4)) {
|
if(strnstr(timer->data, "quit", timer->numbytes)) {
|
||||||
puts("Found last cmd is quit");
|
puts("Found last cmd is quit");
|
||||||
|
timer->numbytes = 0;
|
||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
|
for(int i = 0; i < timer->numbytes; i++) {
|
||||||
|
if(!isdigit(timer->data[i])) {
|
||||||
|
timer->numbytes -= i;
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
}
|
||||||
return r;
|
return r;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
int r = close_file_and_send(timer, "null", 4);
|
int r = close_file_and_send(timer, "null", 4);
|
||||||
if(!strncmp(timer->data, "quit", 4)) {
|
if(strnstr(timer->data, "quit", timer->numbytes)) {
|
||||||
puts("Found last cmd is quit");
|
puts("Found last cmd is quit");
|
||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
|
|||||||
Reference in New Issue
Block a user