The function atoiassumes that the string is a decimal representation of a number. If you want to convert from different databases, use strtol.
mode = strtol(argv[2], NULL, 0);
The third argument indicates the base number. If this value is 0, it will treat the string as hexadecimal if it starts with 0x, octal if it starts with 0, and decimal otherwise.
, , 8.
mode = strtol(argv[2], NULL, 8);