forked from wbenny/mini-tor
-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathfix_bcrypt_includes.sh
More file actions
executable file
·30 lines (23 loc) · 1.27 KB
/
fix_bcrypt_includes.sh
File metadata and controls
executable file
·30 lines (23 loc) · 1.27 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
#!/bin/bash
# Script pour ajouter des gardes conditionnels autour des inclusions de bcrypt.h
# Trouver tous les fichiers qui incluent bcrypt.h
FILES=$(grep -l "#include <bcrypt.h>" --include="*.h" --include="*.cpp" -r ./mini)
for FILE in $FILES; do
echo "Processing $FILE"
# Vérifier si le fichier contient déjà MINI_OS_WINDOWS
if grep -q "MINI_OS_WINDOWS" "$FILE"; then
# Vérifier si bcrypt.h est déjà dans un bloc conditionnel
if grep -A1 "#ifdef MINI_OS_WINDOWS" "$FILE" | grep -q "bcrypt.h"; then
echo " bcrypt.h already in conditional block, skipping"
continue
fi
# Remplacer l'inclusion directe par une inclusion conditionnelle
sed -i 's/#include <bcrypt.h>/#ifdef MINI_OS_WINDOWS\n#include <bcrypt.h>\n#else\n\/\/ Linux\/OpenSSL equivalent headers\n#include <openssl\/rsa.h>\n#include <openssl\/pem.h>\n#endif/g' "$FILE"
else
# Ajouter l'inclusion de win32_compat.h et les gardes conditionnels
sed -i '/#include <bcrypt.h>/i #include <mini/win32_compat.h>\n\n#ifdef MINI_OS_WINDOWS' "$FILE"
sed -i 's/#include <bcrypt.h>/#include <bcrypt.h>\n#else\n\/\/ Linux\/OpenSSL equivalent headers\n#include <openssl\/rsa.h>\n#include <openssl\/pem.h>\n#endif/g' "$FILE"
fi
echo " Updated $FILE"
done
echo "Done processing files"