Mercurial > mxe-octave
annotate src/readline-2-history.patch @ 5534:372ea4c0afb2
Move of-ocs PKG_XXXX to inst dir and add break patch
* src/of-ocs-3-break-fixes.patch,
src/of-ocs-4-pkgadd-fixes.patch: new files
* dist-files.mk: add ref to files
author | John Donoghue <john.donoghue@ieee.org> |
---|---|
date | Sun, 13 Sep 2020 08:15:14 -0400 |
parents | d0a95d2c44bf |
children |
rev | line source |
---|---|
5044
d0a95d2c44bf
Add fix to readline 7+ windows bug for writing history to existing file
John Donoghue
parents:
diff
changeset
|
1 diff -ur readline-8.0.eventhook/histfile.c readline-8.0/histfile.c |
d0a95d2c44bf
Add fix to readline 7+ windows bug for writing history to existing file
John Donoghue
parents:
diff
changeset
|
2 --- readline-8.0.eventhook/histfile.c 2019-04-03 10:21:42.916563353 -0400 |
d0a95d2c44bf
Add fix to readline 7+ windows bug for writing history to existing file
John Donoghue
parents:
diff
changeset
|
3 +++ readline-8.0/histfile.c 2019-04-03 16:16:04.605404093 -0400 |
d0a95d2c44bf
Add fix to readline 7+ windows bug for writing history to existing file
John Donoghue
parents:
diff
changeset
|
4 @@ -107,6 +107,11 @@ |
d0a95d2c44bf
Add fix to readline 7+ windows bug for writing history to existing file
John Donoghue
parents:
diff
changeset
|
5 # define PATH_MAX 1024 /* default */ |
d0a95d2c44bf
Add fix to readline 7+ windows bug for writing history to existing file
John Donoghue
parents:
diff
changeset
|
6 #endif |
d0a95d2c44bf
Add fix to readline 7+ windows bug for writing history to existing file
John Donoghue
parents:
diff
changeset
|
7 |
d0a95d2c44bf
Add fix to readline 7+ windows bug for writing history to existing file
John Donoghue
parents:
diff
changeset
|
8 +#if defined(_WIN32) |
d0a95d2c44bf
Add fix to readline 7+ windows bug for writing history to existing file
John Donoghue
parents:
diff
changeset
|
9 + #define WIN32_LEAN_AND_MEAN |
d0a95d2c44bf
Add fix to readline 7+ windows bug for writing history to existing file
John Donoghue
parents:
diff
changeset
|
10 + #include <windows.h> |
d0a95d2c44bf
Add fix to readline 7+ windows bug for writing history to existing file
John Donoghue
parents:
diff
changeset
|
11 +#endif |
d0a95d2c44bf
Add fix to readline 7+ windows bug for writing history to existing file
John Donoghue
parents:
diff
changeset
|
12 + |
d0a95d2c44bf
Add fix to readline 7+ windows bug for writing history to existing file
John Donoghue
parents:
diff
changeset
|
13 extern void _hs_append_history_line PARAMS((int, const char *)); |
d0a95d2c44bf
Add fix to readline 7+ windows bug for writing history to existing file
John Donoghue
parents:
diff
changeset
|
14 |
d0a95d2c44bf
Add fix to readline 7+ windows bug for writing history to existing file
John Donoghue
parents:
diff
changeset
|
15 /* history file version; currently unused */ |
d0a95d2c44bf
Add fix to readline 7+ windows bug for writing history to existing file
John Donoghue
parents:
diff
changeset
|
16 @@ -139,6 +144,19 @@ |
d0a95d2c44bf
Add fix to readline 7+ windows bug for writing history to existing file
John Donoghue
parents:
diff
changeset
|
17 static int histfile_backup PARAMS((const char *, const char *)); |
d0a95d2c44bf
Add fix to readline 7+ windows bug for writing history to existing file
John Donoghue
parents:
diff
changeset
|
18 static int histfile_restore PARAMS((const char *, const char *)); |
d0a95d2c44bf
Add fix to readline 7+ windows bug for writing history to existing file
John Donoghue
parents:
diff
changeset
|
19 |
d0a95d2c44bf
Add fix to readline 7+ windows bug for writing history to existing file
John Donoghue
parents:
diff
changeset
|
20 +static int |
d0a95d2c44bf
Add fix to readline 7+ windows bug for writing history to existing file
John Donoghue
parents:
diff
changeset
|
21 +history_rename(const char *from, const char *to) |
d0a95d2c44bf
Add fix to readline 7+ windows bug for writing history to existing file
John Donoghue
parents:
diff
changeset
|
22 +{ |
d0a95d2c44bf
Add fix to readline 7+ windows bug for writing history to existing file
John Donoghue
parents:
diff
changeset
|
23 +#if defined(_WIN32) |
d0a95d2c44bf
Add fix to readline 7+ windows bug for writing history to existing file
John Donoghue
parents:
diff
changeset
|
24 + if (!MoveFileEx(from, to, MOVEFILE_REPLACE_EXISTING)) { |
d0a95d2c44bf
Add fix to readline 7+ windows bug for writing history to existing file
John Donoghue
parents:
diff
changeset
|
25 + return -1; |
d0a95d2c44bf
Add fix to readline 7+ windows bug for writing history to existing file
John Donoghue
parents:
diff
changeset
|
26 + } |
d0a95d2c44bf
Add fix to readline 7+ windows bug for writing history to existing file
John Donoghue
parents:
diff
changeset
|
27 + return 0; |
d0a95d2c44bf
Add fix to readline 7+ windows bug for writing history to existing file
John Donoghue
parents:
diff
changeset
|
28 +#else |
d0a95d2c44bf
Add fix to readline 7+ windows bug for writing history to existing file
John Donoghue
parents:
diff
changeset
|
29 + return rename(from, to); |
d0a95d2c44bf
Add fix to readline 7+ windows bug for writing history to existing file
John Donoghue
parents:
diff
changeset
|
30 +#endif |
d0a95d2c44bf
Add fix to readline 7+ windows bug for writing history to existing file
John Donoghue
parents:
diff
changeset
|
31 +} |
d0a95d2c44bf
Add fix to readline 7+ windows bug for writing history to existing file
John Donoghue
parents:
diff
changeset
|
32 + |
d0a95d2c44bf
Add fix to readline 7+ windows bug for writing history to existing file
John Donoghue
parents:
diff
changeset
|
33 /* Return the string that should be used in the place of this |
d0a95d2c44bf
Add fix to readline 7+ windows bug for writing history to existing file
John Donoghue
parents:
diff
changeset
|
34 filename. This only matters when you don't specify the |
d0a95d2c44bf
Add fix to readline 7+ windows bug for writing history to existing file
John Donoghue
parents:
diff
changeset
|
35 filename to read_history (), or write_history (). */ |
d0a95d2c44bf
Add fix to readline 7+ windows bug for writing history to existing file
John Donoghue
parents:
diff
changeset
|
36 @@ -448,10 +466,10 @@ |
d0a95d2c44bf
Add fix to readline 7+ windows bug for writing history to existing file
John Donoghue
parents:
diff
changeset
|
37 if ((n = readlink (filename, linkbuf, sizeof (linkbuf) - 1)) > 0) |
d0a95d2c44bf
Add fix to readline 7+ windows bug for writing history to existing file
John Donoghue
parents:
diff
changeset
|
38 { |
d0a95d2c44bf
Add fix to readline 7+ windows bug for writing history to existing file
John Donoghue
parents:
diff
changeset
|
39 linkbuf[n] = '\0'; |
d0a95d2c44bf
Add fix to readline 7+ windows bug for writing history to existing file
John Donoghue
parents:
diff
changeset
|
40 - return (rename (linkbuf, back)); |
d0a95d2c44bf
Add fix to readline 7+ windows bug for writing history to existing file
John Donoghue
parents:
diff
changeset
|
41 + return (history_rename (linkbuf, back)); |
d0a95d2c44bf
Add fix to readline 7+ windows bug for writing history to existing file
John Donoghue
parents:
diff
changeset
|
42 } |
d0a95d2c44bf
Add fix to readline 7+ windows bug for writing history to existing file
John Donoghue
parents:
diff
changeset
|
43 #endif |
d0a95d2c44bf
Add fix to readline 7+ windows bug for writing history to existing file
John Donoghue
parents:
diff
changeset
|
44 - return (rename (filename, back)); |
d0a95d2c44bf
Add fix to readline 7+ windows bug for writing history to existing file
John Donoghue
parents:
diff
changeset
|
45 + return (history_rename (filename, back)); |
d0a95d2c44bf
Add fix to readline 7+ windows bug for writing history to existing file
John Donoghue
parents:
diff
changeset
|
46 } |
d0a95d2c44bf
Add fix to readline 7+ windows bug for writing history to existing file
John Donoghue
parents:
diff
changeset
|
47 |
d0a95d2c44bf
Add fix to readline 7+ windows bug for writing history to existing file
John Donoghue
parents:
diff
changeset
|
48 /* Restore ORIG from BACKUP handling case where ORIG is a symlink |
d0a95d2c44bf
Add fix to readline 7+ windows bug for writing history to existing file
John Donoghue
parents:
diff
changeset
|
49 @@ -467,10 +485,10 @@ |
d0a95d2c44bf
Add fix to readline 7+ windows bug for writing history to existing file
John Donoghue
parents:
diff
changeset
|
50 if ((n = readlink (orig, linkbuf, sizeof (linkbuf) - 1)) > 0) |
d0a95d2c44bf
Add fix to readline 7+ windows bug for writing history to existing file
John Donoghue
parents:
diff
changeset
|
51 { |
d0a95d2c44bf
Add fix to readline 7+ windows bug for writing history to existing file
John Donoghue
parents:
diff
changeset
|
52 linkbuf[n] = '\0'; |
d0a95d2c44bf
Add fix to readline 7+ windows bug for writing history to existing file
John Donoghue
parents:
diff
changeset
|
53 - return (rename (backup, linkbuf)); |
d0a95d2c44bf
Add fix to readline 7+ windows bug for writing history to existing file
John Donoghue
parents:
diff
changeset
|
54 + return (history_rename (backup, linkbuf)); |
d0a95d2c44bf
Add fix to readline 7+ windows bug for writing history to existing file
John Donoghue
parents:
diff
changeset
|
55 } |
d0a95d2c44bf
Add fix to readline 7+ windows bug for writing history to existing file
John Donoghue
parents:
diff
changeset
|
56 #endif |
d0a95d2c44bf
Add fix to readline 7+ windows bug for writing history to existing file
John Donoghue
parents:
diff
changeset
|
57 - return (rename (backup, orig)); |
d0a95d2c44bf
Add fix to readline 7+ windows bug for writing history to existing file
John Donoghue
parents:
diff
changeset
|
58 + return (history_rename (backup, orig)); |
d0a95d2c44bf
Add fix to readline 7+ windows bug for writing history to existing file
John Donoghue
parents:
diff
changeset
|
59 } |
d0a95d2c44bf
Add fix to readline 7+ windows bug for writing history to existing file
John Donoghue
parents:
diff
changeset
|
60 |
d0a95d2c44bf
Add fix to readline 7+ windows bug for writing history to existing file
John Donoghue
parents:
diff
changeset
|
61 /* Truncate the history file FNAME, leaving only LINES trailing lines. |