File: fdformat-4.3

package info (click to toggle)
fdutils 5.3-3
  • links: PTS
  • area: main
  • in suites: potato
  • size: 1,004 kB
  • ctags: 621
  • sloc: ansic: 6,098; sh: 2,236; makefile: 279; sed: 4
file content (55 lines) | stat: -rw-r--r-- 1,084 bytes parent folder | download | duplicates (4)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
#!/bin/sh
#
# Shell script to simulate fdformat by using superformat.
# (C) 1996 Michael Meskes <meskes@informatik.rwth-aachen.de>
# Placed under GPL.
#

set -e

#
# shall we verify?
#

if [ ! $1 ]
then
	echo "Usage: $0 [ -n ] device"
	exit 1
elif [ $1 = "-n" ]
then
	shift 1
	args="-f "
fi

#
# calculate parameters
#

format=`getfdprm $1`

capacity=`echo $format|cut -d' ' -f1`
capacity=`expr $capacity / 2`
sectors=`echo $format|cut -d' ' -f2`
heads=`echo $format|cut -d' ' -f3`
tracks=`echo $format|cut -d' ' -f4`
stretch=`echo $format|cut -d' ' -f5`
gap=`echo $format|cut -d' ' -f6`
rate=`echo $format|cut -d' ' -f7`
spec1=`echo $format|cut -d' ' -f8` # not needed
fmt_gap=`echo $format|cut -d' ' -f9`

device=`echo $1|sed -e 's/\/dev\/fd//' -e 's/\(u\|h\|H\|d\|D\|E\)[0-9]\+$//'`

args="$args -V -d /dev/fd$device -s $sectors -t $tracks -H $heads --stretch $stretch \
-g $gap -r $rate -G $fmt_gap"

headtext="Sing"
if [ $heads -eq 2 ]
then
	headtext="Doub"
fi

echo ${headtext}le-sided, ${tracks} tracks, ${sectors} sec/track. Total capacity ${capacity} kB.

superformat $args