home *** CD-ROM | disk | FTP | other *** search
- From: IN%"lenoil@APPLE.COM" "Robert Lenoil" 9-DEC-1988 16:12
- To: p150bk19@VB.CC.CMU.EDU
- Subj: REVERT.E
-
- Received: from apple.com by VB.CC.CMU.EDU; Fri, 9 Dec 88 16:12 EST
- Received: by apple.com (5.59/25-eef) id AA17235; Fri, 9 Dec 88 13:10:01 PST
- Date: Fri, 9 Dec 88 13:10:01 PST
- From: Robert Lenoil <lenoil@APPLE.COM>
- Subject: REVERT.E
- To: p150bk19@VB.CC.CMU.EDU
- Message-Id: <8812092110.AA17235@apple.com>
-
- /* The following copyright and trademark notice applies to some of the code
- * herein; all other material is Copyright (c) 1986, 1987 by Robert Lenoil,
- * with free copying allowed for any purpose, provided that this copyright
- * notice is included.
- */
-
- /************************************************************************
- * "Epsilon", "EEL" and "Lugaru" are trademarks of Lugaru Software, Ltd. *
- * *
- * Copyright (C) 1985 Lugaru Software Ltd. All rights reserved. *
- * *
- * Limited permission is hereby granted to reproduce and modify this *
- * copyrighted material provided that the resulting code is used only in *
- * conjunction with Lugaru products and that this notice is retained in *
- * any such reproduction or modification. *
- ************************************************************************/
-
- /*
- * A revert command for Epsilon.
- */
-
- #include <eel.h>
-
- /* This file adds the following commands/procedures:
- COMMAND WRITTEN FOR VERSION
- revert_buffer 3.1
-
- /* REVERT_BUFFER implements the good 'ol revert command. */
- command revert_buffer()
- { char resp[80], *buf, *tbuf, *fname;
- int strip = strip_returns, opoint = point, err;
- short omark = mark;
-
- if (!filename || !*filename)
- say("Buffer not a file buffer");
- else if (!modified)
- say("Buffer not modified");
- else
- { get_string(resp, "Revert buffer? [n]");
- if (toupper(*resp) == 'Y')
- { buf = bufname;
- fname = filename;
- bufname = tbuf = temp_buf();
- if (err = file_read(fname, strip))
- { file_error(err, fname, "Couldn't revert buffer");
- bufname = buf;
- }
- else
- { bufname = buf;
- delete(0, size()-1);
- bufname = tbuf;
- xfer(buf, 0, size()-1);
- bufname = buf;
- modified = 0;
- if (omark <= size()) mark = omark;
- if (opoint <= size()) point = opoint;
- }
- delete_buffer(tbuf);
- }
- }
- }
-