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
Henning Geinitz 2002-07-22 12:49:26 +00:00
rodzic 3c506cae68
commit e96e066c2f
1 zmienionych plików z 144 dodań i 137 usunięć

Wyświetl plik

@ -170,8 +170,7 @@ auth_callback (SANE_String_Const resource,
if (strchr (strchr (tmp, ':') + 1, ':') != NULL)
{
if (
(strncmp
if ((strncmp
(strchr (strchr (tmp, ':') + 1, ':') + 1,
resource, len) == 0)
&&
@ -184,8 +183,7 @@ auth_callback (SANE_String_Const resource,
SANE_MAX_USERNAME_LEN)
{
if (
(strchr (strchr (tmp, ':') + 1, ':') -
if ((strchr (strchr (tmp, ':') + 1, ':') -
(strchr (tmp, ':') + 1)) <
SANE_MAX_PASSWORD_LEN)
{
@ -291,8 +289,7 @@ sighandler (int signum)
if (device)
{
fprintf (stderr, "%s: received signal %d\n", prog_name,
signum);
fprintf (stderr, "%s: received signal %d\n", prog_name, signum);
if (first_time)
{
first_time = SANE_FALSE;
@ -1278,7 +1275,8 @@ cleanup:
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)
expected_bytes = 0;
if (total_bytes > expected_bytes && expected_bytes != 0)
@ -1486,7 +1484,6 @@ main (int argc, char **argv)
case ':':
case '?':
break; /* may be an option that we'll parse later on */
case 'd':
devname = optarg;
break;
@ -1597,7 +1594,8 @@ main (int argc, char **argv)
ftype = 0;
break;
default:
fprintf(stderr, "%s: unknown format specifier %%%c\n",
fprintf (stderr,
"%s: unknown format specifier %%%c\n",
prog_name, *percent);
*percent = '%';
ftype = 0;
@ -1678,8 +1676,7 @@ standard output.\n\
-T, --test test backend thoroughly\n\
-v, --verbose give even more status messages\n\
-V, --version print version information\n\
--accept-md5-only only accept authorization requests using md5\n",
prog_name);
--accept-md5-only only accept authorization requests using md5\n", prog_name);
if (!devname)
{
@ -1826,6 +1823,13 @@ standard output.\n\
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);
for (index = 0; index < 2; ++index)
@ -1923,10 +1927,10 @@ List of available devices:", prog_name);
format = "out%d.pnm";
}
if(batch) {
fprintf(stderr, "Scanning %d pages, incrementing by %d, numbering from %d\n",
if (batch)
fprintf (stderr,
"Scanning %d pages, incrementing by %d, numbering from %d\n",
batch_count, batch_increment, batch_start_at);
}
do
{
@ -1940,11 +1944,13 @@ List of available devices:", prog_name);
return SANE_STATUS_ACCESS_DENIED;
}
if (batch) {
if (batch)
{
fprintf (stderr, "Scanning page %d\n", n);
}
status = scan_it ();
if (batch) {
if (batch)
{
fprintf (stderr, "Scanned page %d.", n);
fprintf (stderr, " (scanner status = %d)\n", status);
}
@ -1966,7 +1972,8 @@ List of available devices:", prog_name);
} /* switch */
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);
}
else