Skip site navigation (1)Skip section navigation (2)
Date:      Fri, 18 May 2001 18:40:20 +0100
From:      Nik Clayton <nik@freebsd.org>
To:        John Reynolds~ <jreynold@sedona.ch.intel.com>
Cc:        doc@FreeBSD.ORG
Subject:   Re: Policy on image source files in the CVS tree
Message-ID:  <20010518184019.B1757@catkin.nothing-going-on.org>
In-Reply-To: <15109.17370.556766.821490@hip186.ch.intel.com>; from jreynold@sedona.ch.intel.com on Fri, May 18, 2001 at 08:46:34AM -0700
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.17370.556766.821490@hip186.ch.intel.com>

next in thread | previous in thread | raw e-mail | index | archive | help

--CblX+4bnyfN0pR09
Content-Type: multipart/mixed; boundary="K8nIJk4ghYZn606h"
Content-Disposition: inline


--K8nIJk4ghYZn606h
Content-Type: text/plain; charset=us-ascii
Content-Disposition: inline
Content-Transfer-Encoding: quoted-printable

On Fri, May 18, 2001 at 08:46:34AM -0700, John Reynolds~ wrote:
> FYI, I'm tackling the shot2txt progie. It's more complicated than the 3-l=
ine
> Perl script I sent out 2 days ago (but yet still definitely not rocket
> science). Is anybody (but Nik) "signed up" to get shot2gif or shot2png
> working/written yet?=20

shot2png is in and committed.  I have shot2txt ready to go as well.
I've attached the source.

N
--=20
FreeBSD: The Power to Serve             http://www.freebsd.org/
FreeBSD Documentation Project           http://www.freebsd.org/docproj/

          --- 15B8 3FFC DDB4 34B0 AA5F  94B7 93A8 0764 2C37 E375 ---

--K8nIJk4ghYZn606h
Content-Type: text/plain; charset=us-ascii
Content-Disposition: attachment; filename="shot2txt.c"
Content-Transfer-Encoding: quoted-printable

/*-
 * Copyright (c) 2001 Nik Clayton
 * All rights reserved.
 *
 * Redistribution and use in source and binary forms, with or without
 * modification, are permitted provided that the following conditions
 * are met:
 * 1. Redistributions of source code must retain the above copyright
 *    notice, this list of conditions and the following disclaimer.
 * 2. Redistributions in binary form must reproduce the above copyright
 *    notice, this list of conditions and the following disclaimer in the
 *    documentation and/or other materials provided with the distribution.
 *
 * THIS SOFTWARE IS PROVIDED BY THE AUTHOR AND CONTRIBUTORS ``AS IS'' AND
 * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
 * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPO=
SE
 * ARE DISCLAIMED.  IN NO EVENT SHALL THE AUTHOR OR CONTRIBUTORS BE LIABLE
 * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTI=
AL
 * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
 * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
 * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRI=
CT
 * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
 * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
 * SUCH DAMAGE.
 */

#ifndef lint
static const char rcsid[] =3D
        "$Id: shot2png.c,v 1.2 2001/05/18 15:01:11 nik Exp $";
#endif /* not lint */

#include <sys/stat.h>
#include <sys/syslimits.h>
#include <sys/types.h>

#include <err.h>
#include <fcntl.h>
#include <stdio.h>
#include <stdlib.h>
#include <unistd.h>

#define MAGIC		"SCRSHOT_"
#define VERSION		1

int
main(int argc, char *argv[])
{
	int 		mx, my;		/* Maxmimum X and Y images positions */
	int 		cx;		/* Current X and Y images positions */
	int 		curChar; 	/* Current character to render */
	char		header[BUFSIZ]; /* Buffer for header components */
=09
	/*
	 * Read the SCRSHOT_ header, confirm the version, and read the image
	 * dimensions.
	 */
	if(fread(header, sizeof(unsigned char), 8, stdin) !=3D 8)
		err(1, "fread() header bytes");

	if(!strcmp(MAGIC, header))
		err(1, "Expecting '%s', read '%s'", MAGIC, header);

	header[0] =3D getc(stdin);
	if(header[0] !=3D VERSION)
		fprintf(stderr, "Expecting version %d, read %d\n",
		    VERSION, header[0]);

	header[0] =3D getc(stdin);
	if(header[0] =3D=3D EOF)
		err(1, "Received EOF when reading header length");

	if(header[0] < 2)
		err(1, "Header length is less than 2 ('%d')", header[0]);
=09
	mx =3D getc(stdin);
	header[0]--;
	if(mx =3D=3D EOF)
		err(1, "Received EOF when reading image width");

	getc(stdin);
	header[0]--;
	if(my =3D=3D EOF)
		err(1, "Received EOF when reading image height");
=09
	/*
	 * Don't know what to do with any other data in the header,
	 * so skip it.
	 */
	while(header[0]-- !=3D 0)
		getc(stdin);
=09
	/*
	 * Read from STDIN, rendering on to the image
	 */
	cx =3D 0;
	while((curChar =3D getchar()) !=3D EOF) {
		getchar();	/* Skip the attribute byte */
	=09
		putchar(curChar);
	=09
		/* New line?  */
		if(++cx >=3D mx) {
			cx =3D 0;
			putchar('\n');
		}
	}

	exit(0);
}


--K8nIJk4ghYZn606h--

--CblX+4bnyfN0pR09
Content-Type: application/pgp-signature
Content-Disposition: inline

-----BEGIN PGP SIGNATURE-----
Version: GnuPG v1.0.5 (FreeBSD)
Comment: For info see http://www.gnupg.org

iEYEARECAAYFAjsFXoIACgkQk6gHZCw343UuhACeP0zq06dz5L8pYbSt0buoyejt
bqwAoId6b8YmNm5PEwV+yDAOTnoDGuTL
=uC82
-----END PGP SIGNATURE-----

--CblX+4bnyfN0pR09--

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?20010518184019.B1757>