diff options
author | jozan <jozan@noemail.net> | 2020-11-08 19:08:54 +0000 |
---|---|---|
committer | jozan <jozan@noemail.net> | 2020-11-08 19:08:54 +0000 |
commit | b5881c0c80ec1ad068b3d4013348da30fc53b0ff (patch) | |
tree | 38795db51ed28ba423908a0a2a1357010f65c2d8 /src/u_utils.c | |
parent | rename (diff) | |
download | unixize-b5881c0c80ec1ad068b3d4013348da30fc53b0ff.tar.gz unixize-b5881c0c80ec1ad068b3d4013348da30fc53b0ff.tar.bz2 unixize-b5881c0c80ec1ad068b3d4013348da30fc53b0ff.tar.xz unixize-b5881c0c80ec1ad068b3d4013348da30fc53b0ff.tar.zst unixize-b5881c0c80ec1ad068b3d4013348da30fc53b0ff.zip |
Added an option to subst extensions
FossilOrigin-Name: d1d91b3f86b63666fe96851ba3b2af0e49f3cf00168fc4fa643b278dd8bb51d8
Diffstat (limited to '')
-rw-r--r-- | src/u_utils.c | 31 |
1 files changed, 25 insertions, 6 deletions
diff --git a/src/u_utils.c b/src/u_utils.c index 75406c8..50f21f2 100644 --- a/src/u_utils.c +++ b/src/u_utils.c @@ -99,31 +99,50 @@ static char u_get_extra_args(char args[], struct opts_s* opts) { char i; + char null_char; i = 0; + null_char = 0; args[0] = 0x00; if (opts->hidden == TRUE) { - memcpy((char*)args + (i * 3), "-a:", 4 * sizeof(char)); + memcpy((char*)args + (i * 2), "a:", 3 * sizeof(char)); + null_char += 2; i++; } if (opts->confirm == TRUE) { - memcpy((char*)args + (i * 3), "-i:", 4 * sizeof(char)); + memcpy((char*)args + (i * 2), "i:", 3 * sizeof(char)); + null_char += 2; i++; } if (opts->hyphen == TRUE) { - memcpy((char*)args + (i * 3), "-n:", 4 * sizeof(char)); + memcpy((char*)args + (i * 2), "n:", 3 * sizeof(char)); + null_char += 2; i++; } if (opts->pretend == TRUE) { - memcpy((char*)args + (i * 3), "-p:", 4 * sizeof(char)); + memcpy((char*)args + (i * 2), "p:", 3 * sizeof(char)); + null_char += 2; i++; } if (opts->verbose == TRUE) { - memcpy((char*)args + (i * 3), "-v:", 4 * sizeof(char)); + memcpy((char*)args + (i * 2), "v:", 3 * sizeof(char)); + null_char += 2; i++; } + if (opts->cxx != 0) { + if (opts->cxx == 1) { + memcpy((char*)args + (i * 2), "e1:", 4 * sizeof(char)); + null_char += 3; + i++; + } + else { + memcpy((char*)args + (i * 2), "e2:", 4 * sizeof(char)); + null_char += 3; + i++; + } + } if (i > 0) { - *(args + (i * 3) - 1) = 0x00; + *(args + null_char) = 0x00; } return (i); } |