Subject: Re: RCS ID in kernel version
To: None <hubert.feyrer@informatik.fh-regensburg.de>
From: enami tsugutomo <enami@sm.sony.co.jp>
List: tech-kern
Date: 01/20/2000 19:33:50
Hubert Feyrer <feyrer@rfhs8012.fh-regensburg.de> writes:

> Index: usr.sbin/config/config.h
	:
>  const char *defbuilddir;	/* default build directory */
> +char *ident=NULL;		/* kernel "ident"ification string */

I don't think a header file is good place to initialize a variable.
It seems that the main() of this program has more suitable section.

> +	IDENT WORD			{ setident($2); } |

Since WORD isn't empty string (it is EMPTY),

> +	if (ident == NULL ||
> +	    *ident == '\0')
> +		return (0);

second test may be unneccesary.

> +void
> +setident(i)
> +	const char *i;
> +{
> +	ident=emalloc(strlen(i)+1);
> +	strcpy(ident, i);
> +}
> +

This can be written as follows using estrdup (and using coding style
closer to KNF):

void
setident(i)
	const char *i;
{

	ident = estrdup(i);
}

enami.