mirror of
https://github.com/jart/cosmopolitan.git
synced 2025-07-27 04:50:28 +00:00
Make ANSI mode closer to being ANSI
This commit is contained in:
parent
28135b7a20
commit
46085797b6
23 changed files with 352 additions and 92 deletions
|
@ -367,7 +367,7 @@ int ReadResponse(void) {
|
|||
goto drop;
|
||||
case kRunitStderr:
|
||||
CHECK_GE(n, 4);
|
||||
size = read32be(p), p += 4, n -= 4;
|
||||
size = READ32BE(p), p += 4, n -= 4;
|
||||
while (size) {
|
||||
if (n) {
|
||||
CHECK_NE(-1, (rc = write(STDERR_FILENO, p, min(n, size))));
|
||||
|
|
|
@ -263,12 +263,12 @@ void HandleClient(void) {
|
|||
got = recv(g_clifd, (p = &g_buf[0]), sizeof(g_buf), 0);
|
||||
CHECK_GE(got, kMinMsgSize);
|
||||
CHECK_LE(got, sizeof(g_buf));
|
||||
CHECK_EQ(RUNITD_MAGIC, read32be(p));
|
||||
CHECK_EQ(RUNITD_MAGIC, READ32BE(p));
|
||||
p += 4, got -= 4;
|
||||
CHECK_EQ(kRunitExecute, *p++);
|
||||
got--;
|
||||
namesize = read32be(p), p += 4, got -= 4;
|
||||
filesize = read32be(p), p += 4, got -= 4;
|
||||
namesize = READ32BE(p), p += 4, got -= 4;
|
||||
filesize = READ32BE(p), p += 4, got -= 4;
|
||||
CHECK_GE(got, namesize);
|
||||
CHECK_LE(namesize, kMaxNameSize);
|
||||
CHECK_LE(filesize, kMaxFileSize);
|
||||
|
|
|
@ -100,7 +100,7 @@ static void Print(void) {
|
|||
arsize = atoi((char *)(data + 8 + 48));
|
||||
CHECK_LE(4, arsize);
|
||||
CHECK_LE(8 + 60 + arsize, size);
|
||||
entries = read32be(data + 8 + 60);
|
||||
entries = READ32BE(data + 8 + 60);
|
||||
CHECK_LE(4 + entries * 4 + 1, arsize);
|
||||
printf("\t# %'s\n", path);
|
||||
PrintString(data, 8, "file signature");
|
||||
|
@ -110,7 +110,7 @@ static void Print(void) {
|
|||
printf("\t.long\t%u\t\t\t# %s\n", entries, "symbol table entries");
|
||||
table = 8 + 60 + 4;
|
||||
for (i = 0; i < entries; ++i) {
|
||||
printf("\t.long\t%#x\t\t\t\t# %u\n", read32be(data + table + i * 4), i);
|
||||
printf("\t.long\t%#x\t\t\t\t# %u\n", READ32BE(data + table + i * 4), i);
|
||||
}
|
||||
symbols = table + entries * 4;
|
||||
symbolslen = arsize - (4 + entries * 4);
|
||||
|
|
|
@ -94,22 +94,22 @@ void showcompressmethod(uint16_t compressmethod) {
|
|||
void showextrantfs(uint8_t *ntfs) {
|
||||
struct timespec mtime, atime, ctime;
|
||||
mtime = FileTimeToTimeSpec(
|
||||
(struct NtFileTime){read32le(ntfs + 8), read32le(ntfs + 12)});
|
||||
(struct NtFileTime){READ32LE(ntfs + 8), READ32LE(ntfs + 12)});
|
||||
atime = FileTimeToTimeSpec(
|
||||
(struct NtFileTime){read32le(ntfs + 16), read32le(ntfs + 20)});
|
||||
(struct NtFileTime){READ32LE(ntfs + 16), READ32LE(ntfs + 20)});
|
||||
ctime = FileTimeToTimeSpec(
|
||||
(struct NtFileTime){read32le(ntfs + 24), read32le(ntfs + 28)});
|
||||
show(".long", gc(xasprintf("%d", read32le(ntfs))), "ntfs reserved");
|
||||
show(".short", gc(xasprintf("0x%04x", read16le(ntfs + 4))),
|
||||
(struct NtFileTime){READ32LE(ntfs + 24), READ32LE(ntfs + 28)});
|
||||
show(".long", gc(xasprintf("%d", READ32LE(ntfs))), "ntfs reserved");
|
||||
show(".short", gc(xasprintf("0x%04x", READ16LE(ntfs + 4))),
|
||||
"ntfs attribute tag value #1");
|
||||
show(".short", gc(xasprintf("%hu", read16le(ntfs + 6))),
|
||||
show(".short", gc(xasprintf("%hu", READ16LE(ntfs + 6))),
|
||||
"ntfs attribute tag size");
|
||||
show(".quad", gc(xasprintf("%lu", read64le(ntfs + 8))),
|
||||
show(".quad", gc(xasprintf("%lu", READ64LE(ntfs + 8))),
|
||||
gc(xasprintf("%s (%s)", "ntfs last modified time",
|
||||
gc(xiso8601(&mtime)))));
|
||||
show(".quad", gc(xasprintf("%lu", read64le(ntfs + 16))),
|
||||
show(".quad", gc(xasprintf("%lu", READ64LE(ntfs + 16))),
|
||||
gc(xasprintf("%s (%s)", "ntfs last access time", gc(xiso8601(&atime)))));
|
||||
show(".quad", gc(xasprintf("%lu", read64le(ntfs + 24))),
|
||||
show(".quad", gc(xasprintf("%lu", READ64LE(ntfs + 24))),
|
||||
gc(xasprintf("%s (%s)", "ntfs creation time", gc(xiso8601(&ctime)))));
|
||||
}
|
||||
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue