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