Fix all incorrect getopt_long() return value usages.

edge.strict_endians
szaka 2006-04-05 12:43:06 +00:00
parent 15e00fcf6c
commit c7a53338c0
18 changed files with 31 additions and 30 deletions

View File

@ -35,6 +35,7 @@ xx/xx/2006 - 1.13.1-WIP
- libntfs: add ntfs_str2ucs(), ntfs_freeucs(), ntfs_mft_usn_dec()
and ntfs_inode_badclus_bad() functions, and convert all copy-pastes
to use them. (Szaka)
- Fix all incorrect getopt_long() return value usages. (Szaka)
27/02/2006 - 1.13.0 - Lots and lots and lots of fixes and enhancements.

View File

@ -372,7 +372,7 @@ static BOOL mkntfs_parse_options(int argc, char *argv[], struct mkntfs_options *
{ NULL, 0, NULL, 0 }
};
char c = -1;
int c = -1;
int lic = 0;
int err = 0;
int ver = 0;
@ -384,7 +384,7 @@ static BOOL mkntfs_parse_options(int argc, char *argv[], struct mkntfs_options *
opterr = 0; /* We'll handle the errors, thank you. */
while ((c = getopt_long(argc, argv, sopt, lopt, NULL)) != (char)-1) {
while ((c = getopt_long(argc, argv, sopt, lopt, NULL)) != -1) {
switch (c) {
case 1: /* A device, or a number of sectors */
if (!opts2->dev_name)

View File

@ -169,7 +169,7 @@ static int parse_options(int argc, char **argv)
{ NULL, 0, NULL, 0 }
};
char c = -1;
int c = -1;
int err = 0;
int ver = 0;
int help = 0;
@ -183,7 +183,7 @@ static int parse_options(int argc, char **argv)
opts.attr_name = NULL;
opts.attr_name_len = 0;
while ((c = getopt_long(argc, argv, sopt, lopt, NULL)) != (char)-1) {
while ((c = getopt_long(argc, argv, sopt, lopt, NULL)) != -1) {
switch (c) {
case 1: /* A non-option argument */
if (!opts.device) {

View File

@ -297,11 +297,11 @@ static void parse_options(int argc, char **argv)
{ NULL, 0, NULL, 0 }
};
char c;
int c;
memset(&opt, 0, sizeof(opt));
while ((c = getopt_long(argc, argv, sopt, lopt, NULL)) != (char)-1) {
while ((c = getopt_long(argc, argv, sopt, lopt, NULL)) != -1) {
switch (c) {
case 1: /* A non-option argument */
if (opt.volume)

View File

@ -127,7 +127,7 @@ static int parse_options(int argc, char **argv)
{ NULL, 0, NULL, 0 }
};
char c = -1;
int c = -1;
int err = 0;
int ver = 0;
int help = 0;
@ -140,7 +140,7 @@ static int parse_options(int argc, char **argv)
opts.range_begin = -1;
opts.range_end = -1;
while ((c = getopt_long(argc, argv, sopt, lopt, NULL)) != (char)-1) {
while ((c = getopt_long(argc, argv, sopt, lopt, NULL)) != -1) {
switch (c) {
case 1: /* A non-option argument */
if (!opts.device) {

View File

@ -177,12 +177,12 @@ static void parse_options(int argc, char **argv)
{ NULL, 0, NULL, 0 }
};
char c;
int c;
memset(&opt, 0, sizeof(opt));
opt.show_progress = 1;
while ((c = getopt_long(argc, argv, sopt, lopt, NULL)) != (char)-1) {
while ((c = getopt_long(argc, argv, sopt, lopt, NULL)) != -1) {
switch (c) {
case 1: /* A non-option argument */
if (!opt.vol1) {

View File

@ -134,7 +134,7 @@ static int parse_options(int argc, char **argv)
};
char *s;
char c = -1;
int c = -1;
int err = 0;
int ver = 0;
int help = 0;
@ -150,7 +150,7 @@ static int parse_options(int argc, char **argv)
opterr = 0; /* We'll handle the errors, thank you. */
while ((c = getopt_long(argc, argv, sopt, lopt, NULL)) != (char) -1) {
while ((c = getopt_long(argc, argv, sopt, lopt, NULL)) != -1) {
switch (c) {
case 1: /* A non-option argument */
if (!opts.device) {

View File

@ -195,7 +195,7 @@ static int parse_options(int argc, char **argv)
{NULL, 0, NULL, 0}
};
char c = -1;
int c = -1;
int err = 0;
int ver = 0;
int help = 0;
@ -204,7 +204,7 @@ static int parse_options(int argc, char **argv)
opts.inode = -1;
while ((c = getopt_long(argc, argv, sopt, lopt, NULL)) != (char)-1) {
while ((c = getopt_long(argc, argv, sopt, lopt, NULL)) != -1) {
switch (c) {
case 1: /* A non-option argument */
if (!opts.device)

View File

@ -130,7 +130,7 @@ static void version(void)
*/
static void parse_options(int argc, char **argv)
{
char c;
int c;
static const char *sopt = "-hV";
static const struct option lopt[] = {
{ "help", no_argument, NULL, 'h' },
@ -140,7 +140,7 @@ static void parse_options(int argc, char **argv)
memset(&opt, 0, sizeof(opt));
while ((c = getopt_long(argc, argv, sopt, lopt, NULL)) != (char)-1) {
while ((c = getopt_long(argc, argv, sopt, lopt, NULL)) != -1) {
switch (c) {
case 1: /* A non-option argument */
if (!opt.volume)

View File

@ -166,7 +166,7 @@ static int parse_options(int argc, char *argv[])
{ NULL, 0, NULL, 0 }
};
char c = -1;
int c = -1;
int err = 0;
int ver = 0;
int help = 0;
@ -177,7 +177,7 @@ static int parse_options(int argc, char *argv[])
opts.inode = -1;
opts.filename = NULL;
while ((c = getopt_long(argc, argv, sopt, lopt, NULL)) != (char)-1) {
while ((c = getopt_long(argc, argv, sopt, lopt, NULL)) != -1) {
ntfs_log_trace("optind=%d; c='%c' optarg=\"%s\".\n", optind, c,
optarg);
switch (c) {

View File

@ -122,7 +122,7 @@ static int parse_options(int argc, char *argv[])
{ NULL, 0, NULL, 0 },
};
char c = -1;
int c = -1;
int err = 0;
int ver = 0;
int help = 0;

View File

@ -210,7 +210,7 @@ static int parse_options(int argc, char *argv[])
{ NULL, 0, NULL, 0 },
};
char c = -1;
int c = -1;
int err = 0;
int ver = 0;
int help = 0;
@ -222,7 +222,7 @@ static int parse_options(int argc, char *argv[])
opts.device = NULL;
opts.path = "/";
while ((c = getopt_long(argc, argv, sopt, lopt, NULL)) != (char)-1) {
while ((c = getopt_long(argc, argv, sopt, lopt, NULL)) != -1) {
switch (c) {
case 1:
if (!opts.device)

View File

@ -1675,7 +1675,7 @@ static char *realpath(const char *path, char *resolved_path)
static int parse_options(int argc, char *argv[])
{
int err = 0, help = 0;
char c = -1;
int c = -1;
static const char *sopt = "-o:h?qv";
static const struct option lopt[] = {
@ -1692,7 +1692,7 @@ static int parse_options(int argc, char *argv[])
opts.options = NULL;
opts.device = NULL;
while ((c = getopt_long(argc, argv, sopt, lopt, NULL)) != (char)-1) {
while ((c = getopt_long(argc, argv, sopt, lopt, NULL)) != -1) {
switch (c) {
case 1: /* A non-option argument */
if (!opts.device) {

View File

@ -121,7 +121,7 @@ static int parse_options(int argc, char **argv)
{ NULL, 0, NULL, 0 }
};
char c = -1;
int c = -1;
int err = 0;
int ver = 0;
int help = 0;

View File

@ -453,7 +453,7 @@ static int parse_options(int argc, char **argv)
{ NULL, 0, NULL, 0 }
};
char c;
int c;
int err = 0;
int ver = 0;
int help = 0;
@ -461,7 +461,7 @@ static int parse_options(int argc, char **argv)
memset(&opt, 0, sizeof(opt));
opt.show_progress = 1;
while ((c = getopt_long(argc, argv, sopt, lopt, NULL)) != (char)-1) {
while ((c = getopt_long(argc, argv, sopt, lopt, NULL)) != -1) {
switch (c) {
case 1: /* A non-option argument */
if (!err && !opt.volume)

View File

@ -126,7 +126,7 @@ static int parse_options(int argc, char **argv)
{ NULL, 0, NULL, 0 }
};
char c = -1;
int c = -1;
int err = 0;
int ver = 0;
int help = 0;

View File

@ -450,7 +450,7 @@ static int parse_options(int argc, char *argv[])
{ NULL, 0, NULL, 0 }
};
char c = -1;
int c = -1;
char *end = NULL;
int err = 0;
int ver = 0;
@ -463,7 +463,7 @@ static int parse_options(int argc, char *argv[])
opts.uinode = -1;
opts.percent = -1;
opts.fillbyte = -1;
while ((c = getopt_long(argc, argv, sopt, lopt, NULL)) != (char)-1) {
while ((c = getopt_long(argc, argv, sopt, lopt, NULL)) != -1) {
switch (c) {
case 1: /* A non-option argument */
if (!opts.device) {

View File

@ -209,7 +209,7 @@ static int parse_options(int argc, char *argv[])
{ NULL, 0, NULL, 0 }
};
char c = -1;
int c = -1;
char *end;
int err = 0;
int ver = 0;