]>
git.ipfire.org Git - thirdparty/xfsprogs-dev.git/blob - db/fprint.c
2 * Copyright (c) 2000-2002,2005 Silicon Graphics, Inc.
5 * This program is free software; you can redistribute it and/or
6 * modify it under the terms of the GNU General Public License as
7 * published by the Free Software Foundation.
9 * This program is distributed in the hope that it would be useful,
10 * but WITHOUT ANY WARRANTY; without even the implied warranty of
11 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
12 * GNU General Public License for more details.
14 * You should have received a copy of the GNU General Public License
15 * along with this program; if not, write the Free Software Foundation,
16 * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA
19 #include <xfs/libxfs.h>
48 ASSERT(bitoffs(bit
) == 0);
49 ASSERT(size
== bitsz(char));
51 for (i
= 0, p
= (char *)obj
+ byteize(bit
);
52 i
< count
&& !seenint();
54 if (*p
== '\\' || *p
== '\'' || *p
== '"' || *p
== '\?')
56 else if (isgraph((int)*p
) || *p
== ' ')
58 else if (*p
== '\a' || *p
== '\b' || *p
== '\f' || *p
== '\n' ||
59 *p
== '\r' || *p
== '\t' || *p
== '\v')
60 dbprintf("\\%c", *p
+ ('a' - '\a'));
62 dbprintf("\\%03o", *p
& 0xff);
84 for (i
= 0, bitpos
= bit
;
85 i
< count
&& !seenint();
86 i
++, bitpos
+= size
) {
87 val
= getbitval(obj
, bitpos
, size
,
88 (arg
& FTARG_SIGNED
) ? BVSIGNED
: BVUNSIGNED
);
89 if ((arg
& FTARG_SKIPZERO
) && val
== 0)
91 isnull
= (arg
& FTARG_SIGNED
) || size
== 64 ?
92 val
== -1LL : val
== ((1LL << size
) - 1LL);
93 if ((arg
& FTARG_SKIPNULL
) && isnull
)
96 dbprintf("%d:", i
+ base
);
97 if ((arg
& FTARG_DONULL
) && isnull
)
100 dbprintf(fmtstr
, val
);
102 dbprintf(fmtstr
, (__int32_t
)val
);
121 print_sarray(obj
, bit
, count
, size
, base
, array
,
122 (const field_t
*)fmtstr
, (arg
& FTARG_SKIPNMS
) != 0);
143 ASSERT(bitoffs(bit
) == 0);
144 for (i
= 0, bitpos
= bit
;
145 i
< count
&& !seenint();
146 i
++, bitpos
+= size
) {
148 dbprintf("%d:", i
+ base
);
149 t
=(time_t)getbitval((char *)obj
+ byteize(bitpos
), 0, sizeof(int32_t)*8, 0);
151 dbprintf("%24.24s", c
);
170 char bp
[40]; /* UUID string is 36 chars + trailing '\0' */
174 ASSERT(bitoffs(bit
) == 0);
175 for (p
= (uuid_t
*)((char *)obj
+ byteize(bit
)), i
= 0;
176 i
< count
&& !seenint();
179 dbprintf("%d:", i
+ base
);
180 uuid_unparse(*p
, bp
);