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