vncServerName.put(argv[i].toCharArray()).flip(); | vncServerName.put(argv[i].toCharArray()).flip(); | ||||
} | } | ||||
// Check if the server name in reality is a configuration file | |||||
potentiallyLoadConfigurationFile(vncServerName); | |||||
} | } | ||||
public static void usage() { | public static void usage() { | ||||
"[host:displayNum]\n"+ | "[host:displayNum]\n"+ | ||||
" vncviewer [options/parameters] -listen [port] "+ | " vncviewer [options/parameters] -listen [port] "+ | ||||
"[options/parameters]\n"+ | "[options/parameters]\n"+ | ||||
" vncviewer [options/parameters] [.tigervnc file]\n"+ | |||||
"\n"+ | "\n"+ | ||||
"Options:\n"+ | "Options:\n"+ | ||||
" -log <level> configure logging level\n"+ | " -log <level> configure logging level\n"+ | ||||
System.exit(1); | System.exit(1); | ||||
} | } | ||||
public static void potentiallyLoadConfigurationFile(CharBuffer vncServerName) { | |||||
String serverName = vncServerName.toString(); | |||||
boolean hasPathSeparator = (serverName.indexOf('/') != -1 || | |||||
(serverName.indexOf('\\')) != -1); | |||||
if (hasPathSeparator) { | |||||
try { | |||||
serverName = loadViewerParameters(vncServerName.toString()); | |||||
if (serverName == "") { | |||||
vlog.info("Unable to load the server name from given file"); | |||||
System.exit(1); | |||||
} | |||||
vncServerName.clear(); | |||||
vncServerName.put(serverName).flip(); | |||||
} catch (com.tigervnc.rfb.Exception e) { | |||||
vlog.info(e.getMessage()); | |||||
System.exit(1); | |||||
} | |||||
} | |||||
} | |||||
public static void newViewer() { | public static void newViewer() { | ||||
String cmd = "java -jar "; | String cmd = "java -jar "; | ||||
try { | try { |
fprintf(stderr, | fprintf(stderr, | ||||
"\nusage: %s [parameters] [host:displayNum] [parameters]\n" | "\nusage: %s [parameters] [host:displayNum] [parameters]\n" | ||||
" %s [parameters] -listen [port] [parameters]\n", | |||||
programName, programName); | |||||
" %s [parameters] -listen [port] [parameters]\n" | |||||
" %s [parameters] [.tigervnc file]\n", | |||||
programName, programName, programName); | |||||
fprintf(stderr,"\n" | fprintf(stderr,"\n" | ||||
"Parameters can be turned on with -<param> or off with -<param>=0\n" | "Parameters can be turned on with -<param> or off with -<param>=0\n" | ||||
"Parameters which take a value can be specified as " | "Parameters which take a value can be specified as " | ||||
exit(1); | exit(1); | ||||
} | } | ||||
static void | |||||
potentiallyLoadConfigurationFile(char *vncServerName) | |||||
{ | |||||
const bool hasPathSeparator = (strchr(vncServerName, '/') != NULL || | |||||
(strchr(vncServerName, '\\')) != NULL); | |||||
if (hasPathSeparator) { | |||||
try { | |||||
strncpy(vncServerName, loadViewerParameters(vncServerName), | |||||
VNCSERVERNAMELEN); | |||||
if (vncServerName[0] == '\0') { | |||||
vlog.error("Unable to load the server name from given file"); | |||||
if (alertOnFatalError) | |||||
fl_alert("Unable to load the server name from given file"); | |||||
exit(EXIT_FAILURE); | |||||
} | |||||
} catch (rfb::Exception& e) { | |||||
vlog.error("%s", e.str()); | |||||
if (alertOnFatalError) | |||||
fl_alert("%s", e.str()); | |||||
exit(EXIT_FAILURE); | |||||
} | |||||
} | |||||
} | |||||
#ifndef WIN32 | #ifndef WIN32 | ||||
static int | static int | ||||
interpretViaParam(char *remoteHost, int *remotePort, int localPort) | interpretViaParam(char *remoteHost, int *remotePort, int localPort) | ||||
i++; | i++; | ||||
} | } | ||||
// Check if the server name in reality is a configuration file | |||||
potentiallyLoadConfigurationFile(vncServerName); | |||||
mkvnchomedir(); | mkvnchomedir(); | ||||
#if !defined(WIN32) && !defined(__APPLE__) | #if !defined(WIN32) && !defined(__APPLE__) |
.RI [ options ] | .RI [ options ] | ||||
.B \-listen | .B \-listen | ||||
.RI [ port ] | .RI [ port ] | ||||
.br | |||||
.B vncviewer | |||||
.RI [ options ] | |||||
.RI [ .tigervnc file ] | |||||
.SH DESCRIPTION | .SH DESCRIPTION | ||||
.B vncviewer | .B vncviewer | ||||
is a viewer (client) for Virtual Network Computing. This manual page documents | is a viewer (client) for Virtual Network Computing. This manual page documents | ||||
omitted. So for example ":1" means display number 1 on the same machine, and | omitted. So for example ":1" means display number 1 on the same machine, and | ||||
"snoopy" means "snoopy:0" i.e. display 0 on machine "snoopy". | "snoopy" means "snoopy:0" i.e. display 0 on machine "snoopy". | ||||
As another quick way to start a connection to a VNC server, specify a .tigervnc | |||||
configuration file as an argument to the viewer, e.g.: | |||||
.RS | |||||
vncviewer ./some.tigervnc | |||||
.RE | |||||
where './some.tigervnc' is an existing and valid TigerVNC configuration file. | |||||
The file name needs to include a path separator. Additional options may be | |||||
given too, but the given configuration file will overwrite any conflicting | |||||
parameters. | |||||
If the VNC server is successfully contacted, you will be prompted for a | If the VNC server is successfully contacted, you will be prompted for a | ||||
password to authenticate you. If the password is correct, a window will appear | password to authenticate you. If the password is correct, a window will appear | ||||
showing the desktop of the VNC server. | showing the desktop of the VNC server. |