--- ray/src/common/lamps.c 1993/08/23 10:12:43 2.3 +++ ray/src/common/lamps.c 2003/06/08 12:03:09 2.9 @@ -1,19 +1,22 @@ -/* Copyright (c) 1990 Regents of the University of California */ - #ifndef lint -static char SCCSid[] = "$SunId$ LBL"; +static const char RCSid[] = "$Id: lamps.c,v 2.9 2003/06/08 12:03:09 schorsch Exp $"; #endif - /* * Load lamp data. */ +#include "copyright.h" + #include +#include #include -extern char *eindex(), *expsave(), *malloc(); -extern FILE *fropen(); +#include "standard.h" +#include "color.h" +extern char *eindex(), *expsave(); +extern FILE *frlibopen(); + typedef struct lamp { char *pattern; /* search pattern */ float *color; /* pointer to lamp value */ @@ -24,8 +27,9 @@ static LAMP *lamps = NULL; /* lamp list */ float * -matchlamp(s) /* see if string matches any lamp */ -char *s; +matchlamp( /* see if string matches any lamp */ +char *s +) { register LAMP *lp; @@ -38,8 +42,10 @@ char *s; } -loadlamps(file) /* load lamp type file */ -char *file; +int +loadlamps( /* load lamp type file */ +char *file +) { LAMP *lastp; register LAMP *lp; @@ -48,7 +54,7 @@ char *file; char buf[128], str[128]; register char *cp1, *cp2; - if ((fp = fropen(file)) == NULL) + if ((fp = frlibopen(file)) == NULL) return(0); lastp = NULL; while (fgets(buf, sizeof(buf), fp) != NULL) { @@ -125,7 +131,8 @@ fmterr: } -freelamps() /* free our lamps list */ +void +freelamps(void) /* free our lamps list */ { register LAMP *lp1, *lp2; @@ -135,10 +142,10 @@ freelamps() /* free our lamps list */ for (lp2 = lp1->next; lp2 != NULL; lp2 = lp2->next) if (lp2->color == lp1->color) lp2->color = NULL; - free((char *)lp1->color); + free((void *)lp1->color); } lp2 = lp1->next; - free((char *)lp1); + free((void *)lp1); } lamps = NULL; }