From mboxrd@z Thu Jan 1 00:00:00 1970 X-Spam-Checker-Version: SpamAssassin 3.4.4 (2020-01-24) on inbox.vuxu.org X-Spam-Level: X-Spam-Status: No, score=-0.8 required=5.0 tests=DKIM_ADSP_CUSTOM_MED, DKIM_INVALID,DKIM_SIGNED,FREEMAIL_FROM,HTML_MESSAGE,MAILING_LIST_MULTI, RCVD_IN_DNSWL_NONE autolearn=ham autolearn_force=no version=3.4.4 Received: (qmail 11410 invoked from network); 25 Jul 2020 15:46:17 -0000 Received: from minnie.tuhs.org (45.79.103.53) by inbox.vuxu.org with ESMTPUTF8; 25 Jul 2020 15:46:17 -0000 Received: by minnie.tuhs.org (Postfix, from userid 112) id 485469CA12; Sun, 26 Jul 2020 01:46:16 +1000 (AEST) Received: from minnie.tuhs.org (localhost [127.0.0.1]) by minnie.tuhs.org (Postfix) with ESMTP id 859A79C8B1; Sun, 26 Jul 2020 01:45:22 +1000 (AEST) Authentication-Results: minnie.tuhs.org; dkim=fail reason="signature verification failed" (2048-bit key; unprotected) header.d=gmail.com header.i=@gmail.com header.b="j7NIdb5Y"; dkim-atps=neutral Received: by minnie.tuhs.org (Postfix, from userid 112) id A9D3B9C8B1; Sun, 26 Jul 2020 01:45:20 +1000 (AEST) Received: from mail-lj1-f178.google.com (mail-lj1-f178.google.com [209.85.208.178]) by minnie.tuhs.org (Postfix) with ESMTPS id DFC5E9BA4F for ; Sun, 26 Jul 2020 01:45:19 +1000 (AEST) Received: by mail-lj1-f178.google.com with SMTP id h22so12915863lji.9 for ; Sat, 25 Jul 2020 08:45:19 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20161025; h=mime-version:references:in-reply-to:from:date:message-id:subject:to :cc; bh=L4xIniFxPPh2hLh09cY4pn2/nVajG3jFfSL2gCwCj9A=; b=j7NIdb5YzQwv8P5QRB8N6jkG7apHVbtV6uUW/pvorWot99YgHwF1HYWh7MelPPyWT5 bLAb5Inu5GEq7Gk2kmxzJlljrpwQmB7iwcHG/SpB8FTUsREPIwEOSnluQSjq+XLEB+RG adhSipwE0ETPmhXxRHbuP7/oSONC5yZl4Rbf9MTU1/6NhtWZd+CJdlsaiXIoeEvpVCc6 A7FNElbLI6FHljxA/7uCiwc1JBKcEN2GS4DMmYWimtJDnylI8MJK8NBJxav1sRHVStKK i9Vl6+gyGDM2q0a34P7moUvNgxz2romwxU1lAYvcrlgwaaBPpPU2702KNwYzio1yG5fT KDDw== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:mime-version:references:in-reply-to:from:date :message-id:subject:to:cc; bh=L4xIniFxPPh2hLh09cY4pn2/nVajG3jFfSL2gCwCj9A=; b=a2b8AZdxrn9Nw7fKjMhXWl70niYTdF95cQ1+5AaFJVEQfh7UOXAzM4K4PVCdi/Kqbo 4nqzXCbKYigWYNbydnTAfQ2KTqvrEwrlrQNg185FJ9cdE46T2b4XyJHHyrLVxHaW8Ovm HOXbzEZUU0gXhCTmnmcH+fQ+naK1ne9llc65gfTgF8VePQr0e1y/wM1EYshGOlheoTUA 8QJNpkmZY4Wc3uk1uMk0RWL92s9OpEeL3CUpUx5a17s9bGbjgLzlRU49R3wvqTYYw+bi N6ulyI4ywGFy0g38lClHLSvqLPKaL+3C8axNtL9TsOkgOF2+1mA7wpxLsMUhyAG9zth3 GKLA== X-Gm-Message-State: AOAM5325ooCUdayGftDUL3VYS+XNw1PEYRC4bnZQoQCJYWb+cLrlHGGG I/eQa7OFxmkvCE+IRofAkY+glc89Rna6xBXcBUZSZiS/ X-Google-Smtp-Source: ABdhPJylzL2azOZCw4l5GRr3A+V3X61Pv8t5frFaKbVLV2quti98FPuupF6avRDBp2/vma7XPCuOCdznyGGQEJO/TE8= X-Received: by 2002:a2e:9dcc:: with SMTP id x12mr7016213ljj.261.1595691918240; Sat, 25 Jul 2020 08:45:18 -0700 (PDT) MIME-Version: 1.0 References: <878sf7adz3.fsf@vuxu.org> In-Reply-To: From: Richard Salz Date: Sat, 25 Jul 2020 11:45:06 -0400 Message-ID: To: Will Senn Content-Type: multipart/alternative; boundary="000000000000f5315705ab45f9d8" Subject: Re: [TUHS] Diff and Patch on v7 X-BeenThere: tuhs@minnie.tuhs.org X-Mailman-Version: 2.1.26 Precedence: list List-Id: The Unix Heritage Society mailing list List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Cc: TUHS main list , Leah Neukirchen Errors-To: tuhs-bounces@minnie.tuhs.org Sender: "TUHS" --000000000000f5315705ab45f9d8 Content-Type: text/plain; charset="UTF-8" > -#define ERASE '#' > -#define KILL '@' > +#define ERASE '\177' > +#define KILL '\025' > That is a context diff. The wikipedia page https://en.wikipedia.org/wiki/Diff#Context_format has a reasonable history. Short answer is context diffs appeared in 2.8BSD in 1981 and unified context diffs were posted to Usenet in 1990. Context diffs are more robust if you have made local changes (patch's "fuzz" messages), and unified are more compact version and can be more useful to see exactly before/after lines. A comparison of the outputs follows: ; diff a.cpp.orig a.cpp 3d2 < int size; 6c5 < : elem{new int[s]}, size{s} --- > : elem{new int[s]} ; diff -e a.cpp.orig a.cpp 6c : elem{new int[s]} . 3d ; diff -c a.cpp.orig a.cpp *** a.cpp.orig Sat Jul 25 11:37:29 2020 --- a.cpp Sat Jul 25 11:42:21 2020 *************** *** 1,9 **** class x { int *elem; - int size; public: x(int s) ! : elem{new int[s]}, size{s} { } ~x() { delete[] elem; } --- 1,8 ---- class x { int *elem; public: x(int s) ! : elem{new int[s]} { } ~x() { delete[] elem; } ; diff -u a.cpp.orig a.cpp --- a.cpp.orig 2020-07-25 11:37:29.000000000 -0400 +++ a.cpp 2020-07-25 11:42:21.000000000 -0400 @@ -1,9 +1,8 @@ class x { int *elem; - int size; public: x(int s) - : elem{new int[s]}, size{s} + : elem{new int[s]} { } ~x() { delete[] elem; } ; --000000000000f5315705ab45f9d8 Content-Type: text/html; charset="UTF-8" Content-Transfer-Encoding: quoted-printable

