[Top][All Lists]
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
fc issues with default editor/history size and format
From: |
llattanzi+bash |
Subject: |
fc issues with default editor/history size and format |
Date: |
Fri, 16 Jul 2004 17:55:51 -0700 (PDT) |
Configuration Information [Automatically generated, do not change]:
Machine: powerpc
OS: darwin8.0
Compiler: gcc
Compilation CFLAGS: -arch i386 -arch ppc -g -Os -pipe -no-cpp-precomp
-arch i386 -arch ppc -pipe -DPROGRAM='bash' -DCONF_HOSTTYPE='powerpc'
-DCONF_OSTYPE='darwin8.0' -DCONF_MACHTYPE='powerpc-apple-darwin8.0'
-DCONF_VENDOR='apple' -DSHELL -DHAVE_CONFIG_H -DMACOSX -I.
-I/SourceCache/bash/bash-32/bash
-I/SourceCache/bash/bash-32/bash/include
-I/SourceCache/bash/bash-32/bash/lib -arch i386 -arch ppc -g -Os -pipe
-no-cpp-precomp -arch i386 -arch ppc -pipe
uname output: Darwin stderr.apple.com 8.0.0b1 Darwin Kernel Version
8.0.0b1: Mon Jul 12 21:41:56 PDT 2004;
root:xnu/xnu-638.1.obj~4/RELEASE_PPC Power Macintosh powerpc
Machine Type: powerpc-apple-darwin8.0
Bash Version: 2.05b
Patch Level: 0
Release Status: release
Description:
fc should use ed when posixly_correct
16 lines of history should be the default
Extra output besides #\t should be suppressed when posixly_correct
Repeat-By:
fc -l | wc -l
unset FCEDIT
fc #do you get vi or ed?
Fix:
Index: bash/bash/builtins/fc.def
diff -u bash/bash/builtins/fc.def:1.1.1.5
bash/bash/builtins/fc.def:1.1.1.5.40.1
--- bash/bash/builtins/fc.def:1.1.1.5 Sat Apr 5 00:00:28 2003
+++ bash/bash/builtins/fc.def Fri Jul 16 17:49:46 2004
@@ -84,6 +84,7 @@
extern int echo_input_at_read;
extern int current_command_line_count;
extern int literal_history;
+extern int posixly_correct;
extern int unlink __P((const char *));
@@ -155,6 +156,7 @@
/* String to execute on a file that we want to edit. */
#define FC_EDIT_COMMAND "${FCEDIT:-${EDITOR:-vi}}"
+#define POSIX_FC_EDIT_COMMAND "${FCEDIT:-ed}"
int
fc_builtin (list)
@@ -302,7 +304,7 @@
if (listing)
{
histend = last_hist;
- histbeg = histend - 16;
+ histbeg = histend - 16 + 1; /* -1 because loop uses >= */
if (histbeg < 0)
histbeg = 0;
}
@@ -346,8 +348,12 @@
QUIT;
if (numbering)
fprintf (stream, "%d", i + history_base);
- if (listing)
- fprintf (stream, "\t%c", histdata (i) ? '*' : ' ');
+ if (listing) {
+ if (posixly_correct)
+ fputs ("\t", stream);
+ else
+ fprintf (stream, "\t%c", histdata (i) ? '*' : ' ');
+ }
fprintf (stream, "%s\n", histline (i));
}
@@ -364,8 +370,9 @@
}
else
{
- command = (char *)xmalloc (3 + strlen (FC_EDIT_COMMAND) + strlen
(fn));
- sprintf (command, "%s %s", FC_EDIT_COMMAND, fn);
+ char *fcedit = posixly_correct ? POSIX_FC_EDIT_COMMAND :
FC_EDIT_COMMAND;
+ command = (char *)xmalloc (3 + strlen (fcedit) + strlen (fn));
+ sprintf (command, "%s %s", fcedit, fn);
}
retval = parse_and_execute (command, "fc", SEVAL_NOHIST);
if (retval != EXECUTION_SUCCESS)
[Prev in Thread] |
Current Thread |
[Next in Thread] |
- fc issues with default editor/history size and format,
llattanzi+bash <=