From 6ce608b05e3f811b25122ce4048ab0f07f3a30ed Mon Sep 17 00:00:00 2001 From: Nathan Straz Date: Tue, 1 Oct 2013 15:45:43 -0400 Subject: Clean up command line options and usage We never did support recursive copy and probably never will. --- qacp.c | 28 +++++++++------------------- 1 file changed, 9 insertions(+), 19 deletions(-) diff --git a/qacp.c b/qacp.c index f441e07..cf76652 100644 --- a/qacp.c +++ b/qacp.c @@ -67,13 +67,9 @@ lprintf(int priority, const char *format, ...) void usage() { -/* printf("usage: qacp: [-r] [[user@]host1:]file1 [...] " */ - /* "[[user@]host2:]file2\n"); */ - - /* For now, only simple cmdlines */ - fprintf(stderr, "usage:\n\t%s\n\t%s\n", - "qacp [ ...] [user@]host:", - "qacp [user@]host: [[user@]host: ...] "); + fprintf(stderr, "usage:\n" \ + "\tqacp [-q] [ ...] [user@]host:\n" + "\tqacp [-q] [user@]host: [[user@]host: ...] \n"); } @@ -361,7 +357,7 @@ qacp_recvonefile(const char *host, const char *srcfile, const char *destfile) int -recvfiles(char **argv, int argc, int fileidx, short recursive) +recvfiles(char **argv, int argc, int fileidx) { char *cp; char *rhost = NULL; @@ -528,7 +524,7 @@ error_free_destpath: int -sendfiles(char **argv, int argc, int fileidx, short recursive) +sendfiles(char **argv, int argc, int fileidx) { char *cp; char *rhost = NULL; @@ -653,22 +649,16 @@ int main(int argc, char *argv[]) { int c; - short recursive=0; int eflag; - while ((c = getopt(argc, argv, "+rq")) != -1) { + while ((c = getopt(argc, argv, "+qh")) != -1) { switch (c) { - case 'r': - fprintf(stderr, "-r not supported\n"); - exit(2); - recursive = 1; - break; case 'q': quiet = 1; break; case '?': + case 'h': default: - printf("Unknown option %c\n", (char)optopt); usage(); exit(1); } @@ -682,11 +672,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) < 0) { + if (sendfiles(argv, argc, optind) < 0) { eflag++; } } else { - if (recvfiles(argv, argc, optind, recursive) < 0) { + if (recvfiles(argv, argc, optind) < 0) { eflag++; } } -- cgit