vncserver: refactor

This commit is contained in:
Dmitry Maksyoma 2021-07-31 00:37:00 +12:00
parent 59d53dbb19
commit c435e6ba7d

View File

@ -88,7 +88,7 @@ if ((@ARGV > 0) && ($ARGV[0] =~ /^:(\d+)$/)) {
} elsif ((@ARGV > 0) && ($ARGV[0] !~ /^-/) && ($ARGV[0] !~ /^\+/)) { } elsif ((@ARGV > 0) && ($ARGV[0] !~ /^-/) && ($ARGV[0] !~ /^\+/)) {
&Usage(); &Usage();
} else { } else {
$displayNumber = &GetDisplayNumber(); $displayNumber = &GetLowestAvailableDisplayNumber();
} }
$vncPort = 5900 + $displayNumber; $vncPort = 5900 + $displayNumber;
@ -378,12 +378,12 @@ sub CheckGeometryAndDepth
# #
# GetDisplayNumber gets the lowest available display number. A display number # GetLowestAvailableDisplayNumber gets the lowest available display number. A
# n is taken if something is listening on the VNC server port (5900+n) or the # display number n is taken if something is listening on the VNC server port
# X server port (6000+n). # (5900+n) or the X server port (6000+n).
# #
sub GetDisplayNumber sub GetLowestAvailableDisplayNumber
{ {
foreach $n (1..99) { foreach $n (1..99) {
if (&CheckDisplayNumber($n)) { if (&CheckDisplayNumber($n)) {