home *** CD-ROM | disk | FTP | other *** search
/ CP/M / CPM_CDROM.iso / simtel / emacs / src / copyreg.c < prev    next >
Encoding:
C/C++ Source or Header  |  1994-07-07  |  1.0 KB  |  39 lines

  1. #include    "stdio.h"
  2. #include    "ed.h"
  3.  
  4. /*
  5.  * Copy all of the characters in the
  6.  * region to the kill buffer. Don't move dot
  7.  * at all. This is a bit like a kill region followed
  8.  * by a yank. Bound to "M-W".
  9.  */
  10. ovmain(x, f, n)
  11. {
  12.     register LINE    *linep;
  13.     register int    loffs;
  14.     register int    s;
  15.     REGION        region;
  16.  
  17.     if ((s=getregion(®ion)) != TRUE)
  18.         return (s);
  19.     if ((lastflag&CFKILL) == 0)        /* Kill type command.    */
  20.         kdelete();
  21.     thisflag |= CFKILL;
  22.     linep = region.r_linep;            /* Current line.    */
  23.     loffs = region.r_offset;        /* Current offset.    */
  24.     while (region.r_size--) {
  25.         if (loffs == llength(linep)) {    /* End of line.        */
  26.             if ((s=kinsert('\n')) != TRUE)
  27.                 return (s);
  28.             linep = lforw(linep);
  29.             loffs = 0;
  30.         } else {            /* Middle of line.    */
  31.             if ((s=kinsert(lgetc(linep, loffs))) != TRUE)
  32.                 return (s);
  33.             ++loffs;
  34.         }
  35.     }
  36.     return (TRUE);
  37. }
  38. #include "getreg.c"
  39.