Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

issue #87 cupsfilter showing particular errors. #88

Merged
merged 4 commits into from
Feb 11, 2021
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Jump to
Jump to file
Failed to load files.
Diff view
Diff view
93 changes: 74 additions & 19 deletions scheduler/cupsfilter.c
Original file line number Diff line number Diff line change
Expand Up @@ -185,8 +185,11 @@ main(int argc, /* I - Number of command-line args */
if (i < argc)
num_options = cupsParseOptions(argv[i], num_options, &options);
else
{
_cupsLangPrintf(stderr,_("%s: Error - expected option after \"-a\" option."),argv[0]);
usage(opt);
break;
}
break;

case 'c' : /* Specify cups-files.conf file location... */
i ++;
Expand All @@ -198,15 +201,21 @@ main(int argc, /* I - Number of command-line args */
strlcpy(cupsfilesconf, argv[i], sizeof(cupsfilesconf));
}
else
usage(opt);
{
_cupsLangPrintf(stderr,_("%s: Error - expected config-file after \"-c\" option."),argv[0]);
usage(NULL);
}
break;

case 'd' : /* Specify the real printer name */
i ++;
if (i < argc)
printer = argv[i];
else
usage(opt);
{
_cupsLangPrintf(stderr,_("%s: Error - expected printer name after \"-d\" option."),argv[0]);
usage(NULL);
}
break;

case 'D' : /* Delete input file after conversion */
Expand All @@ -222,7 +231,10 @@ main(int argc, /* I - Number of command-line args */
if (i < argc && !infile)
infile = argv[i];
else
usage(opt);
{
_cupsLangPrintf(stderr,_("%s: Error - expected input file after \"-f\" option."),argv[0]);
usage(NULL);
}
break;

case 'i' : /* Specify source MIME type... */
Expand All @@ -235,7 +247,10 @@ main(int argc, /* I - Number of command-line args */
srctype = argv[i];
}
else
usage(opt);
{
_cupsLangPrintf(stderr,_("%s: Error - expected source MIME type after \"-i\" option."),argv[0]);
usage(NULL);
}
Comment on lines 249 to +253
Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I don't exactly know why its showing like this in github. I am using vscode editor for editing files. else statement and opening brace { are being shown in vertical line there.

break;

case 'j' : /* Get job file or specify destination MIME type... */
Expand All @@ -248,7 +263,10 @@ main(int argc, /* I - Number of command-line args */
infile = TempFile;
}
else
usage(opt);
{
_cupsLangPrintf(stdout,_("%s: Error - expected job-id after \"-j\" option."),argv[0]);
usage(NULL);
}

break;
}
Expand All @@ -263,16 +281,22 @@ main(int argc, /* I - Number of command-line args */
dsttype = argv[i];
}
else
usage(opt);
{
_cupsLangPrintf(stderr,_("%s: Error - expected destination mime type after \"-m\" option."),argv[0]);
usage(NULL);
}
break;

case 'n' : /* Specify number of copies... */
i ++;
if (i < argc)
num_options = cupsAddOption("copies", argv[i], num_options, &options);
else
usage(opt);
break;
{
_cupsLangPrintf(stderr,_("%s: Error - expected \"number of copies\" after \"-n\" option."),argv[0]);
usage(NULL);
}
break;

case 'o' : /* Specify option(s) or output filename */
i ++;
Expand All @@ -288,27 +312,54 @@ main(int argc, /* I - Number of command-line args */
else
num_options = cupsParseOptions(argv[i], num_options, &options);
}
else
usage(opt);
else
{
_cupsLangPrintf(stderr,_("%s: Error - expected \"options\" after \"-o\" option."),argv[0]);
usage(NULL);
}
break;

case 'p' : /* Specify PPD file... */
i ++;
if (i < argc)
ppdfile = argv[i];
else
{
_cupsLangPrintf(stderr,_("%s: Error - expected \"PPD file\" after \"-p\" option."),argv[0]);
usage(NULL);
}
break;
case 'P' : /* Specify PPD file... */
i ++;
if (i < argc)
ppdfile = argv[i];
else
usage(opt);
break;
{
_cupsLangPrintf(stderr,_("%s: Error - expected \"PPD file\" after \"-P\" option."),argv[0]);
usage(NULL);
}
break;

case 't' : /* Specify title... */
i ++;
if (i < argc)
title = argv[i];
else
{
_cupsLangPrintf(stderr,_("%s: Error - expected title after \"-t\" option."),argv[0]);
usage(NULL);
}
break;
case 'J' : /* Specify title... */
i ++;
if (i < argc)
title = argv[i];
else
usage(opt);
break;
{
_cupsLangPrintf(stderr,_("%s: Error - expected title after \"-J\" option."),argv[0]);
usage(NULL);
}
break;

case 'u' : /* Delete PPD file after conversion */
removeppd = 1;
Expand All @@ -319,12 +370,16 @@ main(int argc, /* I - Number of command-line args */
if (i < argc)
user = argv[i];
else
usage(opt);
break;
{
_cupsLangPrintf(stderr,_("%s: Error - expected \"username\" after \"-U\" option."),argv[0]);
usage(NULL);
}
break;

default : /* Something we don't understand... */
usage(opt);
break;
_cupsLangPrintf(stderr,_("%s: Error - unknown option %s."),argv[0],opt);
usage(NULL);
break;
}
}
}
Expand Down