fix subunsub

This commit is contained in:
Andrew Pamment 2018-05-26 16:27:44 +10:00
parent 56636843aa
commit d026b7ec24

View File

@ -306,16 +306,18 @@ int main(int argc, char **argv) {
return -1; return -1;
} }
// add config line
fptr = fopen(argv[1], "a");
fprintf(fptr, "MSGAREA %d, %d, %s\n", msg.area, msg.daddr, argv[5]);
fclose(fptr);
msg_to_nl(&msg); msg_to_nl(&msg);
fwrite(&msg, sizeof(struct msg_t), 1, fptr); fwrite(&msg, sizeof(struct msg_t), 1, fptr);
fwrite("ADD\r", 4, 1, fptr); fwrite("ADD\r", 4, 1, fptr);
fclose(fptr); fclose(fptr);
// add config line
fptr = fopen(argv[1], "a");
fprintf(fptr, "MSGAREA %d, %d, %s\n", msg.area, msg.daddr, argv[5]);
fclose(fptr);
} else if (strcasecmp(argv[2], "REMOVE") == 0) { } else if (strcasecmp(argv[2], "REMOVE") == 0) {
// send remove control message // send remove control message
@ -355,14 +357,15 @@ int main(int argc, char **argv) {
return -1; return -1;
} }
// remove config line
remove_config_file_area(msg.area);
msg_to_nl(&msg); msg_to_nl(&msg);
fwrite(&msg, sizeof(struct msg_t), 1, fptr); fwrite(&msg, sizeof(struct msg_t), 1, fptr);
fwrite("REMOVE\r", 7, 1, fptr); fwrite("REMOVE\r", 7, 1, fptr);
fclose(fptr); fclose(fptr);
// remove config line
remove_config_file_area(msg.area);
} }
return 0; return 0;