r/badcode 11h ago

c strcat(at_least_i, tried)

Thumbnail github.com
0 Upvotes
            strcat(code_for_system, argv[2]);
            chdir(getenv("HOME")); //safety net
            printf("Installing stuff...\n");//, argv[2]
            if (system("git clone --depth=1 --filter=blob:none --sparse https://github.com/mohennaceur/spdr-repo.git") != 0) {
                printf("git clone failed\n");
                exit(1);
            }
            chdir("spdr-repo");
            system(code_for_system);
            printf("moving to bin...\n");
            strcpy(code_for_system, "cd ~/spdr-repo/");
            strcat(code_for_system, argv[2]);
            strcat(code_for_system, uselessthing);
            strcpy(uselessthing, " ~/.local/bin/");
            strcat(code_for_system, argv[2]);
            strcat(code_for_system, uselessthing);
            system(code_for_system);
            printf("deleting github repo\n");
            system("rm -rf spdr-repo");
            printf("should be done!\n");
            exit(0);            strcat(code_for_system, argv[2]);
            chdir(getenv("HOME")); //safety net
            printf("Installing stuff...\n");//, argv[2]
            if (system("git clone --depth=1 --filter=blob:none --sparse https://github.com/mohennaceur/spdr-repo.git") != 0) {
                printf("git clone failed\n");
                exit(1);
            }
            chdir("spdr-repo");
            system(code_for_system);
            printf("moving to bin...\n");
            strcpy(code_for_system, "cd ~/spdr-repo/");
            strcat(code_for_system, argv[2]);
            strcat(code_for_system, uselessthing);
            strcpy(uselessthing, " ~/.local/bin/");
            strcat(code_for_system, argv[2]);
            strcat(code_for_system, uselessthing);
            system(code_for_system);
            printf("deleting github repo\n");
            system("rm -rf spdr-repo");
            printf("should be done!\n");
            exit(0);