Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- #include <stdlib.h>
- #include <string.h>
- #include "list.c"
- void cst_spl(struct List* lst) {
- for (;;) {
- char* command = get_str();
- if (!strcmp(command, "current")) {
- Current(lst);
- free(command);
- command = NULL;
- }
- else if (!strcmp(command, "delete")) {
- Delete(lst);
- free(command);
- command = NULL;
- }
- else if (!strcmp(command, "right")) {
- Right(lst);
- free(command);
- command = NULL;
- }
- else if (!strcmp(command, "left")) {
- Left(lst);
- free(command);
- command = NULL;
- }
- else if (!strcmp(command, "exit")) {
- free(command);
- command = NULL;
- break;
- }
- else if (!memcmp(command, "add", 3)) {
- char* param = malloc(sizeof(char) * strlen(command));
- param = strncpy(param, command, 50);
- Add(lst, param);
- param = NULL;
- free(command);
- command = NULL;
- }
- }
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement