2 * ----------------------------------------------------------------------------
3 * "THE BEER-WARE LICENSE" (Revision 42):
4 * <phk@FreeBSD.org> 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 * ----------------------------------------------------------------------------
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/");
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 systemSuspendDialog();
74 sprintf(myprompt,"%s> ", d->name);
76 printf("--==##==--\n");
83 printf("%s", myprompt);
85 q = p = fgets(input,sizeof(input),stdin);
88 for(cp = cmds; (*cp = strsep(&p, " \t\n")) != NULL;)
94 if (!strcasecmp(*cmds,"quit")) { break; }
95 if (!strcasecmp(*cmds,"exit")) { break; }
96 if (!strcasecmp(*cmds,"q")) { break; }
97 if (!strcasecmp(*cmds,"x")) { break; }
98 if (!strcasecmp(*cmds,"delete") && ncmd == 2) {
99 printf("delete = %d\n",
101 (struct chunk *)strtol(cmds[1],0,0)));
104 if (!strcasecmp(*cmds,"allfreebsd")) {
108 if (!strcasecmp(*cmds,"dedicate")) {
112 if (!strcasecmp(*cmds,"bios") && ncmd == 4) {
116 strtol(cmds[3],0,0));
119 if (!strcasecmp(*cmds,"list")) {
130 if (!strcasecmp(*cmds,"create") && ncmd == 7) {
131 printf("Create=%d\n",
142 if (!strcasecmp(*cmds,"create") && ncmd == 6) {
143 printf("Create=%d\n",
149 strtol(cmds[5],0,0), ""));
153 if (!strcasecmp(*cmds,"read")) {
156 d = Open_Disk(cmds[1]);
158 d = Open_Disk(d->name);
165 if (!strcasecmp(*cmds,"scan")) {
169 if (!strcasecmp(*cmds,"write")) {
171 Fake ? 0 : Write_Disk(d));
177 if (strcasecmp(*cmds,"help"))
178 printf("\007ERROR\n");
180 printf("allfreebsd\t\t");
181 printf("dedicate\t\t");
182 printf("bios cyl hd sect\n");
183 printf("collapse [pointer]\t\t");
185 printf("create offset size enum subtype flags name\n");
187 printf("create offset size enum subtype flags\n");
189 printf("subtype(part): swap=1, ffs=7\t\t");
190 printf("delete pointer\n");
193 printf("read [disk]\t\t");
199 systemResumeDialog();