summaryrefslogtreecommitdiff
path: root/client/client.c
diff options
context:
space:
mode:
authorJari Vetoniemi <mailroxas@gmail.com>2014-04-12 19:59:21 +0300
committerJari Vetoniemi <mailroxas@gmail.com>2014-04-12 19:59:21 +0300
commit311e4b36768a0d4e113ccf6d2256ca95c6621508 (patch)
tree04be6cb3158375ca9932481f279167eff145435d /client/client.c
parentcd73a1ba610db7cfa928b37039a1bbdaee88972a (diff)
downloadbemenu-311e4b36768a0d4e113ccf6d2256ca95c6621508.tar.gz
bemenu-311e4b36768a0d4e113ccf6d2256ca95c6621508.tar.bz2
bemenu-311e4b36768a0d4e113ccf6d2256ca95c6621508.zip
Use strcspn instead of strtok
Diffstat (limited to 'client/client.c')
-rw-r--r--client/client.c7
1 files changed, 5 insertions, 2 deletions
diff --git a/client/client.c b/client/client.c
index c031c0b..8e670b1 100644
--- a/client/client.c
+++ b/client/client.c
@@ -26,13 +26,16 @@ static void readItemsToMenuFromStdin(bmMenu *menu)
}
buffer[allocated - step + read - 1] = 0;
- char *s;
- for (s = strtok(buffer, "\n"); s; s = strtok(NULL, "\n")) {
+ size_t pos;
+ char *s = buffer;
+ while ((pos = strcspn(s, "\n")) != 0) {
+ s[pos] = 0;
bmItem *item = bmItemNew(s);
if (!item)
break;
bmMenuAddItem(menu, item);
+ s += pos + 1;
}
free(buffer);