=================================================================== RCS file: /cvsrepo/anoncvs/cvs/src/usr.bin/ssh/misc.c,v retrieving revision 1.11 retrieving revision 1.12 diff -u -r1.11 -r1.12 --- src/usr.bin/ssh/misc.c 2001/06/16 08:58:34 1.11 +++ src/usr.bin/ssh/misc.c 2001/06/26 17:27:24 1.12 @@ -1,4 +1,4 @@ -/* $OpenBSD: misc.c,v 1.11 2001/06/16 08:58:34 markus Exp $ */ +/* $OpenBSD: misc.c,v 1.12 2001/06/26 17:27:24 markus Exp $ */ /* * Copyright (c) 2000 Markus Friedl. All rights reserved. @@ -25,12 +25,13 @@ */ #include "includes.h" -RCSID("$OpenBSD: misc.c,v 1.11 2001/06/16 08:58:34 markus Exp $"); +RCSID("$OpenBSD: misc.c,v 1.12 2001/06/26 17:27:24 markus Exp $"); #include "misc.h" #include "log.h" #include "xmalloc.h" +/* remove newline at end of string */ char * chop(char *s) { @@ -46,6 +47,7 @@ } +/* set/unset filedescriptor to non-blocking */ void set_nonblock(int fd) { @@ -93,6 +95,7 @@ /* Characters considered whitespace in strsep calls. */ #define WHITESPACE " \t\r\n" +/* return next token in configuration line */ char * strdelim(char **s) { @@ -139,7 +142,13 @@ return copy; } -int a2port(const char *s) +/* + * Convert ASCII string to TCP/IP port number. + * Port must be >0 and <=65535. + * Return 0 if invalid. + */ +int +a2port(const char *s) { long port; char *endp; @@ -160,7 +169,29 @@ #define DAYS (HOURS * 24) #define WEEKS (DAYS * 7) -long convtime(const char *s) +/* + * Convert a time string into seconds; format is + * a sequence of: + * time[qualifier] + * + * Valid time qualifiers are: + * seconds + * s|S seconds + * m|M minutes + * h|H hours + * d|D days + * w|W weeks + * + * Examples: + * 90m 90 minutes + * 1h30m 90 minutes + * 2d 2 days + * 1w 1 week + * + * Return -1 if time string is invalid. + */ +long +convtime(const char *s) { long total, secs; const char *p; @@ -247,6 +278,7 @@ return (0); } +/* function to assist building execv() arguments */ void addargs(arglist *args, char *fmt, ...) {