/[rdesktop]/sourceforge.net/branches/seamlessrdp-branch/rdesktop/rdesktop.c
This is repository of my old source code which isn't updated any more. Go to git.rot13.org for current projects!
ViewVC logotype

Diff of /sourceforge.net/branches/seamlessrdp-branch/rdesktop/rdesktop.c

Parent Directory Parent Directory | Revision Log Revision Log | View Patch Patch

revision 438 by jsorg71, Fri Aug 1 17:01:58 2003 UTC revision 444 by astrand, Sun Aug 17 07:31:36 2003 UTC
# Line 141  read_password(char *password, int size) Line 141  read_password(char *password, int size)
141          return ret;          return ret;
142  }  }
143    
144    static void
145    parse_server_and_port(char *server)
146    {
147            char *p;
148    #ifdef IPv6
149            int addr_colons;
150    #endif
151    
152    #ifdef IPv6
153            p = server;
154            addr_colons = 0;
155            while (*p)
156                    if (*p++ == ':')
157                            addr_colons++;
158            if (addr_colons >= 2)
159            {
160                    /* numeric IPv6 style address format - [1:2:3::4]:port */
161                    p = strchr(server, ']');
162                    if (*server == '[' && p != NULL)
163                    {
164                            if (*(p + 1) == ':' && *(p + 2) != '\0')
165                                    tcp_port_rdp = strtol(p + 2, NULL, 10);
166                            /* remove the port number and brackets from the address */
167                            *p = '\0';
168                            strncpy(server, server + 1, strlen(server));
169                    }
170            }
171            else
172            {
173                    /* dns name or IPv4 style address format - server.example.com:port or 1.2.3.4:port */
174                    p = strchr(server, ':');
175                    if (p != NULL)
176                    {
177                            tcp_port_rdp = strtol(p + 1, NULL, 10);
178                            *p = 0;
179                    }
180            }
181    #else /* no IPv6 support */
182            p = strchr(server, ':');
183            if (p != NULL)
184            {
185                    tcp_port_rdp = strtol(p + 1, NULL, 10);
186                    *p = 0;
187            }
188    #endif /* IPv6 */
189    
190    }
191    
192  /* Client program */  /* Client program */
193  int  int
194  main(int argc, char *argv[])  main(int argc, char *argv[])
# Line 325  main(int argc, char *argv[]) Line 373  main(int argc, char *argv[])
373          }          }
374    
375          STRNCPY(server, argv[optind], sizeof(server));          STRNCPY(server, argv[optind], sizeof(server));
376          p = strchr(server, ':');          parse_server_and_port(server);
         if (p != NULL)  
         {  
                 tcp_port_rdp = strtol(p + 1, NULL, 10);  
                 *p = 0;  
         }  
377    
378          if (!username_option)          if (!username_option)
379          {          {

Legend:
Removed from v.438  
changed lines
  Added in v.444

  ViewVC Help
Powered by ViewVC 1.1.26