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