changeset 163:a913f894b7d8

Simplify touch -l slightly.
author Rob Landley <rob@landley.net>
date Thu, 15 Nov 2007 20:43:35 -0600
parents 0864aec90026
children c79290b54bd3
files toys/touch.c
diffstat 1 files changed, 2 insertions(+), 8 deletions(-) [+]
line wrap: on
line diff
--- a/toys/touch.c	Sat Nov 10 10:03:01 2007 +0000
+++ b/toys/touch.c	Thu Nov 15 20:43:35 2007 -0600
@@ -25,17 +25,11 @@
 	char *arg;
 	int i, set_a, set_m, create;
 	time_t curr_a, curr_m;
-	off_t length;
 
 	set_a = !!(toys.optflags & ATIME);
 	set_m = !!(toys.optflags & MTIME);
 	create = !(toys.optflags & NO_CREATE);
 
-	if (toys.optflags & LENGTH)
-		length = toy.touch.length;
-	else
-		length = -1;
-
 	if (toys.optflags & REFERENCE) {
 		struct stat sb;
 		if (toys.optflags & TIME)
@@ -86,8 +80,8 @@
 				buf.actime = sb.st_atime;
 		}
 
-		if (length != -1)
-			if (truncate(arg, length))
+		if (toys.optflags & LENGTH)
+			if (truncate(arg, toy.touch.length))
 				goto error;
 		if (utime(arg, &buf))
 error: