📄 finder.c
字号:
}/**************************************************************************/Unipage_routine(ERR_FLAG, FMAX) /* Single screen User interface */ int ERR_FLAG, FMAX;{ if (ERR_FLAG == 1) fprintf(stderr,"\nSelect a number between 1 - %d : ", FMAX); else fprintf(stderr,"\nEnter your choice: "); return(0);}/*****************************************************************************/Multipage_routine(ans, ERR_FLAG) /* Multiple screen User interface */ char ans[8]; int ERR_FLAG;{ if (ERR_FLAG == 1) { fprintf(stderr,"\nYour previous choice, '%s', is not a valid selection.", ans); fprintf(stderr,"\nEnter another choice OR press RETURN for next screen: "); } else fprintf(stderr,"\nEnter your choice OR press RETURN for next screen: "); return(0);}/**************************************************************************/getinstalls(){ register int i; int retval,times,to,dev; char command[50],spec[25],devfile[20]; struct d *n; int num_disks; for(n=installs;strcmp(n->type,"\0") != 0;n++) { /* * There can be more than 32 ra type disks. Up the limit * of devices to examine in this case. */ if (strcmp(n->type,"ra") == 0) num_disks = MAX_RA_DISKS; else num_disks = MAXDISKS; for(i=0;i<num_disks;i++) { sprintf(spec,"%s%d",n->type,i); to = 0; if(strcmp(n->type,"rz") == 0) { sprintf(devfile,"r%sa",spec); dev = makedev(n->majnum,i*8); } else if(strcmp(n->type,"ra") == 0) { sprintf(devfile,"r%sa",spec); dev = makedev(RAMAJOR(i,n->majnum),RAMINOR(i)); } else { strcpy(devfile,"rmt0h"); dev = maketape(n->majnum,i); } mknod(devfile,0020666,dev); to = 0; to = open(devfile,O_RDONLY | O_NDELAY); if(to < 0) { unlink(devfile); continue; } dev_info.device[0] = '\0'; if(ioctl(to,DEVIOCGET,(char *)&dev_info) < 0) { unlink(devfile); close(to); continue; } if(strcmp(n->type,"ra") == 0) if(strcmp(dev_info.device,DEV_RA60)!= 0) { unlink(devfile); close(to); continue; } if(strcmp(n->type,"rz") == 0) if(strncmp(dev_info.device,"RRD",3)!= 0) { unlink(devfile); close(to); continue; } /* * The following TMSCP tape devices are not supported * for installation media. * RV20, TA90 */ if ((strcmp(dev_info.device,DEV_RV20)==0) || (strcmp(dev_info.device,DEV_TA90)==0)) { unlink(devfile); close(to); continue; } strcpy(found[FMAX].name,n->type); strcpy(found[FMAX].type,dev_info.device); found[FMAX].unit = i; found[FMAX].plug = dev_info.slave_num; strcpy(found[FMAX].interface,dev_info.interface); found[FMAX].link = dev_info.ctlr_num; found[FMAX].adpt_num = dev_info.adpt_num; FMAX++; close(to); unlink(devfile); } } return;}/***************************************************************************/getroots(){ register int i; int retval,times,to,dev; char command[25],spec[25],devfile[10]; struct d *n; int num_disks; for(n=roots;strcmp(n->type,"\0") != 0;n++) { /* * There can be more than 32 ra type disks. Up the limit * of devices to examine in this case. */ if (strcmp(n->type,"ra") == 0) num_disks = MAX_RA_DISKS; else num_disks = MAXDISKS; for(i=0;i<num_disks;i++) { sprintf(devfile,"r%s%da",n->type,i); if(strcmp(n->type,"ra") == 0) { dev = makedev(RAMAJOR(i,n->majnum),RAMINOR(i)); } else { dev = makedev(n->majnum,i*8); } mknod(devfile,0020666,dev); to = open(devfile,O_RDONLY | O_NDELAY); if(to < 0) { unlink(devfile); continue; } if((retval=ioctl(to,DEVIOCGET,(char *)&dev_info)) < 0) { close(to); unlink(devfile); continue; } /* * Determine if this device is supported as a * root device. */ if (supported_root(to, dev_info.device)==SUPPORTED_ROOT) { strcpy(found[FMAX].name,n->type); strcpy(found[FMAX].type,dev_info.device); found[FMAX].linktype = dev_info.bus; found[FMAX].trlevel = dev_info.nexus_num; found[FMAX].unit = i; found[FMAX].plug = dev_info.slave_num; if(strncmp(dev_info.device,"RM",2) == 0) found[FMAX].link = dev_info.bus_num; else found[FMAX].link = dev_info.ctlr_num; found[FMAX].adpt_num = dev_info.adpt_num; strcpy(found[FMAX].interface,dev_info.interface); found[FMAX].rctlr_num = dev_info.rctlr_num; FMAX++; } close(to); unlink(devfile); } }}/***************************************************************************/getdisks(){ register int i; int retval,times,to,dev; char command[25],spec[25],devfile[10]; struct d *n; int num_disks; for(n=disks;strcmp(n->type,"\0") != 0;n++) { /* * There can be more than 32 ra type disks. Up the limit * of devices to examine in this case. */ if (strcmp(n->type,"ra") == 0) num_disks = MAX_RA_DISKS; else num_disks = MAXDISKS; for(i=0;i<num_disks;i++) { sprintf(devfile,"r%s%da",n->type,i); if(strcmp(n->type,"ra") == 0) { dev = makedev(RAMAJOR(i,n->majnum),RAMINOR(i)); } else { dev = makedev(n->majnum,i*8); } mknod(devfile,0020666,dev); to = open(devfile,O_RDONLY | O_NDELAY); if(to < 0) { unlink(devfile); continue; } if(ioctl(to,DEVIOCGET,(char *)&dev_info) < 0) { close(to); unlink(devfile); continue; } if(strncmp(dev_info.device,"RX",2) != 0 && strncmp(dev_info.device,"RRD",3) != 0) { strcpy(found[FMAX].name,n->type); strcpy(found[FMAX].type,dev_info.device); found[FMAX].unit = i; found[FMAX].plug = dev_info.slave_num; strcpy(found[FMAX].interface,dev_info.interface); if(strncmp(dev_info.device,"RM",2) == 0) found[FMAX].link = dev_info.bus_num; else found[FMAX].link = dev_info.ctlr_num; FMAX++; } unlink(devfile); close(to); } }}/***************************************************************/getcpu(){ int indx,anyint,mem;#ifdef vax mem = open ("/dev/kmem", 0); indx = 0; indx = lseek(mem,0x80000000,0); read(mem,&rpb,sizeof(rpb)); return(rpb.cpu);#endif vax#ifdef mips struct save_state installinfo; mem = open ("/dev/kmem", 0); indx = 0; indx = lseek(mem, SST_ADDR, 0); read(mem, &installinfo, sizeof(installinfo)); return(installinfo.cpu);#endif mips}/***************************************************************************/getwscons(){ int n; if ((n = open("/dev/console",O_RDONLY | O_NDELAY)) < 0 ) { printf("Can't open /dev/console\n"); exit(1); } if(ioctl(n,DEVIOCGET,(char *)&dev_info) < 0) { printf("devget ioctl failed!\n"); exit(1); } close(n); if (strcmp(dev_info.device,"VR260") == 0 || strcmp(dev_info.device,"VR290") == 0 || strcmp(dev_info.device,"MONO" ) == 0 || strcmp(dev_info.device,"COLOR") == 0) printf("0");}/***************************************************************************/showboot(i)int i;{ int cpu; char console_magic[4]; FILE *fp;#ifdef vax char *syshalt="after the installation software halts the processor: "; char *youhalt="after you halt the processor: "; char *howhalt="\n\Wait for the message indicating that the processor can be halted.\n\To halt the processor,"; char *step1="^P ( CTRL/P, to display the console mode prompt )"; char *step2=">>> H ( H, to halt the processor )"; char *mic="Insert media labeled 'BOOT 1/1' before entering the boot sequence."; char *mictape="Make sure the console TK50 tape is in the drive before entering the boot sequence."; fp=fopen("/tmp/showboot","w"); fprintf(fp,"\nEnter the following boot sequence at the console mode prompt\n"); cpu = getcpu(); switch(cpu) { case MVAX_I: fprintf(fp,"%s\n",youhalt); fprintf(fp,"\n\t>>> b\n\n"); fprintf(fp,"\n%s press and release the front panel HALT button.\n", howhalt); break; case MVAX_II: case VAXSTAR: fprintf(fp,"%s\n",syshalt); fprintf(fp,"\n\t>>> b dua%x\n\n",found[i].plug); break; case C_VAXSTAR: case VAX_60: fprintf(fp,"%s\n",syshalt); switch(found[i].linktype) { case DEV_NB: if (strcmp(found[i].interface,"VS_SCSI")==0) fprintf(fp,"\n\t>>> b dk%c%x00\n\n", found[i].link + 'a', found[i].plug); else fprintf(fp,"\n\t>>> b dua%x\n\n",found[i].plug); break; default: fprintf(fp,"\n\t>>> b dua%x\n\n",found[i].plug); break; } break; case VAX_3600: /* Mayfair I */ case VAX_3400: /* Mayfair II */ case VAX_3900: /* Mayfair III */ fprintf(fp,"%s\n",syshalt); switch(found[i].linktype) { case DEV_MSI: fprintf(fp,"\n\t>>> b dia%x\n\n",found[i].plug); break; default: fprintf(fp,"\n\t>>> b dua%x\n\n",found[i].plug); break; } break; case VAX_730:/* need to fix this when we really know whats going on with 730 bus type */ fprintf(fp,"%s\n",youhalt); fprintf(fp,"\n\t>>> d/g 3 %x\n",found[i].plug); if(strcmp(found[i].type,"R80") == 0) fprintf(fp,"\n\t>>> @ubaidc.cmd\n\n"); else fprintf(fp,"\n\t>>> @ubara.cmd\n\n"); fprintf(fp,"%s type:\n%s\n",howhalt,step1); break;
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -