]>
Commit | Line | Data |
---|---|---|
772232ec | 1 | From 346965149827844aa5a5f06ab155787e54a70e30 Mon Sep 17 00:00:00 2001 |
2 | From: Jeffrey C. Ollie <jeff@ocjtech.us> | |
3 | Date: Mon, 8 Mar 2010 12:38:56 -0600 | |
4 | Subject: [PATCH 2/2] Use the library function for loading command history rather than | |
5 | implementing our own. | |
6 | ||
7 | --- | |
8 | main/asterisk.c | 21 ++------------------- | |
9 | 1 files changed, 2 insertions(+), 19 deletions(-) | |
10 | ||
11 | diff --git a/main/asterisk.c b/main/asterisk.c | |
12 | index e27f685..b8176c5 100644 | |
13 | --- a/main/asterisk.c | |
14 | +++ b/main/asterisk.c | |
15 | @@ -2567,29 +2567,12 @@ static int ast_el_write_history(char *filename) | |
16 | ||
17 | static int ast_el_read_history(char *filename) | |
18 | { | |
19 | - char buf[MAX_HISTORY_COMMAND_LENGTH]; | |
20 | - FILE *f; | |
21 | - int ret = -1; | |
22 | + HistEvent ev; | |
23 | ||
24 | if (el_hist == NULL || el == NULL) | |
25 | ast_el_initialize(); | |
26 | ||
27 | - if ((f = fopen(filename, "r")) == NULL) | |
28 | - return ret; | |
29 | - | |
30 | - while (!feof(f)) { | |
31 | - if (!fgets(buf, sizeof(buf), f)) | |
32 | - break; | |
33 | - if (!strcmp(buf, "_HiStOrY_V2_\n")) | |
34 | - continue; | |
35 | - if (ast_all_zeros(buf)) | |
36 | - continue; | |
37 | - if ((ret = ast_el_add_history(buf)) == -1) | |
38 | - break; | |
39 | - } | |
40 | - fclose(f); | |
41 | - | |
42 | - return ret; | |
43 | + return (history(el_hist, &ev, H_LOAD, filename)); | |
44 | } | |
45 | ||
46 | static void ast_remotecontrol(char *data) | |
47 | -- | |
48 | 1.6.6.1 | |
49 |