[BusyBox-cvs] busybox/shell Config.in,1.2,1.3 ash.c,1.63,1.64 cmdedit.c,1.74,1.75 cmdedit.h,1.13,1.14

Glenn McGrath bug1 at busybox.net
Mon Dec 9 11:10:44 UTC 2002


Update of /var/cvs/busybox/shell
In directory winder:/tmp/cvs-serv8751/shell

Modified Files:
	Config.in ash.c cmdedit.c cmdedit.h 
Log Message:
Command line history changes, lastpatch_71 from Vladimir N. Oleynik


Index: Config.in
===================================================================
RCS file: /var/cvs/busybox/shell/Config.in,v
retrieving revision 1.2
retrieving revision 1.3
diff -u -d -r1.2 -r1.3
--- Config.in	6 Dec 2002 21:49:59 -0000	1.2
+++ Config.in	9 Dec 2002 11:10:39 -0000	1.3
@@ -3,7 +3,7 @@
 # see scripts/kbuild/config-language.txt.
 #
 
-menu "Bourne Shell"
+menu "Another Bourne-like Shell"
 
 choice
 	prompt "Choose your default shell"
@@ -95,12 +95,6 @@
 	help
 	  Please submit a patch to add help text for this item.
 
-config CONFIG_FEATURE_COMMAND_SAVEHISTORY
-	bool "  history saving"
-	default n
-	depends on CONFIG_ASH
-	help
-	  Please submit a patch to add help text for this item.
 
 if CONFIG_FEATURE_SH_IS_HUSH
 	config CONFIG_HUSH
@@ -155,6 +149,13 @@
 	bool "command line editing"
 	default n
 	depends on CONFIG_MSH || CONFIG_LASH || CONFIG_HUSH || CONFIG_ASH
+	help
+	  Please submit a patch to add help text for this item.
+
+config CONFIG_FEATURE_COMMAND_SAVEHISTORY
+	bool "  history saving"
+	default n
+	depends on CONFIG_ASH
 	help
 	  Please submit a patch to add help text for this item.
 

Index: ash.c
===================================================================
RCS file: /var/cvs/busybox/shell/ash.c,v
retrieving revision 1.63
retrieving revision 1.64
diff -u -d -r1.63 -r1.64
--- ash.c	3 Dec 2002 22:45:46 -0000	1.63
+++ ash.c	9 Dec 2002 11:10:39 -0000	1.64
@@ -1196,6 +1196,10 @@
 static struct var vlc_ctype;
 #endif
 
+#ifdef CONFIG_FEATURE_COMMAND_SAVEHISTORY
+static struct var vhistfile;
+#endif
+
 struct varinit {
 	struct var *var;
 	int flags;
@@ -1242,6 +1246,10 @@
[...62 lines suppressed...]
+l1:
+	handler = &loc2;   /* probably unnecessary */
 	flushall();
 #ifdef CONFIG_ASH_JOB_CONTROL
 	setjobctl(0);
 #endif
-  l2:_exit(status);
+#ifdef CONFIG_FEATURE_COMMAND_SAVEHISTORY
+	if (iflag && rootshell) {
+		const char *hp = lookupvar("HISTFILE");
+
+		if(hp != NULL )
+			save_history ( hp );
+	}
+#endif
+l2:
+	_exit(status);
 	/* NOTREACHED */
 }
 

Index: cmdedit.c
===================================================================
RCS file: /var/cvs/busybox/shell/cmdedit.c,v
retrieving revision 1.74
retrieving revision 1.75
diff -u -d -r1.74 -r1.75
--- cmdedit.c	3 Dec 2002 22:45:46 -0000	1.74
+++ cmdedit.c	9 Dec 2002 11:10:40 -0000	1.75
@@ -1131,40 +1131,44 @@
 	}
 }
 
-
-extern void load_history ( char *fromfile )
-{
 #ifdef CONFIG_FEATURE_COMMAND_SAVEHISTORY
+extern void load_history ( const char *fromfile )
+{
 	FILE *fp;
+	int hi;
[...43 lines suppressed...]
+	cur_history = n_history = hi;
 }
 
-extern void save_history ( char *tofile )
+extern void save_history ( const char *tofile )
 {
-#ifdef CONFIG_FEATURE_COMMAND_SAVEHISTORY
 	FILE *fp = fopen ( tofile, "w" );
 	
 	if ( fp ) {
@@ -1176,8 +1180,8 @@
 		}
 		fclose ( fp );
 	}
-#endif
 }
+#endif
 
 #endif
 

Index: cmdedit.h
===================================================================
RCS file: /var/cvs/busybox/shell/cmdedit.h,v
retrieving revision 1.13
retrieving revision 1.14
diff -u -d -r1.13 -r1.14
--- cmdedit.h	3 Dec 2002 22:45:46 -0000	1.13
+++ cmdedit.h	9 Dec 2002 11:10:40 -0000	1.14
@@ -3,7 +3,9 @@
 
 int     cmdedit_read_input(char* promptStr, char* command);
 
-void    load_history ( char *fromfile );
-void    save_history ( char *tofile );
+#ifdef CONFIG_FEATURE_COMMAND_SAVEHISTORY
+void    load_history ( const char *fromfile );
+void    save_history ( const char *tofile );
+#endif
 
 #endif /* CMDEDIT_H */




More information about the busybox-cvs mailing list