/usr/share/slsh/rline/history.sl is in slsh 2.3.0-2ubuntu1.
This file is owned by root:root, with mode 0o644.
The actual contents of the file can be viewed below.
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 | % Public functions:
%
% rline_load_history (file);
% rline_save_history (file);
%
variable RLine_Hist_Max_Lines = 50;
variable RLine_History_File = NULL;
#ifdef UNIX
%if (getenv ("HOME") != NULL) RLine_History_File = "$HOME/.${name}_slhist";
#endif
autoload ("rline_up_hist_search", "rline/histsrch.sl");
autoload ("rline_down_hist_search", "rline/histsrch.sl");
define rline_load_history ()
{
variable file = RLine_History_File;
if (_NARGS == 1)
file = ();
if (file == NULL)
return;
variable fp = fopen (file, "r");
if (fp == NULL)
return;
variable lines = fgetslines (fp);
() = fclose (fp);
lines = strtrim_end (lines, "\n");
rline_set_history (lines);
}
define rline_save_history ()
{
variable file = RLine_History_File;
if (_NARGS == 1)
file = ();
if (file == NULL)
return;
variable max_lines = qualifier ("max", RLine_Hist_Max_Lines);
variable h = rline_get_history ();
variable n = length (h);
if (n > max_lines)
h = h[[n-max_lines:]];
variable fd = open (file, O_WRONLY|O_CREAT|O_TRUNC|O_TEXT, S_IRUSR|S_IWUSR);
if (fd == NULL)
return;
variable fp = fdopen (fd, "w");
if (fp == NULL)
return;
foreach (h)
{
variable line = ();
() = fputs (line, fp);
() = fputs ("\n", fp);
}
() = fflush (fp);
() = close (fd);
}
define rline_edit_history ()
{
variable lines = rline_get_history ();
lines = rline_call_editor (lines, "histedit", "tmp");
if ((lines == NULL)
|| (length (lines) == 0))
return;
rline_set_history (strtrim_end(lines, "\n"));
}
|