rbcdio 0.02 → 0.03

Sign up to get free protection for your applications and to get access to all the features.
data/install-sh CHANGED
@@ -1,7 +1,7 @@
1
1
  #!/bin/sh
2
2
  # install - install a program, script, or datafile
3
3
 
4
- scriptversion=2006-10-14.15
4
+ scriptversion=2005-05-14.22
5
5
 
6
6
  # This originates from X11R5 (mit/util/scripts/install.sh), which was
7
7
  # later released in X11R6 (xc/config/util/install.sh) with the
@@ -39,24 +39,15 @@ scriptversion=2006-10-14.15
39
39
  # when there is no Makefile.
40
40
  #
41
41
  # This script is compatible with the BSD install script, but was written
42
- # from scratch.
43
-
44
- nl='
45
- '
46
- IFS=" "" $nl"
42
+ # from scratch. It can only install one file at a time, a restriction
43
+ # shared with many OS's install programs.
47
44
 
48
45
  # set DOITPROG to echo to test this script
49
46
 
50
47
  # Don't use :- since 4.3BSD and earlier shells don't like it.
51
48
  doit="${DOITPROG-}"
52
- if test -z "$doit"; then
53
- doit_exec=exec
54
- else
55
- doit_exec=$doit
56
- fi
57
49
 
58
- # Put in absolute file names if you don't have them in your path;
59
- # or use environment vars.
50
+ # put in absolute paths if you don't have them in your path; or use env. vars.
60
51
 
61
52
  mvprog="${MVPROG-mv}"
62
53
  cpprog="${CPPROG-cp}"
@@ -67,13 +58,7 @@ stripprog="${STRIPPROG-strip}"
67
58
  rmprog="${RMPROG-rm}"
68
59
  mkdirprog="${MKDIRPROG-mkdir}"
69
60
 
70
- posix_glob=
71
- posix_mkdir=
72
-
73
- # Desired mode of installed file.
74
- mode=0755
75
-
76
- chmodcmd=$chmodprog
61
+ chmodcmd="$chmodprog 0755"
77
62
  chowncmd=
78
63
  chgrpcmd=
79
64
  stripcmd=
@@ -110,7 +95,7 @@ Environment variables override the default commands:
110
95
  CHGRPPROG CHMODPROG CHOWNPROG CPPROG MKDIRPROG MVPROG RMPROG STRIPPROG
111
96
  "
112
97
 
113
- while test $# -ne 0; do
98
+ while test -n "$1"; do
114
99
  case $1 in
115
100
  -c) shift
116
101
  continue;;
@@ -126,15 +111,9 @@ while test $# -ne 0; do
126
111
 
127
112
  --help) echo "$usage"; exit $?;;
128
113
 
129
- -m) mode=$2
114
+ -m) chmodcmd="$chmodprog $2"
130
115
  shift
131
116
  shift
132
- case $mode in
133
- *' '* | *' '* | *'
134
- '* | *'*'* | *'?'* | *'['*)
135
- echo "$0: invalid mode: $mode" >&2
136
- exit 1;;
137
- esac
138
117
  continue;;
139
118
 
140
119
  -o) chowncmd="$chownprog $2"
@@ -157,33 +136,25 @@ while test $# -ne 0; do
157
136
 
158
137
  --version) echo "$0 $scriptversion"; exit $?;;
159
138
 
160
- --) shift
139
+ *) # When -d is used, all remaining arguments are directories to create.
140
+ # When -t is used, the destination is already specified.
141
+ test -n "$dir_arg$dstarg" && break
142
+ # Otherwise, the last argument is the destination. Remove it from $@.
143
+ for arg
144
+ do
145
+ if test -n "$dstarg"; then
146
+ # $@ is not empty: it contains at least $arg.
147
+ set fnord "$@" "$dstarg"
148
+ shift # fnord
149
+ fi
150
+ shift # arg
151
+ dstarg=$arg
152
+ done
161
153
  break;;
