2 * ----------------------------------------------------------------------------
3 * "THE BEER-WARE LICENSE" (Revision 42):
4 * <phk@login.dknet.dk> wrote this file. As long as you retain this notice you
5 * can do whatever you want with this stuff. If we meet some day, and you think
6 * this stuff is worth it, you can buy me a beer in return. Poul-Henning Kamp
7 * ----------------------------------------------------------------------------
13 #include "sysinstall.h"
18 scan_block(int fd, daddr_t block)
22 if (-1 == lseek(fd,block * 512,SEEK_SET))
24 if (512 != read(fd,foo, 512))
36 strcpy(device,"/dev/r");
37 strcat(device,d->name);
39 fd = open(device,O_RDWR);
41 msgWarn("open(%s) failed", device);
48 printf("%c: %lu.",j ? 'B' : 'G', l);
51 printf(".%lu\nB: %lu.",l-1,l);
54 printf(".%lu\nG: %lu.",l-1,l);
67 char myprompt[BUFSIZ];
73 sprintf(myprompt,"%s> ", d->name);
75 printf("--==##==--\n");
84 q = p = fgets(input,sizeof(input),stdin);
87 for(cp = cmds; (*cp = strsep(&p, " \t\n")) != NULL;)
93 if (!strcasecmp(*cmds,"quit")) { break; }
94 if (!strcasecmp(*cmds,"exit")) { break; }
95 if (!strcasecmp(*cmds,"q")) { break; }
96 if (!strcasecmp(*cmds,"x")) { break; }
97 if (!strcasecmp(*cmds,"delete") && ncmd == 2) {
98 printf("delete = %d\n",
100 (struct chunk *)strtol(cmds[1],0,0)));
103 if (!strcasecmp(*cmds,"allfreebsd")) {
107 if (!strcasecmp(*cmds,"dedicate")) {
111 if (!strcasecmp(*cmds,"bios") && ncmd == 4) {
115 strtol(cmds[3],0,0));
118 if (!strcasecmp(*cmds,"list")) {
128 if (!strcasecmp(*cmds,"create") && ncmd == 6) {
130 printf("Create=%d\n",
136 strtol(cmds[5],0,0)));
139 if (!strcasecmp(*cmds,"read")) {
142 d = Open_Disk(cmds[1]);
144 d = Open_Disk(d->name);
151 if (!strcasecmp(*cmds,"scan")) {
155 if (!strcasecmp(*cmds,"write")) {
157 Fake ? 0 : Write_Disk(d));
159 d = Open_Disk(d->name);
162 if (strcasecmp(*cmds,"help"))
163 printf("\007ERROR\n");
165 printf("allfreebsd\t\t");
166 printf("dedicate\t\t");
167 printf("bios cyl hd sect\n");
168 printf("collapse [pointer]\t\t");
169 printf("create offset size enum subtype flags\n");
170 printf("subtype(part): swap=1, ffs=7\t\t");
171 printf("delete pointer\n");
174 printf("read [disk]\t\t");
178 for(i=0;chunk_n[i];i++)
179 printf("%d = %s%s",i,chunk_n[i],i == 4 ? "\n\t" : " ");