New command: account - for authentication.
[egate.git] / kernel / main.c
index a8fadfb..7926912 100644 (file)
@@ -2,7 +2,10 @@
  * Europagate, 1995
  *
  * $Log: main.c,v $
- * Revision 1.17  1995/04/19 10:46:18  adam
+ * Revision 1.18  1995/04/19 13:19:09  adam
+ * New command: account - for authentication.
+ *
+ * Revision 1.17  1995/04/19  10:46:18  adam
  * Persistency works much better now. New command: status - history-like
  *
  * Revision 1.16  1995/04/19  07:31:07  adam
@@ -175,6 +178,7 @@ int main (int argc, char **argv)
     info.default_res = "default.res";
     info.override_res = NULL;
     *info.target = 0;
+    *info.account = 0;
     info.lang = NULL;
     info.bibset = NULL;
     info.zass = NULL;
@@ -487,16 +491,20 @@ void read_kernel_res (void)
     if (*info.target && ! gw_res_get (info.kernel_res, resource_name, NULL))
     {
         /* target is there, and there is no sub-resource for it... */
-        char *split;
+        const char *split;
 
         if ((split = strchr (info.target, ':')))
-            *split++ = '\0';
-        strncpy (info.hostname, info.target, sizeof(info.hostname)-1);
-        if (split)
-            info.port = atoi (split);
+        {
+            memcpy (info.hostname, info.target, split-info.target);
+            info.hostname[split-info.target] = '\0';
+            info.port = atoi (split+1);
+        }
         else
+        {
+            strcpy (info.hostname, info.target);
             info.port = atoi (gw_res_get
                               (info.kernel_res, "gw.portno", "210"));
+        }
     }
     else
     {