Skip to content
Snippets Groups Projects
Commit 405509c3 authored by Jakob Olsson's avatar Jakob Olsson
Browse files

dongle.c: remove lexer function, no longer used

parent 4b98d5b8
No related branches found
No related tags found
No related merge requests found
...@@ -293,56 +293,7 @@ static struct device *search_list(char *name) ...@@ -293,56 +293,7 @@ static struct device *search_list(char *name)
return NULL; return NULL;
} }
char *lexer(char **input, char *delimiter) static char *get_usb_stat(char *path, char *file)
{
char *token, *substr;
if (strlen(*input) == 0) {
debug_print("empty input!\n");
return NULL;
} else if (strlen(delimiter) == 0) {
debug_print("empty delimiter!\n");
return NULL;
}
token = strstr(*input, delimiter);
if (token) {
*token = '\0';
substr = strdup(*input);
if (!substr) {
perror("strdup");
goto fail_strdup;
}
*input = token + strlen(delimiter);
} else {
substr = strdup(*input);
if (!substr) {
perror("strdup");
goto fail_strdup;
}
*input[0] = '\0';
}
fail_strdup:
return substr;
}
void remove_newline(char *input)
{
char *pos;
pos = strchr(input, '\n');
if (!pos)
return;
*pos = '\0';
}
char *get_usb_stat(char *path, char *file)
{ {
char stat_path[PATH_MAX], contents[1024]; char stat_path[PATH_MAX], contents[1024];
FILE *f; FILE *f;
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Please register or to comment