--- ray/src/rt/devcomm.c 1997/11/11 19:55:03 2.5 +++ ray/src/rt/devcomm.c 2003/02/22 02:07:28 2.6 @@ -1,15 +1,69 @@ -/* Copyright (c) 1988 Regents of the University of California */ - #ifndef lint -static char SCCSid[] = "$SunId$ LBL"; +static const char RCSid[] = "$Id: devcomm.c,v 2.6 2003/02/22 02:07:28 greg Exp $"; #endif - /* * devcomm.c - communication routines for separate drivers. * - * 10/5/88 + * External symbols declared in driver.h */ +/* ==================================================================== + * The Radiance Software License, Version 1.0 + * + * Copyright (c) 1990 - 2002 The Regents of the University of California, + * through Lawrence Berkeley National Laboratory. 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. + * + * 3. The end-user documentation included with the redistribution, + * if any, must include the following acknowledgment: + * "This product includes Radiance software + * (http://radsite.lbl.gov/) + * developed by the Lawrence Berkeley National Laboratory + * (http://www.lbl.gov/)." + * Alternately, this acknowledgment may appear in the software itself, + * if and wherever such third-party acknowledgments normally appear. + * + * 4. The names "Radiance," "Lawrence Berkeley National Laboratory" + * and "The Regents of the University of California" must + * not be used to endorse or promote products derived from this + * software without prior written permission. For written + * permission, please contact radiance@radsite.lbl.gov. + * + * 5. Products derived from this software may not be called "Radiance", + * nor may "Radiance" appear in their name, without prior written + * permission of Lawrence Berkeley National Laboratory. + * + * THIS SOFTWARE IS PROVIDED ``AS IS'' AND ANY EXPRESSED OR IMPLIED + * WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES + * OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE + * DISCLAIMED. IN NO EVENT SHALL Lawrence Berkeley National Laboratory OR + * ITS CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, + * SPECIAL, EXEMPLARY, OR CONSEQUENTIAL 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, STRICT 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. + * ==================================================================== + * + * This software consists of voluntary contributions made by many + * individuals on behalf of Lawrence Berkeley National Laboratory. For more + * information on Lawrence Berkeley National Laboratory, please see + * . + */ + #include "standard.h" #include "color.h" @@ -22,15 +76,16 @@ static char SCCSid[] = "$SunId$ LBL"; #define DEVPATH getenv("PATH") /* device search path */ #endif -static int comm_close(), comm_clear(), comm_paintr(), - comm_getcur(), comm_comout(), comm_comin(), comm_flush(); +static int comm_getcur(); +static void comm_close(), comm_clear(), comm_paintr(), + comm_comin(), comm_comout(), comm_flush(); struct driver comm_driver = { comm_close, comm_clear, comm_paintr, comm_getcur, comm_comout, comm_comin, comm_flush }; -static int mygets(), myputs(), reply_error(), getstate(); +static void mygets(), myputs(), reply_error(), getstate(); FILE *devin, *devout; @@ -69,11 +124,11 @@ struct driver * comm_init(dname, id) /* set up and execute driver */ char *dname, *id; { - char *devname; + char *dvcname; int p1[2], p2[2]; char pin[16], pout[16]; /* find driver program */ - if ((devname = getpath(dname, DEVPATH, X_OK)) == NULL) { + if ((dvcname = getpath(dname, DEVPATH, X_OK)) == NULL) { eputs(dname); eputs(": not found\n"); return(NULL); @@ -86,8 +141,8 @@ char *dname, *id; close(p2[0]); sprintf(pin, "%d", p1[0]); sprintf(pout, "%d", p2[1]); - execl(devname, dname, pin, pout, id, 0); - perror(devname); + execl(dvcname, dname, pin, pout, id, 0); + perror(dvcname); _exit(127); } if (devchild == -1) @@ -105,7 +160,7 @@ syserr: } -static +static void comm_close() /* done with driver */ { int pid; @@ -122,7 +177,7 @@ comm_close() /* done with driver */ } -static +static void comm_clear(xres, yres) /* clear screen */ int xres, yres; { @@ -133,7 +188,7 @@ int xres, yres; } -static +static void comm_paintr(col, xmin, ymin, xmax, ymax) /* paint a rectangle */ COLOR col; int xmin, ymin, xmax, ymax; @@ -147,7 +202,7 @@ int xmin, ymin, xmax, ymax; } -static +static void comm_flush() /* flush output to driver */ { putc(COM_FLUSH, devout); @@ -175,7 +230,7 @@ int *xp, *yp; } -static +static void comm_comout(str) /* print string to command line */ char *str; { @@ -186,7 +241,7 @@ char *str; } -static +static void comm_comin(buf, prompt) /* read string from command line */ char *buf; char *prompt; @@ -206,7 +261,7 @@ char *prompt; } -static +static void mygets(s, fp) /* get string from file (with nul) */ register char *s; register FILE *fp; @@ -220,7 +275,7 @@ register FILE *fp; } -static +static void myputs(s, fp) /* put string to file (with nul) */ register char *s; register FILE *fp; @@ -231,7 +286,7 @@ register FILE *fp; } -static +static void reply_error(routine) /* what should we do here? */ char *routine; { @@ -241,7 +296,7 @@ char *routine; } -static +static void getstate() /* get driver state variables */ { fread((char *)&comm_driver.pixaspect,