dedup

deduplicating backup program
git clone git://git.2f30.org/dedup.git
Log | Files | Refs | README | LICENSE

commit 05e0a550a54729efb11fb50d5259312dc9d58dab
parent c047a4a58e9abda33685cce531c0e7386cf35290
Author: sin <sin@2f30.org>
Date:   Thu,  2 May 2019 15:44:39 +0100

Make bparams case-insensitive

Diffstat:
Mbcompress.c | 9+++++----
Mbencrypt.c | 9+++++----
Mbstorage.c | 9+++++----
3 files changed, 15 insertions(+), 12 deletions(-)

diff --git a/bcompress.c b/bcompress.c @@ -8,6 +8,7 @@ #include <stdio.h> #include <stdlib.h> #include <string.h> +#include <strings.h> #include <unistd.h> #include <snappy-c.h> @@ -92,9 +93,9 @@ bccreat(struct bctx *bctx, char *path, int mode, struct bparam *bpar) struct bops *bops; int type; - if (strcmp(bpar->calgo, "none") == 0) + if (strcasecmp(bpar->calgo, "none") == 0) type = CDNONETYPE; - else if (strcmp(bpar->calgo, "snappy") == 0) + else if (strcasecmp(bpar->calgo, "snappy") == 0) type = CDSNAPPYTYPE; else return -1; @@ -130,9 +131,9 @@ bcopen(struct bctx *bctx, char *path, int flags, int mode, struct bparam *bpar) return -1; } - if (strcmp(bpar->calgo, "none") == 0) { + if (strcasecmp(bpar->calgo, "none") == 0) { cctx->type = CDNONETYPE; - } else if (strcmp(bpar->calgo, "snappy") == 0) { + } else if (strcasecmp(bpar->calgo, "snappy") == 0) { cctx->type = CDSNAPPYTYPE; } else { bops->close(bctx); diff --git a/bencrypt.c b/bencrypt.c @@ -8,6 +8,7 @@ #include <stdio.h> #include <stdlib.h> #include <string.h> +#include <strings.h> #include <unistd.h> #include <sodium.h> @@ -97,9 +98,9 @@ becreat(struct bctx *bctx, char *path, int mode, struct bparam *bpar) struct bops *bops; int type; - if (strcmp(bpar->ealgo, "none") == 0) + if (strcasecmp(bpar->ealgo, "none") == 0) type = EDNONETYPE; - else if (strcmp(bpar->ealgo, "XChaCha20-Poly1305") == 0) + else if (strcasecmp(bpar->ealgo, "XChaCha20-Poly1305") == 0) type = EDCHACHATYPE; else return -1; @@ -145,9 +146,9 @@ beopen(struct bctx *bctx, char *path, int flags, int mode, struct bparam *bpar) return -1; } - if (strcmp(bpar->ealgo, "none") == 0) + if (strcasecmp(bpar->ealgo, "none") == 0) ectx->type = EDNONETYPE; - else if (strcmp(bpar->ealgo, "XChaCha20-Poly1305") == 0) + else if (strcasecmp(bpar->ealgo, "XChaCha20-Poly1305") == 0) ectx->type = EDCHACHATYPE; else { bops->close(bctx); diff --git a/bstorage.c b/bstorage.c @@ -18,6 +18,7 @@ #include <stdio.h> #include <stdlib.h> #include <string.h> +#include <strings.h> #include <unistd.h> #include <sodium.h> @@ -314,9 +315,9 @@ bscreat(struct bctx *bctx, char *path, int mode, struct bparam *bpar) bhdr->flags = (VMAJ << VMAJSHIFT) | VMIN; /* Set compression type */ - if (strcmp(bpar->calgo, "none") == 0) { + if (strcasecmp(bpar->calgo, "none") == 0) { bhdr->flags |= CNONETYPE << CALGOSHIFT; - } else if (strcmp(bpar->calgo, "snappy") == 0) { + } else if (strcasecmp(bpar->calgo, "snappy") == 0) { bhdr->flags |= CSNAPPYTYPE << CALGOSHIFT; } else { free(sctx); @@ -325,9 +326,9 @@ bscreat(struct bctx *bctx, char *path, int mode, struct bparam *bpar) } /* Set encryption type */ - if (strcmp(bpar->ealgo, "none") == 0) { + if (strcasecmp(bpar->ealgo, "none") == 0) { bhdr->flags |= ENONETYPE << EALGOSHIFT; - } else if (strcmp(bpar->ealgo, "XChaCha20-Poly1305") == 0) { + } else if (strcasecmp(bpar->ealgo, "XChaCha20-Poly1305") == 0) { bhdr->flags |= ECHACHATYPE << EALGOSHIFT; } else { free(sctx);