There is an check when closing mg via C-x C-c, that if a file name is
too long, the user should receive an error message "Error: filename
too long!", however, currently that message gets lost due to that
check returning ABORT.  This diff changes the return value to UERROR
which allows the message to be shown. 

ok/comments?

-lum

Index: buffer.c
===================================================================
RCS file: /cvs/src/usr.bin/mg/buffer.c,v
retrieving revision 1.80
diff -u -p -r1.80 buffer.c
--- buffer.c    30 Aug 2012 06:25:30 -0000      1.80
+++ buffer.c    30 Aug 2012 20:59:10 -0000
@@ -459,7 +459,7 @@ anycb(int f)
                            bp->b_fname);
                        if (ret < 0 || ret >= sizeof(pbuf)) {
                                ewprintf("Error: filename too long!");
-                               return (ABORT);
+                               return (UERROR);
                        }
                        if ((f == TRUE || (save = eyorn(pbuf)) == TRUE) &&
                            (save2 = buffsave(bp)) == TRUE) {
Index: def.h
===================================================================
RCS file: /cvs/src/usr.bin/mg/def.h,v
retrieving revision 1.124
diff -u -p -r1.124 def.h
--- def.h       14 Jun 2012 17:21:22 -0000      1.124
+++ def.h       30 Aug 2012 20:59:10 -0000
@@ -36,6 +36,7 @@ typedef int   (*PF)(int, int);        /* generall
 #define FALSE  0               /* False, no, bad, etc.          */
 #define TRUE   1               /* True, yes, good, etc.         */
 #define ABORT  2               /* Death, ^G, abort, etc.        */
+#define UERROR 3               /* User Error.                   */
 
 #define KCLEAR 2               /* clear echo area               */
 
Index: main.c
===================================================================
RCS file: /cvs/src/usr.bin/mg/main.c,v
retrieving revision 1.68
diff -u -p -r1.68 main.c
--- main.c      30 Aug 2012 06:09:12 -0000      1.68
+++ main.c      30 Aug 2012 20:59:10 -0000
@@ -224,7 +224,7 @@ quit(int f, int n)
 
        if ((s = anycb(FALSE)) == ABORT)
                return (ABORT);
-       if (s == FIOERR)
+       if (s == FIOERR || s == UERROR)
                return (FALSE);
        if (s == FALSE
            || eyesno("Modified buffers exist; really exit") == TRUE) {

Reply via email to