Date: Sat, 19 May 2001 00:00:07 -0700 From: John Reynolds <jjreynold@home.com> To: Nik Clayton <nik@freebsd.org> Subject: Re: Policy on image source files in the CVS tree Message-ID: <15110.6647.401843.440974@whale.home-net> 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>
next in thread | previous in thread | raw e-mail | index | archive | help
[ 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
Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?15110.6647.401843.440974>