diff --git a/frontend/src/main.c b/frontend/src/main.c index 963ba02..8e30ec2 100644 --- a/frontend/src/main.c +++ b/frontend/src/main.c @@ -49,10 +49,10 @@ static int weak_passphrase(const CHR *str) while (*str) { const CHR c = *str++; - if (iswupper(c)) flags[0U] = 1; - else if (iswlower(c)) flags[1U] = 1; - else if (iswdigit(c)) flags[2U] = 1; - else if (iswgraph(c)) flags[3U] = 1; + if (ISUPPER(c)) flags[0U] = 1; + else if (ISLOWER(c)) flags[1U] = 1; + else if (ISDIGIT(c)) flags[2U] = 1; + else if (ISGRAPH(c)) flags[3U] = 1; } const int strong = flags[0U] && flags[1U] && flags[2U] && flags[3U]; return !strong; @@ -66,11 +66,11 @@ static int encrypt(const CHR* const passphrase, const CHR* const input, const CH if (STRLEN(passphrase) < 8U) { - FPUTS(L"Warning: Using a short passphrase. Eight characters or more are recommended!\n\n", stderr); + FPUTS(T("Warning: Using a short passphrase. Eight characters or more are recommended!\n\n"), stderr); } else if (weak_passphrase(passphrase)) { - FPUTS(L"Warning: Using a weak passphrase. A mix of upper-case characters, lower-case characters, digits and 'special' characters is recommended!\n\n", stderr); + FPUTS(T("Warning: Using a weak passphrase. A mix of upper-case characters, lower-case characters, digits and 'special' characters is recommended!\n\n"), stderr); } char *const passphrase_utf8 = utf16_to_bytes(passphrase, CP_UTF8); @@ -354,8 +354,8 @@ int MAIN(int argc, CHR* argv[]) FPUTS(T("Nothing to do!\n\n"), stderr); } FPUTS(T("Usage:\n"), stderr); - FPRINTF(stderr, T(" %") T(PRIwcs) T(" --encrypt \n"), argv[0U]); - FPRINTF(stderr, T(" %") T(PRIwcs) T(" --decrypt \n\n"), argv[0U]); + FPRINTF(stderr, T(" %") T(PRISTR) T(" --encrypt \n"), argv[0U]); + FPRINTF(stderr, T(" %") T(PRISTR) T(" --decrypt \n\n"), argv[0U]); return 1; } @@ -378,7 +378,7 @@ int MAIN(int argc, CHR* argv[]) } else { - FPRINTF(stderr, T("Error: Command \"%") T(PRIwcs) T("\" is unknown!\n\n"), argv[1U]); + FPRINTF(stderr, T("Error: Command \"%") T(PRISTR) T("\" is unknown!\n\n"), argv[1U]); erase(argv[2U], STRLEN(argv[2U]) * sizeof(CHR)); return 1; } diff --git a/frontend/src/platform.h b/frontend/src/platform.h index fe8efd2..b41a172 100644 --- a/frontend/src/platform.h +++ b/frontend/src/platform.h @@ -18,10 +18,16 @@ #define FILENO(X) _fileno((X)) #define FSTAT64(X,Y) _fstati64((X),(Y)) #define STAT64_T struct _stati64 +#define ISUPPER(X) iswupper((X)) +#define ISLOWER(X) iswlower((X)) +#define ISDIGIT(X) iswdigit((X)) +#define ISGRAPH(X) iswgraph((X)) #ifdef __MINGW32__ +#define PRISTR "ls" #define PRIstr "hs" #define PRIwcs "ls" #else +#define PRISTR "s" #define PRIstr "S" #define PRIwcs "s" #endif @@ -37,6 +43,11 @@ #define FILENO(X) fileno((X)) #define FSTAT64(X,Y) fstat64((X),(Y)) #define STAT64_T struct stat64 +#define ISUPPER(X) isupper((X)) +#define ISLOWER(X) islower((X)) +#define ISDIGIT(X) isdigit((X)) +#define ISGRAPH(X) isgraph((X)) +#define PRISTR "s" #define PRIstr "s" #define PRIwcs "ls" #endif