FreeBSD Bugzilla – Attachment 6803 Details for
Bug 15168
Adding tracklist support to fdformat(1)
Home
|
New
|
Browse
|
Search
|
[?]
|
Reports
|
Help
|
New Account
|
Log In
Remember
[x]
|
Forgot Password
Login:
[x]
[patch]
file.diff
file.diff (text/plain), 4.07 KB, created by
Elmar.Bartel
on 1999-11-29 18:30:00 UTC
(
hide
)
Description:
file.diff
Filename:
MIME Type:
Creator:
Elmar.Bartel
Created:
1999-11-29 18:30:00 UTC
Size:
4.07 KB
patch
obsolete
>diff -c -r fdformat/fdformat.1 fdformat.new/fdformat.1 >*** fdformat/fdformat.1 Mon Nov 29 18:45:25 1999 >--- fdformat.new/fdformat.1 Mon Nov 29 18:49:00 1999 >*************** >*** 34,39 **** >--- 34,40 ---- > .Nm fdformat > .Op Fl q > .Op Fl v | Fl n >+ .Op Fl l Ar tracklist > .Op Fl f Ar capacity > .Op Fl c Ar cyls > .Op Fl s Ar secs >*************** >*** 73,78 **** >--- 74,86 ---- > Suppress any normal output from the command, and don't ask the > user for a confirmation whether to format the floppy disk at > .Ar device_name . >+ .It Fl l Ar tracklist >+ give a list of tracks to be formatted or verified. The >+ .Ar tracklist >+ is given as a comma seperated list of track numbers or track ranges. >+ A track range is a pair of track numbers seperated by a '-' character. >+ The second number has to b equal or larger than the first one. Track >+ numbers start with 0. > .It Fl f Ar capacity > The normal way to specify the desired formatting parameters. > .Ar Capacity >Only in fdformat.new: fdformat.1.gz >diff -c -r fdformat/fdformat.c fdformat.new/fdformat.c >*** fdformat/fdformat.c Mon Nov 29 18:45:25 1999 >--- fdformat.new/fdformat.c Mon Nov 29 18:59:35 1999 >*************** >*** 138,144 **** > usage (void) > { > fprintf(stderr, "%s\n%s\n", >! "usage: fdformat [-q] [-n | -v] [-f #] [-c #] [-s #] [-h #]", > " [-r #] [-g #] [-i #] [-S #] [-F #] [-t #] devname"); > exit(2); > } >--- 138,144 ---- > usage (void) > { > fprintf(stderr, "%s\n%s\n", >! "usage: fdformat [-q] [-n | -v] [ -l tracklist ] [-f #] [-c #] [-s #] [-h #]", > " [-r #] [-g #] [-i #] [-S #] [-F #] [-t #] devname"); > exit(2); > } >*************** >*** 163,168 **** >--- 163,211 ---- > } > } > >+ void >+ parse_list(char *list, char *track_list, int max) { >+ while (*list) { >+ long n; >+ char *nl= list; >+ while (isspace(*nl)) >+ nl++; >+ n= strtol(list, &nl, 0); >+ if (nl == list) { >+ errx(1, "cannot parse track list"); >+ } >+ if (n >= max) { >+ errx(1, "there is no track %ld", n); >+ } >+ while (isspace(*nl)) >+ nl++; >+ if (*nl == ',' || *nl == '\0') { >+ track_list[n]= 1; >+ if (*nl == ',') >+ list= nl+1; >+ else >+ list= nl; >+ } >+ else if (*nl == '-') { >+ long m; >+ char *ml= nl+1; >+ m= strtol(ml, &ml, 0); >+ if (ml == nl+1 || m < n || m >= max) { >+ errx(1, "invalid track range"); >+ } >+ while (n<=m) { >+ track_list[n]= 1; >+ n++; >+ } >+ list= nl+1; >+ } >+ else { >+ errx(1, "invalid list seperator: `%c'.\n", *nl); >+ } >+ } >+ } >+ >+ > int > main(int argc, char **argv) > { >*************** >*** 172,180 **** > int fd, c, track, error, tracks_per_dot, bytes_per_track, errs; > const char *devname, *suffix; > struct fd_type fdt; > >! while((c = getopt(argc, argv, "f:c:s:h:r:g:S:F:t:i:qvn")) != -1) > switch(c) { > case 'f': /* format in kilobytes */ > format = atoi(optarg); > break; >--- 215,228 ---- > int fd, c, track, error, tracks_per_dot, bytes_per_track, errs; > const char *devname, *suffix; > struct fd_type fdt; >+ char *tl_arg, track_list[200]; > >! tl_arg= 0; >! while((c = getopt(argc, argv, "f:l:c:s:h:r:g:S:F:t:i:qvn")) != -1) > switch(c) { >+ case 'l': /* list of tracks to operate on */ >+ tl_arg= optarg; >+ break; > case 'f': /* format in kilobytes */ > format = atoi(optarg); > break; >*************** >*** 279,284 **** >--- 327,340 ---- > bytes_per_track = fdt.sectrac * (1<<fdt.secsize) * 128; > tracks_per_dot = fdt.tracks * fdt.heads / 40; > >+ if (tl_arg) { >+ memset(track_list, 0, sizeof(track_list)); >+ parse_list(tl_arg, track_list, fdt.tracks*fdt.heads); >+ } >+ else { >+ memset(track_list, 1, sizeof(track_list)); >+ } >+ > if (verify_only) { > if(!quiet) > printf("Verify %dK floppy `%s'.\n", >*************** >*** 307,312 **** >--- 363,375 ---- > error = errs = 0; > > for (track = 0; track < fdt.tracks * fdt.heads; track++) { >+ if (!track_list[track]) { >+ if(!quiet && !((track + 1) % tracks_per_dot)) { >+ putchar('.'); >+ fflush(stdout); >+ } >+ continue; >+ } > if (!verify_only) { > format_track(fd, track / fdt.heads, fdt.sectrac, > track % fdt.heads, fdt.trans, fdt.f_gap,
You cannot view the attachment while viewing its details because your browser does not support IFRAMEs.
View the attachment on a separate page
.
View Attachment As Diff
View Attachment As Raw
Actions:
View
|
Diff
Attachments on
bug 15168
: 6803