diff options
| author | epoch <epoch@hacking.allowed.org> | 2020-06-25 08:31:00 -0500 | 
|---|---|---|
| committer | epoch <epoch@hacking.allowed.org> | 2020-06-25 08:31:00 -0500 | 
| commit | 96148386827f7aa831865dc877a06034679422cc (patch) | |
| tree | 79b2905c07289a4671de933f07dded3a6f57ca3a /src | |
| parent | 7c9c6dcb800fcf4652b7f481a5f0693035e673ef (diff) | |
| download | hackvr-96148386827f7aa831865dc877a06034679422cc.tar.gz hackvr-96148386827f7aa831865dc877a06034679422cc.zip | |
anything isspace() things is space is allowed as whitespace instead of just 0x20
Diffstat (limited to 'src')
| -rw-r--r-- | src/hackvr.c | 13 | 
1 files changed, 7 insertions, 6 deletions
| diff --git a/src/hackvr.c b/src/hackvr.c index b789dbe..6dea5b9 100644 --- a/src/hackvr.c +++ b/src/hackvr.c @@ -1,4 +1,5 @@  #define _POSIX_C_SOURCE 200809L //for fileno and strdup +#include <ctype.h> //isspace  #include <stdio.h>  #include <fcntl.h>  #include <assert.h> @@ -92,21 +93,21 @@ char **line_splitter(char *line,int *rlen) {   char **a;   int len,i=0;   len=1;//we're just counting how much we'll need the first loop through. - for(i=0;line[i] && line[i] == ' ';i++);//skip leading space + for(i=0;line[i] && isspace(line[i]);i++);//skip leading space   for(;line[i];len++) { -  for(;line[i] && line[i] != ' ';i++);//skip rest of data -  for(;line[i] && line[i] == ' ';i++);//skip rest of space +  for(;line[i] && !isspace(line[i]);i++);//skip rest of data +  for(;line[i] && isspace(line[i]);i++);//skip rest of space   }   a=malloc(sizeof(char *) * len+1);   a[len]=0;   len=0;//reuse! - for(i=0;line[i] && line[i] == ' ';i++);//skip leading space + for(i=0;line[i] && isspace(line[i]);i++);//skip leading space   a[len]=line+i;   for(;;) { -  for(;line[i] && line[i] != ' ';i++);//skip rest of data +  for(;line[i] && !isspace(line[i]);i++);//skip rest of data    if(!line[i]) break;    line[i++]=0; -  for(;line[i] && line[i] == ' ';i++);//skip rest of space +  for(;line[i] && isspace(line[i]);i++);//skip rest of space    if(!line[i]) break;    a[++len]=line+i;   } | 
