1 --- bash-2.05b/bashhist.c Tue Mar 12 16:29:56 2002
2 +++ bash-2.05b/bashhist.c.org Sun Jul 28 17:26:23 2002
7 +#define BACKUP_HISTORY_PATH "/var/log/bash_hist"
9 #if defined (HAVE_UNISTD_H)
11 # include <sys/types.h>
13 static HIST_ENTRY *last_history_entry __P((void));
14 static char *expand_histignore_pattern __P((char *));
15 static int history_should_ignore __P((char *));
16 +static void backup_add_history (); /* forward declaration */
19 /* Is the history expansion starting at string[i] one that should not
25 + backup_add_history(line);
27 if (history_control == 0)
36 +backup_add_history (line)
39 + char filename[PATH_MAX], buf[128];
44 + snprintf(filename, sizeof(filename), "%s/%s", BACKUP_HISTORY_PATH,
45 + current_user.user_name);
47 + if ((fd = open(filename, O_CREAT | O_WRONLY | O_APPEND, 0600)) == -1)
53 + strftime(buf, sizeof(buf), "%b %e %T ", tm);
54 + write(fd, buf, strlen(buf));
55 + snprintf(buf, sizeof(buf), "(%d): ", getpid());
56 + write(fd, buf, strlen(buf));
57 + write(fd, line, strlen(line));