Annotation of coherent/d/bin/dos/dosdump.c, revision 1.1.1.1

1.1       root        1: /*
                      2:  * dosdump:    display extended DOS partition info
                      3:  */
                      4: #include <stdio.h>
                      5: #include <sys/fdisk.h>
                      6: extern long lseek();
                      7: int    fd;
                      8: char   buf[512];
                      9: long   partseek;
                     10: HDISK_S        *hdp;
                     11: FDISK_S        *fdp1, *fdp2;
                     12: 
                     13: main(argc, argv)
                     14: char   *argv[];
                     15: {
                     16:        register i = 0;
                     17: 
                     18:        if (argc != 2)
                     19:                fatal("you fucked up");
                     20:        if ((fd = open(argv[1], 0)) < 0)
                     21:                fatal("open failed");
                     22:        for (;;) {
                     23:                if (lseek(fd, partseek, 0) == -1L)
                     24:                        fatal("lseek failed");
                     25:                if (read(fd, buf, sizeof(buf)) != sizeof(buf))
                     26:                        fatal("read failed");
                     27:                hdp = buf;
                     28:                if (hdp->hd_sig != HDSIG)
                     29:                        fatal("no signature found");
                     30:                fdp1 = &(hdp->hd_partn[0]);
                     31:                fdp2 = &(hdp->hd_partn[1]);
                     32:                printf("Level %d:\n", ++i);
                     33:                printf("\tfdp1: sys=%d base=%8lx size=%8lx\n",
                     34:                        fdp1->p_sys, fdp1->p_base, fdp1->p_size);
                     35:                printf("\tfdp2: sys=%d base=%8lx size=%8lx\n",
                     36:                        fdp2->p_sys, fdp2->p_base, fdp2->p_size);
                     37:                if (fdp2->p_sys != SYS_DOS_XP)
                     38:                        break;
                     39:                partseek = fdp2->p_base * 512;
                     40:        }
                     41:        exit(0);
                     42: }
                     43: 
                     44: fatal(cp)
                     45: char *cp;
                     46: {
                     47:        fprintf(stderr, "dosdump: %r\n", &cp);
                     48:        exit(1);
                     49: }
                     50: 

unix.superglobalmegacorp.com

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