Skip to content
GitLab
Explore
Sign in
Primary navigation
Search or go to…
Project
K
kam-printing
Manage
Activity
Members
Labels
Plan
Issues
Issue boards
Milestones
Wiki
Code
Merge requests
Repository
Branches
Commits
Tags
Repository graph
Compare revisions
Snippets
Deploy
Releases
Package registry
Model registry
Operate
Terraform modules
Monitor
Incidents
Analyze
Value stream analytics
Contributor analytics
Repository analytics
Model experiments
Help
Help
Support
GitLab documentation
Compare GitLab plans
GitLab community forum
Contribute to GitLab
Provide feedback
Keyboard shortcuts
?
Snippets
Groups
Projects
Show more breadcrumbs
wizards
kam-printing
Commits
4f4057b8
Commit
4f4057b8
authored
9 years ago
by
Martin Mareš
Browse files
Options
Downloads
Patches
Plain Diff
Implemented most useful options
parent
679a900b
No related branches found
No related tags found
No related merge requests found
Changes
1
Show whitespace changes
Inline
Side-by-side
Showing
1 changed file
xcpt.c
+85
-31
85 additions, 31 deletions
xcpt.c
with
85 additions
and
31 deletions
xcpt.c
+
85
−
31
View file @
4f4057b8
...
@@ -77,7 +77,19 @@ static char *xstrdup(const char *x)
...
@@ -77,7 +77,19 @@ static char *xstrdup(const char *x)
O(JOB_TITLE, "?") \
O(JOB_TITLE, "?") \
O(COPIES, "1") \
O(COPIES, "1") \
O(LANGUAGE, "?") \
O(LANGUAGE, "?") \
O(MEDIASIZE, "A4")
O(COLOR, "color") \
O(ORIENTATION, "") \
O(PRIVATE, "") \
O(OFFSET, "none") \
O(SIDES, "one-sided") \
O(COLLATE, "uncollated") \
O(OUTPUT, "automatic") \
O(MEDIACOLOR, "white") \
O(INPUTTRAY, "automatic") \
O(TRAYFEED, "stack") \
O(MEDIATYPE, "system-default") \
O(MEDIAXSIZE, "21000") \
O(MEDIAYSIZE, "29700")
enum
option
{
enum
option
{
#define O(name, val) OPT_##name,
#define O(name, val) OPT_##name,
...
@@ -98,6 +110,11 @@ char *opt[] = {
...
@@ -98,6 +110,11 @@ char *opt[] = {
#undef O
#undef O
};
};
#define OPT(name) opt[OPT_##name]
#define OPT_IS(name, val) !strcasecmp(OPT(name), val)
#define OPT_IS_SET(name) *OPT(name)
#define OPT_IS_TRUE(name) OPT_IS(name, "yes")
static
void
set_option
(
char
*
key
,
char
*
val
)
static
void
set_option
(
char
*
key
,
char
*
val
)
{
{
for
(
int
i
=
0
;
i
<
OPT_MAX
;
i
++
)
for
(
int
i
=
0
;
i
<
OPT_MAX
;
i
++
)
...
@@ -352,59 +369,84 @@ static void xcpt_name(const char *name, const char *text)
...
@@ -352,59 +369,84 @@ static void xcpt_name(const char *name, const char *text)
static
void
gen_job_template
(
void
)
static
void
gen_job_template
(
void
)
{
{
xcpt_integer
(
"adjust-contrast"
,
0
);
// Color adjustments
xcpt_integer
(
"adjust-contrast"
,
0
);
// FIXME: all of them
xcpt_integer
(
"adjust-cyan-red"
,
0
);
xcpt_integer
(
"adjust-cyan-red"
,
0
);
xcpt_integer
(
"adjust-lightness"
,
0
);
xcpt_integer
(
"adjust-lightness"
,
0
);
xcpt_integer
(
"adjust-magenta-green"
,
0
);
xcpt_integer
(
"adjust-magenta-green"
,
0
);
xcpt_integer
(
"adjust-saturation"
,
0
);
xcpt_integer
(
"adjust-saturation"
,
0
);
xcpt_integer
(
"adjust-yellow-blue"
,
0
);
xcpt_integer
(
"adjust-yellow-blue"
,
0
);
if
(
OPT_IS
(
COLOR
,
"color"
))
{
xcpt_keyword
(
"color-adjustment-set"
,
"automatic"
);
xcpt_keyword
(
"color-adjustment-set"
,
"automatic"
);
xcpt_keyword
(
"color-effects-type"
,
"color"
);
xcpt_keyword
(
"color-effects-type"
,
"color"
);
xcpt_integer
(
"copies"
,
1
);
}
xcpt_keyword
(
"document-reading-orientation"
,
"portrait"
);
else
xcpt_keyword
(
"embedded-profiles"
,
"automatic"
);
{
xcpt_keyword
(
"color-adjustment-set"
,
"monochrome-grayscale"
);
xcpt_keyword
(
"color-effects-type"
,
"monochrome-grayscale"
);
}
xcpt_integer
(
"copies"
,
atoi
(
OPT
(
COPIES
)));
if
(
OPT_IS_SET
(
ORIENTATION
))
xcpt_keyword
(
"document-reading-orientation"
,
OPT
(
ORIENTATION
));
// FIXME
xcpt_set_open
(
"finishings"
);
xcpt_set_open
(
"finishings"
);
xcpt_enum
(
"value"
,
3
);
xcpt_enum
(
"value"
,
3
);
xcpt_close
();
xcpt_close
();
xcpt_keyword
(
"halftone-text"
,
"ignore-pdl"
);
xcpt_keyword
(
"halftone-text"
,
"ignore-pdl"
);
xcpt_keyword
(
"halftone-graphics"
,
"ignore-pdl"
);
xcpt_keyword
(
"halftone-images"
,
"ignore-pdl"
);
if
(
OPT_IS_SET
(
PRIVATE
))
xcpt_keyword
(
"hold-for-authentication"
,
"user-id"
);
else
xcpt_keyword
(
"hold-for-authentication"
,
"none"
);
xcpt_keyword
(
"hold-for-authentication"
,
"none"
);
// Interleaving not supported at the moment
xcpt_collection_open
(
"interleaved-sheets-col"
);
xcpt_collection_open
(
"interleaved-sheets-col"
);
xcpt_keyword
(
"interleaved-sheets-type"
,
"none"
);
xcpt_keyword
(
"interleaved-sheets-type"
,
"none"
);
xcpt_close
();
xcpt_close
();
xcpt_set_open
(
"job-offset"
);
xcpt_set_open
(
"job-offset"
);
xcpt_keyword
(
"value"
,
"offset-set"
);
xcpt_keyword
(
"value"
,
OPT
(
OFFSET
)
);
xcpt_close
();
xcpt_close
();
// Saved jobs are not supported at the moment
xcpt_collection_open
(
"job-save-disposition"
);
xcpt_collection_open
(
"job-save-disposition"
);
xcpt_keyword
(
"save"
,
"none"
);
xcpt_keyword
(
"save"
,
"none"
);
xcpt_close
();
xcpt_close
();
xcpt_keyword
(
"job-sheets"
,
"job-start-sheet"
);
// We leave printing of banner sheets to CUPS itself
xcpt_keyword
(
"job-sheets"
,
"none"
);
xcpt_collection_open
(
"client-default-attributes-col"
);
xcpt_collection_open
(
"client-default-attributes-col"
);
xcpt_collection_open
(
"media-col"
);
xcpt_collection_open
(
"media-col"
);
xcpt_keyword
(
"input-tray"
,
"automatic"
);
xcpt_keyword
(
"input-tray"
,
OPT
(
INPUTTRAY
));
xcpt_keyword
(
"media-color"
,
"white"
);
xcpt_keyword
(
"tray-feed"
,
OPT
(
TRAYFEED
));
xcpt_keyword
(
"media-color"
,
OPT
(
MEDIACOLOR
));
xcpt_collection_open
(
"media-size"
);
xcpt_collection_open
(
"media-size"
);
xcpt_integer
(
"x-dimension"
,
21000
);
xcpt_integer
(
"x-dimension"
,
atoi
(
OPT
(
MEDIAXSIZE
))
);
xcpt_integer
(
"y-dimension"
,
29700
);
xcpt_integer
(
"y-dimension"
,
atoi
(
OPT
(
MEDIAYSIZE
))
);
xcpt_close
();
xcpt_close
();
xcpt_keyword
(
"media-type"
,
"system-default"
);
xcpt_keyword
(
"media-type"
,
OPT
(
MEDIATYPE
)
);
xcpt_close
();
xcpt_close
();
xcpt_keyword
(
"print-quality-level"
,
"standard"
);
xcpt_keyword
(
"print-quality-level"
,
"standard"
);
// FIXME
xcpt_keyword
(
"sides"
,
"two-sided-long-edge"
);
xcpt_keyword
(
"sides"
,
OPT
(
SIDES
)
);
xcpt_close
();
xcpt_close
();
xcpt_keyword
(
"output-bin"
,
"automatic"
);
xcpt_keyword
(
"output-bin"
,
OPT
(
OUTPUT
));
xcpt_keyword
(
"sheet-collate"
,
OPT
(
COLLATE
));
// Rendering intents and color sources: so far, nothing can be set
xcpt_keyword
(
"embedded-profiles"
,
"automatic"
);
xcpt_keyword
(
"print-settings"
,
"none"
);
xcpt_keyword
(
"print-settings"
,
"none"
);
xcpt_keyword
(
"rendering-intent-graphics"
,
"automatic"
);
xcpt_keyword
(
"rendering-intent-graphics"
,
"automatic"
);
xcpt_keyword
(
"rendering-intent-images"
,
"automatic"
);
xcpt_keyword
(
"rendering-intent-images"
,
"automatic"
);
xcpt_keyword
(
"rendering-intent-text"
,
"automatic"
);
xcpt_keyword
(
"rendering-intent-text"
,
"automatic"
);
xcpt_keyword
(
"sheet-collate"
,
"collated"
);
xcpt_keyword
(
"spot-color-mapping"
,
"use-local-printer-values"
);
xcpt_keyword
(
"spot-color-mapping"
,
"use-local-printer-values"
);
xcpt_keyword
(
"undefined-source-cmyk-images"
,
"automatic"
);
xcpt_keyword
(
"undefined-source-cmyk-images"
,
"automatic"
);
xcpt_keyword
(
"undefined-source-cmyk-text"
,
"automatic"
);
xcpt_keyword
(
"undefined-source-cmyk-text"
,
"automatic"
);
...
@@ -418,16 +460,21 @@ static void gen_job_template(void)
...
@@ -418,16 +460,21 @@ static void gen_job_template(void)
static
void
gen_job_operation
(
void
)
static
void
gen_job_operation
(
void
)
{
{
xcpt_keyword
(
"creator-name-attributes"
,
"windows-ps-driver"
);
xcpt_keyword
(
"creator-name-attributes"
,
"cups-xcpt"
);
xcpt_keyword
(
"creator-name-pdl"
,
"explorer"
);
xcpt_keyword
(
"creator-name-pdl"
,
"unknown"
);
xcpt_text
(
"creator-version-attributes"
,
"cups-xcpt"
);
xcpt_text
(
"creator-version-attributes"
,
"0.1"
);
// FIXME
xcpt_text
(
"creator-version-pdl"
,
"6.1.7601.17567"
);
// FIXME
xcpt_text
(
"creator-version-pdl"
,
"0.0"
);
xcpt_media_type
(
"document-format"
,
"application/postscript"
);
// FIXME
if
(
OPT_IS
(
LANGUAGE
,
"PDF"
))
xcpt_name
(
"job-id-from-client"
,
"TOP SECRET JOB #1"
);
xcpt_media_type
(
"document-format"
,
"application/pdf"
);
xcpt_name
(
"job-name"
,
"Test Page"
);
else
xcpt_name
(
"job-originating-user-domain"
,
"KAM"
);
xcpt_media_type
(
"document-format"
,
"application/postscript"
);
xcpt_name
(
"job-originating-user-name"
,
"nobody"
);
xcpt_name
(
"job-id-from-client"
,
OPT
(
JOB_ID
));
xcpt_name
(
"requesting-user-name"
,
"nobody"
);
xcpt_name
(
"job-name"
,
OPT
(
JOB_TITLE
));
xcpt_name
(
"job-originating-user-domain"
,
"KAM"
);
// FIXME
const
char
*
user
=
OPT
(
USERNAME
);
xcpt_name
(
"job-originating-user-name"
,
user
);
xcpt_name
(
"requesting-user-name"
,
user
);
}
}
static
void
gen_xcpt
(
void
)
static
void
gen_xcpt
(
void
)
...
@@ -448,12 +495,19 @@ static void gen_xcpt(void)
...
@@ -448,12 +495,19 @@ static void gen_xcpt(void)
xcpt_close
();
xcpt_close
();
ASSERT
(
!
xcpt_level
);
ASSERT
(
!
xcpt_level
);
printf
(
"@PJL ENTER LANGUAGE = %s
\n
"
,
opt
[
OPT
_
LANGUAGE
]
);
printf
(
"@PJL ENTER LANGUAGE = %s
\n
"
,
OPT
(
LANGUAGE
)
);
}
}
static
void
copy_body
(
void
)
static
void
copy_body
(
void
)
{
{
// FIXME
char
buf
[
1024
];
size_t
n
;
while
(
n
=
fread
(
buf
,
1
,
sizeof
(
buf
),
stdin
))
{
if
(
fwrite
(
buf
,
1
,
n
,
stdout
)
!=
n
)
bug
(
"Write error"
);
}
}
}
/*** Main ***/
/*** Main ***/
...
...
This diff is collapsed.
Click to expand it.
Preview
0%
Loading
Try again
or
attach a new file
.
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Save comment
Cancel
Please
register
or
sign in
to comment