fix subunsub

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

View File

@ -305,17 +305,19 @@ int main(int argc, char **argv) {
fprintf(stderr, "Error creating file %s\n", buffer);
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);
fwrite(&msg, sizeof(struct msg_t), 1, fptr);
fwrite("ADD\r", 4, 1, 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) {
// send remove control message
@ -355,14 +357,15 @@ int main(int argc, char **argv) {
return -1;
}
// remove config line
remove_config_file_area(msg.area);
msg_to_nl(&msg);
fwrite(&msg, sizeof(struct msg_t), 1, fptr);
fwrite("REMOVE\r", 7, 1, fptr);
fclose(fptr);
// remove config line
remove_config_file_area(msg.area);
}
return 0;