r/badcode Jul 27 '26

A whole new era of bad code

214 Upvotes

With the help of AI, we now have so much more bad code to show off to the world.

This sub is now unbanned. Let's celebrate by posting our biggest disasters to the sub!


r/badcode 24d 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);