* commands.c (tn): Change sin to sin4 to not shadow global
authorEzra Peisach <epeisach@mit.edu>
Fri, 22 Jun 2001 15:39:33 +0000 (15:39 +0000)
committerEzra Peisach <epeisach@mit.edu>
Fri, 22 Jun 2001 15:39:33 +0000 (15:39 +0000)
* authenc.c (telnet_gets): Change local variable prompt to tprompt
to not shadow global variable.

git-svn-id: svn://anonsvn.mit.edu/krb5/trunk@13494 dc483132-0cff-0310-8789-dd5450dbe970

src/appl/telnet/telnet/ChangeLog
src/appl/telnet/telnet/authenc.c
src/appl/telnet/telnet/commands.c

index cb41b6600d728f074f8782e84e7ce1eead946d0e..44b9690a15f55525f6c1d8a0175b1daba4f9a4b8 100644 (file)
@@ -1,3 +1,10 @@
+2001-06-22  Ezra Peisach  <epeisach@mit.edu>
+
+       * commands.c (tn): Change sin to sin4 to not shadow global.
+
+       * authenc.c (telnet_gets): Change local variable prompt to tprompt
+       to not shadow global variable.
+
 2001-06-21  Ezra Peisach  <epeisach@mit.edu>
 
        * configure.in: Test for parsetos() prototype and presence of
index 99037bb69ef9d03d273b965563fc2cfb06321082..ef2bf2d63daebdd8fca46e350a9b66a13b121337 100644 (file)
@@ -90,8 +90,8 @@ telnet_getenv(val)
 }
 
        char *
-telnet_gets(prompt, result, length, echo)
-       char *prompt;
+telnet_gets(tprompt, result, length, echo)
+       char *tprompt;
        char *result;
        int length;
        int echo;
@@ -103,9 +103,9 @@ telnet_gets(prompt, result, length, echo)
 
        TerminalNewMode(-1);
        if (echo) {
-               printf("%s", prompt);
+               printf("%s", tprompt);
                res = fgets(result, length, stdin);
-       } else if ((res = getpass(prompt))) {
+       } else if ((res = getpass(tprompt))) {
                strncpy(result, res, length);
                res = result;
        }
