From a560276817a610e7677e66f7c08adbb7af0cee3c Mon Sep 17 00:00:00 2001 From: Dmitry Maksyoma Date: Sat, 31 Jul 2021 00:19:37 +1200 Subject: [PATCH] vncserver: extract ProcessCliOptions() --- unix/vncserver | 64 +++++++++++++++++++++++++++----------------------- 1 file changed, 34 insertions(+), 30 deletions(-) diff --git a/unix/vncserver b/unix/vncserver index 06e7360..6dc5abb 100755 --- a/unix/vncserver +++ b/unix/vncserver @@ -71,36 +71,7 @@ chop($host = `uname -n`); &ParseOptions("-geometry",1,"-depth",1,"-pixelformat",1,"-name",1,"-kill",1, "-help",0,"-h",0,"--help",0,"-fp",1,"-list",0,"-fg",0,"-autokill",0,"-noxstartup",0,"-xstartup",1); -&Usage() if ($opt{'-help'} || $opt{'-h'} || $opt{'--help'}); - -&Kill() if ($opt{'-kill'}); - -&List() if ($opt{'-list'}); - -# Uncomment this line if you want default geometry, depth and pixelformat -# to match the current X display: -# &GetXDisplayDefaults(); - -if ($opt{'-geometry'}) { - $geometry = $opt{'-geometry'}; -} -if ($opt{'-depth'}) { - $depth = $opt{'-depth'}; - $pixelformat = ""; -} -if ($opt{'-pixelformat'}) { - $pixelformat = $opt{'-pixelformat'}; -} -if ($opt{'-noxstartup'}) { - $skipxstartup = 1; -} -if ($opt{'-xstartup'}) { - $xstartupFile = $opt{'-xstartup'}; -} -if ($opt{'-fp'}) { - $fontPath = $opt{'-fp'}; - $fpArgSpecified = 1; -} +&ProcessCliOptions(); &CheckGeometryAndDepth(); @@ -943,3 +914,36 @@ sub DetectFontPath { $fontPath = $defFontPath; } } + +sub ProcessCliOptions { + &Usage() if ($opt{'-help'} || $opt{'-h'} || $opt{'--help'}); + + &Kill() if ($opt{'-kill'}); + + &List() if ($opt{'-list'}); + + # Uncomment this line if you want default geometry, depth and pixelformat + # to match the current X display: + # &GetXDisplayDefaults(); + + if ($opt{'-geometry'}) { + $geometry = $opt{'-geometry'}; + } + if ($opt{'-depth'}) { + $depth = $opt{'-depth'}; + $pixelformat = ""; + } + if ($opt{'-pixelformat'}) { + $pixelformat = $opt{'-pixelformat'}; + } + if ($opt{'-noxstartup'}) { + $skipxstartup = 1; + } + if ($opt{'-xstartup'}) { + $xstartupFile = $opt{'-xstartup'}; + } + if ($opt{'-fp'}) { + $fontPath = $opt{'-fp'}; + $fpArgSpecified = 1; + } +}