Annotation of xinu/sys/TEST/test.c.dlc, revision 1.1.1.1

1.1       root        1: /* test.c - main */
                      2: 
                      3: #include <conf.h>
                      4: #include <kernel.h>
                      5: 
                      6: char   message[] = "Hello there world.";
                      7: 
                      8: /*----------------------------------------------------------------------
                      9:  *  main  --  test dlc basics assuming RINOUT connected to RINGIN
                     10:  *----------------------------------------------------------------------
                     11:  */
                     12: main()
                     13: {
                     14:        int     p();
                     15: 
                     16:        kprintf("Testing dlc\n");
                     17:        kprintf("Creating process to read RINGIN (%d)\n",RINGIN);
                     18:        resume(create(p,300,25,"dlctest",1, RINGIN));
                     19:        kprintf("Writing this message to RINGOUT(%d): %s\n\n",
                     20:                RINGOUT, message);
                     21:        write(RINGOUT, message, strlen(message) );
                     22:        kprintf("Writing 'hi' to RINGOUT(%d)\n", RINGOUT);
                     23:        write(RINGOUT, "hi", 2);
                     24:        dldump();
                     25:        kprintf("End writing\n");
                     26: }
                     27: p(dev)
                     28: {
                     29:        char    ch;
                     30:        int     len,i;
                     31:        char    buff[130];
                     32: 
                     33:        kprintf(" P:reading device %d\n",dev);
                     34:        while (TRUE) {
                     35:                kprintf(" P:read returns %d\n",len=read(dev,buff,128));
                     36:                for (i=0 ; i<len ; i++)
                     37:                        if ( (ch=buff[i]) < ' ')
                     38:                                printf("^%c", ch+0100);
                     39:                        else if (ch==0177)
                     40:                                printf("^?");
                     41:                        else
                     42:                                printf("%c", ch);
                     43:                printf("\n");
                     44:        }
                     45: }

unix.superglobalmegacorp.com

This archive runs on limited infrastructure. Preserving old code on modern bandwidth. Automated agents are requested to crawl responsibly.