summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorNathan Straz <nstraz@redhat.com>2013-10-01 15:45:43 -0400
committerNathan Straz <nstraz@redhat.com>2013-10-02 14:11:34 -0400
commit6ce608b05e3f811b25122ce4048ab0f07f3a30ed (patch)
tree2a8de5ed602dc6b1bfdbc5a757c379684e1afc19
parent06c18e4fd532d9f0b8b4b0196949fb60279e2c27 (diff)
downloadqarsh-6ce608b05e3f811b25122ce4048ab0f07f3a30ed.zip
qarsh-6ce608b05e3f811b25122ce4048ab0f07f3a30ed.tar.gz
qarsh-6ce608b05e3f811b25122ce4048ab0f07f3a30ed.tar.xz
Clean up command line options and usage
We never did support recursive copy and probably never will.
-rw-r--r--qacp.c28
1 files 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 <localpath> [<loacalpath> ...] [user@]host:<rmtpath>",
- "qacp [user@]host:<rmtpath> [[user@]host:<rmtpath> ...] <localpath> ");
+ fprintf(stderr, "usage:\n" \
+ "\tqacp [-q] <localpath> [<loacalpath> ...] [user@]host:<rmtpath>\n"
+ "\tqacp [-q] [user@]host:<rmtpath> [[user@]host:<rmtpath> ...] <localpath>\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++;
}
}