|
|
1.1 root 1: /*
2: * Test program for "patch" to work on.
3: */
4: #include <stdio.h>
5: #define MY_DEFAULT 17
6:
7: char my_char = MY_DEFAULT;
8: short my_short = MY_DEFAULT;
9: int my_int = MY_DEFAULT;
10: long my_long = MY_DEFAULT;
11:
12: main()
13: {
14: printf("&my_char: %x\n", &my_char);
15: printf("&my_short: %x\n", &my_short);
16: printf("&my_int: %x\n", &my_int);
17: printf("&my_long: %x\n", &my_long);
18:
19: if (MY_DEFAULT != my_char) {
20: printf("my_char patched to: %x\n", (int) my_char);
21: } else {
22: printf("my_char is defaulted.\n");
23: }
24: if (MY_DEFAULT != my_short) {
25: printf("my_short patched to: %x\n", (int) my_short);
26: } else {
27: printf("my_short is defaulted.\n");
28: }
29: if (MY_DEFAULT != my_int) {
30: printf("my_int patched to: %x\n", my_int);
31: } else {
32: printf("my_int is defaulted.\n");
33: }
34: if (MY_DEFAULT != my_long) {
35: printf("my_long patched to: %lx\n", my_long);
36: } else {
37: printf("my_long is defaulted.\n");
38: }
39:
40: printf("Unpatched nix() will never return.\n");
41: printf("Calling nix():\n");
42: nix();
43: printf("Returning from nix().\n");
44:
45: } /* main() */
46:
This archive runs on limited infrastructure. Preserving old code on modern bandwidth. Automated agents are requested to crawl responsibly.