b9874d0941
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.
26 lines
608 B
C
26 lines
608 B
C
#include <stdio.h>
|
|
#include <string.h>
|
|
#include <wchar.h>
|
|
|
|
#include "test_helpers.h"
|
|
|
|
void print_as_wide(const char* mbstr)
|
|
{
|
|
mbstate_t state;
|
|
memset(&state, 0, sizeof state);
|
|
size_t len = 1 + mbsrtowcs(NULL, &mbstr, 0, &state);
|
|
wchar_t wstr[len];
|
|
mbsrtowcs(&wstr[0], &mbstr, len, &state);
|
|
|
|
//Should be 5
|
|
printf("The length, including '\\0': %li \n",len);
|
|
|
|
//missing wprintf to print this wide string
|
|
//wprintf(L"The wide string: %ls \n", &wstr[0]);
|
|
}
|
|
|
|
int main(void) {
|
|
const char* mbstr = u8"z\u00df\u6c34\U0001f34c"; // or u8"zß水🍌"
|
|
print_as_wide(mbstr);
|
|
}
|