Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- #include <conio.h>
- #include <stdint.h>
- #include <stdio.h>
- #include <string.h>
- void exeCMD(char *cmd, char *params)
- {
- if (params == NULL) { printf("null params\n"); } else {
- printf("Komanda %s - Params %s", cmd, params); }
- }
- void checkParams(char *cmd, char *commands)
- {
- char *param = NULL;
- char params[64];
- printf("Komanda %s - Ostale %s\n", cmd, commands);
- /*if (!strcmp(cmd, "RTC_Set"))
- {
- // FIRST PARAM
- param = strtok(commands, ",");
- strcat(params, param);
- // OTHER PARAMS
- for (uint8_t i = 1; i < 2; i++)
- {
- param = strtok(NULL, ",");
- strcat(params, param);
- }
- }*/
- //exeCMD(cmd, params);
- }
- void parseCommands(char *commands)
- {
- char *cmd = NULL;
- // FIRST COMMAND
- cmd = strtok(commands, ",");
- // OTHER COMMANDS
- while (cmd != NULL)
- {
- checkParams(cmd, commands);
- cmd = strtok(NULL, ",");
- }
- }
- int main()
- {
- char commands[64];
- printf("Upisi komande: ");
- scanf("%s", &commands);
- parseCommands(commands);
- getch();
- return (0);
- }
Advertisement
Add Comment
Please, Sign In to add comment