162
-
163
- -*) echo "$0: invalid option: $1" >&2
164
- exit 1;;
165
-
166
- *) break;;
167
154
  esac
168
155
  done
169
156
 
170
- if test $# -ne 0 && test -z "$dir_arg$dstarg"; then
171
- # When -d is used, all remaining arguments are directories to create.
172
- # When -t is used, the destination is already specified.
173
- # Otherwise, the last argument is the destination. Remove it from $@.
174
- for arg
175
- do
176
- if test -n "$dstarg"; then
177
- # $@ is not empty: it contains at least $arg.
178
- set fnord "$@" "$dstarg"
179
- shift # fnord
180
- fi
181
- shift # arg
182
- dstarg=$arg
183
- done
184
- fi
185
-
186
- if test $# -eq 0; then
157
+ if test -z "$1"; then
187
158
  if test -z "$dir_arg"; then
188
159
  echo "$0: no input file specified." >&2
189
160
  exit 1
@@ -193,33 +164,6 @@ if test $# -eq 0; then
193
164
  exit 0
194
165
  fi
195
166
 
196
- if test -z "$dir_arg"; then
197
- trap '(exit $?); exit' 1 2 13 15
198
-
199
- # Set umask so as not to create temps with too-generous modes.
200
- # However, 'strip' requires both read and write access to temps.
201
- case $mode in
202
- # Optimize common cases.
203
- *644) cp_umask=133;;
204
- *755) cp_umask=22;;
205
-
206
- *[0-7])
207
- if test -z "$stripcmd"; then
208
- u_plus_rw=
209
- else
210
- u_plus_rw='% 200'
211
- fi
212
- cp_umask=`expr '(' 777 - $mode % 1000 ')' $u_plus_rw`;;
213
- *)
214
- if test -z "$stripcmd"; then
215
- u_plus_rw=
216
- else
217
- u_plus_rw=,u+rw
218
- fi
219
- cp_umask=$mode$u_plus_rw;;
220
- esac
221
- fi
222
-
223
167
  for src
224
168
  do
225
169
  # Protect names starting with `-'.
@@ -229,11 +173,15 @@ do
229
173
 
230
174
  if test -n "$dir_arg"; then
231
175
  dst=$src
232
- dstdir=$dst
233
- test -d "$dstdir"
234
- dstdir_status=$?
235
- else
176
+ src=
236
177
 
178
+ if test -d "$dst"; then
179
+ mkdircmd=:
180
+ chmodcmd=
181
+ else
182
+ mkdircmd=$mkdirprog
183
+ fi
184
+ else
237
185
  # Waiting for this to be detected by the "$cpprog $src $dsttmp" command
238
186
  # might cause directories to be created, which would be especially bad
239
187
  # if $src (and thus $dsttmp) contains '*'.
@@ -260,188 +208,53 @@ do
260
208
  echo "$0: $dstarg: Is a directory" >&2
261
209
  exit 1
262
210
  fi
263
- dstdir=$dst
264
- dst=$dstdir/`basename "$src"`
265
- dstdir_status=0
266
- else
267
- # Prefer dirname, but fall back on a substitute if dirname fails.
268
- dstdir=`
269
- (dirname "$dst") 2>/dev/null ||
270
- expr X"$dst" : 'X\(.*[^/]\)//*[^/][^/]*/*$' \| \
271
- X"$dst" : 'X\(//\)[^/]' \| \
272
- X"$dst" : 'X\(//\)$' \| \
273
- X"$dst" : 'X\(/\)' \| . 2>/dev/null ||
274
- echo X"$dst" |
275
- sed '/^X\(.*[^/]\)\/\/*[^/][^/]*\/*$/{
276
- s//\1/
277
- q
278
- }
279
- /^X\(\/\/\)[^/].*/{
280
- s//\1/
281
- q
282
- }
283
- /^X\(\/\/\)$/{
284
- s//\1/
285
- q
286
- }
287
- /^X\(\/\).*/{
288
- s//\1/
289
- q
290
- }
291
- s/.*/./; q'
292
- `
293
-
294
- test -d "$dstdir"
295
- dstdir_status=$?
211
+ dst=$dst/`basename "$src"`
296
212
  fi
