Deleted Added
full compact
misc.c (156251) misc.c (156701)
1/*-
2 * Copyright (c) 2003-2006, Maxime Henrion <mux@FreeBSD.org>
3 * All rights reserved.
4 *
5 * Redistribution and use in source and binary forms, with or without
6 * modification, are permitted provided that the following conditions
7 * are met:
8 * 1. Redistributions of source code must retain the above copyright

--- 9 unchanged lines hidden (view full) ---

18 * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
19 * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
20 * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
21 * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
22 * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
23 * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
24 * SUCH DAMAGE.
25 *
1/*-
2 * Copyright (c) 2003-2006, Maxime Henrion <mux@FreeBSD.org>
3 * All rights reserved.
4 *
5 * Redistribution and use in source and binary forms, with or without
6 * modification, are permitted provided that the following conditions
7 * are met:
8 * 1. Redistributions of source code must retain the above copyright

--- 9 unchanged lines hidden (view full) ---

18 * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
19 * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
20 * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
21 * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
22 * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
23 * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
24 * SUCH DAMAGE.
25 *
26 * $FreeBSD: vendor/csup/dist/contrib/csup/misc.c 156251 2006-03-03 18:45:12Z mux $
26 * $FreeBSD: vendor/csup/dist/contrib/csup/misc.c 156701 2006-03-14 03:51:13Z mux $
27 */
28
29#include <sys/types.h>
30#include <sys/stat.h>
31#include <openssl/md5.h>
32
33#include <assert.h>
34#include <err.h>
35#include <errno.h>
36#include <fcntl.h>
27 */
28
29#include <sys/types.h>
30#include <sys/stat.h>
31#include <openssl/md5.h>
32
33#include <assert.h>
34#include <err.h>
35#include <errno.h>
36#include <fcntl.h>
37#include <limits.h>
37#include <pthread.h>
38#include <stdarg.h>
39#include <stdio.h>
40#include <stdlib.h>
41#include <string.h>
42#include <time.h>
43#include <unistd.h>
44

--- 14 unchanged lines hidden (view full) ---

59 float backoff;
60 float jitter;
61};
62
63static void bt_update(struct backoff_timer *);
64static void bt_addjitter(struct backoff_timer *);
65
66int
38#include <pthread.h>
39#include <stdarg.h>
40#include <stdio.h>
41#include <stdlib.h>
42#include <string.h>
43#include <time.h>
44#include <unistd.h>
45

--- 14 unchanged lines hidden (view full) ---

60 float backoff;
61 float jitter;
62};
63
64static void bt_update(struct backoff_timer *);
65static void bt_addjitter(struct backoff_timer *);
66
67int
68asciitoint(const char *s, int *val, int base)
69{
70 char *end;
71 long longval;
72
73 errno = 0;
74 longval = strtol(s, &end, base);
75 if (errno || *end != '\0')
76 return (-1);
77 if (longval > INT_MAX || longval < INT_MIN) {
78 errno = ERANGE;
79 return (-1);
80 }
81 *val = longval;
82 return (0);
83}
84
85int
67lprintf(int level, const char *fmt, ...)
68{
69 FILE *to;
70 va_list ap;
71 int ret;
72
73 if (level > verbose)
74 return (0);

--- 429 unchanged lines hidden ---
86lprintf(int level, const char *fmt, ...)
87{
88 FILE *to;
89 va_list ap;
90 int ret;
91
92 if (level > verbose)
93 return (0);

--- 429 unchanged lines hidden ---