[comp.sys.amiga] Patch for UNIX Lharc 1.02

stefanb@cip-s02.informatik.rwth-aachen.de (Stefan Becker) (09/26/90)

This adds a special Amiga option to UNIX lharc V1.02.

	Stefan

-------- Cut here -------------------------------------------------------------
*** lharc.h.orig	Fri Mar 16 02:46:37 1990
--- lharc.h	Wed Sep 26 13:24:42 1990
***************
*** 281,286 ****
--- 281,287 ----
  extern boolean	new_archive;
  extern boolean	update_if_newer;
  extern boolean	generic_format;
+ extern boolean	amiga_format;
  
  
  /*----------------------------------------------------------------------*/
*** lharc.c.orig	Fri Mar 16 02:46:41 1990
--- lharc.c	Wed Sep 26 13:36:45 1990
***************
*** 61,66 ****
--- 61,67 ----
  boolean	update_if_newer = FALSE;
  boolean	delete_after_append = FALSE;
  boolean	generic_format = FALSE;
+ boolean	amiga_format = FALSE;	
  
  boolean	remove_temporary_at_error = FALSE;
  boolean	recover_archive_when_interrupt = FALSE;
***************
*** 82,88 ****
  {
    fprintf (stderr, "\
  LHarc for UNIX  V1.02   Copyright(C) 1989  Y.Tagawa\n\
! usage: lharc {axelvudmcp}[qvnftgvd] archive_file [files or directories...]\n\
  commands:				options:\n\
   a   Add(or replace) to archive		 q  quiet\n\
   x,e EXtract from archive		 v  verbose\n\
--- 83,90 ----
  {
    fprintf (stderr, "\
  LHarc for UNIX  V1.02   Copyright(C) 1989  Y.Tagawa\n\
! special Amiga option by S. Becker\n\
! usage: lharc {axelvudmcp}[qvnftgvdA] archive_file [files or directories...]\n\
  commands:				options:\n\
   a   Add(or replace) to archive		 q  quiet\n\
   x,e EXtract from archive		 v  verbose\n\
***************
*** 90,96 ****
   u   Update newer files to archive	 f  force (over write at extract)\n\
   d   Delete from archive		 t  FILES are TEXT file\n\
   m   Move to archive (means 'ad')	 g  [Generic] format (compatiblity)\n\
!  c   re-Construct new archive\n\
   p   Print to STDOUT from archive	 d  delete FILES after a/u/c command\n\
  ");
    exit (1);
--- 92,98 ----
   u   Update newer files to archive	 f  force (over write at extract)\n\
   d   Delete from archive		 t  FILES are TEXT file\n\
   m   Move to archive (means 'ad')	 g  [Generic] format (compatiblity)\n\
!  c   re-Construct new archive		 A  Amiga format\n\
   p   Print to STDOUT from archive	 d  delete FILES after a/u/c command\n\
  ");
    exit (1);
***************
*** 169,174 ****
--- 171,177 ----
  	case 'n':	noexec = TRUE; break;
  	case 'g':	generic_format = TRUE; break;
  	case 'd':	delete_after_append = TRUE; break;
+ 	case 'A':	amiga_format = TRUE; break;
  
  	default:
  	  fprintf (stderr, "LHarc: Unknown option '%c'.\n", p[-1]);
***************
*** 810,815 ****
--- 813,830 ----
      }
  }
  
+ static
+ unix_to_amiga_filename (name, len)
+      register char *name;
+      register int len;
+ {
+   register int i;
+ 
+   for (i = 0; i < len; i ++)
+     if (name[i] == '/')
+ 	name[i] = '\\';
+ }
+ 
  /*----------------------------------------------------------------------*/
  /*									*/
  /*	Generic stamp format:						*/
***************
*** 1059,1064 ****
--- 1074,1081 ----
      }
    if (generic_format)
      unix_to_generic_filename (hdr->name, len);
+   else if (amiga_format)
+     unix_to_amiga_filename (hdr->name, len);
  }
  
  /* Write unix extended header or generic header. */
***************
*** 1083,1089 ****
    bcopy (hdr->name, data + I_NAME, name_length);
    setup_put (data + I_NAME + name_length);
    put_word (hdr->crc);
!   if (generic_format)
      {
        header_size = I_GENERIC_HEADER_BOTTOM - 2 + name_length;
      }
--- 1100,1106 ----
    bcopy (hdr->name, data + I_NAME, name_length);
    setup_put (data + I_NAME + name_length);
    put_word (hdr->crc);
!   if (generic_format || amiga_format)
      {
        header_size = I_GENERIC_HEADER_BOTTOM - 2 + name_length;
      }
*** lhadd.c.orig	Fri Mar 16 02:46:35 1990
--- lhadd.c	Wed Sep 26 12:44:14 1990
***************
*** 141,146 ****
--- 141,147 ----
  	}
      }
  
+   if (!(directory && amiga_format))
    if (update_if_newer)
      {
        if (!oafp ||		/* not in archive */

---------- Cut here -------------------------------------------------	
Mail	: Stefan Becker, Holsteinstrasse 9, 5100 Aachen, West Germany +-------+
Phone	: +49-241-505705	FIDO: 2:242/7.6	    +-----------------+	  Call|
InterNet: stefanb@cip-s02.informatik.rwth-aachen.de |Place free for ad's  now!|
UUCP	: ..mcvax!unido!rwthinf!cip-s02!stefanb	    +-------------------------+