From owner-freebsd-doc Sat May 19 0: 0:26 2001 Delivered-To: freebsd-doc@freebsd.org Received: from cx587235-a.chnd1.az.home.com (cx587235-a.chnd1.az.home.com [24.1.255.253]) by hub.freebsd.org (Postfix) with ESMTP id 12C0637B424; Sat, 19 May 2001 00:00:09 -0700 (PDT) (envelope-from jjreynold@home.com) Received: from whale.home-net (whale [192.168.1.2]) by cx587235-a.chnd1.az.home.com (8.11.3/8.11.3) with ESMTP id f4J708n14142; Sat, 19 May 2001 00:00:08 -0700 (MST) (envelope-from jjreynold@home.com) Received: (from jjreynold@localhost) by whale.home-net (8.11.3/8.11.3) id f4J707b04562; Sat, 19 May 2001 00:00:07 -0700 (MST) (envelope-from jjreynold@home.com) From: John Reynolds MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Transfer-Encoding: 7bit Message-ID: <15110.6647.401843.440974@whale.home-net> Date: Sat, 19 May 2001 00:00:07 -0700 To: Nik Clayton Cc: doc@freebsd.org Subject: Re: Policy on image source files in the CVS tree In-Reply-To: <20010519004606.E1757@catkin.nothing-going-on.org> References: <20010517122744.B3349@catkin.nothing-going-on.org> <20010517113103.A25222@Odin.AC.HMC.Edu> <200105180028.f4I0Snn05073@bmah-freebsd-0.cisco.com> <20010518013645.A8358@catkin.nothing-going-on.org> <15109.16691.817238.944467@hip186.ch.intel.com> <20010518184813.B12846@catkin.nothing-going-on.org> <15109.25794.690992.994411@hip186.ch.intel.com> <20010518224728.C1757@catkin.nothing-going-on.org> <15109.43699.126204.944263@hip186.ch.intel.com> <20010519004606.E1757@catkin.nothing-going-on.org> X-Mailer: VM 6.88 under Emacs 20.7.1 Cc: Sender: owner-freebsd-doc@FreeBSD.ORG Precedence: bulk List-ID: List-Archive: (Web Archive) List-Help: (List Instructions) List-Subscribe: List-Unsubscribe: X-Loop: FreeBSD.org [ On Saturday, May 19, Nik Clayton wrote: ] > > Eh? strcmp() returns 0 if the strings match, so you have to invert the > test (or, better still, write "if(strcmp(MAGIC, header) == 0)" which I > should have done). > > I'd expect to see that with your change, not without it. Do you get > that problem with the ports? > As a followup Nik, yes the one in the ports collection is hosed too. if(!strcmp(MAGIC, header)) err(1, "Expecting '%s', read '%s'", MAGIC, header); strcmp will return '0' if 'header' matches MAGIC. In the case that you're using the right scrshot(1), it will. In all my test cases, it does. So: if(!(0)) err(1, "Expecting '%s', read '%s'", MAGIC, header); ! of 0 == true if(true) err(1, "Expecting '%s', read '%s'", MAGIC, header); therefore: shot2txt: Expecting 'SCRSHOT_', read 'SCRSHOT_': Undefined error: 0 The following patch fixes it: --- shot2txt.c.orig Fri May 18 23:51:52 2001 +++ shot2txt.c Fri May 18 23:57:58 2001 @@ -72,7 +72,7 @@ if(fread(header, sizeof(unsigned char), 8, stdin) != 8) err(1, "fread() header bytes"); - if(!strcmp(MAGIC, header)) + if(strcmp(MAGIC, header) != 0) err(1, "Expecting '%s', read '%s'", MAGIC, header); header[0] = getc(stdin); -Jr -- =-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-= John Reynolds Chandler Capabilities Engineering, CDS, Intel Corporation jreynold@sedona.ch.intel.com My opinions are mine, not Intel's. Running jjreynold@home.com FreeBSD 4.3-STABLE. FreeBSD: The Power to Serve. http://www.reynoldsnet.org/ Come join us!!! @ http://www.FreeBSD.org/ =-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-= To Unsubscribe: send mail to majordomo@FreeBSD.org with "unsubscribe freebsd-doc" in the body of the message