=================================================================== RCS file: /cvsrepo/anoncvs/cvs/src/usr.bin/mg/file.c,v retrieving revision 1.91 retrieving revision 1.92 diff -u -r1.91 -r1.92 --- src/usr.bin/mg/file.c 2014/03/14 10:02:52 1.91 +++ src/usr.bin/mg/file.c 2014/03/20 07:47:29 1.92 @@ -1,4 +1,4 @@ -/* $OpenBSD: file.c,v 1.91 2014/03/14 10:02:52 lum Exp $ */ +/* $OpenBSD: file.c,v 1.92 2014/03/20 07:47:29 lum Exp $ */ /* This file is in the public domain. */ @@ -191,6 +191,7 @@ /* Clear readonly. May be set by autoexec path */ curbp->b_flag &= ~BFREADONLY; if ((status = insertfile(fname, fname, TRUE)) != TRUE) { + dobeep(); ewprintf("File is not readable: %s", fname); return (FALSE); } @@ -322,6 +323,7 @@ } else if (s == FIODIR) { /* file was a directory */ if (replacebuf == FALSE) { + dobeep(); ewprintf("Cannot insert: file is a directory, %s", fname); goto cleanup; @@ -385,6 +387,7 @@ newsize = linesize * 2; if (newsize < 0 || (cp = malloc(newsize)) == NULL) { + dobeep(); ewprintf("Could not allocate %d bytes", newsize); s = FIOERR; @@ -402,6 +405,7 @@ goto retry; } default: + dobeep(); ewprintf("Unknown code %d reading file", s); s = FIOERR; break; @@ -578,6 +582,7 @@ /* must have a name */ if (bp->b_fname[0] == '\0') { + dobeep(); ewprintf("No file name"); return (FALSE); } @@ -655,10 +660,12 @@ (void)xdirname(dp, fn, sizeof(dp)); (void)strlcat(dp, "/", sizeof(dp)); if (access(dp, W_OK) && errno == EACCES) { + dobeep(); ewprintf("Directory %s write-protected", dp); return (FIOERR); } else if (errno == ENOENT) { - ewprintf("%s: no such directory", dp); + dobeep(); + ewprintf("%s: no such directory", dp); return (FIOERR); } } @@ -674,6 +681,7 @@ } else { /* print a message indicating write error */ (void)ffclose(*ffp, bp); + dobeep(); ewprintf("Unable to write %s", fn); } return (s == FIOSUC);