Annotation of dietlibc/t.c, revision 1.13

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.13    ! fefe       13: #include <sys/sem.h>
        !            14: 
        !            15: #if defined(__GNU_LIBRARY__) && !defined(_SEM_SEMUN_UNDEFINED)
        !            16: /* union semun is defined by including <sys/sem.h> */
        !            17: #else
        !            18: /* according to X/OPEN we have to define it ourselves */
        !            19: union semun {
        !            20:   int val;                    /* value for SETVAL */
        !            21:   struct semid_ds *buf;       /* buffer for IPC_STAT, IPC_SET */
        !            22:   unsigned short int *array;  /* array for GETALL, SETALL */
        !            23:   struct seminfo *__buf;      /* buffer for IPC_INFO */
        !            24: };
        !            25: #endif
        !            26: 
1.1       cvs        27: 
1.12      fefe       28: int main(int argc,char *argv[]) {
1.13    ! fefe       29:   union semun foo;
        !            30:   semctl(17,23,IPC_STAT,foo);
        !            31: #if 0
1.12      fefe       32:   struct in_addr duh;
                     33:   printf("%d\n",inet_aton(argv[1]?argv[1]:"10.0.0.1",&duh));
                     34:   printf("%x\n",duh.s_addr);
1.13    ! fefe       35: #endif
1.12      fefe       36: /*  printf("%-19s %10lu %9lu %9lu %3d%% %s\n","/dev/ide/host0/bus0/target0/lun0/part2",8393688,705683,1337084,85,"/"); */
1.11      fefe       37: #if 0
1.10      fefe       38:   char buf[100];
                     39:   fgets(buf,100,stdin); printf("got %d bytes\n",strlen(buf));
                     40:   fgets(buf,100,stdin); printf("got %d bytes\n",strlen(buf));
1.11      fefe       41: #endif
1.9       fefe       42: #if 0
1.7       fefe       43:   struct tm duh;
                     44:   time_t t;
1.8       fefe       45:   time(&t);
                     46:   gmtime_r(&t,&duh);
                     47:   printf("%s\n",asctime(&duh));
1.9       fefe       48: #endif
1.8       fefe       49: #if 0
1.7       fefe       50:   char buf[30];
                     51:   duh.tm_sec=42;
                     52:   duh.tm_min=23;
                     53:   duh.tm_hour=17;
                     54:   duh.tm_mday=2;
                     55:   duh.tm_mon=7;
                     56:   duh.tm_year=100;
                     57:   t=mktime(&duh);
                     58:   printf("%s\n",asctime_r(&duh,buf));
1.8       fefe       59: #endif
1.2       fefe       60: #if 0
1.1       cvs        61:   int i;
                     62:   for (i=0; i<5; i++) {
                     63:     fprintf(stdout,"first message\n");
                     64:     fprintf(stdout,"second message\n");
                     65:     fprintf(stdout,"third message\n");
                     66:     printf("foo %d\n",i);
                     67:   }
1.2       fefe       68: #endif
1.1       cvs        69: #if 0
                     70:   char buf[1024];
                     71:   sscanf("foo bar","%s",buf);
                     72:   printf("%s\n",buf);
                     73: #endif
                     74: #if 0
                     75:   mount("/dev/scsi/host0/bus0/target2/lun0/cd", "/cd", "iso9660", MS_MGC_VAL|MS_RDONLY, NULL);
                     76:   perror("mount");
                     77: #endif
                     78: #if 0
                     79:   char *t="<4>Linux version 2.4.0-test10 (leitner@hellhound) (gcc version 2.95.2 19991024 (release))";
                     80:   int i=strtol(t+1,&t,10);
                     81:   printf("%d %s\n",i,t);
                     82: #endif
                     83: #if 0
                     84:   char **tmp;
                     85:   putenv("FOO");
                     86:   assert(1==2);
                     87:   for (tmp=environ; *tmp; tmp++)
                     88:     puts(*tmp);
                     89: #endif
                     90: #if 0
                     91:   char buf[1024];
                     92:   printf("%d\n",fprintf(stderr,"duh\n"));
                     93: #endif
                     94: #if 0
                     95:   struct passwd *p=getpwuid(100);
                     96:   puts(p->pw_name);
                     97: #endif
                     98: #if 0
                     99:   int pid;
                    100:   char name[32];
                    101:   sscanf("1 (init","%d (%15c",&pid,name);
                    102:   printf("pid %d name %s\n",pid,name);
                    103: #endif
                    104: #if 0
                    105:   DIR *d=opendir("/proc");
                    106:   if (d) {
                    107:     struct dirent *D;
                    108:     while (D=readdir(d))
                    109:       puts(D->d_name);
                    110:     closedir(d);
                    111:   }
                    112: #endif
                    113: #if 0
                    114:   char buf[1024];
                    115:   int fd=open("/etc/passwd",0);
                    116:   pread(fd,buf,30,32);
                    117:   close(fd);
                    118:   write(1,buf,32);
                    119: #endif
                    120: #if 0
                    121:   char *argv[] = {"echo","foo",0};
                    122:   char buf[100];
                    123:   buf[5]='x';
                    124:   sprintf(buf,"foo\n");
                    125:   if (buf[5] == 'x')
                    126:     exit(0);
                    127:   else
                    128:     exit(1);
                    129:   execvp(argv[0],argv);
                    130: #endif
1.10      fefe      131: #if 0
1.1       cvs       132:   struct stat64 f;
                    133:   char buf[128];
                    134:   fstat64(0,&f);
                    135:   fprintf(stderr,"%d %d\n",f.st_size,sizeof(f));
                    136:   return 0;
                    137: #endif
                    138: #if 0
                    139:   FILE *f=fopen("foo","w");
                    140:   fputc('a',f);
                    141:   fputc('b',f);
                    142:   fputc('c',f);
                    143: #endif
                    144: /*  fprintf(stdout,"foo\n"); */
                    145: }

LinuxTV legacy CVS <linuxtv.org/cvs>