Annotation of dietlibc/t.c, revision 1.136
1.56 fefe 1: #define _GNU_SOURCE
1.47 fefe 2: #define _FILE_OFFSET_BITS 64
1.1 cvs 3: #include <unistd.h>
4: #include <endian.h>
5: #include <stdlib.h>
6: #include <dirent.h>
7: #include <pwd.h>
1.40 fefe 8: #include <shadow.h>
1.1 cvs 9: #include <stdio.h>
10: #include <assert.h>
11: #include <sys/mount.h>
1.7 fefe 12: #include <time.h>
1.9 fefe 13: #include <sys/stat.h>
1.10 fefe 14: #include <stdio.h>
1.12 fefe 15: #include <arpa/inet.h>
1.13 fefe 16: #include <sys/sem.h>
1.14 fefe 17: #include <sys/shm.h>
1.17 fefe 18: #include <math.h>
1.20 fefe 19: #include <termios.h>
1.22 fefe 20: #include <netdb.h>
1.38 fefe 21: #include <sys/mman.h>
1.45 fefe 22: #include <ctype.h>
1.49 fefe 23: #include <mntent.h>
1.53 fefe 24: #include <regex.h>
1.56 fefe 25: #include <sys/types.h>
26: #include <sys/msg.h>
1.63 fefe 27: #include <string.h>
1.76 fefe 28: #include <sys/socket.h>
29: #include <netdb.h>
1.86 fefe 30: #include <signal.h>
1.88 fefe 31: #include <sys/io.h>
1.97 fefe 32: #include <getopt.h>
1.101 fefe 33: #include <arpa/nameser.h>
34: #include <resolv.h>
1.102 fefe 35: #include <fnmatch.h>
1.109 fefe 36: #include <stdarg.h>
1.118 fefe 37: #include <sys/wait.h>
1.133 fefe 38: #include <libgen.h>
1.71 fefe 39:
1.121 fefe 40: #include <errno.h>
41: #include <syslog.h>
42: #include <sys/un.h>
43: #include <fcntl.h>
44:
45: #if 0
46: static const char* Ident;
47: static int Option;
48: static int Facility;
49: static struct sockaddr_un sock;
50: static int fd=-1;
51:
52: static void syslogconnect(void) {
53: sock.sun_family=AF_UNIX;
54: strcpy(sock.sun_path,"/dev/log");
55: if ((fd=socket(AF_UNIX,SOCK_STREAM,0))==-1) return;
56: if (connect(fd,(struct sockaddr*)&sock,sizeof(sock))==-1) {
57: int save=errno;
58: close(fd);
59: fd=-1;
1.109 fefe 60: }
1.121 fefe 61: fcntl(fd,F_SETFL,FD_CLOEXEC); /* doesn't work? too bad */
1.109 fefe 62: }
1.107 fefe 63:
1.121 fefe 64: void openlog(const char *ident, int option, int facility) {
65: Ident=ident;
66: Option=option;
67: Facility=facility;
68: syslogconnect();
1.116 fefe 69: }
70:
1.121 fefe 71: void syslog(int priority, const char *format, ...) {
72: /* write(fd,"<13>Jun 29 19:21:32 leitner: fnord",...) */
73: }
74:
75: void closelog(void) {
76: }
77: #endif
78:
1.97 fefe 79: int main(int argc,char *argv[]) {
1.136 ! fefe 80: fwrite("foobar",6,1,stdout);
! 81: #if 0
1.135 fefe 82: char x[5];
83: x[4]='x';
84: fgets(x,4,stdin);
85: puts(x);
86: printf("%c\n",x[4]);
1.136 ! fefe 87: #endif
1.134 fefe 88: #if 0
1.133 fefe 89: char* paths[]={"/usr/lib","/usr/","usr","/",".",".."};
90: char* want[]={"/usr","/",".","/",".","."};
91: int i;
92: for (i=0; i<6; ++i) {
93: printf("%s\t%s\t%s\n",paths[i],want[i],dirname(strdup(paths[i])));
94: }
1.134 fefe 95: #endif
1.133 fefe 96: #if 0
97: char* paths[]={"/usr/lib","/usr/","usr","/",".",".."};
98: char* want[]={"lib","usr","usr","/",".",".."};
99: int i;
100: for (i=0; i<6; ++i) {
101: printf("%s\t%s\t%s\n",paths[i],want[i],basename(strdup(paths[i])));
102: }
103: #endif
104: #if 0
1.132 fefe 105: int i;
106: for (i=0; i<255; ++i) {
107: int a=isalpha(i);
108: int b=(i>='a' && i<='z') || (i>='A' && i<='Z');
109: if (a!=b) printf("%d: %d %d\n",i,a,b);
110: }
1.133 fefe 111: #endif
1.131 fefe 112: #if 0
1.130 fefe 113: char* name;
114: int ptyfd,ttyfd;
115: int i=openpty(&ptyfd,&ttyfd,0,0,0);
116: if (i<0) perror("openpty");
117: printf("%d %d\n",ptyfd,ttyfd);
118: printf("%s %s\n",ttyname(ptyfd),ttyname(ttyfd));
1.131 fefe 119: #endif
1.129 fefe 120: #if 0
121: printf("0x%8.7lx\n",0xfefe);
122: #endif
123: #if 0
1.128 fefe 124: puts(ttyname(0));
1.129 fefe 125: #endif
1.125 fefe 126: #if 0
127: char buf[1024];
128: struct hostent* r;
129: while (r=gethostent_r(buf,1024)) {
130: if (r && r->h_name) {
131: printf("name %s\n", r->h_name);
132: }
133: if (r && (r->h_addr_list)[0]) {
134: struct in_addr address;
135: address = *((struct in_addr *) (r->h_addr_list)[0]);
136: printf("addr %s\n", inet_ntoa(address));
137: }
138: }
139: #endif
140: #if 0
1.124 fefe 141: char *tmp;
142: printf("%lu\n",strtol("0xf0000000",&tmp,0));
1.125 fefe 143: #endif
1.128 fefe 144: #if 0
1.123 fefe 145: struct mntent* me;
1.127 fefe 146: FILE* f=fopen("/etc/fstab","r");
1.123 fefe 147: while (me=getmntent(f)) {
148: printf("%s %s %s %s %d %d\n",me->mnt_fsname,me->mnt_dir,me->mnt_type,me->mnt_opts,me->mnt_freq,me->mnt_passno);
149: }
1.124 fefe 150: #endif
1.123 fefe 151: #if 0
152: char *tmp;
153: printf("%x\n",strtol("0Xffff",&tmp,16));
154: #endif
1.122 fefe 155: // putchar('c');
156: // write(1,"fnord\n",6);
1.132 fefe 157: #if 0
1.121 fefe 158: struct addrinfo *ai;
1.131 fefe 159: getaddrinfo("nagus","22",0,&ai);
1.121 fefe 160: #endif
1.122 fefe 161: #if 0
1.121 fefe 162: struct hostent host,*res;
163: char buf[4096];
164: int fnord;
165:
1.131 fefe 166: gethostbyname2_r("nagus",AF_INET,&host,buf,4096,&res,&fnord);
1.122 fefe 167: #endif
1.121 fefe 168: #if 0
1.119 fefe 169: char buf[128];
1.120 fefe 170: strcpy(buf,"/tmp/fnord/foo.XXXXXXX");
1.119 fefe 171: printf("%d\n",mkdtemp(buf));
172: printf("%s\n",buf);
1.120 fefe 173: #endif
1.119 fefe 174: #if 0
1.118 fefe 175: printf("%d\n",WEXITSTATUS(system("exit 17")));
1.119 fefe 176: #endif
1.113 fefe 177: #if 0
1.109 fefe 178: fnord("fnord","foo\n","bar\n",0);
1.112 fefe 179: assert(0);
1.113 fefe 180: #endif
1.105 fefe 181: #if 0
182: printf("%hd %hhd\n",-5,-1234567);
183: #endif
1.103 fefe 184: #if 0
1.102 fefe 185: printf("%d\n",fnmatch("*.o", "x.o", FNM_PATHNAME));
186: printf("%d\n",fnmatch("a/b/*", "a/b/c/d", FNM_PATHNAME));
1.103 fefe 187: #endif
1.102 fefe 188: #if 0
1.101 fefe 189: char buf[1024];
190: int len;
191: len=res_search("fu-berlin.de",ns_c_in,ns_t_ns,buf,sizeof(buf));
1.102 fefe 192: #endif
1.114 fefe 193: #if 0
1.100 fefe 194: regex_t t;
195: regmatch_t rm;
1.103 fefe 196: // regcomp(&t,"^ *read",0);
1.113 fefe 197: regcomp(&t,"\\<foo\\>",0);
198: printf("%d\n",regexec(&t," blub foo,",1,&rm,0));
1.100 fefe 199: printf("ofs %d\n",rm.rm_so);
1.101 fefe 200: #endif
1.100 fefe 201: #if 0
1.98 fefe 202: char buf[100];
1.99 fefe 203: printf("%d\n",fread(buf,1,0,stdin));
1.100 fefe 204: #endif
1.99 fefe 205: #if 0
206: char buf[100];
1.98 fefe 207: memset(buf,17,100);
208: buf[0]=0;
209: strncat(buf,"foobarbaz23",10);
210: puts(buf);
1.99 fefe 211: #endif
1.98 fefe 212: #if 0
1.97 fefe 213: int aflag = 0;
214: int bflag = 0;
215: char *cvalue = NULL;
216: int index;
217: int c;
218:
219: opterr = 1;
220:
221: while ((c = getopt (argc, argv, "abc:")) != -1)
222: switch (c)
223: {
224: case 'a':
225: aflag = 1;
226: break;
227: case 'b':
228: bflag = 1;
229: break;
230: case 'c':
231: cvalue = optarg;
232: break;
233: case '?':
234: if (isprint (optopt))
235: fprintf (stderr, "Unknown option `-%c'.\n", optopt);
236: else
237: fprintf (stderr,
238: "Unknown option character `\\x%x'.\n",
239: optopt);
240: return 1;
241: default:
242: abort ();
243: }
1.96 fefe 244:
1.97 fefe 245: printf ("aflag = %d, bflag = %d, cvalue = %s\n",
246: aflag, bflag, cvalue);
247:
248: for (index = optind; index < argc; index++)
249: printf ("Non-option argument %s\n", argv[index]);
250: return 0;
1.98 fefe 251: #endif
1.97 fefe 252: #if 0
1.96 fefe 253: char *t="foobar";
254: char *c;
255: char buf[1000];
256: puts(strcat(strcpy(buf,"HOME="),t));
1.97 fefe 257: #endif
1.89 fefe 258: #if 0
259: struct netent* n=getnetbyname("loopback");
260: printf("%s %s\n",n->n_name,inet_ntoa(*(struct in_addr*)&n->n_net));
261: #endif
262: #if 0
1.88 fefe 263: fprintf(stdout,"foo\n");
264: sleep(1);
265: fprintf(stdout,"bar");
266: fprintf(stderr,"blonk");
267: sleep(1);
268: fprintf(stdout,"\rbz");
269: sleep(1);
270: fprintf(stdout,"\n");
271: sleep(1);
1.89 fefe 272: #endif
1.87 fefe 273: #if 0
1.86 fefe 274: sigset_t s; /* sigsetops */
275:
276: sigemptyset(&s);
277: sigaddset(&s,SIGCHLD);
278: sigaddset(&s,SIGHUP);
279: sigsuspend(&s);
1.87 fefe 280: #endif
1.85 fefe 281: #if 0
1.84 fefe 282: char buf[1024];
283: FILE *f=popen("uname -srm","r");
284: fgets(buf,1023,f);
285: pclose(f);
286: write(1,buf,strlen(buf));
1.85 fefe 287: #endif
1.84 fefe 288: #if 0
1.82 fefe 289: char type[64];
1.83 fefe 290: char filename[256];
291: int major,minor;
1.82 fefe 292: int len;
1.83 fefe 293: printf("%d\n",sscanf("GET / HTTP/1.0\r\n","%4[A-Z] %255[^ \t\r\n] HTTP/%d.%d",type,filename,&major,&minor));
294: printf("%s %s %d %d\n",type,filename,major,minor);
1.84 fefe 295: #endif
1.82 fefe 296: #if 0
1.81 fefe 297: char buf[100];
298: char ip[16];
299: memset(ip,0,16);
300: printf("%p %p\n",inet_ntop(AF_INET6,ip,buf,100),buf);
301: puts(buf);
1.82 fefe 302: #endif
1.127 fefe 303: #if 0
1.76 fefe 304: struct addrinfo *ai;
1.78 fefe 305: struct addrinfo hints;
1.79 fefe 306: char buf[16];
1.78 fefe 307: hints.ai_family = AF_UNSPEC;
1.79 fefe 308: hints.ai_flags = AI_PASSIVE|AI_CANONNAME;
1.78 fefe 309: hints.ai_socktype = SOCK_STREAM;
1.126 fefe 310: printf("%d\n",getaddrinfo("xorn.continuum.local","ssh",0,&ai));
1.76 fefe 311: while (ai) {
312: printf("found host %s, port %d, family %s, socktype %s\n",ai->ai_canonname,
313: ntohs(ai->ai_family==AF_INET6?((struct sockaddr_in6*)ai->ai_addr)->sin6_port:
314: ((struct sockaddr_in*)ai->ai_addr)->sin_port),
315: ai->ai_family==AF_INET6?"PF_INET6":"PF_INET",
316: ai->ai_socktype==SOCK_STREAM?"SOCK_STREAM":"SOCK_DGRAM");
1.80 fefe 317: {
318: char buf[100];
319: inet_ntop(ai->ai_family,ai->ai_family==AF_INET6?
320: (char*)&(((struct sockaddr_in6*)ai->ai_addr)->sin6_addr):
321: (char*)&(((struct sockaddr_in*)ai->ai_addr)->sin_addr),buf,100);
322: printf(" %s\n",buf);
323: }
1.76 fefe 324: ai=ai->ai_next;
325: }
1.81 fefe 326: #endif
1.76 fefe 327: #if 0
1.71 fefe 328: int i=foo;
1.75 fefe 329: printf("load average is %3.2f\n",0.0);
1.76 fefe 330: #endif
1.70 fefe 331: #if 0
1.69 fefe 332: struct dirent **namelist;
333: int n;
1.16 fefe 334:
1.69 fefe 335: n = scandir(".", &namelist, 0, alphasort);
336: if (n < 0)
337: perror("scandir");
338: else {
339: while(n--) {
340: printf("%s\n", namelist[n]->d_name);
341: free(namelist[n]);
342: }
343: free(namelist);
344: }
1.70 fefe 345: #endif
1.68 fefe 346: #if 0
1.67 fefe 347: char foo[10]="none,zlib";
348: char *tmp,*tmp2=foo;
349: while (tmp=strsep(&tmp2,",")) {
350: puts(tmp);
351: }
1.68 fefe 352: #endif
1.65 fefe 353: #if 0
1.61 fefe 354: char foo[10];
1.64 fefe 355: printf("%d %d\n",abs(-3),abs(23));
1.63 fefe 356: strcpy(foo,"foo");
357: strncat(foo,"barbaz",3);
358: foo[6]=0;
359: puts(foo);
1.65 fefe 360: #endif
1.115 fefe 361: #if 0
1.58 fefe 362: struct hostent * host;
363: struct in_addr i;
1.57 fefe 364:
1.131 fefe 365: host = gethostbyname2("nagus",AF_INET);
1.57 fefe 366:
1.58 fefe 367: if (!host)
368: printf("host null\n");
1.57 fefe 369:
1.58 fefe 370: if (host && host->h_name) {
371: printf("name %s\n", host->h_name);
372: }
373: if (host && (host->h_addr_list)[0]) {
374: struct in_addr address;
375: address = *((struct in_addr *) (host->h_addr_list)[0]);
376: printf("addr %s\n", inet_ntoa(address));
377: }
1.59 fefe 378: #endif
1.57 fefe 379: #if 0
1.56 fefe 380: struct msgbuf bla;
381: bla.mtype=0;
382: bla.mtext[0]='x';
383: msgsnd(327680,&bla,5,IPC_NOWAIT);
1.57 fefe 384: #endif
1.55 fefe 385: #if 0
1.54 fefe 386: char buf[PATH_MAX];
387: printf("%s\n",realpath("../../incoming/..///.zshrc",buf));
1.55 fefe 388: #endif
1.73 fefe 389: #if 0
1.53 fefe 390: regex_t t;
1.68 fefe 391: regcomp(&t,"^OpenSSH_2\\.5\\.[012]",5);
1.65 fefe 392: printf("%d\n",regexec(&t,"OpenSSH_2.5.2p2",0,0,0));
1.56 fefe 393: #endif
1.53 fefe 394: #if 0
1.52 fefe 395: float my_float = 9.2334;
396: char buffer[100];
397:
398: sprintf(buffer, "%.2f", my_float);
399: fprintf(stdout, "%s", buffer);
1.53 fefe 400: #endif
1.52 fefe 401: #if 0
1.51 fefe 402: printf("%d\n",setenv("foo","bar",0));
403: printf("%d\n",setenv("foo","bar",1));
404: execlp("printenv","printenv","foo",0);
1.52 fefe 405: #endif
1.106 fefe 406: #if 0
1.59 fefe 407: printf("%d\n",fnmatch("*c*","bin",0));
1.50 fefe 408: if (!fnmatch("s*", "sub", 0))
409: printf("s* sub\n");
410: if (!fnmatch("s*", "glob", 0))
411: printf("s* glob\n");
412: if (!fnmatch("s*b", "sub", 0))
413: printf("s*b sub\n");
414: if (!fnmatch("s*h", "sub", 0))
415: printf("s*h sub\n");
1.51 fefe 416: #endif
1.49 fefe 417: #if 0
1.48 fefe 418: char*tmp;
419: int n=asprintf(&tmp,"foo %s %d\n","bar",23);
420: write(1,tmp,n);
421: free(tmp);
1.49 fefe 422: #endif
1.41 fefe 423: #if 0
1.40 fefe 424: struct passwd *p=getpwnam("leitner");
1.41 fefe 425: struct spwd *s=getspnam("leitner");
1.39 fefe 426: printf("%g\n",30.0123);
1.41 fefe 427: #endif
1.43 fefe 428: #if 0
1.42 fefe 429: initgroups("root",100);
1.43 fefe 430: #endif
1.38 fefe 431: #if 0
1.37 fefe 432: time_t t=time(0);
433: puts(asctime(localtime(&t)));
1.38 fefe 434: #endif
1.135 fefe 435: #if 0
1.134 fefe 436: struct servent *foo=getservbyname("pop-3","tcp");
1.36 fefe 437: if (foo)
438: printf("found service %s on port %d\n",foo->s_name,foo->s_port);
1.37 fefe 439: #endif
1.121 fefe 440: #if 0
1.33 fefe 441: char buf[128];
1.120 fefe 442: strcpy(buf,"/tmp/blub/foo.XXXXXXX");
1.33 fefe 443: printf("%d\n",mkstemp(buf));
1.34 fefe 444: printf("%s\n",buf);
445: unlink(buf);
1.35 fefe 446: #endif
1.33 fefe 447: #if 0
1.32 fefe 448: char buf[512]="foo";
449: strncat(buf,"barbaz",3);
450: puts(buf);
1.33 fefe 451: #endif
1.32 fefe 452: #if 0
1.31 fefe 453: time_t oink=time(0);
454: struct tm *duh=localtime(&oink);
455: strftime(buf,512,"%A %B %Y\n",duh);
456: puts(buf);
1.32 fefe 457: #endif
1.126 fefe 458: #if 0
1.28 fefe 459: struct in_addr bar;
460: struct hostent *foo;
1.125 fefe 461: inet_aton("160.45.10.8",&bar);
462: /* foo=gethostbyname("zeit.fu-berlin.de"); */
463: foo=gethostbyaddr(&bar,4,AF_INET);
1.30 fefe 464: if (foo)
465: printf("%s -> %s\n",foo->h_name,inet_ntoa(*(struct in_addr*)foo->h_addr));
1.22 fefe 466: /* printf("%g %g\n",1e-10,1e10); */
1.31 fefe 467: #endif
1.18 fefe 468: #if 0
1.17 fefe 469: double d=0.0;
470: long long t=0x12345678ABCDEF01;
471: d/=0.0;
472: printf("%d %llx\n",__isnan(d),t,*(long long*)&d);
1.18 fefe 473: #endif
1.17 fefe 474: #if 0
1.16 fefe 475: int i,j;
476: long a,b,c;
477: int *res;
478: printf("%p\n",malloc(0));
479: qsort(array,2,sizeof(int),compint);
480: for (i=0; i<SIZE; ++i)
481: array[i]=rand();
482: rdtscl(a);
483: qsort(array,SIZE,sizeof(int),compint);
484: rdtscl(b);
485: j=array[LOOKFOR];
486: res=bsearch(&j,array,SIZE,sizeof(int),compint);
487: rdtscl(c);
488: printf("%lu cycles sort, %lu cycles bsearch\n",b-a,c-b);
489: for (i=0; i<SIZE-1; ++i)
490: if (array[i]>array[i+1]) {
491: printf("qsort does not work, index %d: %d > %d\n",i,array[i],array[i+1]);
492: return 1;
493: }
494: if (*res!=j)
495: printf("besearch does not work, returned %p (%d) instead of %p (%d)\n",res,res?*res:-1,array+LOOKFOR,j);
496: /* printf("array={%d,%d,%d,%d,%d}\n",array[0],array[1],array[2],array[3],array[4]); */
1.17 fefe 497: #endif
1.13 fefe 498: #if 0
1.12 fefe 499: struct in_addr duh;
500: printf("%d\n",inet_aton(argv[1]?argv[1]:"10.0.0.1",&duh));
501: printf("%x\n",duh.s_addr);
1.13 fefe 502: #endif
1.12 fefe 503: /* printf("%-19s %10lu %9lu %9lu %3d%% %s\n","/dev/ide/host0/bus0/target0/lun0/part2",8393688,705683,1337084,85,"/"); */
1.11 fefe 504: #if 0
1.10 fefe 505: char buf[100];
506: fgets(buf,100,stdin); printf("got %d bytes\n",strlen(buf));
507: fgets(buf,100,stdin); printf("got %d bytes\n",strlen(buf));
1.11 fefe 508: #endif
1.9 fefe 509: #if 0
1.7 fefe 510: struct tm duh;
511: time_t t;
1.8 fefe 512: time(&t);
513: gmtime_r(&t,&duh);
514: printf("%s\n",asctime(&duh));
1.9 fefe 515: #endif
1.8 fefe 516: #if 0
1.7 fefe 517: char buf[30];
518: duh.tm_sec=42;
519: duh.tm_min=23;
520: duh.tm_hour=17;
521: duh.tm_mday=2;
522: duh.tm_mon=7;
523: duh.tm_year=100;
524: t=mktime(&duh);
525: printf("%s\n",asctime_r(&duh,buf));
1.8 fefe 526: #endif
1.2 fefe 527: #if 0
1.1 cvs 528: int i;
529: for (i=0; i<5; i++) {
530: fprintf(stdout,"first message\n");
531: fprintf(stdout,"second message\n");
532: fprintf(stdout,"third message\n");
533: printf("foo %d\n",i);
534: }
1.2 fefe 535: #endif
1.1 cvs 536: #if 0
537: char buf[1024];
538: sscanf("foo bar","%s",buf);
539: printf("%s\n",buf);
540: #endif
541: #if 0
542: mount("/dev/scsi/host0/bus0/target2/lun0/cd", "/cd", "iso9660", MS_MGC_VAL|MS_RDONLY, NULL);
543: perror("mount");
544: #endif
545: #if 0
546: char *t="<4>Linux version 2.4.0-test10 (leitner@hellhound) (gcc version 2.95.2 19991024 (release))";
547: int i=strtol(t+1,&t,10);
548: printf("%d %s\n",i,t);
549: #endif
550: #if 0
551: char **tmp;
1.115 fefe 552: putenv("A=foo");
1.1 cvs 553: for (tmp=environ; *tmp; tmp++)
554: puts(*tmp);
555: #endif
556: #if 0
557: char buf[1024];
558: printf("%d\n",fprintf(stderr,"duh\n"));
559: #endif
560: #if 0
561: struct passwd *p=getpwuid(100);
562: puts(p->pw_name);
563: #endif
564: #if 0
565: int pid;
566: char name[32];
567: sscanf("1 (init","%d (%15c",&pid,name);
568: printf("pid %d name %s\n",pid,name);
569: #endif
1.109 fefe 570: #if 0
1.1 cvs 571: DIR *d=opendir("/proc");
572: if (d) {
573: struct dirent *D;
574: while (D=readdir(d))
575: puts(D->d_name);
576: closedir(d);
577: }
578: #endif
579: #if 0
580: char buf[1024];
581: int fd=open("/etc/passwd",0);
582: pread(fd,buf,30,32);
583: close(fd);
584: write(1,buf,32);
585: #endif
586: #if 0
587: char *argv[] = {"echo","foo",0};
588: char buf[100];
589: buf[5]='x';
590: sprintf(buf,"foo\n");
591: if (buf[5] == 'x')
592: exit(0);
593: else
594: exit(1);
595: execvp(argv[0],argv);
596: #endif
1.10 fefe 597: #if 0
1.1 cvs 598: struct stat64 f;
599: char buf[128];
600: fstat64(0,&f);
601: fprintf(stderr,"%d %d\n",f.st_size,sizeof(f));
602: return 0;
603: #endif
604: #if 0
605: FILE *f=fopen("foo","w");
606: fputc('a',f);
607: fputc('b',f);
608: fputc('c',f);
609: #endif
610: /* fprintf(stdout,"foo\n"); */
611: }
LinuxTV legacy CVS <linuxtv.org/cvs>