Cleanup from Gennady Feldman <gfeldman@mail.com>
authorEric Andersen <andersen@codepoet.org>
Fri, 22 Dec 2000 18:02:02 +0000 (18:02 -0000)
committerEric Andersen <andersen@codepoet.org>
Fri, 22 Dec 2000 18:02:02 +0000 (18:02 -0000)
lash.c
sh.c
shell/lash.c

diff --git a/lash.c b/lash.c
index a47ff5ca211c56d4b0b57c7c28d523d8d189c6d6..14571169ba1bef6793d8f633175e59bae98faf9a 100644 (file)
--- a/lash.c
+++ b/lash.c
@@ -807,14 +807,8 @@ static int get_command(FILE * source, char *command)
                signal(SIGWINCH, SIG_DFL);
                return 0;
 #else
-               i=strlen(cwd);
-               i--;
-               if (i>1){
-                       while ((i>0) && (*(cwd+i)!='/') ) i--;
-                       if (*(cwd+i)=='/') i++;
-               }
-               
-               fprintf(stdout, "[%s@%s %s]%s",user, buf, (cwd+i), prompt);
+               fprintf(stdout, "[%s@%s %s]%s",user, buf, 
+                               get_last_path_component(cwd), prompt);
                fflush(stdout);
 #endif
        }
diff --git a/sh.c b/sh.c
index a47ff5ca211c56d4b0b57c7c28d523d8d189c6d6..14571169ba1bef6793d8f633175e59bae98faf9a 100644 (file)
--- a/sh.c
+++ b/sh.c
@@ -807,14 +807,8 @@ static int get_command(FILE * source, char *command)
                signal(SIGWINCH, SIG_DFL);
                return 0;
 #else
-               i=strlen(cwd);
-               i--;
-               if (i>1){
-                       while ((i>0) && (*(cwd+i)!='/') ) i--;
-                       if (*(cwd+i)=='/') i++;
-               }
-               
-               fprintf(stdout, "[%s@%s %s]%s",user, buf, (cwd+i), prompt);
+               fprintf(stdout, "[%s@%s %s]%s",user, buf, 
+                               get_last_path_component(cwd), prompt);
                fflush(stdout);
 #endif
        }
index a47ff5ca211c56d4b0b57c7c28d523d8d189c6d6..14571169ba1bef6793d8f633175e59bae98faf9a 100644 (file)
@@ -807,14 +807,8 @@ static int get_command(FILE * source, char *command)
                signal(SIGWINCH, SIG_DFL);
                return 0;
 #else
-               i=strlen(cwd);
-               i--;
-               if (i>1){
-                       while ((i>0) && (*(cwd+i)!='/') ) i--;
-                       if (*(cwd+i)=='/') i++;
-               }
-               
-               fprintf(stdout, "[%s@%s %s]%s",user, buf, (cwd+i), prompt);
+               fprintf(stdout, "[%s@%s %s]%s",user, buf, 
+                               get_last_path_component(cwd), prompt);
                fflush(stdout);
 #endif
        }