xref: /titanic_44/usr/src/lib/libcmd/common/fts_fix.c (revision 3e14f97f673e8a630f076077de35afdd43dc1587)
1*3e14f97fSRoger A. Faulkner /***********************************************************************
2*3e14f97fSRoger A. Faulkner *                                                                      *
3*3e14f97fSRoger A. Faulkner *               This software is part of the ast package               *
4*3e14f97fSRoger A. Faulkner *          Copyright (c) 1992-2010 AT&T Intellectual Property          *
5*3e14f97fSRoger A. Faulkner *                      and is licensed under the                       *
6*3e14f97fSRoger A. Faulkner *                  Common Public License, Version 1.0                  *
7*3e14f97fSRoger A. Faulkner *                    by AT&T Intellectual Property                     *
8*3e14f97fSRoger A. Faulkner *                                                                      *
9*3e14f97fSRoger A. Faulkner *                A copy of the License is available at                 *
10*3e14f97fSRoger A. Faulkner *            http://www.opensource.org/licenses/cpl1.0.txt             *
11*3e14f97fSRoger A. Faulkner *         (with md5 checksum 059e8cd6165cb4c31e351f2b69388fd9)         *
12*3e14f97fSRoger A. Faulkner *                                                                      *
13*3e14f97fSRoger A. Faulkner *              Information and Software Systems Research               *
14*3e14f97fSRoger A. Faulkner *                            AT&T Research                             *
15*3e14f97fSRoger A. Faulkner *                           Florham Park NJ                            *
16*3e14f97fSRoger A. Faulkner *                                                                      *
17*3e14f97fSRoger A. Faulkner *                 Glenn Fowler <gsf@research.att.com>                  *
18*3e14f97fSRoger A. Faulkner *                  David Korn <dgk@research.att.com>                   *
19*3e14f97fSRoger A. Faulkner *                                                                      *
20*3e14f97fSRoger A. Faulkner ***********************************************************************/
21*3e14f97fSRoger A. Faulkner /*
22*3e14f97fSRoger A. Faulkner  * -lcmd specific workaround to handle
23*3e14f97fSRoger A. Faulkner  *	fts_namelen
24*3e14f97fSRoger A. Faulkner  *	fts_pathlen
25*3e14f97fSRoger A. Faulkner  *	fts_level
26*3e14f97fSRoger A. Faulkner  * changing from [unsigned] short bit to [s]size_t
27*3e14f97fSRoger A. Faulkner  *
28*3e14f97fSRoger A. Faulkner  * ksh (or any other main application) that pulls in -lcmd
29*3e14f97fSRoger A. Faulkner  * at runtime may result in old -last running with new -lcmd
30*3e14f97fSRoger A. Faulkner  * which is not a good situation (tm)
31*3e14f97fSRoger A. Faulkner  *
32*3e14f97fSRoger A. Faulkner  * probably safe to drop after 20150101
33*3e14f97fSRoger A. Faulkner  */
34*3e14f97fSRoger A. Faulkner 
35*3e14f97fSRoger A. Faulkner #include <ast.h>
36*3e14f97fSRoger A. Faulkner #include <fts_fix.h>
37*3e14f97fSRoger A. Faulkner 
38*3e14f97fSRoger A. Faulkner #undef	fts_read
39*3e14f97fSRoger A. Faulkner 
40*3e14f97fSRoger A. Faulkner FTSENT*
_fts_read(FTS * fts)41*3e14f97fSRoger A. Faulkner _fts_read(FTS* fts)
42*3e14f97fSRoger A. Faulkner {
43*3e14f97fSRoger A. Faulkner 	FTSENT*		oe;
44*3e14f97fSRoger A. Faulkner 
45*3e14f97fSRoger A. Faulkner 	static FTSENT*	ne;
46*3e14f97fSRoger A. Faulkner 
47*3e14f97fSRoger A. Faulkner 	if ((oe = _ast_fts_read(fts)) && ast.version < 20100102L && (ne || (ne = newof(0, FTSENT, 1, 0))))
48*3e14f97fSRoger A. Faulkner 	{
49*3e14f97fSRoger A. Faulkner 		*ne = *oe;
50*3e14f97fSRoger A. Faulkner 		oe = ne;
51*3e14f97fSRoger A. Faulkner 		ne->fts_namelen = ne->_fts_namelen;
52*3e14f97fSRoger A. Faulkner 		ne->fts_pathlen = ne->_fts_pathlen;
53*3e14f97fSRoger A. Faulkner 		ne->fts_level = ne->_fts_level;
54*3e14f97fSRoger A. Faulkner 	}
55*3e14f97fSRoger A. Faulkner 	return oe;
56*3e14f97fSRoger A. Faulkner }
57