kopia lustrzana https://gitlab.com/sane-project/backends
Fail if there are arguments without a preceding option on the command line.
Fixed indenting. Henning Meier-Geinitz <henning@meier-geinitz.de>DEVEL_2_0_BRANCH-1
rodzic
3c506cae68
commit
e96e066c2f
|
@ -170,8 +170,7 @@ auth_callback (SANE_String_Const resource,
|
||||||
if (strchr (strchr (tmp, ':') + 1, ':') != NULL)
|
if (strchr (strchr (tmp, ':') + 1, ':') != NULL)
|
||||||
{
|
{
|
||||||
|
|
||||||
if (
|
if ((strncmp
|
||||||
(strncmp
|
|
||||||
(strchr (strchr (tmp, ':') + 1, ':') + 1,
|
(strchr (strchr (tmp, ':') + 1, ':') + 1,
|
||||||
resource, len) == 0)
|
resource, len) == 0)
|
||||||
&&
|
&&
|
||||||
|
@ -184,8 +183,7 @@ auth_callback (SANE_String_Const resource,
|
||||||
SANE_MAX_USERNAME_LEN)
|
SANE_MAX_USERNAME_LEN)
|
||||||
{
|
{
|
||||||
|
|
||||||
if (
|
if ((strchr (strchr (tmp, ':') + 1, ':') -
|
||||||
(strchr (strchr (tmp, ':') + 1, ':') -
|
|
||||||
(strchr (tmp, ':') + 1)) <
|
(strchr (tmp, ':') + 1)) <
|
||||||
SANE_MAX_PASSWORD_LEN)
|
SANE_MAX_PASSWORD_LEN)
|
||||||
{
|
{
|
||||||
|
@ -291,8 +289,7 @@ sighandler (int signum)
|
||||||
|
|
||||||
if (device)
|
if (device)
|
||||||
{
|
{
|
||||||
fprintf (stderr, "%s: received signal %d\n", prog_name,
|
fprintf (stderr, "%s: received signal %d\n", prog_name, signum);
|
||||||
signum);
|
|
||||||
if (first_time)
|
if (first_time)
|
||||||
{
|
{
|
||||||
first_time = SANE_FALSE;
|
first_time = SANE_FALSE;
|
||||||
|
@ -1278,7 +1275,8 @@ cleanup:
|
||||||
|
|
||||||
|
|
||||||
expected_bytes = parm.bytes_per_line * parm.lines *
|
expected_bytes = parm.bytes_per_line * parm.lines *
|
||||||
((parm.format == SANE_FRAME_RGB || parm.format == SANE_FRAME_GRAY)?1:3);
|
((parm.format == SANE_FRAME_RGB
|
||||||
|
|| parm.format == SANE_FRAME_GRAY) ? 1 : 3);
|
||||||
if (parm.lines < 0)
|
if (parm.lines < 0)
|
||||||
expected_bytes = 0;
|
expected_bytes = 0;
|
||||||
if (total_bytes > expected_bytes && expected_bytes != 0)
|
if (total_bytes > expected_bytes && expected_bytes != 0)
|
||||||
|
@ -1486,7 +1484,6 @@ main (int argc, char **argv)
|
||||||
case ':':
|
case ':':
|
||||||
case '?':
|
case '?':
|
||||||
break; /* may be an option that we'll parse later on */
|
break; /* may be an option that we'll parse later on */
|
||||||
|
|
||||||
case 'd':
|
case 'd':
|
||||||
devname = optarg;
|
devname = optarg;
|
||||||
break;
|
break;
|
||||||
|
@ -1597,7 +1594,8 @@ main (int argc, char **argv)
|
||||||
ftype = 0;
|
ftype = 0;
|
||||||
break;
|
break;
|
||||||
default:
|
default:
|
||||||
fprintf(stderr, "%s: unknown format specifier %%%c\n",
|
fprintf (stderr,
|
||||||
|
"%s: unknown format specifier %%%c\n",
|
||||||
prog_name, *percent);
|
prog_name, *percent);
|
||||||
*percent = '%';
|
*percent = '%';
|
||||||
ftype = 0;
|
ftype = 0;
|
||||||
|
@ -1678,8 +1676,7 @@ standard output.\n\
|
||||||
-T, --test test backend thoroughly\n\
|
-T, --test test backend thoroughly\n\
|
||||||
-v, --verbose give even more status messages\n\
|
-v, --verbose give even more status messages\n\
|
||||||
-V, --version print version information\n\
|
-V, --version print version information\n\
|
||||||
--accept-md5-only only accept authorization requests using md5\n",
|
--accept-md5-only only accept authorization requests using md5\n", prog_name);
|
||||||
prog_name);
|
|
||||||
|
|
||||||
if (!devname)
|
if (!devname)
|
||||||
{
|
{
|
||||||
|
@ -1826,6 +1823,13 @@ standard output.\n\
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
if (optind < argc)
|
||||||
|
{
|
||||||
|
fprintf (stderr, "%s: argument without option: `%s'; ", prog_name,
|
||||||
|
argv[argc - 1]);
|
||||||
|
fprintf (stderr, "try %s --help\n", prog_name);
|
||||||
|
exit (1);
|
||||||
|
}
|
||||||
|
|
||||||
free (full_optstring);
|
free (full_optstring);
|
||||||
for (index = 0; index < 2; ++index)
|
for (index = 0; index < 2; ++index)
|
||||||
|
@ -1923,10 +1927,10 @@ List of available devices:", prog_name);
|
||||||
format = "out%d.pnm";
|
format = "out%d.pnm";
|
||||||
}
|
}
|
||||||
|
|
||||||
if(batch) {
|
if (batch)
|
||||||
fprintf(stderr, "Scanning %d pages, incrementing by %d, numbering from %d\n",
|
fprintf (stderr,
|
||||||
|
"Scanning %d pages, incrementing by %d, numbering from %d\n",
|
||||||
batch_count, batch_increment, batch_start_at);
|
batch_count, batch_increment, batch_start_at);
|
||||||
}
|
|
||||||
|
|
||||||
do
|
do
|
||||||
{
|
{
|
||||||
|
@ -1940,11 +1944,13 @@ List of available devices:", prog_name);
|
||||||
return SANE_STATUS_ACCESS_DENIED;
|
return SANE_STATUS_ACCESS_DENIED;
|
||||||
}
|
}
|
||||||
|
|
||||||
if (batch) {
|
if (batch)
|
||||||
|
{
|
||||||
fprintf (stderr, "Scanning page %d\n", n);
|
fprintf (stderr, "Scanning page %d\n", n);
|
||||||
}
|
}
|
||||||
status = scan_it ();
|
status = scan_it ();
|
||||||
if (batch) {
|
if (batch)
|
||||||
|
{
|
||||||
fprintf (stderr, "Scanned page %d.", n);
|
fprintf (stderr, "Scanned page %d.", n);
|
||||||
fprintf (stderr, " (scanner status = %d)\n", status);
|
fprintf (stderr, " (scanner status = %d)\n", status);
|
||||||
}
|
}
|
||||||
|
@ -1966,7 +1972,8 @@ List of available devices:", prog_name);
|
||||||
} /* switch */
|
} /* switch */
|
||||||
n += batch_increment;
|
n += batch_increment;
|
||||||
}
|
}
|
||||||
while ((batch && (batch_count==BATCH_COUNT_UNLIMITED || --batch_count))
|
while ((batch
|
||||||
|
&& (batch_count == BATCH_COUNT_UNLIMITED || --batch_count))
|
||||||
&& SANE_STATUS_GOOD == status);
|
&& SANE_STATUS_GOOD == status);
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
|
|
Ładowanie…
Reference in New Issue