/* The pipes for sending data to remote tape drives. */
static int to_remote[MAXUNIT][2] = {{-1, -1}, {-1, -1}, {-1, -1}, {-1, -1}};
+#define RMT_COMMAND (rmt_command_option ? rmt_command_option : "/etc/rmt")
+
/* Temporary variable used by macros in rmt.h. */
-char *rmt_path__;
+char *rmt_dev_name__;
\f
/* Close remote tape connection HANDLE, and reset errno to ERRNO_VALUE. */
if (rexecserv = getservbyname ("exec", "tcp"), !rexecserv)
error (EXIT_ON_EXEC_ERROR, 0, _("exec/tcp: Service not available"));
- result = rexec (&host, rexecserv->s_port, user, 0, "/etc/rmt", 0);
+ result = rexec (&host, rexecserv->s_port, user, 0, RMT_COMMAND, 0);
if (fclose (stdin) == EOF)
error (0, errno, _("stdin"));
fdopen (saved_stdin, "r");
}
/* Open a file (a magnetic tape device?) on the system specified in
- PATH, as the given user. PATH has the form `[USER@]HOST:FILE'.
+ FILE_NAME, as the given user. FILE_NAME has the form `[USER@]HOST:FILE'.
OPEN_MODE is O_RDONLY, O_WRONLY, etc. If successful, return the
remote pipe number plus BIAS. REMOTE_SHELL may be overridden. On
error, return -1. */
int
-rmt_open__ (const char *path, int open_mode, int bias, const char *remote_shell)
+rmt_open__ (const char *file_name, int open_mode, int bias,
+ const char *remote_shell)
{
int remote_pipe_number; /* pseudo, biased file descriptor */
- char *path_copy ; /* copy of path string */
+ char *file_name_copy; /* copy of file_name string */
char *remote_host; /* remote host name */
char *remote_file; /* remote file name (often a device) */
char *remote_user; /* remote user name */
{
char *cursor;
- path_copy = xstrdup (path);
- remote_host = path_copy;
+ file_name_copy = xstrdup (file_name);
+ remote_host = file_name_copy;
remote_user = 0;
remote_file = 0;
- for (cursor = path_copy; *cursor; cursor++)
+ for (cursor = file_name_copy; *cursor; cursor++)
switch (*cursor)
{
default:
break;
case '\n':
- /* Do not allow newlines in the path, since the protocol
+ /* Do not allow newlines in the file_name, since the protocol
uses newline delimiters. */
- free (path_copy);
+ free (file_name_copy);
errno = ENOENT;
return -1;
if (READ_SIDE (remote_pipe_number) < 0)
{
int e = errno;
- free (path_copy);
+ free (file_name_copy);
errno = e;
return -1;
}
#ifdef REMOTE_SHELL
remote_shell = REMOTE_SHELL;
#else
- free (path_copy);
+ free (file_name_copy);
errno = EIO;
return -1;
#endif
|| pipe (from_remote[remote_pipe_number]) == -1)
{
int e = errno;
- free (path_copy);
+ free (file_name_copy);
errno = e;
return -1;
}
if (status == -1)
{
int e = errno;
- free (path_copy);
+ free (file_name_copy);
errno = e;
return -1;
}
if (remote_user)
execl (remote_shell, remote_shell_basename, remote_host,
- "-l", remote_user, "/etc/rmt", (char *) 0);
+ "-l", remote_user, RMT_COMMAND, (char *) 0);
else
execl (remote_shell, remote_shell_basename, remote_host,
- "/etc/rmt", (char *) 0);
+ RMT_COMMAND, (char *) 0);
/* Bad problems if we get here. */
{
int e = errno;
free (command_buffer);
- free (path_copy);
+ free (file_name_copy);
_rmt_shutdown (remote_pipe_number, e);
return -1;
}
free (command_buffer);
}
- free (path_copy);
+ free (file_name_copy);
return remote_pipe_number + bias;
}