Make some corrections.

This commit is contained in:
2024-06-10 06:28:01 +03:00
parent d0a7b2d16f
commit 99ecb9daf3
15 changed files with 42 additions and 52 deletions

View File

@@ -46,4 +46,4 @@ endif
include $(BUILD_EXECUTABLE)
# end
# end

View File

@@ -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);

View File

@@ -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 */

View File

@@ -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 */

View File

@@ -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 */

View File

@@ -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;

View File

@@ -68,4 +68,6 @@ void check_dev_point()
#if defined(__cplusplus)
}
#endif /* __cplusplus */
#endif /* __cplusplus */
/* end */

View File

@@ -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;
}
}

View File

@@ -29,7 +29,7 @@ extern "C" {
#include <pmt.h>
/* root checker function */
void check_root()
void check_root(void)
{
/* a quick, easy method to verify root */
if (getuid() != 0)

View File

@@ -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. */

View File

@@ -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);