Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Support
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in / Register
Toggle navigation
N
net-tools
Project overview
Project overview
Details
Activity
Releases
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Issues
0
Issues
0
List
Boards
Labels
Milestones
Merge Requests
0
Merge Requests
0
Analytics
Analytics
Repository
Value Stream
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Create a new issue
Commits
Issue Boards
Open sidebar
Kirill Smelkov
net-tools
Commits
46150910
Commit
46150910
authored
Dec 31, 2011
by
Bernd Eckenfels
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
slattach: add support for /dev/ptmx [Bug:3467521]
parent
aa6c8854
Changes
1
Show whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
29 additions
and
3 deletions
+29
-3
slattach.c
slattach.c
+29
-3
No files found.
slattach.c
View file @
46150910
...
@@ -67,6 +67,9 @@
...
@@ -67,6 +67,9 @@
#ifndef _UID_UUCP
#ifndef _UID_UUCP
#define _UID_UUCP "uucp"
/* owns locks */
#define _UID_UUCP "uucp"
/* owns locks */
#endif
#endif
#ifndef _PATH_DEVPTMX
#define _PATH_DEVPTMX "/dev/ptmx"
/* pseudo-terminal master */
#endif
#define DEF_PROTO "cslip"
#define DEF_PROTO "cslip"
...
@@ -108,6 +111,7 @@ struct termios tty_saved, /* saved TTY device state */
...
@@ -108,6 +111,7 @@ struct termios tty_saved, /* saved TTY device state */
int
tty_sdisc
,
/* saved TTY line discipline */
int
tty_sdisc
,
/* saved TTY line discipline */
tty_ldisc
,
/* current TTY line discipline */
tty_ldisc
,
/* current TTY line discipline */
tty_fd
=
-
1
;
/* TTY file descriptor */
tty_fd
=
-
1
;
/* TTY file descriptor */
char
*
path_pts
=
NULL
;
/* slave pseudo-terminal device */
int
opt_c
=
0
;
/* "command" to run at exit */
int
opt_c
=
0
;
/* "command" to run at exit */
int
opt_e
=
0
;
/* "activate only" flag */
int
opt_e
=
0
;
/* "activate only" flag */
int
opt_h
=
0
;
/* "hangup" on carrier loss */
int
opt_h
=
0
;
/* "hangup" on carrier loss */
...
@@ -492,7 +496,28 @@ tty_open(char *name, const char *speed)
...
@@ -492,7 +496,28 @@ tty_open(char *name, const char *speed)
return
(
-
errno
);
return
(
-
errno
);
}
}
tty_fd
=
fd
;
tty_fd
=
fd
;
if
(
opt_d
)
printf
(
"slattach: tty_open: %s (fd=%d) "
,
path_open
,
fd
);
if
(
opt_d
)
printf
(
"slattach: tty_open: %s (fd=%d)
\n
"
,
path_open
,
fd
);
if
(
!
strcmp
(
path_open
,
_PATH_DEVPTMX
))
{
if
(
opt_d
)
printf
(
"slattach: tty_open: trying to grantpt and unlockpt
\n
"
);
if
(
grantpt
(
fd
)
<
0
)
{
if
(
opt_q
==
0
)
fprintf
(
stderr
,
"slattach: tty_open: grantpt: %s
\n
"
,
strerror
(
errno
));
return
(
-
errno
);
}
if
(
unlockpt
(
fd
)
<
0
)
{
if
(
opt_q
==
0
)
fprintf
(
stderr
,
"slattach: tty_open: unlockpt: %s
\n
"
,
strerror
(
errno
));
return
(
-
errno
);
}
path_pts
=
ptsname
(
fd
);
if
(
path_pts
==
NULL
)
{
if
(
opt_q
==
0
)
fprintf
(
stderr
,
"slattach: tty_open: ptsname: %s
\n
"
,
strerror
(
errno
));
return
(
-
errno
);
}
if
(
opt_d
)
printf
(
"slattach: tty_open: %s: slave pseudo-terminal is %s
\n
"
,
path_open
,
path_pts
);
}
}
else
{
}
else
{
tty_fd
=
0
;
tty_fd
=
0
;
}
}
...
@@ -707,6 +732,7 @@ main(int argc, char *argv[])
...
@@ -707,6 +732,7 @@ main(int argc, char *argv[])
if
(
tty_get_name
(
buff
))
{
return
(
3
);
}
if
(
tty_get_name
(
buff
))
{
return
(
3
);
}
printf
(
_
(
"%s started"
),
proto
);
printf
(
_
(
"%s started"
),
proto
);
if
(
path_dev
!=
NULL
)
printf
(
_
(
" on %s"
),
path_dev
);
if
(
path_dev
!=
NULL
)
printf
(
_
(
" on %s"
),
path_dev
);
if
(
path_pts
!=
NULL
)
printf
(
_
(
" ptsname %s"
),
path_pts
);
printf
(
_
(
" interface %s
\n
"
),
buff
);
printf
(
_
(
" interface %s
\n
"
),
buff
);
}
}
...
...
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment