[comp.unix.wizards] A quick /etc/rmt question

dan@srs.UUCP (Dan Kegel) (05/26/88)

I'm trying to manipulate a remote tape drive from within a program, and 
/etc/rmt looks like just the ticket.  Unfortunately, I can't get it to
work even from the shell.  Here's what I tried:

    % ls -l /dev/rmt8
    crw-rw-rw-  1 root      30,   8 May 24 14:18 /dev/rmt8
    % /etc/rmt
    O /dev/rmt8 2			# command to open a device for r/w
    					# extra newline to get the reply?
    E2					# reply from /etc/rmt: ENOENT
    No such file or directory
    %
What am I doing wrong?  Thanks for any (preferably e-mailed) replies.
-- 
  Dan Kegel   "... earn it anew if thou wouldst possess it."  - Goethe: Faust
  srs!dan@cs.rochester.edu  rochester!srs!dan dan%srs.uucp@harvard.harvard.edu

dan@srs.UUCP (Dan Kegel) (05/26/88)

In article <886@srs.UUCP> I wrote:
> I'm trying to manipulate a remote tape drive from within a program, and 
> /etc/rmt looks like just the ticket.  Unfortunately, I can't get it to
> work even from the shell.  Here's what I tried:
> ...
> What am I doing wrong?  Thanks for any (preferably e-mailed) replies.

I recieved two helpful replies (almost before I posted the article, even!-)

#1:
> From: parmelee@wayback.cs.cornell.edu (Larry Parmelee)
> There was a remote mag tape library posted a while back.  It seems
> like it would be just what you want.
>	Newsgroups: mod.sources
>	Subject: v07i091:  Remote magtape library for 4.3BSD
>	Date: 18 Dec 86 01:21:16 GMT
> The person who posted it was
>	Arnold Robbins
>	Emory University Computing Center
>	{ akgua, gatech }!emory!arnold

#2:
> From: matt@srs.uucp (Matt Goheen)
> How about "O/dev/rmt8".

Sure enough, omitting the space between the O and the device name fixed
the problem.  Sun's documentation is a little misleading here:
>    The protocol  is  comprised  of  the following commands (a space is
>    present between each token).
>     O device mode     Open the specified device using the indicated mode.

Thanks for the help, guys.
-- 
  Dan Kegel   "... earn it anew if thou wouldst possess it."  - Goethe: Faust
  srs!dan@cs.rochester.edu  rochester!srs!dan dan%srs.uucp@harvard.harvard.edu

guy@gorodish.Sun.COM (Guy Harris) (05/27/88)

> Sure enough, omitting the space between the O and the device name fixed
> the problem.  Sun's documentation is a little misleading here:
> >    The protocol  is  comprised  of  the following commands (a space is
> >    present between each token).

Sun's documentation is derived from Berkeley's, and both are not just
misleading, but *wrong*.  There is no space between *any* of the tokens.  There
is a *newline* after each of the arguments to the command (or after the
command, if it takes no arguments), and there is no space between the command
and its first operand.

dkc@hotlr.ATT (Dave Cornutt) (05/28/88)

In article <886@srs.UUCP> srs!dan@cs.rochester.edu (Dan Kegel) writes:
 > I'm trying to manipulate a remote tape drive from within a program, and 
 > /etc/rmt looks like just the ticket.  Unfortunately, I can't get it to
 > work even from the shell.  Here's what I tried:
 > 
 >     % ls -l /dev/rmt8
 >     crw-rw-rw-  1 root      30,   8 May 24 14:18 /dev/rmt8
 >     % /etc/rmt
 >     O /dev/rmt8 2			# command to open a device for r/w
 >     					# extra newline to get the reply?
 >     E2					# reply from /etc/rmt: ENOENT
 >     No such file or directory
 >     %
 > What am I doing wrong?  Thanks for any (preferably e-mailed) replies.

I thought that this might be of general interest, so I'm posting it.

I have done this with the /etc/rmt that comes with Sun 3.4, which I
assume is the BSD 4.2 one.  The documentation is wrong; it leads
you to believe that arguments are separated by spaces, but this is
not the case.  The first argument is flush against the command letter
(no space), and subsequent args, if any, are separated by newlines.
So, it should look like this:

% /etc/rmt
O/dev/rmt8
2
A0

Note that: (1) there is no space between the O and the slash, and
(2) the A0 is the acknowledgement (the count is not significant
for open).

If you need more help, drop me a line.  I've written an /etc/rmt
for Vax S5R2 (paging).  It can't emulate all of the functions,
but it does enough of them so that I can dump from my 3/180
to one of the S5 Vaxen.

The BSD 4.3 one I think is the same, because I used to do dumps
from Suns to a Gould PN9000 running UTX 2.0, which is 4.3-based.

-- 
Dave Cornutt, AT&T Bell Labs (rm 4A406,x1088), Holmdel, NJ
UUCP:{ihnp4,allegra,cbosgd}!hotly!dkc
"The opinions expressed herein are not necessarily my employer's, not
necessarily mine, and probably not necessary"

dan@srs.UUCP (Dan Kegel) (05/30/88)

In article <889@srs.UUCP> I wrote:
> Sun's documentation for /etc/rmt is a little misleading here.
> A space isn't allowed between the command ('O') and the argument (/dev/rmt8).

guy@Sun.COM, Ken Lalonde, and Steve Hayman all pointed out the following:
> It's even worse.  The *real* syntax for, say, "O" is:
> O/dev/rmt8
> 2
> There is a *newline* between the tokens, not a space.  There is no separator
> between the command and the first token.

Guy is also filing a bug report (and says that BSD's documentation is also
wrong).  
Thanks again for the help, folks!
-- 
  Dan Kegel   "... earn it anew if thou wouldst possess it."  - Goethe: Faust
  srs!dan@cs.rochester.edu  rochester!srs!dan dan%srs.uucp@harvard.harvard.edu

barmar@think.COM (Barry Margolin) (05/31/88)

In article <54670@sun.uucp> guy@gorodish.Sun.COM (Guy Harris) writes:
>  There
>is a *newline* after each of the arguments to the command (or after the
>command, if it takes no arguments)

Almost right.  There is no newline after the command if it takes no
arguments.  The newlines are read by the function that reads the
arguments, and it is not called if no arguments are required.  If you
do type a newline after an argumentless command, the newline will be
read as the next command character, and it will not be a recognized
command, so rmt will exit.

Barry Margolin
Thinking Machines Corp.

barmar@think.com
uunet!think!barmar