From bd083c50264fcefcf4454401793c0dc43e8a3d62 Mon Sep 17 00:00:00 2001 From: Dean Jansa Date: Tue, 13 Sep 2005 21:49:10 +0000 Subject: Clean up printing of file xfers. --- qacp.c | 26 +++++++++++++------------- 1 file changed, 13 insertions(+), 13 deletions(-) diff --git a/qacp.c b/qacp.c index 90185dd..ccfcff8 100644 --- a/qacp.c +++ b/qacp.c @@ -32,6 +32,7 @@ /* Globals */ int qacp_fd = -1; /* The control connection to qacpd */ +short quiet = 0; void usage() @@ -156,6 +157,10 @@ qacp_sendonefile(const char *host, const char *srcfile, const char *destfile) exit(125); } + if (!quiet) { + printf("%-30.30s -> %s:%s\n", srcfile, host, destfile); + } + return; } @@ -246,13 +251,17 @@ qacp_recvonefile(const char *host, const char *srcfile, const char *destfile) close(qacp_fd); exit(125); } + + if (!quiet) { + printf("%s:%s -> %30.30s\n", host, srcfile, destfile); + } return; } int -recvfiles(char **argv, int argc, int fileidx, short recursive, short quiet) +recvfiles(char **argv, int argc, int fileidx, short recursive) { char *cp; char *rhost = NULL; @@ -392,10 +401,6 @@ recvfiles(char **argv, int argc, int fileidx, short recursive, short quiet) free(cp); free(rbnp); } else { - if (!quiet) { - printf("%s:%s -> %30.30s\n", - rhost, rmtpath, destpath); - } qacp_recvonefile(rhost, rmtpath, destpath); } } @@ -416,7 +421,7 @@ recvfiles(char **argv, int argc, int fileidx, short recursive, short quiet) int -sendfiles(char **argv, int argc, int fileidx, short recursive, short quiet) +sendfiles(char **argv, int argc, int fileidx, short recursive) { char *cp; char *rhost = NULL; @@ -526,10 +531,6 @@ sendfiles(char **argv, int argc, int fileidx, short recursive, short quiet) } } - if (!quiet) { - printf("%-30.30s -> %s:%s\n", argv[file], rhost, destpath); - } - qacp_sendonefile(rhost, argv[file], destpath); free(lbnp); @@ -545,7 +546,6 @@ main(int argc, char *argv[]) { int c; short recursive=0; - short quiet=0; int eflag; while ((c = getopt(argc, argv, "+rq")) != -1) { @@ -574,11 +574,11 @@ main(int argc, char *argv[]) eflag = 0; /* If last arg has a ':' then we are sending files */ if (strchr(argv[argc-1], ':') != NULL) { - if (sendfiles(argv, argc, optind, recursive, quiet) < 0) { + if (sendfiles(argv, argc, optind, recursive) < 0) { eflag++; } } else { - if (recvfiles(argv, argc, optind, recursive, quiet) < 0) { + if (recvfiles(argv, argc, optind, recursive) < 0) { eflag++; } } -- cgit