Skip site navigation (1)Skip section navigation (2)
Date:      Sun, 27 Oct 2002 16:34:51 -0800
From:      Juli Mallett <jmallett@FreeBSD.org>
To:        Garrett Wollman <wollman@FreeBSD.org>
Cc:        cvs-committers@FreeBSD.org, cvs-all@FreeBSD.org
Subject:   Re: cvs commit: src/bin/expr expr.1 expr.y src/include unistd.h src/lib/libc/gen Makefile.inc check_utility_compat.3 check_utility_compat.c
Message-ID:  <20021027163451.A69160@FreeBSD.org>
In-Reply-To: <20021027162523.A68817@FreeBSD.org>; from jmallett@FreeBSD.org on Sun, Oct 27, 2002 at 04:25:23PM -0800
References:  <200210280015.g9S0Fhfp042683@repoman.freebsd.org> <20021027162523.A68817@FreeBSD.org>

next in thread | previous in thread | raw e-mail | index | archive | help
* De: Juli Mallett <jmallett@FreeBSD.org> [ Data: 2002-10-27 ]
	[ Subjecte: Re: cvs commit: src/bin/expr expr.1 expr.y src/include unistd.h src/lib/libc/gen Makefile.inc check_utility_compat.3 check_utility_compat.c ]
> * De: Garrett Wollman <wollman@FreeBSD.org> [ Data: 2002-10-27 ]
> 	[ Subjecte: cvs commit: src/bin/expr expr.1 expr.y src/include unistd.h src/lib/libc/gen Makefile.inc check_utility_compat.3 check_utility_compat.c ]
> > wollman     2002/10/27 16:15:43 PST
> > 
> >   Modified files:
> >     bin/expr             expr.1 expr.y 
> >     include              unistd.h 
> >     lib/libc/gen         Makefile.inc 
> >   Added files:
> >     lib/libc/gen         check_utility_compat.3 
> >                          check_utility_compat.c 
> >   Log:
> >   Create a small library function, check_utility_compat(3), to determine
> >   whether a named utility should behave in FreeBSD 4.x-compatible mode
> >   or in a standard mode (default standard).  The configuration is done
> >   malloc(3)-style, with either an environment variable or a symlink.
> >   
> >   Update expr(1) to use this new interface.
> 
> in libc!?  I dunno, isn't that a bit frivilous?  Our libc is big enough
> without freebsd-base-system-only-and-even-few-there stuff in it... What
> about libutil or something?

After further thought though, a generic "check_interface_version" or
such, which would do such as...

int
check_interface_version(const char *interface, char **version)
{
	char *env;
	char *setting;
	int error;

	error = 0;
	asprintf(&env, "%s_INTERFACE_VERSION", interface);
	if (env == NULL) {
		/* XXX check some symlink */
		error = 1;
		goto out;
	}
	setting = getenv(env);
	if (setting == NULL) {
		error = 1;
		goto out;
	}
out:
	free(env);
	*version = setting;
	return (error);
}

And allow me to check_interface_version("xargs", &iv);
And do if (strcasecmp(iv, "GNU") == 0) { enable_dodgy_args = 1; }

Or some such.

I think "FreeBSD 4 compatability" is too specific to check for, in and
of itself.
-- 
Juli Mallett <jmallett@FreeBSD.org>       | FreeBSD: The Power To Serve
Will break world for fulltime employment. | finger jmallett@FreeBSD.org
http://people.FreeBSD.org/~jmallett/      | Support my FreeBSD hacking!

To Unsubscribe: send mail to majordomo@FreeBSD.org
with "unsubscribe cvs-all" in the body of the message




Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?20021027163451.A69160>