bin: Clang warning fixes.
* Functions that call exit() should return void * char* -> const char* * main returns int, not bool.
This commit is contained in:
+1
-1
@@ -98,7 +98,7 @@ main(int argc, char** argv)
|
|||||||
if (status != B_OK) {
|
if (status != B_OK) {
|
||||||
fprintf(stderr, "%s: Could not prepare the device for modifications: "
|
fprintf(stderr, "%s: Could not prepare the device for modifications: "
|
||||||
"%s\n", kProgramName, strerror(status));
|
"%s\n", kProgramName, strerror(status));
|
||||||
return false;
|
return 1;
|
||||||
}
|
}
|
||||||
|
|
||||||
// Check if the partition supports repairing
|
// Check if the partition supports repairing
|
||||||
|
|||||||
+1
-1
@@ -59,7 +59,7 @@ private:
|
|||||||
};
|
};
|
||||||
|
|
||||||
|
|
||||||
static int usage(char *prog)
|
static int usage(const char *prog)
|
||||||
{
|
{
|
||||||
printf("usage: eject [-q|-l|-s|-b|-u] /dev/disk/.../raw\n");
|
printf("usage: eject [-q|-l|-s|-b|-u] /dev/disk/.../raw\n");
|
||||||
// printf("usage: eject [-q|-l|-s|-b|-u] [scsi|ide|/dev/disk/.../raw]\n");
|
// printf("usage: eject [-q|-l|-s|-b|-u] [scsi|ide|/dev/disk/.../raw]\n");
|
||||||
|
|||||||
+15
-15
@@ -24,7 +24,7 @@ const char *kProgramName = __progname;
|
|||||||
#endif
|
#endif
|
||||||
|
|
||||||
|
|
||||||
enum arg_needed {
|
enum arg_needed {
|
||||||
switch_needed, major_version, middle_version, minor_version,
|
switch_needed, major_version, middle_version, minor_version,
|
||||||
variety_version, internal_version, long_string, short_string
|
variety_version, internal_version, long_string, short_string
|
||||||
};
|
};
|
||||||
@@ -103,7 +103,7 @@ errorToString(BString& output, status_t error, const char *appName = NULL)
|
|||||||
case e_expecting:
|
case e_expecting:
|
||||||
output = "expecting -short, -long, -app or -system\n";
|
output = "expecting -short, -long, -app or -system\n";
|
||||||
break;
|
break;
|
||||||
case e_long_string:
|
case e_long_string:
|
||||||
output = "expecting long version string\n";
|
output = "expecting long version string\n";
|
||||||
break;
|
break;
|
||||||
case e_short_string:
|
case e_short_string:
|
||||||
@@ -134,7 +134,7 @@ errorToString(BString& output, status_t error, const char *appName = NULL)
|
|||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
static int
|
static void
|
||||||
errorOut(status_t error, const char *appName = NULL, bool showUsage = true)
|
errorOut(status_t error, const char *appName = NULL, bool showUsage = true)
|
||||||
{
|
{
|
||||||
BString output;
|
BString output;
|
||||||
@@ -184,12 +184,12 @@ parse(bool &systemModified, bool &appModified, arg_needed &argNeeded,
|
|||||||
systemModified = true;
|
systemModified = true;
|
||||||
} else if (strcmp(argv[i], "-long") == 0) {
|
} else if (strcmp(argv[i], "-long") == 0) {
|
||||||
if (mode == no_switch)
|
if (mode == no_switch)
|
||||||
errorOut(e_app_sys_switch);
|
errorOut(e_app_sys_switch);
|
||||||
|
|
||||||
argNeeded = long_string;
|
argNeeded = long_string;
|
||||||
} else if (strcmp(argv[i], "-short") == 0) {
|
} else if (strcmp(argv[i], "-short") == 0) {
|
||||||
if (mode == no_switch)
|
if (mode == no_switch)
|
||||||
errorOut(e_app_sys_switch);
|
errorOut(e_app_sys_switch);
|
||||||
|
|
||||||
argNeeded = short_string;
|
argNeeded = short_string;
|
||||||
} else if (mode == no_switch)
|
} else if (mode == no_switch)
|
||||||
@@ -197,20 +197,20 @@ parse(bool &systemModified, bool &appModified, arg_needed &argNeeded,
|
|||||||
else if (strncmp(argv[i], "-", 1) == 0)
|
else if (strncmp(argv[i], "-", 1) == 0)
|
||||||
errorOut(e_parameter);
|
errorOut(e_parameter);
|
||||||
else
|
else
|
||||||
errorOut(e_expecting);
|
errorOut(e_expecting);
|
||||||
break;
|
break;
|
||||||
|
|
||||||
case major_version:
|
case major_version:
|
||||||
if (isalpha(argv[i][0]))
|
if (isalpha(argv[i][0]))
|
||||||
errorOut(e_major_version);
|
errorOut(e_major_version);
|
||||||
|
|
||||||
version.major = atoi(argv[i]);
|
version.major = atoi(argv[i]);
|
||||||
argNeeded = middle_version;
|
argNeeded = middle_version;
|
||||||
break;
|
break;
|
||||||
|
|
||||||
case middle_version:
|
case middle_version:
|
||||||
if (isalpha(argv[i][0]))
|
if (isalpha(argv[i][0]))
|
||||||
errorOut(e_middle_version);
|
errorOut(e_middle_version);
|
||||||
|
|
||||||
version.middle = atoi(argv[i]);
|
version.middle = atoi(argv[i]);
|
||||||
argNeeded = minor_version;
|
argNeeded = minor_version;
|
||||||
@@ -220,7 +220,7 @@ parse(bool &systemModified, bool &appModified, arg_needed &argNeeded,
|
|||||||
if (isalpha(argv[i][0]))
|
if (isalpha(argv[i][0]))
|
||||||
errorOut(e_minor_version);
|
errorOut(e_minor_version);
|
||||||
|
|
||||||
version.minor = atoi(argv[i]);
|
version.minor = atoi(argv[i]);
|
||||||
|
|
||||||
if (i >= argc-1) {
|
if (i >= argc-1) {
|
||||||
argNeeded = switch_needed;
|
argNeeded = switch_needed;
|
||||||
@@ -251,7 +251,7 @@ parse(bool &systemModified, bool &appModified, arg_needed &argNeeded,
|
|||||||
if (isalpha(argv[i][0]))
|
if (isalpha(argv[i][0]))
|
||||||
errorOut(e_expecting);
|
errorOut(e_expecting);
|
||||||
|
|
||||||
version.internal = atoi(argv[i]);
|
version.internal = atoi(argv[i]);
|
||||||
argNeeded = switch_needed;
|
argNeeded = switch_needed;
|
||||||
break;
|
break;
|
||||||
|
|
||||||
@@ -304,9 +304,9 @@ main(int argc, char *argv[])
|
|||||||
{
|
{
|
||||||
if (argc < 3) {
|
if (argc < 3) {
|
||||||
if (argc < 2)
|
if (argc < 2)
|
||||||
return errorOut(e_app_sys_switch);
|
errorOut(e_app_sys_switch);
|
||||||
|
|
||||||
return errorOut(e_specify_version);
|
errorOut(e_specify_version);
|
||||||
}
|
}
|
||||||
|
|
||||||
// reset version infos
|
// reset version infos
|
||||||
@@ -355,10 +355,10 @@ main(int argc, char *argv[])
|
|||||||
}
|
}
|
||||||
|
|
||||||
if (systemModified) {
|
if (systemModified) {
|
||||||
status = info.SetVersionInfo(&systemVersion, B_SYSTEM_VERSION_KIND);
|
status = info.SetVersionInfo(&systemVersion, B_SYSTEM_VERSION_KIND);
|
||||||
if (status < B_OK)
|
if (status < B_OK)
|
||||||
errorOut(status, NULL, false);
|
errorOut(status, NULL, false);
|
||||||
}
|
}
|
||||||
|
|
||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
|
|||||||
Reference in New Issue
Block a user