Contents of /trunk/mkinitrd-magellan/klibc/usr/klibc/tests/memstrtest.c
Parent Directory | Revision Log
Revision 532 -
(show annotations)
(download)
Sat Sep 1 22:45:15 2007 UTC (16 years, 9 months ago) by niro
File MIME type: text/plain
File size: 577 byte(s)
Sat Sep 1 22:45:15 2007 UTC (16 years, 9 months ago) by niro
File MIME type: text/plain
File size: 577 byte(s)
-import if magellan mkinitrd; it is a fork of redhats mkinitrd-5.0.8 with all magellan patches and features; deprecates magellan-src/mkinitrd
1 | #include <stdlib.h> |
2 | #include <stdio.h> |
3 | #include <string.h> |
4 | |
5 | int main(void) |
6 | { |
7 | unsigned char t1[256], t2[256]; |
8 | int i; |
9 | int r; |
10 | |
11 | for (i = 0; i < (int)sizeof(t1); i++) |
12 | t1[i] = t2[i] = (unsigned char)i; |
13 | |
14 | r = memcmp(t1, t2, sizeof(t1)); |
15 | printf("memcmp r = %d\n", r); |
16 | r = memcmp(t1, t2, sizeof(t1) / 2); |
17 | printf("memcmp r = %d\n", r); |
18 | t1[255] = 0; |
19 | r = memcmp(t1, t2, sizeof(t1)); |
20 | printf("memcmp r = %d\n", r); |
21 | |
22 | for (i = 0; i < (int)sizeof(t1); i++) |
23 | t1[i] = 0xaa; |
24 | memset(t2, 0xaa, sizeof(t2)); |
25 | r = memcmp(t1, t2, sizeof(t1)); |
26 | printf("memcmp r = %d\n", r); |
27 | return 0; |
28 | } |