Real-time collaboration for Jupyter Notebooks, Linux Terminals, LaTeX, VS Code, R IDE, and more,
all in one place.
Real-time collaboration for Jupyter Notebooks, Linux Terminals, LaTeX, VS Code, R IDE, and more,
all in one place.
Path: blob/master/external/source/vncdll/winvnc/ParseHost.h
Views: 11780
// Copyright (C) 2006 Constantin Kaplinsky. All Rights Reserved.1//2// TightVNC is free software; you can redistribute it and/or modify3// it under the terms of the GNU General Public License as published by4// the Free Software Foundation; either version 2 of the License, or5// (at your option) any later version.6//7// This program is distributed in the hope that it will be useful,8// but WITHOUT ANY WARRANTY; without even the implied warranty of9// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the10// GNU General Public License for more details.11//12// You should have received a copy of the GNU General Public License13// along with this program; if not, write to the Free Software14// Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307,15// USA.16//17// TightVNC distribution homepage on the Web: http://www.tightvnc.com/1819//20// The ParseHostPort function parses a VNC host name which can be specified21// in one of these formats:22// (1) hostname23// (2) hostname:display (display < 100)24// (3) hostname:port (port >= 100)25// (4) hostname::port26// The function determines and returns the port number, and modifies str[]27// by inserting a zero byte in place of the first colon found in the string.28// The algorithm of determining the port number is as follows:29// (1) if there are no colons in the string, base_port is used;30// (2) if there is one colon and the following number is less than 100,31// then the port number is calculated by adding this number (display32// number) to base_port;33// (3) if there is one colon and the following number is 100 or greater,34// then this number is interpreted as a port number;35// (4) if there are two colons, the following number is always treated as36// a port number.37//3839int ParseHostPort(char *str, int base_port);404142