-#define BUF_SIZE       (1024)
-
-// XXX use enums
-#define MODE_CHANGED   0
-#define MODE_DELETED   1
-#define MODE_ADDED             2
-
-#define ED_OK                   0
-#define ED_ORDERING            1
-#define ED_PARSER              2
-#define ED_FAILURE             3
-
-// XXX someone better go out and understand the error reporting/handling here...
-int ed_rec(FILE *ed_cmds, FILE *in_file, FILE *out_file, int line, 
-               char *buffer, unsigned int bufsize, Hashes *hash) {
-       int pos;
-       int startline;
-       int stopline;
-       int mode;
-       int written;
-       char *idx;
-
-       /* get the current command and parse it*/
-       if (fgets(buffer, bufsize, ed_cmds) == NULL) {
-               return line;
-       }
-       startline = strtol(buffer, &idx, 10);
-       if (startline < line) {
-               return ED_ORDERING;
-       }
-       if (*idx == ',') {
-               idx++;
-               stopline = strtol(idx, &idx, 10);
-       }
-       else {
-               stopline = startline;
-       }
-       if (*idx == 'c') {
-               mode = MODE_CHANGED;
-       }
-       else if (*idx == 'a') {
-               mode = MODE_ADDED;
-       }
-       else if (*idx == 'd') {
-               mode = MODE_DELETED;
-       }
-       else {
-               return ED_PARSER;
-       }
-       /* get the current position */
-       pos = ftell(ed_cmds);
-       /* if this is add or change then go to the next full stop */
-       if ((mode == MODE_CHANGED) || (mode == MODE_ADDED)) {
-               do {
-                       fgets(buffer, bufsize, ed_cmds);
-                       while ((strlen(buffer) == (bufsize - 1)) 
-                                       && (buffer[bufsize - 2] != '\n')) {
-                               fgets(buffer, bufsize, ed_cmds);
-                               buffer[0] = ' ';
-                       }
-               } while (strncmp(buffer, ".", 1) != 0);
-       }
-       /* do the recursive call */
-       line = ed_rec(ed_cmds, in_file, out_file, line, buffer, bufsize, 
-                       hash);
-       /* pass on errors */
-       if (line < 0) {
-               return line;
-       }
-       /* apply our hunk */
-       fseek(ed_cmds, pos, SEEK_SET); 
-       /* first wind to the current position */
-       if (mode != MODE_ADDED) {
-               startline -= 1;
-       }
-       while (line < startline) {
-               fgets(buffer, bufsize, in_file);
-               written = fwrite(buffer, 1, strlen(buffer), out_file);
-               hash->Add((unsigned char*)buffer, written);
-               while ((strlen(buffer) == (bufsize - 1)) 
-                               && (buffer[bufsize - 2] != '\n')) {
-                       fgets(buffer, bufsize, in_file);
-                       written = fwrite(buffer, 1, strlen(buffer), out_file);
-                       hash->Add((unsigned char*)buffer, written);
-               }
-               line++;
-       }
-       /* include from ed script */
-       if ((mode == MODE_ADDED) || (mode == MODE_CHANGED)) {
-               do {
-                       fgets(buffer, bufsize, ed_cmds);
-                       if (strncmp(buffer, ".", 1) != 0) {
-                               written = fwrite(buffer, 1, strlen(buffer), out_file);
-                               hash->Add((unsigned char*)buffer, written);
-                               while ((strlen(buffer) == (bufsize - 1)) 
-                                               && (buffer[bufsize - 2] != '\n')) {
-                                       fgets(buffer, bufsize, ed_cmds);
-                                       written = fwrite(buffer, 1, strlen(buffer), out_file);
-                                       hash->Add((unsigned char*)buffer, written);
-                               }
-                       }
-                       else {
-                               break;
-                       }
-               } while (1);
-       }
-       /* ignore the corresponding number of lines from input */
-       if ((mode == MODE_DELETED) || (mode == MODE_CHANGED)) {
-               while (line < stopline) {
-                       fgets(buffer, bufsize, in_file);
-                       while ((strlen(buffer) == (bufsize - 1)) 
-                                       && (buffer[bufsize - 2] != '\n')) {
-                               fgets(buffer, bufsize, in_file);
-                       }
-                       line++;
-               }
-       }
-       return line;
+int RredMethod::ed_rec(FILE *ed_cmds, FILE *in_file, FILE *out_file, int line, 
+      char *buffer, unsigned int bufsize, Hashes *hash) {
+   int pos;
+   int startline;
+   int stopline;
+   int mode;
+   int written;
+   char *idx;
+
+   /* get the current command and parse it*/
+   if (fgets(buffer, bufsize, ed_cmds) == NULL) {
+      return line;
+   }
+   startline = strtol(buffer, &idx, 10);
+   if (startline < line) {
+      return ED_ORDERING;
+   }
+   if (*idx == ',') {
+      idx++;
+      stopline = strtol(idx, &idx, 10);
+   }
+   else {
+      stopline = startline;
+   }
+   if (*idx == 'c') {
+      mode = MODE_CHANGED;
+   }
+   else if (*idx == 'a') {
+      mode = MODE_ADDED;
+   }
+   else if (*idx == 'd') {
+      mode = MODE_DELETED;
+   }
+   else {
+      return ED_PARSER;
+   }
+   /* get the current position */
+   pos = ftell(ed_cmds);
+   /* if this is add or change then go to the next full stop */
+   if ((mode == MODE_CHANGED) || (mode == MODE_ADDED)) {
+      do {
+         fgets(buffer, bufsize, ed_cmds);
+         while ((strlen(buffer) == (bufsize - 1)) 
+               && (buffer[bufsize - 2] != '\n')) {
+            fgets(buffer, bufsize, ed_cmds);
+            buffer[0] = ' ';
+         }
+      } while (strncmp(buffer, ".", 1) != 0);
+   }
+   /* do the recursive call */
+   line = ed_rec(ed_cmds, in_file, out_file, line, buffer, bufsize, 
+         hash);
+   /* pass on errors */
+   if (line < 0) {
+      return line;
+   }
+   /* apply our hunk */
+   fseek(ed_cmds, pos, SEEK_SET); 
+   /* first wind to the current position */
+   if (mode != MODE_ADDED) {
+      startline -= 1;
+   }
+   while (line < startline) {
+      fgets(buffer, bufsize, in_file);
+      written = fwrite(buffer, 1, strlen(buffer), out_file);
+      hash->Add((unsigned char*)buffer, written);
+      while ((strlen(buffer) == (bufsize - 1)) 
+            && (buffer[bufsize - 2] != '\n')) {
+         fgets(buffer, bufsize, in_file);
+         written = fwrite(buffer, 1, strlen(buffer), out_file);
+         hash->Add((unsigned char*)buffer, written);
+      }
+      line++;
+   }
+   /* include from ed script */
+   if ((mode == MODE_ADDED) || (mode == MODE_CHANGED)) {
+      do {
+         fgets(buffer, bufsize, ed_cmds);
+         if (strncmp(buffer, ".", 1) != 0) {
+            written = fwrite(buffer, 1, strlen(buffer), out_file);
+            hash->Add((unsigned char*)buffer, written);
+            while ((strlen(buffer) == (bufsize - 1)) 
+                  && (buffer[bufsize - 2] != '\n')) {
+               fgets(buffer, bufsize, ed_cmds);
+               written = fwrite(buffer, 1, strlen(buffer), out_file);
+               hash->Add((unsigned char*)buffer, written);
+            }
+         }
+         else {
+            break;
+         }
+      } while (1);
+   }
+   /* ignore the corresponding number of lines from input */
+   if ((mode == MODE_DELETED) || (mode == MODE_CHANGED)) {
+      while (line < stopline) {
+         fgets(buffer, bufsize, in_file);
+         while ((strlen(buffer) == (bufsize - 1)) 
+               && (buffer[bufsize - 2] != '\n')) {
+            fgets(buffer, bufsize, in_file);
+         }
+         line++;
+      }
+   }
+   return line;