Annotation of dietlibc/t.c, revision 1.12
1.1 cvs 1: #include <unistd.h>
2: #include <endian.h>
3: #include <stdlib.h>
4: #include <dirent.h>
5: #include <pwd.h>
6: #include <stdio.h>
7: #include <assert.h>
8: #include <sys/mount.h>
1.7 fefe 9: #include <time.h>
1.9 fefe 10: #include <sys/stat.h>
1.10 fefe 11: #include <stdio.h>
1.12 ! fefe 12: #include <arpa/inet.h>
1.1 cvs 13:
1.12 ! fefe 14: int main(int argc,char *argv[]) {
! 15: struct in_addr duh;
! 16: printf("%d\n",inet_aton(argv[1]?argv[1]:"10.0.0.1",&duh));
! 17: printf("%x\n",duh.s_addr);
! 18: /* printf("%-19s %10lu %9lu %9lu %3d%% %s\n","/dev/ide/host0/bus0/target0/lun0/part2",8393688,705683,1337084,85,"/"); */
1.11 fefe 19: #if 0
1.10 fefe 20: char buf[100];
21: fgets(buf,100,stdin); printf("got %d bytes\n",strlen(buf));
22: fgets(buf,100,stdin); printf("got %d bytes\n",strlen(buf));
1.11 fefe 23: #endif
1.9 fefe 24: #if 0
1.7 fefe 25: struct tm duh;
26: time_t t;
1.8 fefe 27: time(&t);
28: gmtime_r(&t,&duh);
29: printf("%s\n",asctime(&duh));
1.9 fefe 30: #endif
1.8 fefe 31: #if 0
1.7 fefe 32: char buf[30];
33: duh.tm_sec=42;
34: duh.tm_min=23;
35: duh.tm_hour=17;
36: duh.tm_mday=2;
37: duh.tm_mon=7;
38: duh.tm_year=100;
39: t=mktime(&duh);
40: printf("%s\n",asctime_r(&duh,buf));
1.8 fefe 41: #endif
1.2 fefe 42: #if 0
1.1 cvs 43: int i;
44: for (i=0; i<5; i++) {
45: fprintf(stdout,"first message\n");
46: fprintf(stdout,"second message\n");
47: fprintf(stdout,"third message\n");
48: printf("foo %d\n",i);
49: }
1.2 fefe 50: #endif
1.1 cvs 51: #if 0
52: char buf[1024];
53: sscanf("foo bar","%s",buf);
54: printf("%s\n",buf);
55: #endif
56: #if 0
57: mount("/dev/scsi/host0/bus0/target2/lun0/cd", "/cd", "iso9660", MS_MGC_VAL|MS_RDONLY, NULL);
58: perror("mount");
59: #endif
60: #if 0
61: char *t="<4>Linux version 2.4.0-test10 (leitner@hellhound) (gcc version 2.95.2 19991024 (release))";
62: int i=strtol(t+1,&t,10);
63: printf("%d %s\n",i,t);
64: #endif
65: #if 0
66: char **tmp;
67: putenv("FOO");
68: assert(1==2);
69: for (tmp=environ; *tmp; tmp++)
70: puts(*tmp);
71: #endif
72: #if 0
73: char buf[1024];
74: printf("%d\n",fprintf(stderr,"duh\n"));
75: #endif
76: #if 0
77: struct passwd *p=getpwuid(100);
78: puts(p->pw_name);
79: #endif
80: #if 0
81: int pid;
82: char name[32];
83: sscanf("1 (init","%d (%15c",&pid,name);
84: printf("pid %d name %s\n",pid,name);
85: #endif
86: #if 0
87: DIR *d=opendir("/proc");
88: if (d) {
89: struct dirent *D;
90: while (D=readdir(d))
91: puts(D->d_name);
92: closedir(d);
93: }
94: #endif
95: #if 0
96: char buf[1024];
97: int fd=open("/etc/passwd",0);
98: pread(fd,buf,30,32);
99: close(fd);
100: write(1,buf,32);
101: #endif
102: #if 0
103: char *argv[] = {"echo","foo",0};
104: char buf[100];
105: buf[5]='x';
106: sprintf(buf,"foo\n");
107: if (buf[5] == 'x')
108: exit(0);
109: else
110: exit(1);
111: execvp(argv[0],argv);
112: #endif
1.10 fefe 113: #if 0
1.1 cvs 114: struct stat64 f;
115: char buf[128];
116: fstat64(0,&f);
117: fprintf(stderr,"%d %d\n",f.st_size,sizeof(f));
118: return 0;
119: #endif
120: #if 0
121: FILE *f=fopen("foo","w");
122: fputc('a',f);
123: fputc('b',f);
124: fputc('c',f);
125: #endif
126: /* fprintf(stdout,"foo\n"); */
127: }
LinuxTV legacy CVS <linuxtv.org/cvs>