Download raw body.
tog: ensure stdin is a tty
On Sat, Sep 03, 2022 at 11:24:47PM +1000, Mark Jamsek wrote: > This was discussed a while back on IRC to handle such things like: > > $ tog < /dev/null > > ok? Should 'return 1' or exit(1) on error, not return GOT_ERR_IO. > diff refs/heads/main refs/heads/fix/tty > commit - 58381f7013ee220415b44aaf36c549b2f1cd2937 > commit + 1859edcc64e667da877c42b8e0575cedcb812ee6 > blob - d3fe18a13136b64b9e9ba153ae5a2deda0482b9c > blob + 05c7f2e05a60fb8224d0514b4c65008eb24facb7 > --- tog/tog.c > +++ tog/tog.c > @@ -8471,6 +8471,11 @@ main(int argc, char *argv[]) > }; > char *diff_algo_str = NULL; > > + if (!isatty(STDIN_FILENO)) { > + fprintf(stderr, "%s: tty required\n", getprogname()); > + return GOT_ERR_IO; > + } > + > setlocale(LC_CTYPE, ""); > > while ((ch = getopt_long(argc, argv, "+hV", longopts, NULL)) != -1) { > > -- > Mark Jamsek <fnc.bsdbox.org> > GPG: F2FF 13DE 6A06 C471 CA80 E6E2 2930 DC66 86EE CF68
tog: ensure stdin is a tty