297
213
  fi
298
214
 
299
- obsolete_mkdir_used=false
300
-
301
- if test $dstdir_status != 0; then
302
- case $posix_mkdir in
303
- '')
304
- # Create intermediate dirs using mode 755 as modified by the umask.
305
- # This is like FreeBSD 'install' as of 1997-10-28.
306
- umask=`umask`
307
- case $stripcmd.$umask in
308
- # Optimize common cases.
309
- *[2367][2367]) mkdir_umask=$umask;;
310
- .*0[02][02] | .[02][02] | .[02]) mkdir_umask=22;;
311
-
312
- *[0-7])
313
- mkdir_umask=`expr $umask + 22 \
314
- - $umask % 100 % 40 + $umask % 20 \
315
- - $umask % 10 % 4 + $umask % 2
316
- `;;
317
- *) mkdir_umask=$umask,go-w;;
318
- esac
319
-
320
- # With -d, create the new directory with the user-specified mode.
321
- # Otherwise, rely on $mkdir_umask.
322
- if test -n "$dir_arg"; then
323
- mkdir_mode=-m$mode
324
- else
325
- mkdir_mode=
326
- fi
327
-
328
- posix_mkdir=false
329
- case $umask in
330
- *[123567][0-7][0-7])
331
- # POSIX mkdir -p sets u+wx bits regardless of umask, which
332
- # is incompatible with FreeBSD 'install' when (umask & 300) != 0.
333
- ;;
334
- *)
335
- tmpdir=${TMPDIR-/tmp}/ins$RANDOM-$$
336
- trap 'ret=$?; rmdir "$tmpdir/d" "$tmpdir" 2>/dev/null; exit $ret' 0
337
-
338
- if (umask $mkdir_umask &&
339
- exec $mkdirprog $mkdir_mode -p -- "$tmpdir/d") >/dev/null 2>&1
340
- then
341
- if test -z "$dir_arg" || {
342
- # Check for POSIX incompatibilities with -m.
343
- # HP-UX 11.23 and IRIX 6.5 mkdir -m -p sets group- or
344
- # other-writeable bit of parent directory when it shouldn't.
345
- # FreeBSD 6.1 mkdir -m -p sets mode of existing directory.
346
- ls_ld_tmpdir=`ls -ld "$tmpdir"`
347
- case $ls_ld_tmpdir in
348
- d????-?r-*) different_mode=700;;
349
- d????-?--*) different_mode=755;;
350
- *) false;;
351
- esac &&
352
- $mkdirprog -m$different_mode -p -- "$tmpdir" && {
353
- ls_ld_tmpdir_1=`ls -ld "$tmpdir"`
354
- test "$ls_ld_tmpdir" = "$ls_ld_tmpdir_1"
355
- }
356
- }
357
- then posix_mkdir=:
358
- fi
359
- rmdir "$tmpdir/d" "$tmpdir"
360
- else
361
- # Remove any dirs left behind by ancient mkdir implementations.
362
- rmdir ./$mkdir_mode ./-p ./-- 2>/dev/null
363
- fi
364
- trap '' 0;;
365
- esac;;
366
- esac
215
+ # This sed command emulates the dirname command.
216
+ dstdir=`echo "$dst" | sed -e 's,/*$,,;s,[^/]*$,,;s,/*$,,;s,^$,.,'`
367
217
 
