In the case above, where you need two sections for the positive cable, the 'second' part, from the starter relay to the starter, generally does not get much damage from acid, etc, so should be in good shape. If that's the case, you only need to find a positive cable to reach from the battery terminal to the input terminal on the relay.
If you can't measure that part, you could buy a selection of different lengths, and then at your leisure remove the old cable, compare lengths, and install the one which fits best, then return the cables that you found were to long or short for your use.
If your second cable is damaged, you could do the same thing to select a cable of proper length.
Cable terminals are available that can be used for ring or battery post connection, and you might just shorten your current cables and install new fittings. Some require use of a really big soldering iron or a torch to heat the solder & fitting so you can fill the terminal opening with solder all around the cable wires, while others depend on crimping to hold the wires into the cable. If you do replace the terminals, it might be a good idea to swish the cables around in a mixture of water and baking soda. Doing so would neutralize any battery acid that had misted or wicked its way up into the cable(past the obvious damage area). You would also want to seal the exposed wire with heat shrink or if you cannot, at least gooze a blob of grease onto the wires to prevent more acid action. FLA batteries seem to all mist out a bit of acid as they operate, and you likely will find acid on the top and perhaps sides of the battery itself. Using a paper towel dipped into the baking soda/water mixture to wipe the top and sides of the battery will reduce the acid effect for a while. The battery box likely has acid in it also. Use the same mixture to slosh out the acid in it, and remove the rust, etc, and paint as you see fit to slow down the corrosion.
I have the original cables in my old truck, and have always blobbed some grease onto them, or sprayed with some lube(WD-40 will work, but won't last, so I used other lubes that have more body) to keep them from corroding. Every now and then squirt some goo onto them and they'll last the life of the truck.
tom