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 * ----------------------------------------------------------------------------
13 #include "sysinstall.h"
19 scan_block(int fd, daddr_t block)
23 if (-1 == lseek(fd,block * 512,SEEK_SET))
25 if (512 != read(fd,foo, 512))
37 strcpy(device,"/dev/");
38 strcat(device,d->name);
40 fd = open(device,O_RDWR);
42 msgWarn("open(%s) failed", device);
49 printf("%c: %lu.",j ? 'B' : 'G', l);
52 printf(".%lu\nB: %lu.",l-1,l);
55 printf(".%lu\nG: %lu.",l-1,l);
68 char myprompt[BUFSIZ];
74 systemSuspendDialog();
75 sprintf(myprompt,"%s> ", d->name);
77 printf("--==##==--\n");
84 printf("%s", myprompt);
86 q = p = fgets(input,sizeof(input),stdin);
89 for(cp = cmds; (*cp = strsep(&p, " \t\n")) != NULL;)
95 if (!strcasecmp(*cmds,"quit")) { break; }
96 if (!strcasecmp(*cmds,"exit")) { break; }
97 if (!strcasecmp(*cmds,"q")) { break; }
98 if (!strcasecmp(*cmds,"x")) { break; }
99 if (!strcasecmp(*cmds,"delete") && ncmd == 2) {
100 printf("delete = %d\n",
102 (struct chunk *)strtol(cmds[1],0,0)));
105 if (!strcasecmp(*cmds,"allfreebsd")) {
109 if (!strcasecmp(*cmds,"dedicate")) {
113 if (!strcasecmp(*cmds,"bios") && ncmd == 4) {
117 strtol(cmds[3],0,0));
120 if (!strcasecmp(*cmds,"list")) {
131 if (!strcasecmp(*cmds,"create") && ncmd == 7) {
132 printf("Create=%d\n",
143 if (!strcasecmp(*cmds,"create") && ncmd == 6) {
144 printf("Create=%d\n",
150 strtol(cmds[5],0,0), ""));
154 if (!strcasecmp(*cmds,"read")) {
157 d = Open_Disk(cmds[1]);
159 d = Open_Disk(d->name);
166 if (!strcasecmp(*cmds,"scan")) {
170 if (!strcasecmp(*cmds,"write")) {
172 Fake ? 0 : Write_Disk(d));
178 if (strcasecmp(*cmds,"help"))
179 printf("\007ERROR\n");
181 printf("allfreebsd\t\t");
182 printf("dedicate\t\t");
183 printf("bios cyl hd sect\n");
184 printf("collapse [pointer]\t\t");
186 printf("create offset size enum subtype flags name\n");
188 printf("create offset size enum subtype flags\n");
190 printf("subtype(part): swap=1, ffs=7\t\t");
191 printf("delete pointer\n");
194 printf("read [disk]\t\t");
200 systemResumeDialog();