368
- if
369
- $posix_mkdir && (
370
- umask $mkdir_umask &&
371
- $doit_exec $mkdirprog $mkdir_mode -p -- "$dstdir"
372
- )
373
- then :
374
- else
218
+ # Make sure that the destination directory exists.
219
+
220
+ # Skip lots of stat calls in the usual case.
221
+ if test ! -d "$dstdir"; then
222
+ defaultIFS='
223
+ '
224
+ IFS="${IFS-$defaultIFS}"
375
225
 
376
- # The umask is ridiculous, or mkdir does not conform to POSIX,
377
- # or it failed possibly due to a race condition. Create the
378
- # directory the slow way, step by step, checking for races as we go.
379
-
380
- case $dstdir in
381
- /*) prefix=/ ;;
382
- -*) prefix=./ ;;
383
- *) prefix= ;;
384
- esac
385
-
386
- case $posix_glob in
387
- '')
388
- if (set -f) 2>/dev/null; then
389
- posix_glob=true
390
- else
391
- posix_glob=false
392
- fi ;;
393
- esac
394
-
395
- oIFS=$IFS
396
- IFS=/
397
- $posix_glob && set -f
398
- set fnord $dstdir
226
+ oIFS=$IFS
227
+ # Some sh's can't handle IFS=/ for some reason.
228
+ IFS='%'
229
+ set x `echo "$dstdir" | sed -e 's@/@%@g' -e 's@^%@/@'`
230
+ shift
231
+ IFS=$oIFS
232
+
233
+ pathcomp=
234
+
235
+ while test $# -ne 0 ; do
236
+ pathcomp=$pathcomp$1
399
237
  shift
400
- $posix_glob && set +f
401
- IFS=$oIFS
402
-
403
- prefixes=
404
-
405
- for d
406
- do
407
- test -z "$d" && continue
408
-
409
- prefix=$prefix$d
410
- if test -d "$prefix"; then
411
- prefixes=
412
- else
413
- if $posix_mkdir; then
414
- (umask=$mkdir_umask &&
415
- $doit_exec $mkdirprog $mkdir_mode -p -- "$dstdir") && break
416
- # Don't fail if two instances are running concurrently.
417
- test -d "$prefix" || exit 1
418
- else
419
- case $prefix in
420
- *\'*) qprefix=`echo "$prefix" | sed "s/'/'\\\\\\\\''/g"`;;
421
- *) qprefix=$prefix;;
422
- esac
423
- prefixes="$prefixes '$qprefix'"
424
- fi
425
- fi
426
- prefix=$prefix/
427
- done
428
-
429
- if test -n "$prefixes"; then
430
- # Don't fail if two instances are running concurrently.
431
- (umask $mkdir_umask &&
432
- eval "\$doit_exec \$mkdirprog $prefixes") ||
433
- test -d "$dstdir" || exit 1
434
- obsolete_mkdir_used=true
238
+ if test ! -d "$pathcomp"; then
239
+ $mkdirprog "$pathcomp"
240
+ # mkdir can fail with a `File exist' error in case several
241
+ # install-sh are creating the directory concurrently. This
242
+ # is OK.
243
+ test -d "$pathcomp" || exit
435
244
  fi
436
- fi
245
+ pathcomp=$pathcomp/
246
+ done
437
247
  fi
438
248
 
439
249
  if test -n "$dir_arg"; then
440
- { test -z "$chowncmd" || $doit $chowncmd "$dst"; } &&
441
- { test -z "$chgrpcmd" || $doit $chgrpcmd "$dst"; } &&
442
- { test "$obsolete_mkdir_used$chowncmd$chgrpcmd" = false ||
443
- test -z "$chmodcmd" || $doit $chmodcmd $mode "$dst"; } || exit 1
250
+ $doit $mkdircmd "$dst" \
251
+ && { test -z "$chowncmd" || $doit $chowncmd "$dst"; } \
252
+ && { test -z "$chgrpcmd" || $doit $chgrpcmd "$dst"; } \
253
+ && { test -z "$stripcmd" || $doit $stripcmd "$dst"; } \
254
+ && { test -z "$chmodcmd" || $doit $chmodcmd "$dst"; }
255
+
444
256
  else
257
+ dstfile=`basename "$dst"`
445
258
 
446
259
  # Make a couple of temp file names in the proper directory.
447
260
  dsttmp=$dstdir/_inst.$$_
@@ -449,9 +262,10 @@ do
449
262
 
450
263
  # Trap to clean up those temp files at exit.
451
264
  trap 'ret=$?; rm -f "$dsttmp" "$rmtmp" && exit $ret' 0
265
+ trap '(exit $?); exit' 1 2 13 15
452
266
 
453
267
  # Copy the file name to the temp name.
454
- (umask $cp_umask && $doit_exec $cpprog "$src" "$dsttmp") &&
268
+ $doit $cpprog "$src" "$dsttmp" &&
455
269
 
456
270
  # and set any options; do chmod last to preserve setuid bits.
457
271
  #
@@ -462,10 +276,10 @@ do
462
276
  { test -z "$chowncmd" || $doit $chowncmd "$dsttmp"; } \
463
277
  && { test -z "$chgrpcmd" || $doit $chgrpcmd "$dsttmp"; } \
464
278
  && { test -z "$stripcmd" || $doit $stripcmd "$dsttmp"; } \
465
- && { test -z "$chmodcmd" || $doit $chmodcmd $mode "$dsttmp"; } &&
279
+ && { test -z "$chmodcmd" || $doit $chmodcmd "$dsttmp"; } &&
466
280
 
467
281
  # Now rename the file to the real destination.
468
- { $doit $mvcmd -f "$dsttmp" "$dst" 2>/dev/null \
282
+ { $doit $mvcmd -f "$dsttmp" "$dstdir/$dstfile" 2>/dev/null \
469
283
  || {
470
284
  # The rename failed, perhaps because mv can't rename something else
471
285
  # to itself, or perhaps because mv is so ancient that it does not
@@ -477,12 +291,11 @@ do
477
291
  # reasons. In this case, the final cleanup might fail but the new
478
292
  # file should still install successfully.
479
293
  {
480
- if test -f "$dst"; then
481
- $doit $rmcmd -f "$dst" 2>/dev/null \
482
- || { $doit $mvcmd -f "$dst" "$rmtmp" 2>/dev/null \
483
- && { $doit $rmcmd -f "$rmtmp" 2>/dev/null; :; }; }\
294
+ if test -f "$dstdir/$dstfile"; then
295
+ $doit $rmcmd -f "$dstdir/$dstfile" 2>/dev/null \
296
+ || $doit $mvcmd -f "$dstdir/$dstfile" "$rmtmp" 2>/dev/null \
484
297
  || {
485
- echo "$0: cannot unlink or rename $dst" >&2
298
+ echo "$0: cannot unlink or rename $dstdir/$dstfile" >&2
486
299
  (exit 1); exit 1
487
300
  }
488
301
  else
@@ -491,14 +304,17 @@ do
491
304
  } &&
492
305
 
493
306
  # Now rename the file to the real destination.
494
- $doit $mvcmd "$dsttmp" "$dst"
307
+ $doit $mvcmd "$dsttmp" "$dstdir/$dstfile"
495
308
  }
496
- } || exit 1
497
-
498
- trap '' 0
499
- fi
309
+ }
310
+ fi || { (exit 1); exit 1; }
500
311
  done
501
312
 
313
+ # The final little trick to "correctly" pass the exit status to the exit trap.
314
+ {
315
+ (exit 0); exit 0
316
+ }
317
+
502
318
  # Local variables:
503
319
  # eval: (add-hook 'write-file-hooks 'time-stamp)
504
320
  # time-stamp-start: "scriptversion="
data/lib/cdio.rb CHANGED
@@ -1,23 +1,21 @@
1
1
  #!/usr/bin/env ruby
2
- # $Id: cdio.rb,v 1.19 2007/10/13 23:00:18 rocky Exp $
2
+ # $Id: cdio.rb,v 1.21 2008/05/02 13:05:40 karl Exp $
3
3
  #
4
- # Copyright (C) 2006 Rocky Bernstein <rocky@gnu.org>
4
+ # Copyright (C) 2006, 2007, 2008 Rocky Bernstein <rocky@gnu.org>
5
5
  #
6
- # This program is free software; you can redistribute it and/or modify
7
- # it under the terms of the GNU General Public License as published by
8
- # the Free Software Foundation; either version 2 of the License, or
9
- # (at your option) any later version.
6
+ # This program is free software: you can redistribute it and/or modify
7
+ # it under the terms of the GNU General Public License as published by
8
+ # the Free Software Foundation, either version 3 of the License, or
9
+ # (at your option) any later version.
10
10
  #
11
- # This program is distributed in the hope that it will be useful,
12
- # but WITHOUT ANY WARRANTY; without even the implied warranty of
13
- # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
14
- # GNU General Public License for more details.
15
- #
16
- # You should have received a copy of the GNU General Public License
17
- # along with this program; if not, write to the Free Software
18
- # Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA
19
- # 02110-1301 USA.
11
+ # This program is distributed in the hope that it will be useful,
12
+ # but WITHOUT ANY WARRANTY; without even the implied warranty of
13
+ # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
14
+ # GNU General Public License for more details.
20
15
  #
16
+ # You should have received a copy of the GNU General Public License
17
+ # along with this program. If not, see <http://www.gnu.org/licenses/>.
18
+
21
19
  # Author:: Rocky Bernstein (mailto:rocky@gnu.org)
22
20
  #
23
21
  # = cdio
@@ -146,7 +144,7 @@ end
146
144
 
147
145
 
148
146
  # close media tray in CD drive if there is a routine to do so.
149
- # The driver id is returned. A DeviceException is thrown on error.
147
+ # The +driver id +is returned. A DeviceException is thrown on error.
150
148
  def close_tray(drive=nil, driver_id=Rubycdio::DRIVER_UNKNOWN)
151
149
  drc, found_driver_id = Rubycdio::close_tray(drive, driver_id)
152
150
  possibly_raise_exception__(drc)
@@ -156,7 +154,7 @@ end
156
154
  # Returns: [device, driver]
157
155
  #
158
156
  # Return a string containing the default CD device if none is
159
- # specified. if driver_id is DRIVER_UNKNOWN or DRIVER_DEVICE
157
+ # specified. if +driver_id+ is DRIVER_UNKNOWN or DRIVER_DEVICE
160
158
  # then one set the default device for that.
161
159
  #
162
160
  # nil is returned as the device if we couldn't get a default
@@ -174,9 +172,9 @@ end
174
172
 
175
173
  # Returns: [device1, device2, ... driver_id]
176
174
  #
177
- # Like get_devices, but return the p_driver_id which may be different
175
+ # Like get_devices, but return the driver_id which may be different
178
176
  # from the passed-in driver_id if it was Rubycdio::DRIVER_DEVICE or
179
- # Rubycdio::DRIVER_UNKNOWN. The return driver_id may be useful because
177
+ # Rubycdio::DRIVER_UNKNOWN. The return +driver_id+ may be useful because
180
178
  # often one wants to get a drive name and then *open* it
181
179
  # afterwards. Giving the driver back facilitates this, and speeds things
182
180
  # up for libcdio as well.
@@ -194,9 +192,9 @@ end
194
192
  #
195
193
  # To find a CD-drive of any type, use the mask Rubycdio::CDIO_FS_MATCH_ALL.
196
194
  #
197
- # The array of device names is returned or NULL if we couldn't get a
198
- # default device. It is also possible to return a non NULL but after
199
- # dereferencing the the value is NULL. This also means nothing was
195
+ # The array of device names is returned or nil if we couldn't get a
196
+ # default device. It is also possible to return a non nil but after
197
+ # dereferencing the the value is nil. This also means nothing was
200
198
  # found.
201
199
  def devices_with_cap(capabilities, any=false)
202
200
  return Rubycdio::get_devices_with_cap(capabilities, any)
@@ -233,7 +231,7 @@ end
233
231
  # binfile?(binfile_name)->cue_name
234
232
  #++
235
233
  #
236
- # Determine if binfile_name is the BIN file part of a CDRWIN CD
234
+ # Determine if +binfile_name+ is the BIN file part of a CDRWIN CD
237
235
  # disk image.
238
236
  #
239
237
  # Return the corresponding CUE file if bin_name is a BIN file or
@@ -245,7 +243,7 @@ end
245
243
  #--
246
244
  # FIXME ? is not quite right
247
245
  #++
248
- # return bin_name
246
+ # return bin_name for a corresponding CUE file
249
247
  #
250
248
  # Determine if cuefile_name is the CUE file part of a CDRWIN CD
251
249
  # disk image.
@@ -273,12 +271,12 @@ end
273
271
 
274
272
  # tocfile?(tocfile_name)->bool
275
273
  #
276
- # Determine if tocfile_name is a cdrdao CD disc image
274
+ # Determine if +tocfile_name+ is a cdrdao CD disc image
277
275
  def tocfile?(tocfile_name)
278
276
  return Rubycdio::tocfile?(tocfile_name)
279
277
  end
280
278
 
281
- # Convert bit mask for miscellaneous drive properties
279
+ # Convert +bitmask+ for miscellaneous drive properties
282
280
  # into a dictionary of drive capabilities
283
281
  def convert_drive_cap_misc(bitmask)
284
282
  result={}
@@ -373,7 +371,7 @@ def convert_drive_cap_read(bitmask)
373
371
  return result
374
372
  end
375
373
 
376
- # Convert bit mask for drive write properties
374
+ # Convert +bitmask+ for drive write properties
377
375
  # into a dictionary of drive capabilities
378
376
  def convert_drive_cap_write(bitmask)
379
377
  result={}
@@ -458,7 +456,7 @@ class Device
458
456
 
459
457
  # Returns: status
460
458
  #
461
- # Playing CD through analog output at the given lsn to the ending lsn
459
+ # Playing CD through analog output from +start_lsn+ to +ending_lsn+
462
460
  # A DeviceError exception may be raised.
463
461
  def audio_play_lsn(start_lsn, end_lsn)
464
462
  drc=Rubycdio::audio_play_lsn(@cd, start_lsn, end_lsn)
@@ -483,8 +481,9 @@ class Device
483
481
  possibly_raise_exception__(drc)
484
482
  end
485
483
 
486
- # Free resources associated with p_cdio. Call this when done using
487
- # using CD reading/control operations for the current device.
484
+ # Free (C memory) resources associated with the object. Call this when
485
+ # done using using CD reading/control operations for the current
486
+ # device.
488
487
  def close()
489
488
  if @cd
490
489
  Rubycdio::close(@cd)
@@ -696,13 +695,13 @@ class Device
696
695
 
697
696
  # Returns: track
698
697
  #
699
- # Find the track which contains lsn.
698
+ # Find the track which contains +lsn+.
700
699
  # nil is returned if the lsn outside of the CD or
701
700
  # if there was some error.
702
701
  #
703
- # If the lsn is before the pregap of the first track,
702
+ # If +lsn+ is before the pregap of the first track,
704
703
  # A track object with a 0 track is returned.
705
- # Otherwise we return the track that spans the lsn.
704
+ # Otherwise we return the track that spans the LSN.
706
705
  def track_for_lsn(lsn)
707
706
  track = Rubycdio::get_last_track_num(@cd)
708
707
  if track == Rubycdio::INVALID_TRACK:
@@ -715,8 +714,8 @@ class Device
715
714
  # Reposition read offset
716
715
  # Similar to (if not the same as) libc's fseek()
717
716
  #
718
- # cdio is object to get adjested, offset is amount to seek and
719
- # whence is like corresponding parameter in libc's lseek, e.g.
717
+ # +offset+ is amount to seek and
718
+ # +whence+ is like corresponding parameter in libc's lseek, e.g.
720
719
  # it should be SEEK_SET or SEEK_END.
721
720
  #
722
721
  # the offset is returned or -1 on error.
@@ -724,12 +723,12 @@ class Device
724
723
  return Rubycdio::lseek(@cd, offset, whence)
725
724
  end
726
725
 
727
- # Sets up to read from place specified by source, driver_id and
728
- # access mode. This should be called before using any other routine
726
+ # Sets up to read from place specified by +source+, +driver_id+ and
727
+ # +access_mode+. This should be called before using any other routine
729
728
  # except those that act on a CD-ROM drive by name.
730
729
  #
731
- # If nil is given as the source, we'll use the default driver device.
732
- # If nil is given as the driver_id, we'll find a suitable device driver.
730
+ # If nil is the value of +source+, we'll use the default driver device.
731
+ # If nil is the value of +driver_id+, we'll find a suitable device driver.
733
732
  #
734
733
  # If device object was, previously opened it is closed first.
735
734
  #
@@ -753,7 +752,7 @@ class Device
753
752
 
754
753
  # Returns: [size, data]
755
754
  #
756
- # Reads the next size bytes.
755
+ # Reads the next +size+ bytes.
757
756
  # Similar to (if not the same as) libc's read()
758
757
  #
759
758
  # The number of bytes read and the data is returned.
@@ -768,7 +767,7 @@ class Device
768
767
  #
769
768
  # Reads a number of data sectors (AKA blocks).
770
769
  #
771
- # lsn is sector to read, bytes is the number of bytes.
770
+ # +lsn+ is the sector to read; +bytes+ is the number of bytes to read.
772
771
  # A DeviceError exception may be raised.
773
772
  def read_data_blocks(lsn, blocks=1)
774
773
  size = Rubycdio::ISO_BLOCKSIZE*blocks
@@ -786,19 +785,19 @@ class Device
786
785
  #
787
786
  # Reads a number of sectors (AKA blocks).
788
787
  #
789
- # lsn is sector to read, bytes is the number of bytes.
788
+ # +lsn+ is the sector to read, +bytes+ is the number of bytes to read.
790
789
  #
791
- # If read_mode is Rubycdio::MODE_AUDIO, the return buffer size will be
790
+ # If +read_mode+ is Rubycdio::MODE_AUDIO, the return buffer size will be
792
791
  # truncated to multiple of Rubycdio::CDIO_FRAMESIZE_RAW i_blocks bytes.
793
792
  #
794
- # If read_mode is Rubycdio::MODE_DATA, buffer will be truncated to a
793
+ # If +read_mode+ is Rubycdio::MODE_DATA, buffer will be truncated to a
795
794
  # multiple of Rubycdio::ISO_BLOCKSIZE, Rubycdio::M1RAW_SECTOR_SIZE or
796
795
  # Rubycdio::M2F2_SECTOR_SIZE bytes depending on what mode the data is in.
797
796
  #
798
- # If read_mode is Rubycdio::MODE_M2F1, buffer will be truncated to a
797
+ # If +read_mode+ is Rubycdio::MODE_M2F1, buffer will be truncated to a
799
798
  # multiple of Rubycdio::M2RAW_SECTOR_SIZE bytes.
800
799
  #
801
- # If read_mode is Rubycdio::MODE_M2F2, the return buffer size will be
800
+ # If +read_mode+ is Rubycdio::MODE_M2F2, the return buffer size will be
802
801
  # truncated to a multiple of Rubycdio::CD_FRAMESIZE bytes.
803
802
  #
804
803
  # The number of bytes read and the data is returned.