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