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