index 3e94b022cf59c531977fa2c202ae83fb7c9a376d..c23570e0071b6063577704630713285c48cfc413 100644 (file)
@@ -2388,7 +2388,7 @@ tn(argc, argv)
     char *argv[];
 {
     register struct hostent *host = 0;
-    struct sockaddr_in sin;
+    struct sockaddr_in sin4;
     struct servent *sp = 0;
     unsigned long temp;
 #if    defined(IP_OPTIONS) && defined(IPPROTO_IP)
@@ -2398,7 +2398,7 @@ tn(argc, argv)
     char *cmd, *hostp = 0, *portp = 0, *volatile user = 0;
 
     /* clear the socket address prior to use */
-    memset((char *)&sin, 0, sizeof(sin));
+    memset((char *)&sin4, 0, sizeof(sin4));
 
     if (connected) {
        printf("?Already connected to %s\r\n", hostname);
@@ -2461,28 +2461,28 @@ tn(argc, argv)
            printf("Bad source route option: %s\r\n", hostp);
            return 0;
        } else {
-           sin.sin_addr.s_addr = temp;
-           sin.sin_family = AF_INET;
+           sin4.sin_addr.s_addr = temp;
+           sin4.sin_family = AF_INET;
        }
     } else {
 #endif
        temp = inet_addr(hostp);
        if ((temp & 0xffffffff) != INADDR_NONE) {
-           sin.sin_addr.s_addr = temp;
-           sin.sin_family = AF_INET;
+           sin4.sin_addr.s_addr = temp;
+           sin4.sin_family = AF_INET;
            (void) strncpy(_hostname, hostp, sizeof(_hostname) - 1);  
            _hostname[sizeof(_hostname) - 1] = '\0';
            hostname = _hostname;
        } else {
            host = gethostbyname(hostp);
            if (host) {
-               sin.sin_family = host->h_addrtype;
+               sin4.sin_family = host->h_addrtype;
 #if    defined(h_addr)         /* In 4.3, this is a #define */
-               memcpy((caddr_t)&sin.sin_addr,
-                      host->h_addr_list[0], sizeof(sin.sin_addr));
+               memcpy((caddr_t)&sin4.sin_addr,
+                      host->h_addr_list[0], sizeof(sin4.sin_addr));
 #else  /* defined(h_addr) */
-               memcpy((caddr_t)&sin.sin_addr, host->h_addr, 
-                      sizeof(sin.sin_addr)); 
+               memcpy((caddr_t)&sin4.sin_addr, host->h_addr, 
+                      sizeof(sin4.sin_addr)); 
 #endif /* defined(h_addr) */
                strncpy(_hostname, host->h_name, sizeof(_hostname));
                _hostname[sizeof(_hostname)-1] = '\0';
@@ -2495,24 +2495,24 @@ tn(argc, argv)
 #if    defined(IP_OPTIONS) && defined(IPPROTO_IP)
     }
 #endif
-    hostaddr.s_addr = sin.sin_addr.s_addr;
+    hostaddr.s_addr = sin4.sin_addr.s_addr;
     if (portp) {
        if (*portp == '-') {
            portp++;
            telnetport = 1;
        } else
            telnetport = 0;
-       sin.sin_port = atoi(portp);
-       if (sin.sin_port == 0) {
+       sin4.sin_port = atoi(portp);
+       if (sin4.sin_port == 0) {
            sp = getservbyname(portp, "tcp");
            if (sp)
-               sin.sin_port = sp->s_port;
+               sin4.sin_port = sp->s_port;
            else {
                printf("%s: bad port number\r\n", portp);
                return 0;
            }
        } else {
-           sin.sin_port = htons(sin.sin_port);
+           sin4.sin_port = htons(sin4.sin_port);
        }
     } else {
        if (sp == 0) {
@@ -2521,11 +2521,11 @@ tn(argc, argv)
                fprintf(stderr, "telnet: tcp/telnet: unknown service\n");
                return 0;
            }
-           sin.sin_port = sp->s_port;
+           sin4.sin_port = sp->s_port;
        }
        telnetport = 1;
     }
-    printf("Trying %s...\r\n", inet_ntoa(sin.sin_addr));
+    printf("Trying %s...\r\n", inet_ntoa(sin4.sin_addr));
     do {
        net = socket(AF_INET, SOCK_STREAM, 0);
        if (net < 0) {
@@ -2557,20 +2557,20 @@ tn(argc, argv)
                perror("setsockopt (SO_DEBUG)");
        }
 
-       if (connect(net, (struct sockaddr *)&sin, sizeof (sin)) < 0) {
+       if (connect(net, (struct sockaddr *)&sin4, sizeof (sin4)) < 0) {
 #if    defined(h_addr)         /* In 4.3, this is a #define */
            if (host && host->h_addr_list[1]) {
                int oerrno = errno;
 
                fprintf(stderr, "telnet: connect to address %s: ",
-                                               inet_ntoa(sin.sin_addr));
+                                               inet_ntoa(sin4.sin_addr));
                errno = oerrno;
                perror((char *)0);
                host->h_addr_list++;
-               memcpy((caddr_t)&sin.sin_addr, 
-                       host->h_addr_list[0], sizeof(sin.sin_addr));
+               memcpy((caddr_t)&sin4.sin_addr, 
+                       host->h_addr_list[0], sizeof(sin4.sin_addr));
                memcpy((caddr_t)&hostaddr,
-                      host->h_addr_list[0], sizeof(sin.sin_addr));
+                      host->h_addr_list[0], sizeof(sin4.sin_addr));
                (void) NetClose(net);
                continue;
            }
@@ -2579,7 +2579,8 @@ tn(argc, argv)
            return 0;
        }
        connected++;
-       host = gethostbyaddr((char *) &sin.sin_addr, sizeof(struct in_addr), sin.sin_family);
+       host = gethostbyaddr((char *) &sin4.sin_addr, sizeof(struct in_addr),
+                            sin4.sin_family);
            if (host) {
              strncpy(_hostname, host->h_name, sizeof(_hostname));
                _hostname[sizeof(_hostname)-1] = '\0';