Subject: MT(1) exit code problem
To: None <current-users@NetBSD.ORG>
From: Scott R. Burns <Scott.Burns@labatt.com>
List: current-users
Date: 08/27/1995 13:22:20
Sorry that this is not in send-pr form but out internet link won't be up for
3 weeks. If someone could send-pr it for me that would be great.

While playing with a couple of tape drives on NetBSD-current
(NetBSD ncti100.ncti.com 1.0A NetBSD 1.0A (NCTI100) #0: Fri Jun 30 11:57:14 PDT)
I think I have discovered a bug in the 'mt' commands use of exit codes. From the
man page for MT(1).

     Mt returns a 0 exit status when the operation(s) were successful, 1 if
     the command was unrecognized, and 2 if an operation failed.

So, if say the tape is not in the drive (EXAbyte or DEC TZ86) should it not
exit with
a '2' ? It appears to be exiting with a '1' in the case of a bad command
passed to
'mt' and if the tape is not in the drive.

scott
Scott.Burns@Labatt.Com
burns@eisner.decus.org

# /bin/sh
# TAPE="/dev/nrst0"
# mt unknown_cmd
mt: unknown_cmd: unknown command
# echo $?
1
# mt rewind
mt: /dev/nrst0: Input/output error
# echo $?
1     <<<<<<<<<<<<<-------------Should this not be a 2 as per the man page ???
# TAPE="/dev/rst0"
# mt unknown_cmd
mt: unknown_cmd: unknown command
# echo $?
1
# mt rewind
mt: /dev/rst0: Input/output error
# echo $?
1     <<<<<<<<<<<<<-------------Should this not be a 2 as per the man page ???