Deleted Added
full compact
truncate.c (92922) truncate.c (132542)
1/*
2 * Copyright (c) 2000 Sheldon Hearn <sheldonh@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

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

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 */
27
28#ifndef lint
29static const char rcsid[] =
1/*
2 * Copyright (c) 2000 Sheldon Hearn <sheldonh@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

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

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 */
27
28#ifndef lint
29static const char rcsid[] =
30 "$FreeBSD: head/usr.bin/truncate/truncate.c 92922 2002-03-22 01:42:45Z imp $";
30 "$FreeBSD: head/usr.bin/truncate/truncate.c 132542 2004-07-22 13:38:10Z le $";
31#endif
32
33#include <sys/stat.h>
34
35#include <ctype.h>
36#include <err.h>
37#include <errno.h>
38#include <fcntl.h>

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

172 */
173 while (isdigit(*ls)) {
174 oflow = length * 10 + *ls++ - '0';
175 ASSIGN_CHK_OFLOW(oflow, length);
176 }
177
178 switch (*ls) {
179 case 'G':
31#endif
32
33#include <sys/stat.h>
34
35#include <ctype.h>
36#include <err.h>
37#include <errno.h>
38#include <fcntl.h>

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

172 */
173 while (isdigit(*ls)) {
174 oflow = length * 10 + *ls++ - '0';
175 ASSIGN_CHK_OFLOW(oflow, length);
176 }
177
178 switch (*ls) {
179 case 'G':
180 case 'g':
180 oflow = length * 1024;
181 ASSIGN_CHK_OFLOW(oflow, length);
182 case 'M':
181 oflow = length * 1024;
182 ASSIGN_CHK_OFLOW(oflow, length);
183 case 'M':
184 case 'm':
183 oflow = length * 1024;
184 ASSIGN_CHK_OFLOW(oflow, length);
185 case 'K':
185 oflow = length * 1024;
186 ASSIGN_CHK_OFLOW(oflow, length);
187 case 'K':
188 case 'k':
186 if (ls[1] != '\0')
187 return -1;
188 oflow = length * 1024;
189 ASSIGN_CHK_OFLOW(oflow, length);
190 case '\0':
191 break;
192 default:
193 return -1;

--- 14 unchanged lines hidden ---
189 if (ls[1] != '\0')
190 return -1;
191 oflow = length * 1024;
192 ASSIGN_CHK_OFLOW(oflow, length);
193 case '\0':
194 break;
195 default:
196 return -1;

--- 14 unchanged lines hidden ---