Files
vasilito b9874d0941 feat: USB storage read/write proof + full Red Bear OS tree sync
Add redbear-usb-storage-check in-guest binary that validates USB mass
storage read and write I/O: discovers /scheme/disk/ devices, writes a
test pattern to sector 2048, reads it back, verifies match, restores
original content. Updates test-usb-storage-qemu.sh with write-proof
verification step.

Includes all accumulated Red Bear OS work: kernel patches, relibc
patches, driver infrastructure, DRM/GPU, KDE recipes, firmware,
validation tooling, build system hardening, and documentation.
2026-05-03 23:03:24 +01:00

32 lines
1.0 KiB
C

#include <stddef.h>
#include <stdio.h>
#include <time.h>
#include "test_helpers.h"
int main(void) {
int day = 60 * 60 * 24;
time_t inputs[] = { -(day * 33), -day, -1, -500, 0, 1, 1531454950 };
for (size_t i = 0; i < (sizeof(inputs) / sizeof(time_t)); i += 1) {
struct tm* t = localtime(&inputs[i]);
printf(
"Year %d, Day of year: %d, Month %d, Day of month: %d, Day of week: %d, %d:%d:%d\n",
t->tm_year, t->tm_yday, t->tm_mon, t->tm_mday, t->tm_wday, t->tm_hour, t->tm_min, t->tm_sec
);
}
time_t input = 1531461823;
fputs(ctime(&input), stdout); // Omit newline
char ctime_r_buffer[26];
/* ctime_r() generally returns the address of the provided buffer,
* but may return NULL upon error according to the spec. */
char *ctime_r_result = ctime_r(&input, ctime_r_buffer);
if (ctime_r_result == ctime_r_buffer) {
fputs(ctime_r_result, stdout);
} else {
printf("Unexpected pointer from ctime_r: %p\n", ctime_r_result);
}
}