Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with HTTPS or Subversion.

Download ZIP
Browse files

remove ability to read from stdin

this only causes grief from cron, and it's not worth having to hide all
error message in cron just to have clean output. the freopen call isn't
fatal, but it's worth knowing about. additionally, xargs can be used in
place of a straight pipe with the same effect.
  • Loading branch information...
commit f37c6e28a2b4e72d6d2390d054a898700013e026 1 parent 002d6fd
Dave Reisner authored
Showing with 1 addition and 34 deletions.
  1. +1 −2  README.pod
  2. +0 −32 cower.c
3  README.pod
View
@@ -10,8 +10,7 @@ Usage: I<cower> [options] E<lt>operationE<gt> [ targets... ]
cower is a simple tool to get information and download packages from the Arch
User Repository (AUR). Invoking cower consists of supplying an operation, any
-applicable options, and usually one or more targets. Targets can be supplied
-either on the command line or read from standard input.
+applicable options, and usually one or more targets.
=head1 OPERATIONS
32 cower.c
View
@@ -1654,38 +1654,6 @@ int main(int argc, char *argv[]) {
return(1);
}
- /* we also read package arguments from stdin */
- if(!isatty(fileno(stdin))) {
- char line[BUFSIZ];
- int i = 0;
- while (i < BUFSIZ && (line[i] = fgetc(stdin)) != EOF) {
- if (isspace((unsigned char)line[i])) {
- /* avoid adding zero length arg, if multiple spaces separate args */
- if (i > 0) {
- line[i] = '\0';
- targets = alpm_list_add(targets, strdup(line));
- i = 0;
- }
- } else {
- ++i;
- }
-
- if (i >= BUFSIZ) {
- cwr_fprintf(stderr, LOG_ERROR, "buffer overflow detected in stdin\n");
- goto finish;
- }
- }
- /* end of stream -- check for data still in line buffer */
- if (i > 0) {
- line[i] = '\0';
- targets = alpm_list_add(targets, strdup(line));
- }
- if (!freopen(ctermid(NULL), "r", stdin)) {
- cwr_fprintf(stderr, LOG_ERROR, "failed to reopen stdin for reading\n");
- goto finish;
- }
- }
-
cwr_printf(LOG_DEBUG, "initializing curl\n");
if (strcmp(optproto, HTTPS) == 0) {
curl_global_init(CURL_GLOBAL_SSL);
Please sign in to comment.
Something went wrong with that request. Please try again.