Develop and Download Open Source Software

Browse Subversion Repository

Diff of /trunk/teraterm/ttpset/ttset.c

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

revision 6958 by doda, Tue Oct 24 12:05:11 2017 UTC revision 7091 by doda, Tue Apr 3 13:49:43 2018 UTC
# Line 40  Line 40 
40  #include <errno.h>  #include <errno.h>
41  #include "ttlib.h"  #include "ttlib.h"
42  #include "tt_res.h"  #include "tt_res.h"
43    #include "servicenames.h"
44    
45  #include "compat_w95.h"  #include "compat_w95.h"
46    
# Line 3820  BOOL NextParam(PCHAR Param, int *i, PCHA Line 3821  BOOL NextParam(PCHAR Param, int *i, PCHA
3821          return (strlen(Temp) > 0);          return (strlen(Temp) > 0);
3822  }  }
3823  #endif  #endif
3824    
3825    static int ParsePortName(char *buff)
3826    {
3827            int port = parse_port_from_buf(buff);
3828    
3829            if (port > 0 || sscanf(buff, "%d", &port) == 1)
3830                    return port;
3831            else
3832                    return 0;
3833    }
3834    
3835  static void ParseHostName(char *HostStr, WORD * port)  static void ParseHostName(char *HostStr, WORD * port)
3836  {  {
3837          /*          /*
3838           * hostname.domain.com           * hostname.example.jp
3839           * hostname.domain.com:23           * hostname.example.jp:23
3840           * [3ffe:1234:1234::1]     IPv6 raw address           * hostname.example.jp:telnet
3841           * [3ffe:1234:1234::1]:23  IPv6 raw address and port#           * [3ffe:1234:1234::1]         IPv6 raw address
3842           * telnet://hostname.domain.com/           * [3ffe:1234:1234::1]:23      IPv6 raw address and port#
3843           * telnet://hostname.domain.com:23/           * [3ffe:1234:1234::1]:telnet  IPv6 raw address and service name
3844             * telnet://hostname.example.jp/
3845             * telnet://hostname.example.jp:23/
3846             * telnet://hostname.example.jp:telnet/
3847           * telnet://[3ffe:1234:1234::1]/           * telnet://[3ffe:1234:1234::1]/
3848           * telnet://[3ffe:1234:1234::1]:23/           * telnet://[3ffe:1234:1234::1]:23/
3849             * telnet://[3ffe:1234:1234::1]:telnet/
3850           * tn3270:// .... /           * tn3270:// .... /
3851           */           */
3852    
# Line 3885  static void ParseHostName(char *HostStr, Line 3901  static void ParseHostName(char *HostStr,
3901           *                    |           *                    |
3902           *                    s           *                    s
3903           *           *
3904           *   hostname.domain.com           *   hostname.example.jp
3905           *   |           *   |
3906           *   s           *   s
3907           */           */
# Line 3896  static void ParseHostName(char *HostStr, Line 3912  static void ParseHostName(char *HostStr,
3912          } while (b != '\0' && b != ':');          } while (b != '\0' && b != ':');
3913          if (b == ':') {          if (b == ':') {
3914                  s[i - 1] = '\0';                  s[i - 1] = '\0';
3915                  if (sscanf(&(s[i]), "%hd", port) != 1)                  *port = ParsePortName(&(s[i]));
                         *port = 65535;  
3916                  is_port = 1;                  is_port = 1;
3917          }          }
3918          if (is_telnet_handler == 1 && is_port == 0) {          if (is_telnet_handler == 1 && is_port == 0) {
# Line 4097  void PASCAL ParseParam(PCHAR Param, PTTS Line 4112  void PASCAL ParseParam(PCHAR Param, PTTS
4112                  }                  }
4113                  else if (_strnicmp(Temp, "/P=", 3) == 0) {      /* TCP port num */                  else if (_strnicmp(Temp, "/P=", 3) == 0) {      /* TCP port num */
4114                          ParamPort = IdTCPIP;                          ParamPort = IdTCPIP;
4115                          if (sscanf(&Temp[3], "%hd", &ParamTCP) != 1)                          ParamTCP = ParsePortName(&Temp[3]);
                                 ParamTCP = 0;  
4116                  }                  }
4117                  else if (_stricmp(Temp, "/PIPE") == 0 ||                  else if (_stricmp(Temp, "/PIPE") == 0 ||
4118                           _stricmp(Temp, "/NAMEDPIPE") == 0) {   /* 名前付きパイプ */                           _stricmp(Temp, "/NAMEDPIPE") == 0) {   /* 名前付きパイプ */
# Line 4161  void PASCAL ParseParam(PCHAR Param, PTTS Line 4175  void PASCAL ParseParam(PCHAR Param, PTTS
4175    
4176                  }                  }
4177                  else if ((Temp[0] != '/') && (strlen(Temp) > 0)) {                  else if ((Temp[0] != '/') && (strlen(Temp) > 0)) {
4178                          if (JustAfterHost && (sscanf(Temp, "%d", &c) == 1))                          if (JustAfterHost && ((c=ParsePortName(Temp)) > 0))
4179                                  ParamTCP = c;                                  ParamTCP = c;
4180                          else {                          else {
4181                                  strncpy_s(ts->HostName, sizeof(ts->HostName), Temp, _TRUNCATE); /* host name */                                  strncpy_s(ts->HostName, sizeof(ts->HostName), Temp, _TRUNCATE); /* host name */

Legend:
Removed from v.6958  
changed lines
  Added in v.7091

Back to OSDN">Back to OSDN
ViewVC Help
Powered by ViewVC 1.1.26