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 fc8f01a..0000000 Binary files a/debutils/mandoc/pmt.1.gz and /dev/null differ diff --git a/debutils/mandoc/pmt.8.gz b/debutils/mandoc/pmt.8.gz new file mode 100755 index 0000000..4ffb9e2 Binary files /dev/null and b/debutils/mandoc/pmt.8.gz differ 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