This makes no sense.  You use the *total* number of arguments (from cf-upgrade's command-line) as the size of a buffer, to which you're only going to write the upgrade command's number of arguments - and, just to confuse me some more, you'll be storing *the latter* in a variable named "total" !  Not to be confused with the else clause's quite different situation on this !