STDMETHODIMP CDisk::get_compdesc(BSTR *pVal) { const char *name = dsk_compdesc(m_driver); if (!name) name = ""; *pVal = ret_string(name); return S_OK; }
int do_login(int argc, char *outfile, char *outtyp, char *outcomp, int forcehead) { DSK_PDRIVER outdr = NULL; dsk_err_t e; DSK_GEOMETRY dg; unsigned char drv_status; const char *comp; char *comment; int indent = 0; int opt, any; dsk_reportfunc_set(report, report_end); e = dsk_open(&outdr, outfile, outtyp, outcomp); if (!e) e = dsk_set_retry(outdr, retries); if (forcehead >= 0 && !e) e = dsk_set_forcehead(outdr, forcehead); if (!e) e = dsk_getgeom(outdr, &dg); if (!e) { if (argc > 1) { printf("%s:\n", outfile); indent = 2; } printf( "%-*.*sDriver: %s\n", indent, indent, "", dsk_drvdesc(outdr)); comp = dsk_compname(outdr); if (comp) { printf("%-*.*sCompression: %s\n", indent, indent, "", dsk_compdesc(outdr)); } if (forcehead >= 0) { printf("%-*.*s[Forced to read from side %d]\n", indent, indent, "", forcehead); } printf("%-*.*sSidedness: %s\n" "%-*.*sCylinders: %2d\n" "%-*.*sHeads: %d\n" "%-*.*sSectors: %3d\n" "%-*.*sFirst sector: %3d\n" "%-*.*sSector size: %4ld\n" "%-*.*sData rate: %s\n" "%-*.*sRecord mode: %s\n" "%-*.*sComplement: %s\n" "%-*.*sR/W gap: 0x%02x\n" "%-*.*sFormat gap: 0x%02x\n", indent, indent, "", show_sidedness(dg.dg_sidedness), indent, indent, "", dg.dg_cylinders, indent, indent, "", dg.dg_heads, indent, indent, "", dg.dg_sectors, indent, indent, "", dg.dg_secbase, indent, indent, "", (long)dg.dg_secsize, indent, indent, "", show_rate(dg.dg_datarate), indent, indent, "", show_recmode(dg.dg_fm), indent, indent, "", (dg.dg_fm & RECMODE_COMPLEMENT) ? "Yes" : "No", indent, indent, "", dg.dg_rwgap, indent, indent, "", dg.dg_fmtgap); e = dsk_drive_status(outdr, &dg, 0, &drv_status); if (!e) { printf("\n%-*.*sDrive status: 0x%02x\n", indent, indent, "", drv_status); } e = dsk_get_comment(outdr, &comment); if (!e && comment) { char *c; printf("%-*.*sComment: ", indent, indent, ""); c = comment; while (*c) { putchar(*c); if (*c == '\n') printf("%-*.*s ", indent, indent, ""); c++; } } putchar('\n'); /* Dump filesystem options -- ie, any options beginning "FS." */ opt = 0; any = 0; while (dsk_option_enum(outdr, opt, &comment) == DSK_ERR_OK && comment != NULL) { int value; char buf[30]; if (!strncmp(comment, "FS:", 3) && dsk_get_option(outdr, comment, &value) == DSK_ERR_OK) { if (!any) { printf("%-*.*sFilesystem parameters:\n", indent, indent, ""); any = 1; } sprintf(buf, "%s:", comment + 3); printf("%-*.*s%-15.15s0x%02x\n", indent, indent, "", buf, value); } ++opt; } } if (outdr) { if (!e) e = dsk_close(&outdr); else dsk_close(&outdr); } if (e) { fprintf(stderr, "%s: %s\n", outfile, dsk_strerror(e)); return 1; } return 0; }