-#define ERASE=C2=A0=C2=A0=C2=A0 '#'
-#define KILL=C2=A0=C2=A0=C2=A0 '@'
+#define ERASE=C2=A0=C2=A0=C2=A0 '\177'
+#define KILL=C2=A0=C2=A0=C2=A0 '\025'

That is a context diff.=C2=A0 The wikipedia page https://en.wikipedia.org/wiki/D= iff#Context_format has a reasonable history.=C2=A0 Short answer is cont= ext diffs appeared in 2.8BSD in 1981 and unified context diffs were posted = to Usenet in 1990. Context diffs are more robust if you have made local cha= nges (patch's "fuzz" messages), and unified are more compact = version and can be more useful to see exactly before/after lines.
=

A comparison of the outputs follows:
; diff a= .cpp.orig a.cpp
3d2
< =C2=A0 =C2=A0 int size;
6c5
< : el= em{new int[s]}, size{s}
---
> : elem{new int[s]}

; diff -e= a.cpp.orig a.cpp
6c
: elem{new int[s]}
.
3d

; diff -c = a.cpp.orig a.cpp
*** a.cpp.orig Sat Jul 25 11:37:29 2020
--- a.cpp Sa= t Jul 25 11:42:21 2020
***************
*** 1,9 ****
=C2=A0 class x= {
=C2=A0 =C2=A0 =C2=A0 int *elem;
- =C2=A0 =C2=A0 int size;
=C2= =A0 public:
=C2=A0 =C2=A0 =C2=A0 x(int s)
! : elem{new int[s]}, size= {s}
=C2=A0 =C2=A0 =C2=A0 {
=C2=A0 =C2=A0 =C2=A0 }
=C2=A0 =C2=A0 = =C2=A0 ~x() { delete[] elem; }
--- 1,8 ----
=C2=A0 class x {
=C2= =A0 =C2=A0 =C2=A0 int *elem;
=C2=A0 public:
=C2=A0 =C2=A0 =C2=A0 x(in= t s)
! : elem{new int[s]}
=C2=A0 =C2=A0 =C2=A0 {
=C2=A0 =C2=A0 = =C2=A0 }
=C2=A0 =C2=A0 =C2=A0 ~x() { delete[] elem; }

; diff -u a= .cpp.orig a.cpp
--- a.cpp.orig 2020-07-25 11:37:29.000000000 -0400
++= + a.cpp 2020-07-25 11:42:21.000000000 -0400
@@ -1,9 +1,8 @@
=C2=A0cla= ss x {
=C2=A0 =C2=A0 =C2=A0int *elem;
- =C2=A0 =C2=A0int size;
=C2= =A0public:
=C2=A0 =C2=A0 =C2=A0x(int s)
- : elem{new int[s]}, size{s}=
+ : elem{new int[s]}
=C2=A0 =C2=A0 =C2=A0{
=C2=A0 =C2=A0 =C2=A0}<= br>=C2=A0 =C2=A0 =C2=A0~x() { delete[] elem; }

;
--000000000000f5315705ab45f9d8--