]>
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
49 ASSERT(bitoffs(bit
) == 0);
50 ASSERT(size
== bitsz(char));
52 for (i
= 0, p
= (char *)obj
+ byteize(bit
);
53 i
< count
&& !seenint();
55 if (*p
== '\\' || *p
== '\'' || *p
== '"' || *p
== '\?')
57 else if (isgraph((int)*p
) || *p
== ' ')
59 else if (*p
== '\a' || *p
== '\b' || *p
== '\f' || *p
== '\n' ||
60 *p
== '\r' || *p
== '\t' || *p
== '\v')
61 dbprintf("\\%c", *p
+ ('a' - '\a'));
63 dbprintf("\\%03o", *p
& 0xff);
85 for (i
= 0, bitpos
= bit
;
86 i
< count
&& !seenint();
87 i
++, bitpos
+= size
) {
88 val
= getbitval(obj
, bitpos
, size
,
89 (arg
& FTARG_SIGNED
) ? BVSIGNED
: BVUNSIGNED
);
90 if ((arg
& FTARG_SKIPZERO
) && val
== 0)
92 isnull
= (arg
& FTARG_SIGNED
) || size
== 64 ?
93 val
== -1LL : val
== ((1LL << size
) - 1LL);
94 if ((arg
& FTARG_SKIPNULL
) && isnull
)
96 if (array
&& count
> 1)
97 dbprintf("%d:", i
+ base
);
98 if ((arg
& FTARG_DONULL
) && isnull
)
101 dbprintf(fmtstr
, val
);
103 dbprintf(fmtstr
, (__int32_t
)val
);
122 print_sarray(obj
, bit
, count
, size
, base
, array
,
123 (const field_t
*)fmtstr
, (arg
& FTARG_SKIPNMS
) != 0);
144 ASSERT(bitoffs(bit
) == 0);
145 for (i
= 0, bitpos
= bit
;
146 i
< count
&& !seenint();
147 i
++, bitpos
+= size
) {
149 dbprintf("%d:", i
+ base
);
150 t
=(time_t)getbitval((char *)obj
+ byteize(bitpos
), 0, sizeof(int32_t)*8, 0);
152 dbprintf("%24.24s", c
);
171 char bp
[40]; /* UUID string is 36 chars + trailing '\0' */
175 ASSERT(bitoffs(bit
) == 0);
176 for (p
= (uuid_t
*)((char *)obj
+ byteize(bit
)), i
= 0;
177 i
< count
&& !seenint();
180 dbprintf("%d:", i
+ base
);
181 platform_uuid_unparse(p
, bp
);
190 * CRC is correct is the current buffer it is being pulled out
191 * of is not marked with a EFSCORRUPTED error.
209 switch (iocur_crc_valid()) {
220 ok
= "unknown state";
224 for (i
= 0, bitpos
= bit
;
225 i
< count
&& !seenint();
226 i
++, bitpos
+= size
) {
228 dbprintf("%d:", i
+ base
);
229 val
= getbitval(obj
, bitpos
, size
, BVUNSIGNED
);
231 dbprintf(fmtstr
, val
, ok
);
233 dbprintf(fmtstr
, (__int32_t
)val
, ok
);