summaryrefslogtreecommitdiffstats
path: root/sbin
diff options
context:
space:
mode:
authorache <ache@FreeBSD.org>1995-09-20 04:56:09 +0000
committerache <ache@FreeBSD.org>1995-09-20 04:56:09 +0000
commit1954e30948433371c8f9656ac8b54508f61a79cc (patch)
treeebeaf55e385159ccfb67b6a53c9db68ca1fbf561 /sbin
parent241d9dc635e0ca470094184ed7f6af3523143f96 (diff)
downloadFreeBSD-src-1954e30948433371c8f9656ac8b54508f61a79cc.zip
FreeBSD-src-1954e30948433371c8f9656ac8b54508f61a79cc.tar.gz
Make uucp-lock optional: -L option
Diffstat (limited to 'sbin')
-rw-r--r--sbin/startslip/startslip.113
-rw-r--r--sbin/startslip/startslip.c36
2 files changed, 31 insertions, 18 deletions
diff --git a/sbin/startslip/startslip.1 b/sbin/startslip/startslip.1
index dbfa6ae..2a0c368 100644
--- a/sbin/startslip/startslip.1
+++ b/sbin/startslip/startslip.1
@@ -47,6 +47,7 @@
]
.Op Fl h
.Op Fl l
+.Op Fl L
.Op Fl A Ar annexname
.Op Fl U Ar upscript
.Op Fl D Ar downscript
@@ -113,15 +114,15 @@ default value is 60.
Set maximum number of connection retries for one session,
default value is 6.
Value 0 means infinite count.
-.It Fl s Ar string1
+.It Fl s Ar stringN
The optional
-.Ar string
+.Ar stringN
is written to
.Ar device .
Return character is added automatically.
For a dialup modem,
the string is used to specify a dial sequence.
-Default string is return character.
+No string written by default.
You can specify several
.Fl s Ar stringN
arguments to use with each try, f.e. several host phone numbers.
@@ -177,6 +178,11 @@ Default value is no timeout.
Set SLIP unit number directly. Use with caution, no check for two
interfaces with same number made.
Default is dynamic assignment.
+.It Fl L
+Use uucp-style device locking. You need it unless you start
+.Nm startslip
+from external program which already does uucp locking.
+Default case is no uucp locking to satisfy such programs.
.El
.Sh FILES
.Bl -tag -width /var/run/startslip.<device>.pid -compact
@@ -185,6 +191,7 @@ pid stored here
.Sh SEE ALSO
.Xr sliplogin 8 ,
.Xr slattach 8 ,
+.Xr uustat 1 ,
/usr/share/examples/startslip
.Sh HISTORY
The
diff --git a/sbin/startslip/startslip.c b/sbin/startslip/startslip.c
index 3ff364f..2c88e92 100644
--- a/sbin/startslip/startslip.c
+++ b/sbin/startslip/startslip.c
@@ -30,7 +30,7 @@
* OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
* SUCH DAMAGE.
*
- * $Id: startslip.c,v 1.15 1995/09/18 14:01:11 ache Exp $
+ * $Id: startslip.c,v 1.16 1995/09/19 03:37:05 ache Exp $
*/
#ifndef lint
@@ -70,10 +70,11 @@ int speed = DEFAULT_BAUD;
int flowcontrol = FC_NONE;
int modem_control = 1; /* !CLOCAL+HUPCL iff we watch carrier. */
int sl_unit = -1;
+int uucp_lock = 0; /* uucp locking */
char *annex;
int hup;
int terminate;
-int locked;
+int locked = 0; /* uucp lock active */
int logged_in = 0;
int wait_time = 60; /* then back off */
int script_timeout = 90; /* connect script default timeout */
@@ -121,7 +122,7 @@ main(argc, argv)
pid_t pid;
struct termios t;
- while ((ch = getopt(argc, argv, "dhlb:s:t:w:A:U:D:W:K:O:S:")) != EOF)
+ while ((ch = getopt(argc, argv, "dhlb:s:t:w:A:U:D:W:K:O:S:L")) != EOF)
switch (ch) {
case 'd':
debug = 1;
@@ -155,6 +156,9 @@ main(argc, argv)
case 'D':
downscript = strdup(optarg);
break;
+ case 'L':
+ uucp_lock = 1;
+ break;
case 'l':
modem_control = 0;
break;
@@ -240,7 +244,8 @@ restart:
if (wfd) {
printd("fclose, ");
fclose(wfd);
- uu_unlock(dvname);
+ if (uucp_lock)
+ uu_unlock(dvname);
locked = 0;
wfd = NULL;
fd = -1;
@@ -248,7 +253,8 @@ restart:
} else if (fd >= 0) {
printd("close, ");
close(fd);
- uu_unlock(dvname);
+ if (uucp_lock)
+ uu_unlock(dvname);
locked = 0;
fd = -1;
sleep(5);
@@ -275,17 +281,20 @@ restart:
fclose(pfd);
}
printd("open");
- if (uu_lock(dvname)) {
- syslog(LOG_ERR, "can't lock %s", devicename);
- goto restart;
+ if (uucp_lock) {
+ if (uu_lock(dvname)) {
+ syslog(LOG_ERR, "can't lock %s", devicename);
+ goto restart;
+ }
+ locked = 1;
}
- locked = 1;
if ((fd = open(devicename, O_RDWR | O_NONBLOCK)) < 0) {
syslog(LOG_ERR, "open %s: %m\n", devicename);
if (first)
down(1);
else {
- uu_unlock(dvname);
+ if (uucp_lock)
+ uu_unlock(dvname);
locked = 0;
goto restart;
}
@@ -340,9 +349,6 @@ restart:
if (dialerstring) {
printd("send dialstring: %s\\r", dialerstring);
fprintf(wfd, "%s\r", dialerstring);
- } else {
- printd("send \\r");
- putc('\r', wfd);
}
printd("\n");
@@ -558,7 +564,7 @@ down(code)
close(fd);
if (pfd)
unlink(pidfile);
- if (locked)
+ if (uucp_lock && locked)
uu_unlock(dvname);
exit(code);
}
@@ -567,7 +573,7 @@ usage()
{
(void)fprintf(stderr, "\
usage: startslip [-d] [-b speed] [-s string1 [-s string2 [...]]] [-A annexname] \\\n\
- [-h] [-l] [-U upscript] [-D downscript] [-t script_timeout] \\\n\
+ [-h] [-l] [-U upscript] [-D downscript] [-t script_timeout] [-L]\\\n\
[-w retry_pause] [-W maxtries] [-K keepalive] [-O outfill] [-S unit] \\\n\
device user passwd\n");
exit(1);
OpenPOWER on IntegriCloud