=================================================================== RCS file: /cvsrepo/anoncvs/cvs/src/usr.bin/mg/region.c,v retrieving revision 1.33 retrieving revision 1.34 diff -u -r1.33 -r1.34 --- src/usr.bin/mg/region.c 2013/05/22 19:23:45 1.33 +++ src/usr.bin/mg/region.c 2014/03/20 07:47:29 1.34 @@ -1,4 +1,4 @@ -/* $OpenBSD: region.c,v 1.33 2013/05/22 19:23:45 lum Exp $ */ +/* $OpenBSD: region.c,v 1.34 2014/03/20 07:47:29 lum Exp $ */ /* This file is in the public domain. */ @@ -118,6 +118,7 @@ if ((s = checkdirty(curbp)) != TRUE) return (s); if (curbp->b_flag & BFREADONLY) { + dobeep(); ewprintf("Buffer is read-only"); return (FALSE); } @@ -161,6 +162,7 @@ if ((s = checkdirty(curbp)) != TRUE) return (s); if (curbp->b_flag & BFREADONLY) { + dobeep(); ewprintf("Buffer is read-only"); return (FALSE); } @@ -204,6 +206,7 @@ long fsize, bsize; if (curwp->w_markp == NULL) { + dobeep(); ewprintf("No mark set in this window"); return (FALSE); } @@ -249,6 +252,7 @@ } } } + dobeep(); ewprintf("Bug: lost mark"); return (FALSE); } @@ -261,6 +265,7 @@ { rp->r_size = size; if (rp->r_size != size) { + dobeep(); ewprintf("Region is too large"); return (FALSE); } @@ -288,6 +293,7 @@ if ((s = checkdirty(curbp)) != TRUE) return (s); if (curbp->b_flag & BFREADONLY) { + dobeep(); ewprintf("Buffer is read-only"); return (FALSE); } @@ -416,6 +422,7 @@ return (ABORT); if (curwp->w_markp == NULL) { + dobeep(); ewprintf("The mark is not set now, so there is no region"); return (FALSE); } @@ -432,6 +439,7 @@ len = region.r_size; if ((text = malloc(len + 1)) == NULL) { + dobeep(); ewprintf("Cannot allocate memory."); return (FALSE); } @@ -507,12 +515,14 @@ char *err; if (socketpair(AF_UNIX, SOCK_STREAM, PF_UNSPEC, s) == -1) { + dobeep(); ewprintf("socketpair error"); return (FALSE); } switch(fork()) { case -1: + dobeep(); ewprintf("Can't fork"); return (FALSE); case 0: @@ -584,9 +594,11 @@ leftover[0] = '\0'; } if (nfds == 0) { + dobeep(); ewprintf("poll timed out"); return (FALSE); } else if (nfds == -1) { + dobeep(); ewprintf("poll error"); return (FALSE); } @@ -638,6 +650,7 @@ *q++ = '\0'; if (strlcat(leftover, p, sizeof(leftover)) >= sizeof(leftover)) { + dobeep(); ewprintf("line too long"); return (FALSE); } @@ -651,6 +664,7 @@ p = q; } if (strlcpy(leftover, p, sizeof(leftover)) >= sizeof(leftover)) { + dobeep(); ewprintf("line too long"); return (FALSE); }