summaryrefslogtreecommitdiff
path: root/math/sc-im/files/patch-file.c
diff options
context:
space:
mode:
authorBaptiste Daroussin <bapt@FreeBSD.org>2019-05-23 17:05:47 +0000
committerBaptiste Daroussin <bapt@FreeBSD.org>2019-05-23 17:05:47 +0000
commitf83106b6c1265d9fa396ec7162235eaeb50edb77 (patch)
tree3f94d9e9efa1fe97f248c6775c8aac7bd436ffe9 /math/sc-im/files/patch-file.c
parentBump port revision (diff)
Update to 0.7.0-81
Upstream changes fixes a conflict with textproc/scim Some cleanups PR: 237839 Approved by: Samy Mahmoudi <samy.mahmoudi@gmail.com>
Notes
Notes: svn path=/head/; revision=502344
Diffstat (limited to 'math/sc-im/files/patch-file.c')
-rw-r--r--math/sc-im/files/patch-file.c54
1 files changed, 42 insertions, 12 deletions
diff --git a/math/sc-im/files/patch-file.c b/math/sc-im/files/patch-file.c
index 7f5c554e6651..386fdb241913 100644
--- a/math/sc-im/files/patch-file.c
+++ b/math/sc-im/files/patch-file.c
@@ -1,16 +1,46 @@
---- file.c.orig 2017-12-13 17:48:59 UTC
+--- file.c.orig 2019-05-11 16:23:57 UTC
+++ file.c
-@@ -202,7 +202,12 @@ int savefile() {
- del_range_chars(name, 0, 1 + force_rewrite);
+@@ -189,21 +189,23 @@ int modcheck() {
+
+ int savefile() {
+ int force_rewrite = 0;
++ int shall_quit = 0;
+ char name[BUFFERSIZE];
+ #ifndef NO_WORDEXP
+ size_t len;
+ wordexp_t p;
+ #endif
+
+- if (! curfile[0] && wcslen(inputline) < 3) { // casos ":w" ":w!" ":x" ":x!"
++ if (! curfile[0] && wcslen(inputline) < 3) { // casos ":w" ":w!" ":wq" ":x" ":x!"
+ sc_error("There is no filename");
+ return -1;
+ }
+
+ if (inputline[1] == L'!') force_rewrite = 1;
++ if (inputline[1] == L'q') shall_quit = 1;
+
+ wcstombs(name, inputline, BUFFERSIZE);
+- del_range_chars(name, 0, 1 + force_rewrite);
++ del_range_chars(name, 0, 1 + force_rewrite + shall_quit);
+
+ #ifndef NO_WORDEXP
wordexp(name, &p, 0);
+@@ -221,7 +223,7 @@ int savefile() {
+ #endif
-- if (! force_rewrite && p.we_wordv[0] && file_exists(p.we_wordv[0])) {
-+ if (wcslen(inputline) > 2 && (!p.we_wordv || !p.we_wordv[0])) {
-+ sc_error("Trailing space(s)");
-+ return -1;
-+ }
-+
-+ if (! force_rewrite && p.we_wordv && p.we_wordv[0] && file_exists(p.we_wordv[0])) {
- sc_error("File already exists. Use \"!\" to force rewrite.");
- wordfree(&p);
+ if (! force_rewrite && file_exists(name)) {
+- sc_error("File already exists. Use \"!\" to force rewrite.");
++ sc_error("File already exists. Use \"w!\" to force rewrite.");
return -1;
+ }
+
+@@ -235,7 +237,7 @@ int savefile() {
+ // if it exists and no '!' is set, return.
+ if (!strlen(curfile) && backup_exists(name)) {
+ if (!force_rewrite) {
+- sc_error("Backup file of %s exists. Use \"!\" to force the write process.", name);
++ sc_error("Backup file of %s exists. Use \"w!\" to force the write process.", name);
+ return -1;
+ } else remove_backup(name);
+ }