Use err(3). Add missing prototypes. Cosmetic in usage string.

This commit is contained in:
Philippe Charnier 1997-06-19 14:38:53 +00:00
parent ac9df8c8e7
commit 64c12016e7
Notes: svn2git 2020-12-20 02:59:44 +00:00
svn path=/head/; revision=26739

View File

@ -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 <time.h>
#include <unistd.h>
#include <libutil.h>
#include <err.h>
#include <netinet/in.h>
#include <net/if.h>
@ -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 @@ main(argc, argv)
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);
}