summary refs log tree commit diff
path: root/Src/subst.c
diff options
context:
space:
mode:
authorDaniel Shahaf <d.s@daniel.shahaf.name>2016-07-30 16:16:22 +0000
committerDaniel Shahaf <d.s@daniel.shahaf.name>2016-08-22 03:34:30 +0000
commit7154052ebe3d810390164a05c39ff83f98a1d858 (patch)
treede329087e802a17df0dd93aee35fdb5e49b25ac3 /Src/subst.c
parent4b2810ab2d6be3d1cf811e53d3b4f57630821108 (diff)
downloadzsh-7154052ebe3d810390164a05c39ff83f98a1d858.tar.gz
zsh-7154052ebe3d810390164a05c39ff83f98a1d858.tar.xz
zsh-7154052ebe3d810390164a05c39ff83f98a1d858.zip
39046 + 39061: New :P history modifier.
Diffstat (limited to 'Src/subst.c')
-rw-r--r--Src/subst.c13
1 files changed, 13 insertions, 0 deletions
diff --git a/Src/subst.c b/Src/subst.c
index c61551bf6..15eb59b64 100644
--- a/Src/subst.c
+++ b/Src/subst.c
@@ -4081,6 +4081,7 @@ modify(char **str, char **ptr)
 	    case 'u':
 	    case 'q':
 	    case 'Q':
+	    case 'P':
 		c = **ptr;
 		break;
 
@@ -4287,6 +4288,12 @@ modify(char **str, char **ptr)
 			    untokenize(copy);
 			}
 			break;
+		    case 'P':
+			if (*copy != '/') {
+			    copy = zhtricat(metafy(zgetcwd(), -1, META_HEAPDUP), "/", copy);
+			}
+			copy = xsymlink(copy, 1);
+			break;
 		    }
 		    tc = *tt;
 		    *tt = '\0';
@@ -4363,6 +4370,12 @@ modify(char **str, char **ptr)
 			untokenize(*str);
 		    }
 		    break;
+		case 'P':
+		    if (**str != '/') {
+			*str = zhtricat(metafy(zgetcwd(), -1, META_HEAPDUP), "/", *str);
+		    }
+		    *str = xsymlink(*str, 1);
+		    break;
 		}
 	    }
 	    if (rec < 0) {