Beispiel #1
0
  public VncViewer(String[] argv) {
    applet = false;

    // Override defaults with command-line options
    for (int i = 0; i < argv.length; i++) {
      if (argv[i].equalsIgnoreCase("-log")) {
        if (++i >= argv.length) usage();
        System.err.println("Log setting: " + argv[i]);
        LogWriter.setLogParams(argv[i]);
        continue;
      }

      if (Configuration.setParam(argv[i])) continue;

      if (argv[i].charAt(0) == '-') {
        if (i + 1 < argv.length) {
          if (Configuration.setParam(argv[i].substring(1), argv[i + 1])) {
            i++;
            continue;
          }
        }
        usage();
      }

      if (vncServerName.getValue() != null) usage();
      vncServerName.setParam(argv[i]);
    }
  }
Beispiel #2
0
 public void start() {
   vlog.debug("start called");
   if (version == null || build == null) {
     ClassLoader cl = this.getClass().getClassLoader();
     InputStream stream = cl.getResourceAsStream("com/tigervnc/vncviewer/timestamp");
     try {
       Manifest manifest = new Manifest(stream);
       Attributes attributes = manifest.getMainAttributes();
       version = attributes.getValue("Version");
       build = attributes.getValue("Build");
     } catch (java.io.IOException e) {
     }
   }
   nViewers++;
   if (firstApplet) {
     alwaysShowServerDialog.setParam(true);
     Configuration.readAppletParams(this);
     String host = getCodeBase().getHost();
     if (vncServerName.getValue() == null && vncServerPort.getValue() != 0) {
       int port = vncServerPort.getValue();
       vncServerName.setParam(
           host + ((port >= 5900 && port <= 5999) ? (":" + (port - 5900)) : ("::" + port)));
     }
   }
   thread = new Thread(this);
   thread.start();
 }
Beispiel #3
0
 public static void usage() {
   String usage =
       ("\nusage: vncviewer [options/parameters] "
           + "[host:displayNum] [options/parameters]\n"
           + "       vncviewer [options/parameters] -listen [port] "
           + "[options/parameters]\n"
           + "\n"
           + "Options:\n"
           + "  -log <level>    configure logging level\n"
           + "\n"
           + "Parameters can be turned on with -<param> or off with "
           + "-<param>=0\n"
           + "Parameters which take a value can be specified as "
           + "-<param> <value>\n"
           + "Other valid forms are <param>=<value> -<param>=<value> "
           + "--<param>=<value>\n"
           + "Parameter names are case-insensitive.  The parameters "
           + "are:\n\n"
           + Configuration.listParams());
   System.err.print(usage);
   System.exit(1);
 }