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