[Initng-svn] r1980 - initng/tools

svn at initng.thinktux.net svn at initng.thinktux.net
Mon Nov 7 23:16:14 CET 2005


Author: SaTaN0r1
Date: Mon Nov  7 23:16:14 2005
New Revision: 1980

Modified:
   initng/tools/install_service.c
Log:
now @/usr/bin/foo@ will look for foo in the path, if found (let's say in /sbin/) it will print /sbin/foo else it will print /usr/sbin/foo

Modified: initng/tools/install_service.c
==============================================================================
--- initng/tools/install_service.c	(original)
+++ initng/tools/install_service.c	Mon Nov  7 23:16:14 2005
@@ -131,14 +131,15 @@
     }
 }
 
-static void parse_phrase(FILE * stream, const char *phrase)
+static void parse_phrase(FILE * stream, const char *fullphrase)
 {
 #define FILENAME_LEN 1000
     char filename[FILENAME_LEN];
     const char *tmp;
+    const char *phrase;
     int i;
 
-    if (!*phrase)
+    if (!*fullphrase)
     {
         fputc('@', stream);
         return;
@@ -146,6 +147,11 @@
 
     if (!path)
         return;
+    if (! (phrase = strrchr(fullphrase, '/')) )
+        phrase = fullphrase;
+    else
+        phrase++;
+    
     tmp = path;
     while (1)
     {
@@ -182,16 +188,22 @@
             }
             fprintf(stderr, "WARNING: No executable found for \"%s\", ",
                     phrase);
-	    if (at_default_path)
+	    if (fullphrase != phrase)
 	    {
-                fprintf(stderr, "using supplied default path \"%s\"\n", 
-                    at_default_path);
+                fprintf(stderr, "using full path \"%s\"\n", fullphrase);
+		fputs(fullphrase, stream);
+	    }
+	    else if (at_default_path)
+	    {
+                fprintf(stderr, "using supplied default path \"%s%s\"\n", 
+                    at_default_path, phrase);
 		fputs(at_default_path, stream);
 		fputs(phrase, stream);
 	    }
-	    else
+	    else /* at_default_path == NULL && fullphrase == phrase */
 	    {
-                fprintf(stderr, "using builtin default path \"/usr/sbin/\\n");
+                fprintf(stderr, "using builtin default path \"/usr/sbin/%s\"\n",
+                    phrase);
 		fputs("/usr/sbin/", stream);
 		fputs(phrase, stream);
 	    }


More information about the Initng-svn mailing list