diff --git a/coreutils/cp.c b/coreutils/cp.c index 5594746..79cf0c6 100644 --- a/coreutils/cp.c +++ b/coreutils/cp.c @@ -108,16 +108,10 @@ int cptree(const char *src, const char *dst) { } int main(const int argc, const char **argv) { - int i; - for (i = 1; i < argc; i++) { - if (argv[i][0] != '-') - break; - - else if (!strcmp(argv[i], "-h")) { - printf("cp [Src] [Dst]\n"); - return 0; - } + if (argc < 2 || !strcmp(argv[1], "-h")) { + printf("cp [Src] [Dst]\n"); + return 0; } - return cptree(argv[i], argv[argc - 1]); + return cptree(argv[1], argv[2]); }