From 99ecb9daf3bb2e667016f0ed94a5508379fbc66a Mon Sep 17 00:00:00 2001 From: YZ-Bruh Date: Mon, 10 Jun 2024 06:28:01 +0300 Subject: [PATCH] Make some corrections. --- .../files/usr/share/man/{man1 => man8}/dummy | 0 debutils/mandoc/pmt.1.gz | Bin 889 -> 0 bytes debutils/mandoc/pmt.8.gz | Bin 0 -> 1118 bytes jni/Android.mk | 2 +- jni/docs.c | 4 +-- jni/include/pmt-docs.h | 12 +++---- jni/include/pmt-versioning.h | 8 ++--- jni/include/pmt.h | 16 ++++----- jni/listpart.c | 2 +- jni/partition_tool.c | 4 ++- jni/pmt.c | 2 +- jni/root.c | 2 +- jni/tools.c | 6 ++-- jni/versioner.c | 2 +- make-deb.sh | 34 +++++++++--------- 15 files changed, 42 insertions(+), 52 deletions(-) rename debutils/data/data/com.termux/files/usr/share/man/{man1 => man8}/dummy (100%) delete mode 100755 debutils/mandoc/pmt.1.gz create mode 100755 debutils/mandoc/pmt.8.gz diff --git a/debutils/data/data/com.termux/files/usr/share/man/man1/dummy b/debutils/data/data/com.termux/files/usr/share/man/man8/dummy similarity index 100% rename from debutils/data/data/com.termux/files/usr/share/man/man1/dummy rename to debutils/data/data/com.termux/files/usr/share/man/man8/dummy diff --git a/debutils/mandoc/pmt.1.gz b/debutils/mandoc/pmt.1.gz deleted file mode 100755 index fc8f01ad7c3cd8fdeaae1571b7b111ad47a07cae..0000000000000000000000000000000000000000 GIT binary patch literal 0 HcmV?d00001 literal 889 zcmV-<1BUz`iwFqB@LFaB18{A0E-?V5Ro`#ZFc5yvUvb(KNNWOvCqPIk1c>M_H7PLI zgdE37ttGaxon`&+IXi9X+9Dybhc1r4`|j?$@7nO@0>&G-{yx^-ItbkHom3mm>$Qce zXIC#_LA2$TO94|NNX@hZdEkUoCJZZ~6D8AN*9>AsDE`~tT*4QojSIaBpTQFcxY%A@ zJbmpsHnM}3Y(Pj0onc7A4OF~gz#b@57PtT^Th(wPD1)BcwNJFA2|da6mP8hoAf8}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*7L+ECn_c znhAbLY#?J4p@~?hrBTnR5%Tj5KgrOKC2;TNxw%pyV$dTHh5e2x(-u8TfoYfE5bb)1 z){(x)GrO{TL{N#iVcgEdsk(VNq;*4mep*^PG^fVhBkVxS*}Lh*YCb!zvv!kFD1`pR zXc7&3S>;Td3VTM1XW$(AYyEc+?R0r6j+l%+-N?!sxLJ|@AFgdKzH;;fQhTL&VUUhn zZJ_zj@W$M1G*gM`CBFaG&c^&;IJ83~2gn^}KICRYbejTW-~Py20ON)*SO5S3 literal 0 HcmV?d00001 diff --git a/jni/Android.mk b/jni/Android.mk index 5a2aeda..1ca6def 100755 --- a/jni/Android.mk +++ b/jni/Android.mk @@ -46,4 +46,4 @@ endif include $(BUILD_EXECUTABLE) -# end \ No newline at end of file +# end diff --git a/jni/docs.c b/jni/docs.c index dee9ac0..6124714 100755 --- a/jni/docs.c +++ b/jni/docs.c @@ -25,7 +25,7 @@ extern "C" { extern char* bin_name; -void licenses() +void licenses(void) { printf("Copyright 2024 Partition Manager\n"); printf("Licensed under the Apache License, Version 2.0 (the \"License\");\n"); @@ -38,7 +38,7 @@ void licenses() printf("See the License for the specific language governing permissions and limitations under the License.\n"); } -void help() +void help(void) { printf("Usage: \n"); printf(" %s backup PARTITION [OUTPUT] [OPTIONS]...\n", bin_name); diff --git a/jni/include/pmt-docs.h b/jni/include/pmt-docs.h index 91c4aa6..988b0f6 100755 --- a/jni/include/pmt-docs.h +++ b/jni/include/pmt-docs.h @@ -16,15 +16,11 @@ * limitations under the License. */ -#if defined(__cplusplus) -extern "C" { -#endif /* __cplusplus */ +__BEGIN_DECLS -void help(); -void licenses(); +void help(void); +void licenses(void); -#if defined(__cplusplus) -} -#endif /* __cplusplus */ +__END_DECLS /* end */ \ No newline at end of file diff --git a/jni/include/pmt-versioning.h b/jni/include/pmt-versioning.h index 43055be..4b86822 100755 --- a/jni/include/pmt-versioning.h +++ b/jni/include/pmt-versioning.h @@ -16,17 +16,13 @@ * limitations under the License. */ -#if defined(__cplusplus) -extern "C" { -#endif /* __cplusplus */ +__BEGIN_DECLS /* versioning */ #define PMT_MAJOR 2 #define PMT_MINOR 1 #define PMT_PATCHLEVEL 0 -#if defined(__cplusplus) -} -#endif /* __cplusplus */ +__END_DECLS /* end */ \ No newline at end of file diff --git a/jni/include/pmt.h b/jni/include/pmt.h index c8c0ea6..005ad28 100755 --- a/jni/include/pmt.h +++ b/jni/include/pmt.h @@ -16,9 +16,7 @@ * limitations under the License. */ -#if defined(__cplusplus) -extern "C" { -#endif +__BEGIN_DECLS #if !defined(__PMT_H_) #define __PMT_H_ @@ -50,16 +48,14 @@ extern bool pmt_format; extern bool pmt_force_mode; /* function definations */ -int listpart(); -void check_dev_point(); -void check_root(); +int listpart(void); +void check_dev_point(void); +void check_root(void); int pmt(unsigned short progress_code); -void version(); +void version(void); #endif /* __PMT_H_ */ -#if defined(__cplusplus) -} -#endif /* __cplusplus */ +__END_DECLS /* end of code */ diff --git a/jni/listpart.c b/jni/listpart.c index 82605c9..0cf6dff 100755 --- a/jni/listpart.c +++ b/jni/listpart.c @@ -40,7 +40,7 @@ extern char* cust_cxt; extern char* bin_name; /* list existing partitions */ -int listpart() { +int listpart(void) { DIR *dir; struct dirent *entry; diff --git a/jni/partition_tool.c b/jni/partition_tool.c index b9e8fa3..df1f79f 100755 --- a/jni/partition_tool.c +++ b/jni/partition_tool.c @@ -68,4 +68,6 @@ void check_dev_point() #if defined(__cplusplus) } -#endif /* __cplusplus */ \ No newline at end of file +#endif /* __cplusplus */ + +/* end */ \ No newline at end of file diff --git a/jni/pmt.c b/jni/pmt.c index 1ef7686..19ddd81 100755 --- a/jni/pmt.c +++ b/jni/pmt.c @@ -205,7 +205,7 @@ int main(int argc, char* argv[]) break; default: printf("Usage: %s [backup] flash] [format] [-l | --logical] [-c | --context] [-D | --list] [-v | --version] [--help] [-L | --license]\n", argv[0]); - exit(EX_USAGE); + return EX_USAGE; } } diff --git a/jni/root.c b/jni/root.c index 45d3cc5..caf0f26 100755 --- a/jni/root.c +++ b/jni/root.c @@ -29,7 +29,7 @@ extern "C" { #include /* root checker function */ -void check_root() +void check_root(void) { /* a quick, easy method to verify root */ if (getuid() != 0) diff --git a/jni/tools.c b/jni/tools.c index 7a5347b..eb65595 100755 --- a/jni/tools.c +++ b/jni/tools.c @@ -84,7 +84,7 @@ calc_flsz(const char* _Nonnull filepath) * It's for quick action. */ static int -partition_not_found() +partition_not_found(void) { if (!pmt_silent) errx(EX_OSFILE, "partition not found!"); else return EX_OSFILE; @@ -95,7 +95,7 @@ partition_not_found() * It's for quick action. */ static int -invalid_partition_type() +invalid_partition_type(void) { if (!pmt_silent) errx(EX_USAGE, "invalid partition type!"); else exit(EX_USAGE); @@ -142,7 +142,7 @@ search_stat(const char* _Nonnull filepath, const char* _Nonnull stype) else return -1; } - return 0; + return 2; } /* the partitions are meant to quickly find. */ diff --git a/jni/versioner.c b/jni/versioner.c index 46311e6..0fed1d9 100755 --- a/jni/versioner.c +++ b/jni/versioner.c @@ -26,7 +26,7 @@ extern "C" { extern char* bin_name; -void version() +void version(void) { printf("%s version %d.%d.%d (code %d%d%d) ", bin_name, PMT_MAJOR, PMT_MINOR, PMT_PATCHLEVEL, PMT_MAJOR, PMT_MINOR, PMT_PATCHLEVEL); diff --git a/make-deb.sh b/make-deb.sh index a764c4a..677b29d 100755 --- a/make-deb.sh +++ b/make-deb.sh @@ -19,13 +19,23 @@ RED='\e[31m' NC='\e[0m' +# needed variables +VERSION="2.1.0" +CUR_DIR=$(pwd) +LIB_DIR=${CUR_DIR}/libs +ARMV8A_DIR=${LIB_DIR}/arm64-v8a +ARMV7A_DIR=${LIB_DIR}/armeabi-v7a +DEB_DIR=${CUR_DIR}/deb +DEBUTILS_DIR=${CUR_DIR}/debutils +DEBTERMUX_USR=${DEBUTILS_DIR}/data/data/com.termux/files/usr + # error messages abort() { if [ ! "$1" = "" ]; then printf "${RED}${1}${NC}\n" fi if [ -d ${DEBUTILS_DIR}/temp ]; then - rm -rf ${DEB_DIR}/temp + rm -rf ${DEBUTILS_DIR}/temp fi exit 1 } @@ -55,16 +65,6 @@ case "$2" in SUDO="" esac -# variables -VERSION="2.1.0" -CUR_DIR=$(pwd) -LIB_DIR=${CUR_DIR}/libs -ARMV8A_DIR=${LIB_DIR}/arm64-v8a -ARMV7A_DIR=${LIB_DIR}/armeabi-v7a -DEB_DIR=${CUR_DIR}/deb -DEBUTILS_DIR=${CUR_DIR}/debutils -DEBTERMUX_USR=${DEBUTILS_DIR}/data/data/com.termux/files/usr - # set file modes (all) to 755 ${SUDO} chmod -R 755 * @@ -92,11 +92,11 @@ fi if [ ! -d ${DEBUTILS_DIR}/data/data/com.termux/files/usr/bin ]; then abort " - Not found: ${DEBUTILS_DIR}/data/data/com.termux/files/usr/bin\n" fi -if [ ! -d ${DEBUTILS_DIR}/data/data/com.termux/files/usr/share/man/man1 ]; then - abort " - Not found: ${DEBUTILS_DIR}/data/data/com.termux/files/usr/share/man/man1\n" +if [ ! -d ${DEBUTILS_DIR}/data/data/com.termux/files/usr/share/man/man8 ]; then + abort " - Not found: ${DEBUTILS_DIR}/data/data/com.termux/files/usr/share/man/man8\n" fi -if [ ! -f ${DEBUTILS_DIR}/mandoc/pmt.1 ]; then - abort " - Not found: ${DEBUTILS_DIR}/mandoc/pmt.1\n" +if [ ! -f ${DEBUTILS_DIR}/mandoc/pmt.8.gz ]; then + abort " - Not found: ${DEBUTILS_DIR}/mandoc/pmt.8.gz\n" fi if [ ! -f ${DEBUTILS_DIR}/DEBIAN/control_32 ]; then abort " - Not found: ${DEBUTILS_DIR}/DEBIAN/control_32\n" @@ -121,14 +121,14 @@ ${SUDO} mkdir -p ${DEB_DIR} || abort # copy files printf " - Copying files...\n" ${SUDO} cp -r ${DEBUTILS_DIR}/data ${DEBUTILS_DIR}/temp || abort -${SUDO} rm -f ${DEBTERMUX_USR}/share/man/man1/dummy +${SUDO} rm -f ${DEBTERMUX_USR}/share/man/man8/dummy ${SUDO} rm -f ${DEBTERMUX_USR}/bin/dummy ${SUDO} mkdir -p ${DEBUTILS_DIR}/temp/DEBIAN || abort # select control file printf " - Selected arm-${PREFIX} package control file.\n" ${SUDO} cp ${DEBUTILS_DIR}/DEBIAN/control_${PREFIX} ${DEBUTILS_DIR}/temp/DEBIAN/control || exit 1 -${SUDO} cp ${DEBUTILS_DIR}/mandoc/pmt.1.gz ${DEBTERMUX_USR}/share/man/man1 || abort +${SUDO} cp ${DEBUTILS_DIR}/mandoc/pmt.8.gz ${DEBTERMUX_USR}/share/man/man8 || abort if [ "${PREFIX}" = "64" ]; then ${SUDO} cp ${ARMV8A_DIR}/pmt ${DEBTERMUX_USR}/bin || abort elif [ "${PREFIX}" = "32" ]; then