Subversion Repositories SvarDOS

Rev

Rev 1453 | Rev 1461 | Go to most recent revision | Show entire file | Ignore whitespace | Details | Blame | Last modification | View Log | RSS feed

Rev 1453 Rev 1454
Line 747... Line 747...
747
 
747
 
748
static int savefile(const struct file *db, const char *saveas) {
748
static int savefile(const struct file *db, const char *saveas) {
749
  int fd = 0;
749
  int fd = 0;
750
  const struct line far *l;
750
  const struct line far *l;
751
  unsigned int bytes;
751
  unsigned int bytes;
752
  unsigned char eollen;
752
  unsigned char eollen = 2;
753
  unsigned char eolbuf[2];
753
  const unsigned char *eolbuf = "\r\n";
754
  int errflag = 0;
754
  int errflag = 0;
755
 
755
 
756
  /* if filename not overloaded then use the fname in db */
756
  /* if filename not overloaded then use the fname in db */
757
  if (saveas == NULL) saveas = db->fname;
757
  if (saveas == NULL) saveas = db->fname;
758
 
758
 
Line 780... Line 780...
780
  l = db->cursor;
780
  l = db->cursor;
781
  while (l->prev) l = l->prev;
781
  while (l->prev) l = l->prev;
782
 
782
 
783
  /* preset line terminators */
783
  /* preset line terminators */
784
  if (db->lfonly) {
784
  if (db->lfonly) {
785
    eolbuf[0] = '\n';
-
 
786
    eollen = 1;
785
    eolbuf++;
787
  } else {
-
 
788
    eolbuf[0] = '\r';
-
 
789
    eolbuf[1] = '\n';
-
 
790
    eollen = 2;
786
    eollen--;
791
  }
787
  }
792
 
788
 
793
  while (l) {
789
  while (l) {
794
    /* do not write the last empty line, it is only useful for edition */
790
    /* do not write the last empty line, it is only useful for edition */
795
    if (l->len != 0) {
791
    if (l->len != 0) {