]> andersk Git - moira.git/commitdiff
use library version of canonicalize hostname
authormar <mar>
Thu, 1 Jun 1989 21:13:26 +0000 (21:13 +0000)
committermar <mar>
Thu, 1 Jun 1989 21:13:26 +0000 (21:13 +0000)
clients/moira/attach.c
clients/moira/cluster.c

index a3b850a448e6621fd6ee0fd9e40f8c8488296b4f..4a7076ff0009a64bee7f28f694b1ce1d37fb5e9e 100644 (file)
@@ -262,9 +262,7 @@ Bool name;
        info[FS_MACHINE] = Strsave(NO_MACHINE);
     } else {
        GetValueFromUser("Filesystem's Machine", &info[FS_MACHINE]);
-       strcpy(temp_buf, CanonicalizeHostname(info[FS_MACHINE]));
-       free(info[FS_MACHINE]);
-       info[FS_MACHINE] = Strsave(temp_buf);
+       info[FS_MACHINE] = canonicalize_hostname(info[FS_MACHINE]);
     }
     if (!fsgroup) {
        GetValueFromUser("Filesystem's Pack Name", &info[FS_PACK]);
index 2575a4044a2a373012adf5b84c77b51af03f98b4..f1980f22e03b0b157ce95e853ab0db1a64e0bdf8 100644 (file)
@@ -260,9 +260,7 @@ Bool name;
        case MACHINE:
            newname = Strsave(info[M_NAME]);
            GetValueFromUser("The new name for this machine? ", &newname);
-           strcpy(temp_buf, CanonicalizeHostname(newname));
-           free(newname);
-           newname = Strsave(temp_buf);
+           newname = canonicalize_hostname(newname);
            break;
        case CLUSTER:
            newname = Strsave(info[C_NAME]);
@@ -320,8 +318,10 @@ int argc;
 char **argv;
 {
     struct qelem *top;
+    char *tmpname;
 
-    top = GetMCInfo(MACHINE, CanonicalizeHostname(argv[1]), (char *) NULL);
+    tmpname = canonicalize_hostname(strsave(argv[1]));
+    top = GetMCInfo(MACHINE, tmpname, (char *) NULL);
     Loop(top, ( (void *) PrintMachInfo) );
     FreeQueue(top);
     return(DM_NORMAL);
@@ -347,14 +347,16 @@ char **argv;
 /* 
  * Check to see if this machine already exists. 
  */
-    name =  CanonicalizeHostname(argv[1]);
+    name =  canonicalize_hostname(strsave(argv[1]));
 
     if ( (stat = do_sms_query("get_machine", 1, &name, NullFunc, NULL)) == 0) {
        Put_message("This machine already exists.");
+       free(name);
        return(DM_NORMAL);
     }
     else if (stat != SMS_NO_MATCH) {
        com_err(program_name, stat, " in AddMachine.");
+       free(name);
        return(DM_NORMAL);
     }
 
@@ -369,6 +371,7 @@ char **argv;
        com_err(program_name, stat, " in AddMachine.");
 
     FreeInfo(info);
+    free(name);
     return(DM_NORMAL);
 }
 
@@ -406,11 +409,15 @@ UpdateMachine(argc, argv)
 int argc;
 char **argv;
 {
-    struct qelem *top = GetMCInfo( MACHINE,  CanonicalizeHostname(argv[1]),
-                                  (char *) NULL);
+    struct qelem *top;
+    char *tmpname;
+
+    tmpname = canonicalize_hostname(strsave(argv[1]));
+    top = GetMCInfo( MACHINE,  tmpname, (char *) NULL);
     QueryLoop(top, NullPrint, RealUpdateMachine, "Update the machine");
 
     FreeQueue(top);
+    free(tmpname);
     return(DM_NORMAL);
 }
 
@@ -530,10 +537,13 @@ int argc;
 char **argv;
 {
     struct qelem *top;
+    char *tmpname;
 
-    top = GetMCInfo(MACHINE, CanonicalizeHostname(argv[1]), (char *) NULL);
+    tmpname = canonicalize_hostname(strsave(argv[1]));
+    top = GetMCInfo(MACHINE, tmpname, (char *) NULL);
     QueryLoop(top, PrintMachInfo, RealDeleteMachine, "Delete the machine");
     FreeQueue(top);
+    free(tmpname);
     return(DM_NORMAL);
 }
 
@@ -555,11 +565,12 @@ char ** argv;
     Bool add_it, one_machine, one_cluster;
     struct qelem * melem, *mtop, *celem, *ctop;
 
-    machine = CanonicalizeHostname(argv[1]);
+    machine = canonicalize_hostname(strsave(argv[1]));
     cluster = argv[2];
 
     celem = ctop = GetMCInfo(CLUSTER,  cluster, (char *) NULL);
     melem = mtop = GetMCInfo(MACHINE,  machine, (char *) NULL);
+    free(machine);
 
     one_machine = (QueueCount(mtop) == 1);
     one_cluster = (QueueCount(ctop) == 1);
@@ -667,7 +678,7 @@ char ** argv;
     char buf[BUFSIZ], * args[10];
     register int stat;
 
-    args[MAP_MACHINE] = CanonicalizeHostname(argv[1]);
+    args[MAP_MACHINE] = canonicalize_hostname(strsave(argv[1]));
     args[MAP_CLUSTER] = argv[2];
     args[MAP_END] = NULL;
 
@@ -677,6 +688,7 @@ char ** argv;
        sprintf(buf, "The machine %s is not is the cluster %s.",
                args[MAP_MACHINE], args[MAP_CLUSTER]);
        Put_message(buf);
+       free(args[MAP_MACHINE]);
        return(DM_NORMAL);
     }
     if (stat != SMS_SUCCESS)
@@ -687,6 +699,7 @@ char ** argv;
              "Remove this machine from this cluster");
 
     FreeQueue(elem);
+    free(args[MAP_MACHINE]);
     return(DM_NORMAL);
 }
 
@@ -705,10 +718,13 @@ int argc;
 char ** argv;
 {
     struct qelem *top;
+    char *tmpname;
 
-    top = GetMCInfo(CLUSTER, CanonicalizeHostname(argv[1]), (char *) NULL);
+    tmpname = canonicalize_hostname(strsave(argv[1]));
+    top = GetMCInfo(CLUSTER, tmpname, (char *) NULL);
     Loop(top, (void *) PrintClusterInfo);
     FreeQueue(top);
+    free(tmpname);
     return(DM_NORMAL);
 }
 
@@ -1046,8 +1062,10 @@ int argc;
 char **argv;
 {
     struct qelem *elem, *top;
+    char *tmpname;
 
-    top = elem = GetMCInfo(MAP, CanonicalizeHostname(argv[1]), argv[2]);
+    tmpname = canonicalize_hostname(strsave(argv[1]));
+    top = elem = GetMCInfo(MAP, tmpname, argv[2]);
   
     Put_message("");           /* blank line on screen */
     while (elem != NULL) {
@@ -1057,5 +1075,6 @@ char **argv;
     }
 
     FreeQueue(top);
+    free(tmpname);
     return(DM_NORMAL);
 }
This page took 0.306099 seconds and 5 git commands to generate.