TIP: Click on subject to list as thread! ANSI
echo: cis.os9.68000.osk
to: Bob van der Poel 76510,2203
from: Mike Haaland 72300,1433
date: 1993-05-15 01:45:50
subject: #18091-new unzip

#: 18093 S12/OS9/68000 (OSK)
    15-May-93  01:45:50
Sb: #18091-new unzip
Fm: Mike Haaland 72300,1433
To: Bob van der Poel 76510,2203

Hey Bob,

I did the same thing with Lha(rc) It's pretty simple. Just save the last char
you are putting to the file.  If you get a LF don't output anything, then on
the next char, check it the last one was a LF, if the current char is a CR
output it, if it was anything else, output a CR then the current char.  This
add the need to do an extra loop at EOF to make sure the last LF get's output
as a CR. (In case the file only had LF's).

Hope this helps,

 - Mike -

  #define fputc putc

  outchar(fp,c)
  FILE *fp;
  int c;
  {
      static int last_c;

      if (c == '\l') {
          if (last_c == '\l')
             fputc('\n',fp);
      } else {
          if (last_c == '\l' && c != '\n')
              fputc('\n',fp);
          fputc(c,fp);
      }
      last_c = c;
   }

SOURCE: compuserve via textfiles.com

Email questions or comments to sysop@ipingthereforeiam.com
All parts of this website painstakingly hand-crafted in the U.S.A.!
IPTIA BBS/MUD/Terminal/Game Server List, © 2025 IPTIA Consulting™.