From 64c12016e7c3d0659543953fe9bb754a4dc306d8 Mon Sep 17 00:00:00 2001 From: Philippe Charnier Date: Thu, 19 Jun 1997 14:38:53 +0000 Subject: [PATCH] Use err(3). Add missing prototypes. Cosmetic in usage string. --- sbin/startslip/startslip.c | 31 ++++++++++++++++++++----------- 1 file changed, 20 insertions(+), 11 deletions(-) diff --git a/sbin/startslip/startslip.c b/sbin/startslip/startslip.c index 60d97e029c62..aa92219fc425 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.23 1997/03/29 03:33:08 imp Exp $ + * $Id: startslip.c,v 1.24 1997/03/31 22:50:30 brian Exp $ */ #ifndef lint @@ -61,6 +61,7 @@ static char sccsid[] = "@(#)startslip.c 8.1 (Berkeley) 6/5/93"; #include #include #include +#include #include #include @@ -109,6 +110,12 @@ int debug = 0; #endif #define printd if (debug) printf +int carrier __P((void)); +void down __P((int)); +int getline __P((char *, int, int, time_t)); +static void usage __P((void)); + +int main(argc, argv) int argc; char **argv; @@ -138,11 +145,8 @@ main(argc, argv) speed = atoi(optarg); break; case 's': - if (diali >= MAXDIALS) { - (void)fprintf(stderr, - "max dial strings number (%d) exceeded\n", MAXDIALS); - exit(1); - } + if (diali >= MAXDIALS) + errx(1, "max dial strings number (%d) exceeded", MAXDIALS); dials[diali++] = strdup(optarg); break; case 't': @@ -473,6 +477,7 @@ restart: printd("sigpause return\n"); } goto restart; + return(0); /* not reached */ } void @@ -505,6 +510,7 @@ sigterm() terminate = 1; } +int getline(buf, size, fd, fintimeout) char *buf; int size, fd; @@ -561,6 +567,7 @@ getline(buf, size, fd, fintimeout) return (0); } +int carrier() { int comstate; @@ -573,6 +580,7 @@ carrier() return !!(comstate & TIOCM_CD); } +void down(code) { if (fd > -1) @@ -584,12 +592,13 @@ down(code) exit(code); } +static void 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] [-L]\\\n\ - [-w retry_pause] [-W maxtries] [-K keepalive] [-O outfill] [-S unit] \\\n\ - device user passwd\n"); + (void)fprintf(stderr, "%s\n%s\n%s\n%s\n", +"usage: startslip [-d] [-b speed] [-s string1 [-s string2 [...]]] [-h] [-l]", +" [-L] [-A annexname] [-U upscript] [-D downscript]", +" [-t script_timeout] [-W maxtries] [-w retry_pause]", +" [-K keepalive] [-O outfill] [-S unit] device user passwd"); exit(1); }