Deleted Added
sdiff udiff text old ( 78858 ) new ( 79111 )
full compact
1/*
2 * Copyright (C) 1992-1994,2001 by Joerg Wunsch, Dresden
3 * All rights reserved.
4 *
5 * Redistribution and use in source and binary forms, with or without
6 * modification, are permitted provided that the following conditions
7 * are met:
8 * 1. Redistributions of source code must retain the above copyright

--- 9 unchanged lines hidden (view full) ---

18 * INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES
19 * (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR
20 * SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
21 * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT,
22 * STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN
23 * ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
24 * POSSIBILITY OF SUCH DAMAGE.
25 *
26 * $FreeBSD: head/usr.sbin/fdformat/fdformat.c 78858 2001-06-26 22:19:32Z joerg $
27 */
28
29/*
30 * FreeBSD:
31 * format a floppy disk
32 *
33 * Added FD_GTYPE ioctl, verifying, proportional indicators.
34 * Serge Vakulenko, vak@zebub.msk.su
35 * Sat Dec 18 17:45:47 MSK 1993
36 *
37 * Final adaptation, change format/verify logic, add separate
38 * format gap/interleave values
39 * Andrew A. Chernov, ache@astral.msk.su
40 * Thu Jan 27 00:47:24 MSK 1994
41 */
42
43#include <ctype.h>
44#include <err.h>
45#include <fcntl.h>
46#include <paths.h>
47#include <stdio.h>
48#include <stdlib.h>
49#include <strings.h>
50#include <unistd.h>
51
52#include <sys/fdcio.h>
53
54static void
55format_track(int fd, int cyl, int secs, int head, int rate,
56 int gaplen, int secsize, int fill,int interleave)
57{
58 struct fd_formb f;
59 register int i,j;
60 int il[FD_MAX_NSEC + 1];
61

--- 105 unchanged lines hidden (view full) ---

167}
168
169int
170main(int argc, char **argv)
171{
172 int format = -1, cyls = -1, secs = -1, heads = -1, intleave = -1;
173 int rate = -1, gaplen = -1, secsize = -1, steps = -1;
174 int fill = 0xf6, quiet = 0, verify = 1, verify_only = 0, confirm = 0;
175 int fd, c, track, error, tracks_per_dot, bytes_per_track, errs;
176 int fdopts;
177 const char *devname, *suffix;
178 struct fd_type fdt;
179
180 while((c = getopt(argc, argv, "f:c:s:h:r:g:S:F:t:i:qyvn")) != -1)
181 switch(c) {
182 case 'f': /* format in kilobytes */
183 format = atoi(optarg);
184 break;
185
186 case 'c': /* # of cyls */

--- 144 unchanged lines hidden (view full) ---

331 track % fdt.heads, fdt.trans, fdt.f_gap,
332 fdt.secsize, fill, fdt.f_inter);
333 if(!quiet && !((track + 1) % tracks_per_dot)) {
334 putchar('F');
335 fflush(stdout);
336 }
337 }
338 if (verify) {
339 if (verify_track(fd, track, bytes_per_track) < 0)
340 error = errs = 1;
341 if(!quiet && !((track + 1) % tracks_per_dot)) {
342 if (!verify_only)
343 putchar('\b');
344 if (error) {
345 putchar('E');
346 error = 0;
347 }
348 else
349 putchar('V');
350 fflush(stdout);
351 }
352 }
353 }
354 if(!quiet)
355 printf(" done.\n");
356
357 return errs;
358}
359/*
360 * Local Variables:
361 * c-indent-level: 8
362 * c-continued-statement-offset: 8
363 * c-continued-brace-offset: 0
364 * c-brace-offset: -8
365 * c-brace-imaginary-offset: 0
366 * c-argdecl-indent: 8
367 * c-label-offset: -8
368 * c++-hanging-braces: 1
369 * c++-access-specifier-offset: -8
370 * c++-empty-arglist-indent: 8
371 * c++-friend-offset: 0
372 * End:
373 */