logger.c (92920) | logger.c (93525) |
---|---|
1/* 2 * Copyright (c) 1983, 1993 3 * The Regents of the University of California. 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 --- 27 unchanged lines hidden (view full) --- 36"@(#) Copyright (c) 1983, 1993\n\ 37 The Regents of the University of California. All rights reserved.\n"; 38#endif /* not lint */ 39 40#ifndef lint 41#if 0 42static char sccsid[] = "@(#)logger.c 8.1 (Berkeley) 6/6/93"; 43#endif | 1/* 2 * Copyright (c) 1983, 1993 3 * The Regents of the University of California. 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 --- 27 unchanged lines hidden (view full) --- 36"@(#) Copyright (c) 1983, 1993\n\ 37 The Regents of the University of California. All rights reserved.\n"; 38#endif /* not lint */ 39 40#ifndef lint 41#if 0 42static char sccsid[] = "@(#)logger.c 8.1 (Berkeley) 6/6/93"; 43#endif |
44static const char rcsid[] = 45 "$FreeBSD: head/usr.bin/logger/logger.c 92920 2002-03-22 01:22:50Z imp $"; | |
46#endif /* not lint */ 47 | 44#endif /* not lint */ 45 |
46#include <sys/cdefs.h> 47__FBSDID("$FreeBSD: head/usr.bin/logger/logger.c 93525 2002-04-01 11:06:00Z dwmalone $"); 48 |
|
48#include <sys/types.h> 49#include <sys/socket.h> 50#include <netinet/in.h> 51 52#include <ctype.h> 53#include <err.h> 54#include <netdb.h> 55#include <stdio.h> --- 82 unchanged lines hidden (view full) --- 138 139 /* setup for logging */ 140 openlog(tag ? tag : getlogin(), logflags, 0); 141 (void) fclose(stdout); 142 143 /* log input line if appropriate */ 144 if (argc > 0) { 145 register char *p, *endp; | 49#include <sys/types.h> 50#include <sys/socket.h> 51#include <netinet/in.h> 52 53#include <ctype.h> 54#include <err.h> 55#include <netdb.h> 56#include <stdio.h> --- 82 unchanged lines hidden (view full) --- 139 140 /* setup for logging */ 141 openlog(tag ? tag : getlogin(), logflags, 0); 142 (void) fclose(stdout); 143 144 /* log input line if appropriate */ 145 if (argc > 0) { 146 register char *p, *endp; |
146 int len; | 147 size_t len; |
147 148 for (p = buf, endp = buf + sizeof(buf) - 2; *argv;) { 149 len = strlen(*argv); 150 if (p + len > endp && p > buf) { 151 logmessage(pri, host, buf); 152 p = buf; 153 } 154 if (len > sizeof(buf) - 1) --- 66 unchanged lines hidden (view full) --- 221 222 for (i = 0; i < nsock; ++i) { 223 lsent = sendto(socks[i].sock, line, len, 0, 224 (struct sockaddr *)&socks[i].addr, 225 socks[i].addrlen); 226 if (lsent == len && !send_to_all) 227 break; 228 } | 148 149 for (p = buf, endp = buf + sizeof(buf) - 2; *argv;) { 150 len = strlen(*argv); 151 if (p + len > endp && p > buf) { 152 logmessage(pri, host, buf); 153 p = buf; 154 } 155 if (len > sizeof(buf) - 1) --- 66 unchanged lines hidden (view full) --- 222 223 for (i = 0; i < nsock; ++i) { 224 lsent = sendto(socks[i].sock, line, len, 0, 225 (struct sockaddr *)&socks[i].addr, 226 socks[i].addrlen); 227 if (lsent == len && !send_to_all) 228 break; 229 } |
229 if (lsent != len) | 230 if (lsent != len) { |
230 if (lsent == -1) 231 warn ("sendto"); 232 else 233 warnx ("sendto: short send - %d bytes", lsent); | 231 if (lsent == -1) 232 warn ("sendto"); 233 else 234 warnx ("sendto: short send - %d bytes", lsent); |
235 } |
|
234 235 free(line); 236} 237 238/* 239 * Decode a symbolic name to a numeric value 240 */ 241int --- 49 unchanged lines hidden --- | 236 237 free(line); 238} 239 240/* 241 * Decode a symbolic name to a numeric value 242 */ 243int --- 49 unchanged lines hidden --- |