about summary refs log tree commit diff
path: root/Src/prompt.c
diff options
context:
space:
mode:
Diffstat (limited to 'Src/prompt.c')
-rw-r--r--Src/prompt.c26
1 files changed, 26 insertions, 0 deletions
diff --git a/Src/prompt.c b/Src/prompt.c
index 36eaca3e9..7bba51c61 100644
--- a/Src/prompt.c
+++ b/Src/prompt.c
@@ -725,11 +725,37 @@ putpromptchar(int doprint, int endchar, unsigned int *txtchangep)
 		if(Rstring)
 		    stradd(Rstring);
 		break;
+	    case 'I':
+		if (funcstack && funcstack->tp != FS_SOURCE) {
+		    /*
+		     * We're in a function or an eval with
+		     * EVALLINENO.  Calculate the line number in
+		     * the file.
+		     */
+		    zlong flineno = lineno + funcstack->flineno;
+		    /* take account of eval line nos. starting at 1 */
+		    if (funcstack->tp == FS_EVAL)
+			lineno--;
+		    addbufspc(DIGBUFSIZE);
+		    sprintf(bp, "%ld", (long)flineno);
+		    bp += strlen(bp);
+		    break;
+		}
+		/* else we're in a file and lineno is already correct */
+		/* FALLTHROUGH */
 	    case 'i':
 		addbufspc(DIGBUFSIZE);
 		sprintf(bp, "%ld", (long)lineno);
 		bp += strlen(bp);
 		break;
+	    case 'x':
+		if (funcstack && funcstack->tp != FS_SOURCE)
+		    promptpath(funcstack->filename ? funcstack->filename : "",
+			       arg, 0);
+		else
+		    promptpath(scriptfilename ? scriptfilename : argzero,
+			       arg, 0);
+		break;
 	    case '\0':
 		return 0;
 	    case Meta: