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
c104e56f
Commit
c104e56f
authored
4 years ago
by
Martin Mareš
Browse files
Options
Downloads
Patches
Plain Diff
Scan: Implemented --exit
parent
bb972f53
No related branches found
No related tags found
No related merge requests found
Changes
2
Show whitespace changes
Inline
Side-by-side
Showing
2 changed files
scan/scan
+20
-6
20 additions, 6 deletions
scan/scan
scan/show-snmp
+1
-1
1 addition, 1 deletion
scan/show-snmp
with
21 additions
and
7 deletions
scan/scan
+
20
−
6
View file @
c104e56f
...
...
@@ -13,6 +13,7 @@ use Digest::SHA;
my
$verbose
=
0
;
my
$close
=
0
;
my
$opt_exit
=
0
;
my
$s_all
=
0
;
my
$s_encodings
=
0
;
my
$s_iodev
=
0
;
...
...
@@ -44,6 +45,7 @@ GetOptions(
"
psversion!
"
=>
\
$s_psversion
,
"
verbose!
"
=>
\
$verbose
,
"
close!
"
=>
\
$close
,
"
exit!
"
=>
\
$opt_exit
,
)
and
@ARGV
==
1
or
die
<<
AMEN
;
Usage:
$
0
[
<
options
>
]
<
hostname
>
...
...
@@ -59,6 +61,7 @@ Options:
--
psversion
Scan
PS
interpreter
version
--
verbose
Be
verbose
and
dump
all
communication
with
the
printer
--
close
Close
connection
after
each
scan
to
flush
buffers
--
exit
Send
Universal
Exit
Language
after
each
scan
to
flush
buffers
AMEN
my
(
$host
)
=
@ARGV
;
...
...
@@ -236,10 +239,16 @@ sub need_ps() {
enter_ps
();
}
sub
end_ps
()
{
tx
("
flush
\n
");
uel
()
if
$opt_exit
;
}
sub
scan_psversion
()
{
heading
("
PS interpreter version
");
need_ps
();
tx
("
version == revision == (%END%) = flush
\n
");
tx
("
version == revision == (%END%) =
\n
");
end_ps
();
my
$ver
=
rx_until
("
%END%
");
print
join
("
",
@$ver
),
"
\n
";
}
...
...
@@ -247,7 +256,8 @@ sub scan_psversion() {
sub
scan_pagedev
()
{
heading
("
PS page device parameters
");
need_ps
();
tx
("
currentpagedevice showdict (%END%) = flush
\n
");
tx
("
currentpagedevice showdict (%END%) =
\n
");
end_ps
();
my
$dict
=
rx_until
("
%END
");
out_dict
(
$dict
);
}
...
...
@@ -262,8 +272,9 @@ sub scan_iodev() {
currentdevparams
showdict
}
100
string
/
IODevice
resourceforall
(
%>>%
)
=
(
%END
%
)
=
flush
(
%END
%
)
=
AMEN
end_ps
();
out_dict
(
rx_until
("
%END
"));
}
...
...
@@ -277,8 +288,9 @@ sub scan_outdev() {
cvn
/
OutputDevice
findresource
showdict
}
100
string
/
OutputDevice
resourceforall
(
%>>%
)
=
(
%END
%
)
=
flush
(
%END
%
)
=
AMEN
end_ps
();
my
$odev
=
rx_until
("
%END%
");
out_dict
(
$odev
);
}
...
...
@@ -328,8 +340,9 @@ sub scan_psfonts() {
(
%>>%
)
=
flush
%
Flush
to
avoid
buffer
management
bugs
on
Xerox
Phaser
3300
}
100
string
/
Font
resourceforall
(
%>>%
)
=
(
%END
%
)
=
flush
(
%END
%
)
=
AMEN
end_ps
();
my
$fonts
=
parse_dict
(
rx_until
("
%END%
"));
if
(
$verbose
)
{
show_dict
(
$fonts
);
...
...
@@ -367,8 +380,9 @@ sub scan_encodings() {
/
Encoding
findresource
==
}
100
string
/
Encoding
resourceforall
(
%>>%
)
=
(
%END
%
)
=
flush
(
%END
%
)
=
AMEN
end_ps
();
my
$encs
=
parse_dict
(
rx_until
("
%END%
"));
for
my
$e
(
keys
%$encs
)
{
my
$array
=
$encs
->
{
$e
};
...
...
This diff is collapsed.
Click to expand it.
scan/show-snmp
+
1
−
1
View file @
c104e56f
...
...
@@ -10,7 +10,7 @@ my $host = $ARGV[0] or die "Usage: $0 <host>\n";
print
"
Scanning
$host
...
\n
";
my
$sess
=
Net::
SNMP
->
session
(
-
hostname
=>
$host
.
'
.kam.
hide.ms.
mff.cuni.cz
',
-
hostname
=>
$host
.
'
.kam.mff.cuni.cz
',
-
version
=>
1
,
-
community
=>
'
public
',
)
or
die
;
...
...
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