Files
RedBear-OS/recipes/tests/stdlib/strtol.c
T
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

47 lines
1.5 KiB
C

#include <errno.h>
#include <stdlib.h>
#include <stdio.h>
#include "test_helpers.h"
int main(void) {
char *endptr;
printf("%ld\n", strtol(" -42", &endptr, 0));
printf("endptr \"%s\"\n", endptr);
printf("%ld\n", strtol(" +555", &endptr, 0));
printf("endptr \"%s\"\n", endptr);
printf("%ld\n", strtol(" 1234567890 ", &endptr, 0));
printf("endptr \"%s\"\n", endptr);
printf("%ld\n", strtol(" -42", &endptr, 10));
printf("endptr \"%s\"\n", endptr);
printf("%ld\n", strtol(" +555", &endptr, 10));
printf("endptr \"%s\"\n", endptr);
printf("%ld\n", strtol(" 1234567890 ", &endptr, 10));
printf("endptr \"%s\"\n", endptr);
printf("%lx\n", strtol(" 0x38Acfg", &endptr, 0));
printf("endptr \"%s\"\n", endptr);
printf("%lx\n", strtol("0Xabcdef12", &endptr, 16));
printf("endptr \"%s\"\n", endptr);
printf("%lx\n", strtol("cafebeef", &endptr, 16));
printf("endptr \"%s\"\n", endptr);
printf("%lo\n", strtol(" 073189", &endptr, 0));
printf("endptr \"%s\"\n", endptr);
printf("%lo\n", strtol(" 073189", &endptr, 8));
printf("endptr \"%s\"\n", endptr);
printf("%lo\n", strtol(" 0b", &endptr, 8));
if(errno != 0) {
printf("errno is not 0 (%d), something went wrong\n", errno);
}
printf("endptr \"%s\"\n", endptr);
printf("%lo\n", strtol(" 0b", &endptr, 0));
if(errno != 0) {
printf("errno is not 0 (%d), something went wrong\n", errno);
}
printf("endptr \"%s\"\n", endptr);
}