From 6ec5c94969920975941d5fdb32d3a51515078799 Mon Sep 17 00:00:00 2001 From: Your Name Date: Tue, 17 Oct 2023 16:01:25 +0300 Subject: [PATCH] Yes --- coreutils/cp.c | 14 ++++---------- 1 file changed, 4 insertions(+), 10 deletions(-) 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]); }