summaryrefslogtreecommitdiffstats
path: root/dmenu.c
diff options
context:
space:
mode:
Diffstat (limited to 'dmenu.c')
-rw-r--r--dmenu.c14
1 files changed, 7 insertions, 7 deletions
diff --git a/dmenu.c b/dmenu.c
index 571bc35..969f6d8 100644
--- a/dmenu.c
+++ b/dmenu.c
@@ -549,18 +549,18 @@ paste(void)
static void
readstdin(void)
{
- char buf[sizeof text], *p;
- size_t i, size = 0;
+ char *line = NULL;
+ size_t i, junk, size = 0;
+ ssize_t len;
/* read each line from stdin and add it to the item list */
- for (i = 0; fgets(buf, sizeof buf, stdin); i++) {
+ for (i = 0; (len = getline(&line, &junk, stdin)) != -1; i++, line = NULL) {
if (i + 1 >= size / sizeof *items)
if (!(items = realloc(items, (size += BUFSIZ))))
die("cannot realloc %zu bytes:", size);
- if ((p = strchr(buf, '\n')))
- *p = '\0';
- if (!(items[i].text = strdup(buf)))
- die("cannot strdup %zu bytes:", strlen(buf) + 1);
+ if (line[len - 1] == '\n')
+ line[len - 1] = '\0';
+ items[i].text = line;
items[i].out = 0;
}
if (items)
oph Lohmann 1-0/+1 2015-01-19Remove the debugging from the testing.Gravatar Christoph Lohmann 1-1/+0 2015-01-19Add some description for the plumb feature.Gravatar Christoph Lohmann 1-0/+3 2015-01-19Add plumbing functionality.Gravatar Christoph Lohmann 2-2/+28 2015-01-18Add a comment about how the styles are iterated.Gravatar Christoph Lohmann 1-0/+4 2015-01-18My CMD was too short. :OGravatar Christoph Lohmann 1-1/+1 2015-01-17Add the manpage changes for the disk cache support.Gravatar Christoph Lohmann 1-1/+7 2015-01-17Adding disk cache support for soup.Gravatar Christoph Lohmann 2-9/+40 2015-01-17Fix extra newline, and add -g where other switches are forwarded.Gravatar Ben Woolley 1-1/+3 2015-01-17Newer libc want _DEFAULT_SOURCE.Gravatar Christoph Lohmann 1-1/+1 2015-01-17Major styles update.Gravatar Christoph Lohmann 3-11/+84 2015-01-02Fix a typo in surf manual.Gravatar Jakukyo Friel 1-1/+1 2014-09-28Minor style change.Gravatar Christoph Lohmann 1-1/+1 2014-09-28Make »Copy image address« work.Gravatar Christoph Lohmann 1-3/+10 2014-08-07Mention xdotool in SEE ALSO too.Gravatar Christoph Lohmann 1-1/+2 2014-08-07Fix the manpage about xid.Gravatar Christoph Lohmann 1-1/+3 enu/commit/dmenu.1?id=5146c3f27f730b3b37805c1f7b19bbebe312959f&follow=1'>appliead Sanders manpage/Makefile pacthGravatar arg@10ksloc.org 2-2/+2 2006-08-07fixed dmenu.1 version infoGravatar arg@10ksloc.org 1-1/+1 2006-08-07settle with greyGravatar arg@10ksloc.org 1-2/+2 2006-08-07next version is 0.3Gravatar arg@10ksloc.org 1-1/+1 2006-08-07also made my colors tasting better with my overall colorschemeGravatar arg@10ksloc.org 1-3/+3 2006-08-07next attempt for bright background switchGravatar arg@10ksloc.org 1-3/+3 2006-08-07Added tag 0.2 for changeset 656be0f47df545dfdd2e1e0663663b8b1b26f031Gravatar arg@10ksloc.org 1-0/+1 2006-08-07added stripping to dmenu targetGravatar arg@10ksloc.org 1-0/+1 2006-08-07fixed a bad mistake setting the dmenu border to False;Gravatar arg@10ksloc.org 1-1/+0 2006-08-07renamed some functions to make it more readableGravatar arg@10ksloc.org 1-9/+9 2006-08-07updated man pageGravatar arg@10ksloc.org 1-1/+1 2006-08-07updated man pageGravatar arg@10ksloc.org 1-0/+4 2006-08-07removed -t title crap from dmenuGravatar arg@10ksloc.org 2-57/+12 2006-08-05menu now also uses -OsGravatar arg@10ksloc.org 1-2/+2 2006-08-05small changeGravatar arg@10ksloc.org 1-1/+1 2006-08-04yet another fixGravatar arg@10ksloc.org 1-2/+2 2006-08-04fixed README of dmenuGravatar arg@10ksloc.org 1-27/+10 2006-08-04fixed dist targetGravatar arg@10ksloc.org 1-1/+1 2006-08-04removed config.hGravatar arg@10ksloc.org 1-9/+0