--- ssh-1.2.27-fresh/ssh.c	Wed May 12 07:19:28 1999
+++ ssh-1.2.27/ssh.c	Fri Jul 21 14:24:07 2000
@@ -16,8 +16,17 @@
 */
 
 /*
- * $Id: ssh.c,v 1.33 1999/02/22 08:14:06 tri Exp $
+ * $Id: ssh.c,v 1.2 2000/05/13 19:40:18 itoi Exp itoi $
  * $Log: ssh.c,v $
+ * Revision 1.2  2000/05/13 19:40:18  itoi
+ * ssh / speke / udp / ip / 7816 works!
+ *
+ * Revision 1.1  2000/05/10 10:51:18  itoi
+ * Initial revision
+ *
+ * Revision 1.1.1.1  2000/02/21 22:19:46  itoi
+ * SSH / Smartcard
+ *
  * Revision 1.33  1999/02/22 08:14:06  tri
  * 	Final fixes for 1.2.27.
  *
@@ -271,6 +280,12 @@
 /* Original real uid. */
 uid_t original_real_uid;
 
+/* remote smartcard
+   NI, 5/11/2000
+*/
+/*#define NAMELEN 256*/
+int remote_sc_mode;
+char *remote_sc_name; 
 
 /* Prints a help message to the user.  This function never returns. */
 void usage(void)
@@ -321,6 +336,13 @@
   fprintf(stderr, "  -C          Enable compression.\n");
   fprintf(stderr, "  -g          Allow remote hosts to connect to local port forwardings\n");
   fprintf(stderr, "  -o 'option' Process the option as if it was read from a configuration file.\n");
+
+#ifdef SC_SSH
+  fprintf(stderr, "  -K          Print RSA key for Cyberflex.\n");
+  fprintf(stderr, "  -s port     Specify port # for card reader\n");
+  fprintf(stderr, "  -I port     Specify remote smartcard's address\n");
+#endif
+
   exit(1);
 }
 
@@ -413,6 +435,9 @@
 #ifdef SIGWINCH
   struct winsize ws;
 #endif /* SIGWINCH */
+  /* NI */
+  int rv;
+  struct termios tio;
 
   /* Save the original real uid.  It will be needed later (uid-swapping may
      clobber the real uid).  */
@@ -472,6 +497,10 @@
   /* Parse command-line arguments. */
   host = NULL;
 
+  /* NI : Initialize smartcard mode */
+
+  remote_sc_mode = 0; 
+
   /* If program name is not one of the standard names, use it as host name. */
   if (strchr(av0, '/'))
     cp = strrchr(av0, '/') + 1;
@@ -482,7 +511,12 @@
       strcmp(cp, "ssh1") != 0 && strcmp(cp, "slogin1") != 0 &&
       strcmp(cp, "ssh.old") != 0 && strcmp(cp, "slogin.old") != 0 &&
       strcmp(cp, "ssh1.old") != 0 && strcmp(cp, "slogin1.old") != 0 &&
-      strcmp(cp, "remsh") != 0)
+      strcmp(cp, "remsh") != 0
+#ifdef SC_SSH
+      && strcmp(cp, "ssh_solaris") && strcmp(cp, "ssh_obsd")
+      && strcmp(cp, "ssh_linux")
+#endif
+      )
     host = cp;
   
   for (optind = 1; optind < ac; optind++)
@@ -504,7 +538,11 @@
       opt = av[optind][1];
       if (!opt)
         usage();
+#ifdef SC_SSH
+      if (strchr("seilcpLRoI", opt)) /* options with arguments */
+#else
       if (strchr("eilcpLRo", opt)) /* options with arguments */
+#endif
         {
           optarg = av[optind] + 2;
           if (strcmp(optarg, "") == 0)
@@ -522,6 +560,28 @@
         }
       switch (opt)
         {
+#ifdef SC_SSH
+	case 'T':
+	  printf ("nya- nya-\n");
+	  exit (0);
+	  
+	case 'K':
+	  setPrintKeyFlag ();
+	  break;
+	  
+	case 's':
+	  openPort (atoi(optarg));
+	  break;
+
+	case 'I':
+	  remote_sc_mode = 1;
+	  remote_sc_name = (char *)
+	    malloc (sizeof(char) * (strlen (optarg) + 2));
+	  strcpy (remote_sc_name, optarg); 
+	  debug ("IP mode, smartcard %s\n", remote_sc_name);
+	  break;
+#endif
+
         case 'n':
           stdin_null_flag = 1;
           break;
@@ -686,6 +746,8 @@
           usage();
         }
     }
+
+
 
  /* Check that we got a host name. */
   if (!host)
