[mpich2-commits] r4021 - mpich2/trunk/src/pm/hydra/utils/args

balaji at mcs.anl.gov balaji at mcs.anl.gov
Thu Mar 12 02:00:51 CDT 2009


Author: balaji
Date: 2009-03-12 02:00:51 -0500 (Thu, 12 Mar 2009)
New Revision: 4021

Modified:
   mpich2/trunk/src/pm/hydra/utils/args/args.c
Log:
Cleaned up the code to find the location of the proxy.

Modified: mpich2/trunk/src/pm/hydra/utils/args/args.c
===================================================================
--- mpich2/trunk/src/pm/hydra/utils/args/args.c	2009-03-12 06:53:24 UTC (rev 4020)
+++ mpich2/trunk/src/pm/hydra/utils/args/args.c	2009-03-12 07:00:51 UTC (rev 4021)
@@ -102,27 +102,21 @@
 
 HYD_Status HYDU_Get_base_path(char *execname, char **path)
 {
-    char *str[HYDU_NUM_JOIN_STR];
-    int i;
+    char *loc;
     HYD_Status status = HYD_SUCCESS;
 
     HYDU_FUNC_ENTER();
 
-    i = 0;
-    if (execname[0] == '/')
-        str[i++] = "/";
-    str[i++] = strtok(execname, "/");
-    do {
-        str[i++] = "/";
-        str[i++] = strtok(NULL, "/");
-    } while (str[i - 1]);
-    str[i - 3] = NULL;
-
-    status = HYDU_String_alloc_and_join(str, path);
-    if (status != HYD_SUCCESS) {
-        HYDU_Error_printf("String utils returned error while joining strings\n");
-        goto fn_fail;
+    *path = MPIU_Strdup(execname);
+    loc = strrchr(*path, '/');
+    if (loc) {
+        loc++;
+        *loc = 0;
     }
+    else {
+        HYDU_FREE(*path);
+        *path = MPIU_Strdup("");
+    }
 
   fn_exit:
     HYDU_FUNC_EXIT();



More information about the mpich2-commits mailing list