pmt: initial 2.5.0 update
This commit is contained in:
99
include/pmt/deprecates.h
Executable file
99
include/pmt/deprecates.h
Executable file
@@ -0,0 +1,99 @@
|
||||
/* By YZBruh */
|
||||
|
||||
/**
|
||||
* Copyright 2024 Partition Manager
|
||||
*
|
||||
* Licensed under the Apache License, Version 2.0 (the "License");
|
||||
* you may not use this file except in compliance with the License.
|
||||
* You may obtain a copy of the License at
|
||||
*
|
||||
* http://www.apache.org/licenses/LICENSE-2.0
|
||||
*
|
||||
* Unless required by applicable law or agreed to in writing, software
|
||||
* distributed under the License is distributed on an "AS IS" BASIS,
|
||||
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
||||
* See the License for the specific language governing permissions and
|
||||
* limitations under the License.
|
||||
*/
|
||||
|
||||
#ifndef __PMT_DEPRECATED_H
|
||||
#define __PMT_DEPRECATED_H
|
||||
|
||||
#include <sys/cdefs.h>
|
||||
|
||||
__BEGIN_DECLS
|
||||
|
||||
#define deprecated_opt 1
|
||||
#define changed_opt 2
|
||||
#define end_depr_pointer 0
|
||||
#define not_changed 0
|
||||
#define not_changed_long NULL
|
||||
|
||||
/* versions */
|
||||
#define v150 "1.5.0"
|
||||
#define v160 "1.6.0"
|
||||
#define v170 "1.7.0"
|
||||
#define v180 "1.8.0"
|
||||
#define v190 "1.9.0"
|
||||
#define v200 "2.0.0"
|
||||
#define v210 "2.1.0"
|
||||
#define v220 "2.2.0"
|
||||
#define v230 "2.3.0"
|
||||
#define v240 "2.4.0"
|
||||
#define v250 "2.5.0"
|
||||
#define vUNK NULL
|
||||
|
||||
struct pmt_deprecates {
|
||||
int depr_type;
|
||||
int option;
|
||||
int option_new;
|
||||
const char* option_long;
|
||||
const char* option_long_new;
|
||||
const char* depr_version;
|
||||
};
|
||||
|
||||
static void
|
||||
__deprecated_opt_handle(int opt, const char* opt_long, const char* depr_msg)
|
||||
{
|
||||
static char long_e_msg[250];
|
||||
|
||||
static struct pmt_deprecates depr_table[] = {
|
||||
{deprecated_opt, 'b', not_changed, "backup", not_changed_long, v210},
|
||||
{deprecated_opt, 'F', not_changed, "flash", not_changed_long, v210},
|
||||
{deprecated_opt, 'r', not_changed, "format", not_changed_long, v210},
|
||||
{deprecated_opt, 'L', not_changed, "license", not_changed_long, v250},
|
||||
{changed_opt, 'D', 'p', "list", not_changed_long, v210},
|
||||
{end_depr_pointer, not_changed, not_changed, not_changed_long, not_changed_long, vUNK}
|
||||
};
|
||||
|
||||
if (opt_long == NULL)
|
||||
sprintf(long_e_msg, "%s", current->not_changed_opt);
|
||||
else
|
||||
sprintf(long_e_msg, "%s", opt_long);
|
||||
|
||||
for (int optctrl = 0; depr_table[optctrl].depr_type != 0; optctrl++)
|
||||
{
|
||||
|
||||
if (depr_table[optctrl].depr_type == 1)
|
||||
{
|
||||
if (opt == depr_table[optctrl].option || strcmp(opt_long, depr_table[optctrl].option_long) == 0)
|
||||
LOGD("%s [%s]: -%c (%s): %s\n", current->depr_opt_str, depr_table[optctrl].depr_version, (char)depr_table[optctrl].option, depr_table[optctrl].option_long, depr_msg);
|
||||
|
||||
}
|
||||
else if (depr_table[optctrl].depr_type == 2)
|
||||
{
|
||||
if (opt == depr_table[optctrl].option || strcmp(opt_long, depr_table[optctrl].option_long) == 0)
|
||||
LOGD("%s [%s]: -%c (%s): %s\n", current->switched_opt_str, depr_table[optctrl].depr_version, (char)depr_table[optctrl].option, long_e_msg, depr_msg);
|
||||
|
||||
}
|
||||
|
||||
}
|
||||
}
|
||||
|
||||
#define DEPR_HANDLE(x, y, z) __deprecated_opt_handle(x, y, z)
|
||||
|
||||
__END_DECLS
|
||||
|
||||
#endif
|
||||
|
||||
/* end of code */
|
||||
30
include/pmt/docs.h
Executable file
30
include/pmt/docs.h
Executable file
@@ -0,0 +1,30 @@
|
||||
/* By YZBruh */
|
||||
|
||||
/*
|
||||
* Copyright 2024 Partition Manager
|
||||
*
|
||||
* Licensed under the Apache License, Version 2.0 (the "License");
|
||||
* you may not use this file except in compliance with the License.
|
||||
* You may obtain a copy of the License at
|
||||
*
|
||||
* http://www.apache.org/licenses/LICENSE-2.0
|
||||
*
|
||||
* Unless required by applicable law or agreed to in writing, software
|
||||
* distributed under the License is distributed on an "AS IS" BASIS,
|
||||
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
||||
* See the License for the specific language governing permissions and
|
||||
* limitations under the License.
|
||||
*/
|
||||
|
||||
#ifndef __PMT_DOCS_H
|
||||
#define __PMT_DOCS_H
|
||||
|
||||
__BEGIN_DECLS
|
||||
|
||||
void help(void);
|
||||
|
||||
__END_DECLS
|
||||
|
||||
#endif
|
||||
|
||||
/* end */
|
||||
1
include/pmt/generated/clang-version.h
Executable file
1
include/pmt/generated/clang-version.h
Executable file
@@ -0,0 +1 @@
|
||||
#define __NDK_CC_VERSION__ ""
|
||||
116
include/pmt/pmt.h
Executable file
116
include/pmt/pmt.h
Executable file
@@ -0,0 +1,116 @@
|
||||
/* By YZBruh */
|
||||
|
||||
/**
|
||||
* Copyright 2024 Partition Manager
|
||||
*
|
||||
* Licensed under the Apache License, Version 2.0 (the "License");
|
||||
* you may not use this file except in compliance with the License.
|
||||
* You may obtain a copy of the License at
|
||||
*
|
||||
* http://www.apache.org/licenses/LICENSE-2.0
|
||||
*
|
||||
* Unless required by applicable law or agreed to in writing, software
|
||||
* distributed under the License is distributed on an "AS IS" BASIS,
|
||||
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
||||
* See the License for the specific language governing permissions and
|
||||
* limitations under the License.
|
||||
*/
|
||||
|
||||
#include <sys/cdefs.h>
|
||||
|
||||
__BEGIN_DECLS
|
||||
|
||||
#ifndef __PMT_H_
|
||||
#define __PMT_H_
|
||||
|
||||
#define PMT_PACKAGE_NAME "Partition Manager"
|
||||
|
||||
#ifdef INC_MAIN_LIBS
|
||||
#include <stdio.h>
|
||||
#include <stdbool.h>
|
||||
#include <unistd.h>
|
||||
#include <fcntl.h>
|
||||
#include <stdlib.h>
|
||||
#include <stdarg.h>
|
||||
#include <string.h>
|
||||
#endif
|
||||
|
||||
#ifdef INC_GETOPT
|
||||
#include <getopt.h>
|
||||
#endif
|
||||
|
||||
#ifdef INC_DIRENT
|
||||
#include <dirent.h>
|
||||
#endif
|
||||
|
||||
#ifdef INC_STAT
|
||||
#include <sys/stat.h>
|
||||
#endif
|
||||
|
||||
#ifdef INC_DEBUGERS
|
||||
#include <errno.h>
|
||||
#endif
|
||||
|
||||
#ifdef INC_TOOLS_REQS
|
||||
#include <fcntl.h>
|
||||
#include <sys/statvfs.h>
|
||||
#endif
|
||||
|
||||
/* variable definations */
|
||||
extern char* _Nullable out;
|
||||
extern char* _Nullable cust_cxt;
|
||||
extern char* _Nullable target_partition;
|
||||
extern char* _Nullable target_flash_file;
|
||||
extern char* _Nullable format_fs;
|
||||
extern char* _Nullable partition_type;
|
||||
extern char* _Nullable bin_name;
|
||||
extern bool pmt_use_logical;
|
||||
extern bool pmt_use_cust_cxt;
|
||||
extern bool pmt_ab;
|
||||
extern bool pmt_logical;
|
||||
extern bool pmt_silent;
|
||||
extern bool pmt_flash;
|
||||
extern bool pmt_backup;
|
||||
extern bool pmt_format;
|
||||
extern bool pmt_force_mode;
|
||||
extern bool pmt_inst_on_termux;
|
||||
|
||||
/* language struces configurations */
|
||||
extern struct pmt_langdb_general* _Nullable current;
|
||||
extern struct pmt_langdb_docs* _Nullable curr_docs;
|
||||
extern struct pmt_langdb_general en;
|
||||
extern struct pmt_langdb_general tr;
|
||||
extern struct pmt_langdb_docs en_docs;
|
||||
extern struct pmt_langdb_docs tr_docs;
|
||||
|
||||
/* logging levels */
|
||||
typedef enum {
|
||||
LOG_LEVEL_FATAL,
|
||||
LOG_LEVEL_ERR,
|
||||
LOG_LEVEL_WARN,
|
||||
LOG_LEVEL_DEBUG
|
||||
} LogLevel;
|
||||
|
||||
/* function definations */
|
||||
int listpart(void);
|
||||
void check_dev_point(void);
|
||||
void check_root(void);
|
||||
int pmt(unsigned short progress_code);
|
||||
void version(void);
|
||||
void setlang(const char* _Nonnull lang, int null_conf_stat);
|
||||
int search_sls(void);
|
||||
int loadlang(void);
|
||||
int get_stat(const char* _Nonnull filepath, const char* _Nonnull stype);
|
||||
void debug(LogLevel status, const char* _Nullable fmt, ...);
|
||||
|
||||
/* logging macros */
|
||||
#define LOGF(fmt, ...) debug(LOG_LEVEL_FATAL, fmt, ##__VA_ARGS__)
|
||||
#define LOGE(fmt, ...) debug(LOG_LEVEL_ERR, fmt, ##__VA_ARGS__)
|
||||
#define LOGW(fmt, ...) debug(LOG_LEVEL_WARN, fmt, ##__VA_ARGS__)
|
||||
#define LOGD(fmt, ...) debug(LOG_LEVEL_DEBUG, fmt, ##__VA_ARGS__)
|
||||
|
||||
#endif
|
||||
|
||||
__END_DECLS
|
||||
|
||||
/* end of code */
|
||||
119
include/pmt/stringkeys.h
Executable file
119
include/pmt/stringkeys.h
Executable file
@@ -0,0 +1,119 @@
|
||||
/* By YZBruh */
|
||||
|
||||
/**
|
||||
* Copyright 2024 Partition Manager
|
||||
*
|
||||
* Licensed under the Apache License, Version 2.0 (the "License");
|
||||
* you may not use this file except in compliance with the License.
|
||||
* You may obtain a copy of the License at
|
||||
*
|
||||
* http://www.apache.org/licenses/LICENSE-2.0
|
||||
*
|
||||
* Unless required by applicable law or agreed to in writing, software
|
||||
* distributed under the License is distributed on an "AS IS" BASIS,
|
||||
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
||||
* See the License for the specific language governing permissions and
|
||||
* limitations under the License.
|
||||
*/
|
||||
|
||||
#ifndef __PMT_STRINGKEYS_
|
||||
#define __PMT_STRINGKEYS_
|
||||
|
||||
__BEGIN_DECLS
|
||||
|
||||
/* The struct is a very good option for setting the languages of texts etc. */
|
||||
struct pmt_langdb_general {
|
||||
const char* _Nonnull lang_by_s;
|
||||
const char* _Nonnull language;
|
||||
const char* _Nonnull lang_prefix;
|
||||
const char* _Nonnull not_logical;
|
||||
const char* _Nonnull not_file;
|
||||
const char* _Nonnull not_dir;
|
||||
const char* _Nonnull not_in_dev;
|
||||
const char* _Nonnull not_open;
|
||||
const char* _Nonnull not_block;
|
||||
const char* _Nonnull not_read;
|
||||
const char* _Nonnull not_readdir;
|
||||
const char* _Nonnull not_write;
|
||||
const char* _Nonnull not_gen;
|
||||
const char* _Nonnull no_root;
|
||||
const char* _Nonnull no_target;
|
||||
const char* _Nonnull expected_backup_arg;
|
||||
const char* _Nonnull expected_flash_arg;
|
||||
const char* _Nonnull expected_format_arg;
|
||||
const char* _Nonnull missing_operand;
|
||||
const char* _Nonnull multiple_wiewers;
|
||||
const char* _Nonnull common_symbol_rule;
|
||||
const char* _Nonnull req_part_name;
|
||||
const char* _Nonnull part_not_found;
|
||||
const char* _Nonnull unsupported_fs;
|
||||
const char* _Nonnull cannot_stat;
|
||||
const char* _Nonnull ffile_more_part;
|
||||
const char* _Nonnull cannot_get_bsz;
|
||||
const char* _Nonnull format_fail;
|
||||
const char* _Nonnull depr_backup_opt;
|
||||
const char* _Nonnull depr_flash_opt;
|
||||
const char* _Nonnull depr_format_opt;
|
||||
const char* _Nonnull depr_Vlicense_opt;
|
||||
const char* _Nonnull depr_ch_list_opt;
|
||||
const char* _Nonnull not_spec_opt;
|
||||
const char* _Nonnull logical_warn;
|
||||
const char* _Nonnull ab_warn;
|
||||
const char* _Nonnull out_not_spec;
|
||||
const char* _Nonnull please_rerun;
|
||||
const char* _Nonnull part_disk_sz;
|
||||
const char* _Nonnull flash_file_sz;
|
||||
const char* _Nonnull part_disk_sz_fail;
|
||||
const char* _Nonnull flash_file_sz_fail;
|
||||
const char* _Nonnull unknown_opr;
|
||||
const char* _Nonnull list_of_dir;
|
||||
const char* _Nonnull success_backup;
|
||||
const char* _Nonnull success_flash;
|
||||
const char* _Nonnull warn;
|
||||
const char* _Nonnull fatal;
|
||||
const char* _Nonnull switching_lang;
|
||||
const char* _Nonnull welcome;
|
||||
const char* _Nullable welcome_;
|
||||
const char* _Nonnull for_more;
|
||||
const char* _Nonnull try_h;
|
||||
const char* _Nonnull usage_head;
|
||||
const char* _Nonnull depr_opt_str;
|
||||
const char* _Nonnull switched_opt_str;
|
||||
const char* _Nonnull not_changed_opt;
|
||||
const char* _Nonnull compiler_str;
|
||||
const char* _Nonnull version_str;
|
||||
const char* _Nonnull bin_str;
|
||||
const char* _Nonnull unknw_str;
|
||||
const char* _Nonnull by_str;
|
||||
};
|
||||
|
||||
/* docs etc. */
|
||||
struct pmt_langdb_docs {
|
||||
const char* _Nonnull docs_strs_l1;
|
||||
const char* _Nonnull docs_strs_l2;
|
||||
const char* _Nonnull docs_strs_l3;
|
||||
const char* _Nonnull docs_strs_l4;
|
||||
const char* _Nonnull docs_strs_l5;
|
||||
const char* _Nonnull docs_strs_l6;
|
||||
const char* _Nonnull docs_strs_l7;
|
||||
const char* _Nonnull docs_strs_l8;
|
||||
const char* _Nonnull docs_strs_l9;
|
||||
const char* _Nonnull docs_strs_l10;
|
||||
const char* _Nonnull docs_strs_l11;
|
||||
const char* _Nonnull docs_strs_l12;
|
||||
const char* _Nonnull docs_strs_l13;
|
||||
const char* _Nonnull docs_strs_l14;
|
||||
const char* _Nonnull or_str;
|
||||
const char* _Nonnull usage_docstr;
|
||||
};
|
||||
|
||||
/* for checks etc */
|
||||
struct pmt_langdb_langs {
|
||||
const char* _Nullable lang_pr;
|
||||
};
|
||||
|
||||
__END_DECLS
|
||||
|
||||
#endif /* __PMT_STRINGKEYS_ */
|
||||
|
||||
/* end of code */
|
||||
38
include/pmt/versioning.h
Executable file
38
include/pmt/versioning.h
Executable file
@@ -0,0 +1,38 @@
|
||||
/* By YZBruh */
|
||||
|
||||
/*
|
||||
* Copyright 2024 Partition Manager
|
||||
*
|
||||
* Licensed under the Apache License, Version 2.0 (the "License");
|
||||
* you may not use this file except in compliance with the License.
|
||||
* You may obtain a copy of the License at
|
||||
*
|
||||
* http://www.apache.org/licenses/LICENSE-2.0
|
||||
*
|
||||
* Unless required by applicable law or agreed to in writing, software
|
||||
* distributed under the License is distributed on an "AS IS" BASIS,
|
||||
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
||||
* See the License for the specific language governing permissions and
|
||||
* limitations under the License.
|
||||
*/
|
||||
|
||||
#ifndef __PMT_VERSIONING_H
|
||||
#define __PMT_VERSIONING_H
|
||||
|
||||
__BEGIN_DECLS
|
||||
|
||||
#ifdef __NDK_BUILD
|
||||
#include <android/ndk-version.h>
|
||||
#include <pmt/generated/clang-version.h>
|
||||
#endif
|
||||
|
||||
/* versioning */
|
||||
#define PMT_MAJOR 2
|
||||
#define PMT_MINOR 5
|
||||
#define PMT_PATCHLEVEL 0
|
||||
|
||||
__END_DECLS
|
||||
|
||||
#endif
|
||||
|
||||
/* end */
|
||||
Reference in New Issue
Block a user