aboutsummaryrefslogtreecommitdiff
path: root/editors
diff options
context:
space:
mode:
authorNguyễn Thái Ngọc Duy <pclouds@gmail.com>2009-04-22 22:34:40 +1000
committerNguyễn Thái Ngọc Duy <pclouds@gmail.com>2009-04-23 04:44:39 +1000
commit90540ee9b9d1bf6622e0d5d9064ba9e42f9fe130 (patch)
tree524a13790c6400c3e529ce4f308d410a369e4988 /editors
parent9edc74053e3233e5c0aac2a966785c4ece7e55aa (diff)
downloadbusybox-w32-90540ee9b9d1bf6622e0d5d9064ba9e42f9fe130.tar.gz
busybox-w32-90540ee9b9d1bf6622e0d5d9064ba9e42f9fe130.tar.bz2
busybox-w32-90540ee9b9d1bf6622e0d5d9064ba9e42f9fe130.zip
editors/patch: strip all dirs if patch level is -1
Diffstat (limited to 'editors')
-rw-r--r--editors/patch.c7
1 files changed, 7 insertions, 0 deletions
diff --git a/editors/patch.c b/editors/patch.c
index 65b8f659b..3de293f03 100644
--- a/editors/patch.c
+++ b/editors/patch.c
@@ -58,6 +58,13 @@ static char *extract_filename(char *line, int patch_level)
58 temp = strchr(filename_start_ptr, '\t'); 58 temp = strchr(filename_start_ptr, '\t');
59 if (temp) *temp = 0; 59 if (temp) *temp = 0;
60 60
61 if (patch_level == -1) {
62 temp = strrchr(filename_start_ptr, '/');
63 if (temp)
64 filename_start_ptr = temp + 1;
65 return xstrdup(filename_start_ptr);
66 }
67
61 /* skip over (patch_level) number of leading directories */ 68 /* skip over (patch_level) number of leading directories */
62 for (i = 0; i < patch_level; i++) { 69 for (i = 0; i < patch_level; i++) {
63 temp = strchr(filename_start_ptr, '/'); 70 temp = strchr(filename_start_ptr, '/');