1 /***********************************************************************
2 *                                                                      *
3 *               This software is part of the ast package               *
4 *          Copyright (c) 1985-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 *                   Phong Vo <kpv@research.att.com>                    *
20 *                                                                      *
21 ***********************************************************************/
22 #pragma prototyped
23 /*
24  * Glenn Fowler
25  * AT&T Research
26  *
27  * ls formatter interface definitions
28  */
29 
30 #ifndef _LS_H
31 #define _LS_H
32 
33 #include <ast_std.h>
34 #include <ast_fs.h>
35 #include <ast_mode.h>
36 
37 /*
38  * some systems (could it beee AIX) pollute the std name space
39  */
40 
41 #undef	fileid
42 #define fileid	fileID
43 
44 #define LS_BLOCKSIZE	512
45 
46 #define iblocks(p)	_iblocks(p)
47 
48 #if _mem_st_rdev_stat
49 #define idevice(p)	((p)->st_rdev)
50 #define IDEVICE(p,v)	((p)->st_rdev=(v))
51 #else
52 #define idevice(p)	0
53 #define IDEVICE(p,v)
54 #endif
55 
56 #define LS_ATIME	(1<<0)		/* list st_atime		*/
57 #define LS_BLOCKS	(1<<1)		/* list blocks used by file	*/
58 #define LS_CTIME	(1<<2)		/* list st_ctime		*/
59 #define LS_EXTERNAL	(1<<3)		/* st_mode is modex canonical	*/
60 #define LS_INUMBER	(1<<4)		/* list st_ino			*/
61 #define LS_LONG		(1<<5)		/* long listing			*/
62 #define LS_MARK		(1<<6)		/* append file name marks	*/
63 #define LS_NOGROUP	(1<<7)		/* omit group name for LS_LONG	*/
64 #define LS_NOUSER	(1<<8)		/* omit user name for LS_LONG	*/
65 #define LS_NUMBER	(1<<9)		/* number instead of name	*/
66 
67 #define LS_USER		(1<<10)		/* first user flag bit		*/
68 
69 #define LS_W_BLOCKS	6		/* LS_BLOCKS field width	*/
70 #define LS_W_INUMBER	9		/* LS_INUMBER field width	*/
71 #define LS_W_LONG	57		/* LS_LONG width (w/o names)	*/
72 #define LS_W_LINK	4		/* link text width (w/o names)	*/
73 #define LS_W_MARK	1		/* LS_MARK field width		*/
74 #define LS_W_NAME	9		/* group|user name field width	*/
75 
76 #if _BLD_ast && defined(__EXPORT__)
77 #define extern		__EXPORT__
78 #endif
79 
80 extern off_t		_iblocks(struct stat*);
81 extern char*		fmtdev(struct stat*);
82 extern char*		fmtfs(struct stat*);
83 extern char*		fmtls(char*, const char*, struct stat*, const char*, const char*, int);
84 extern int		pathstat(const char*, struct stat*);
85 
86 #undef	extern
87 
88 #endif
89