tftpd.c (241848) | tftpd.c (246139) |
---|---|
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 --- 29 unchanged lines hidden (view full) --- 38#endif /* not lint */ 39 40#ifndef lint 41#if 0 42static char sccsid[] = "@(#)tftpd.c 8.1 (Berkeley) 6/4/93"; 43#endif 44#endif /* not lint */ 45#include <sys/cdefs.h> | 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 --- 29 unchanged lines hidden (view full) --- 38#endif /* not lint */ 39 40#ifndef lint 41#if 0 42static char sccsid[] = "@(#)tftpd.c 8.1 (Berkeley) 6/4/93"; 43#endif 44#endif /* not lint */ 45#include <sys/cdefs.h> |
46__FBSDID("$FreeBSD: head/libexec/tftpd/tftpd.c 241848 2012-10-22 03:07:05Z eadler $"); | 46__FBSDID("$FreeBSD: head/libexec/tftpd/tftpd.c 246139 2013-01-31 00:02:36Z marius $"); |
47 48/* 49 * Trivial file transfer protocol server. 50 * 51 * This version includes many modifications by Jim Guyton 52 * <guyton@rand-unix>. 53 */ 54 --- 5 unchanged lines hidden (view full) --- 60#include <netinet/in.h> 61#include <arpa/tftp.h> 62 63#include <ctype.h> 64#include <errno.h> 65#include <fcntl.h> 66#include <netdb.h> 67#include <pwd.h> | 47 48/* 49 * Trivial file transfer protocol server. 50 * 51 * This version includes many modifications by Jim Guyton 52 * <guyton@rand-unix>. 53 */ 54 --- 5 unchanged lines hidden (view full) --- 60#include <netinet/in.h> 61#include <arpa/tftp.h> 62 63#include <ctype.h> 64#include <errno.h> 65#include <fcntl.h> 66#include <netdb.h> 67#include <pwd.h> |
68#include <stdint.h> |
|
68#include <stdio.h> 69#include <stdlib.h> 70#include <string.h> 71#include <syslog.h> 72#include <tcpd.h> 73#include <unistd.h> 74 75#include "tftp-file.h" --- 718 unchanged lines hidden (view full) --- 794 if (debug&DEBUG_SIMPLE) 795 tftp_log(LOG_DEBUG, "Transmitting file"); 796 797 read_init(0, file, mode); 798 block = 1; 799 tftp_send(peer, &block, &ts); 800 read_close(); 801 if (debug&DEBUG_SIMPLE) | 69#include <stdio.h> 70#include <stdlib.h> 71#include <string.h> 72#include <syslog.h> 73#include <tcpd.h> 74#include <unistd.h> 75 76#include "tftp-file.h" --- 718 unchanged lines hidden (view full) --- 795 if (debug&DEBUG_SIMPLE) 796 tftp_log(LOG_DEBUG, "Transmitting file"); 797 798 read_init(0, file, mode); 799 block = 1; 800 tftp_send(peer, &block, &ts); 801 read_close(); 802 if (debug&DEBUG_SIMPLE) |
802 tftp_log(LOG_INFO, "Sent %d bytes in %d seconds", 803 ts.amount, time(NULL) - now); | 803 tftp_log(LOG_INFO, "Sent %jd bytes in %jd seconds", 804 (intmax_t)ts.amount, (intmax_t)time(NULL) - now); |
804} 805 806static void 807tftp_recvfile(int peer, const char *mode) 808{ 809 uint16_t block; 810 struct timeval now1, now2; 811 struct tftp_stats ts; --- 15 unchanged lines hidden (view full) --- 827 if (now1.tv_usec > now2.tv_usec) { 828 now2.tv_usec += 1000000; 829 now2.tv_sec--; 830 } 831 832 f = now2.tv_sec - now1.tv_sec + 833 (now2.tv_usec - now1.tv_usec) / 100000.0; 834 tftp_log(LOG_INFO, | 805} 806 807static void 808tftp_recvfile(int peer, const char *mode) 809{ 810 uint16_t block; 811 struct timeval now1, now2; 812 struct tftp_stats ts; --- 15 unchanged lines hidden (view full) --- 828 if (now1.tv_usec > now2.tv_usec) { 829 now2.tv_usec += 1000000; 830 now2.tv_sec--; 831 } 832 833 f = now2.tv_sec - now1.tv_sec + 834 (now2.tv_usec - now1.tv_usec) / 100000.0; 835 tftp_log(LOG_INFO, |
835 "Download of %d bytes in %d blocks completed after %0.1f seconds\n", 836 ts.amount, block, f); | 836 "Download of %jd bytes in %d blocks completed after %0.1f seconds\n", 837 (intmax_t)ts.amount, block, f); |
837 } 838 839 return; 840} | 838 } 839 840 return; 841} |