Re: [PATCH 06/11] built-in add -i: implement the main loop
- From
Johannes Schindelin <johannes.schindelin@gmx.de>
- Date
- May 13, 2019, 12:04 UTC
- Message-ID
- <nycvar.QRO.7.76.6.1905131401510.44@tvgsbejvaqbjf.bet>
- In-Reply-To
- <27ebbb44-1208-563c-2419-edfc6570fefb@jeffhostetler.com>
Hi Jeff,
On Thu, 18 Apr 2019, Jeff Hostetler wrote:
Show 30 quoted lines
> On 4/10/2019 1:37 PM, Johannes Schindelin via GitGitGadget wrote:
>
> > [...]
> > +
> > +/*
> > + * Returns the selected index.
> > + */
> > +static ssize_t list_and_choose(struct item **items, size_t nr,
> > + struct list_and_choose_options *opts)
> > +{
> > + struct strbuf input = STRBUF_INIT;
> > + ssize_t res = -1;
> > +
> > + for (;;) {
> > + char *p, *endp;
> > +
> > + strbuf_reset(&input);
> > +
> > + list(items, nr, &opts->list_opts);
> > +
> > + printf("%s%s", opts->prompt, "> ");
> > + fflush(stdout);
> > +
> > + if (strbuf_getline(&input, stdin) == EOF) {
> > + putchar('\n');
> > + res = -2;
>
> It would be nice to know what -1 and -2 mean if
> they get returned to our caller. Maybe a #define
> for these??Makes a total lot of sense. I changed that.
Thanks! Dscho