Browse Source

Plan 9 from Bell Labs 2006-09-07

David du Colombier 14 years ago
parent
commit
129a2a43c2
4 changed files with 40 additions and 26 deletions
  1. 5 5
      dist/replica/_plan9.db
  2. 5 5
      dist/replica/plan9.db
  3. 6 0
      dist/replica/plan9.log
  4. 24 16
      sys/src/cmd/cmp.c

+ 5 - 5
dist/replica/_plan9.db

@@ -182,7 +182,7 @@
 386/bin/cifscmd - 775 sys sys 1155491749 343673
 386/bin/cleanname - 775 sys sys 1148500614 58635
 386/bin/clock - 775 sys sys 1155491749 158782
-386/bin/cmp - 775 sys sys 1148500615 40600
+386/bin/cmp - 775 sys sys 1157597609 40658
 386/bin/colors - 775 sys sys 1155491750 151061
 386/bin/comm - 775 sys sys 1148500616 61680
 386/bin/con - 775 sys sys 1148500616 78580
@@ -228,7 +228,7 @@
 386/bin/faces - 775 sys sys 1155491750 194710
 386/bin/factor - 775 sys sys 1148500632 61793
 386/bin/fcp - 775 sys sys 1148500632 82527
-386/bin/file - 775 sys sys 1157143567 124531
+386/bin/file - 775 sys sys 1157570246 124531
 386/bin/fmt - 775 sys sys 1148500633 65661
 386/bin/fortune - 775 sys sys 1148500633 67450
 386/bin/fossil - 20000000775 sys sys 1042005470 0
@@ -333,7 +333,7 @@
 386/bin/mount - 775 sys sys 1148500672 73436
 386/bin/ms2html - 775 sys sys 1148500672 104279
 386/bin/mtime - 775 sys sys 1148500673 59470
-386/bin/mug - 775 sys sys 1157143842 176351
+386/bin/mug - 775 sys sys 1157570246 176473
 386/bin/mv - 775 sys sys 1148500673 65825
 386/bin/ndb - 20000000775 sys sys 985743147 0
 386/bin/ndb/cs - 775 sys sys 1148500674 150956
@@ -510,7 +510,7 @@
 386/bin/webcookies - 775 sys sys 1148500701 167738
 386/bin/webfs - 775 sys sys 1134389883 360008
 386/bin/webfsget - 775 sys sys 1148500702 39177
-386/bin/wikifs - 775 sys sys 1157146170 203727
+386/bin/wikifs - 775 sys sys 1157570247 203727
 386/bin/winwatch - 775 sys sys 1155491758 155371
 386/bin/x.echo - 775 sys sys 1148500702 57686
 386/bin/xd - 775 sys sys 1148500703 64373
@@ -9883,7 +9883,7 @@ sys/src/cmd/chgrp.c - 664 sys sys 1014926580 624
 sys/src/cmd/chmod.c - 664 sys sys 1079372923 1904
 sys/src/cmd/cleanname.c - 664 sys sys 944960760 715
 sys/src/cmd/clock.c - 664 sys sys 1014925410 1881
-sys/src/cmd/cmp.c - 664 sys sys 1134330528 2379
+sys/src/cmd/cmp.c - 664 sys sys 1157581072 2491
 sys/src/cmd/colors.c - 664 sys sys 951763912 3186
 sys/src/cmd/comm.c - 664 sys sys 1093979717 2140
 sys/src/cmd/con - 20000000775 sys sys 944961996 0

+ 5 - 5
dist/replica/plan9.db

@@ -182,7 +182,7 @@
 386/bin/cifscmd - 775 sys sys 1155491749 343673
 386/bin/cleanname - 775 sys sys 1148500614 58635
 386/bin/clock - 775 sys sys 1155491749 158782
-386/bin/cmp - 775 sys sys 1148500615 40600
+386/bin/cmp - 775 sys sys 1157597609 40658
 386/bin/colors - 775 sys sys 1155491750 151061
 386/bin/comm - 775 sys sys 1148500616 61680
 386/bin/con - 775 sys sys 1148500616 78580
@@ -228,7 +228,7 @@
 386/bin/faces - 775 sys sys 1155491750 194710
 386/bin/factor - 775 sys sys 1148500632 61793
 386/bin/fcp - 775 sys sys 1148500632 82527
-386/bin/file - 775 sys sys 1157143567 124531
+386/bin/file - 775 sys sys 1157570246 124531
 386/bin/fmt - 775 sys sys 1148500633 65661
 386/bin/fortune - 775 sys sys 1148500633 67450
 386/bin/fossil - 20000000775 sys sys 1042005470 0
@@ -333,7 +333,7 @@
 386/bin/mount - 775 sys sys 1148500672 73436
 386/bin/ms2html - 775 sys sys 1148500672 104279
 386/bin/mtime - 775 sys sys 1148500673 59470
-386/bin/mug - 775 sys sys 1157143842 176351
+386/bin/mug - 775 sys sys 1157570246 176473
 386/bin/mv - 775 sys sys 1148500673 65825
 386/bin/ndb - 20000000775 sys sys 985743147 0
 386/bin/ndb/cs - 775 sys sys 1148500674 150956
@@ -510,7 +510,7 @@
 386/bin/webcookies - 775 sys sys 1148500701 167738
 386/bin/webfs - 775 sys sys 1134389883 360008
 386/bin/webfsget - 775 sys sys 1148500702 39177
-386/bin/wikifs - 775 sys sys 1157146170 203727
+386/bin/wikifs - 775 sys sys 1157570247 203727
 386/bin/winwatch - 775 sys sys 1155491758 155371
 386/bin/x.echo - 775 sys sys 1148500702 57686
 386/bin/xd - 775 sys sys 1148500703 64373
@@ -9883,7 +9883,7 @@ sys/src/cmd/chgrp.c - 664 sys sys 1014926580 624
 sys/src/cmd/chmod.c - 664 sys sys 1079372923 1904
 sys/src/cmd/cleanname.c - 664 sys sys 944960760 715
 sys/src/cmd/clock.c - 664 sys sys 1014925410 1881
-sys/src/cmd/cmp.c - 664 sys sys 1134330528 2379
+sys/src/cmd/cmp.c - 664 sys sys 1157581072 2491
 sys/src/cmd/colors.c - 664 sys sys 951763912 3186
 sys/src/cmd/comm.c - 664 sys sys 1093979717 2140
 sys/src/cmd/con - 20000000775 sys sys 944961996 0

+ 6 - 0
dist/replica/plan9.log

@@ -30363,3 +30363,9 @@
 1157149806 0 c lib/face/48x48x8/f/fst.1 - 664 sys sys 1157149515 1099
 1157169606 0 c sys/src/cmd/wikifs/fs.c - 664 sys sys 1157169486 14459
 1157169606 1 c sys/src/cmd/wikifs/io.c - 664 sys sys 1157169580 11896
+1157571004 0 c 386/bin/wikifs - 775 sys sys 1157570247 203727
+1157571004 1 c 386/bin/file - 775 sys sys 1157570246 124531
+1157571004 2 c 386/bin/mug - 775 sys sys 1157570246 176473
+1157581805 0 c 386/bin/cmp - 775 sys sys 1157581077 40658
+1157581805 1 c sys/src/cmd/cmp.c - 664 sys sys 1157581072 2491
+1157598006 0 c 386/bin/cmp - 775 sys sys 1157597609 40658

+ 24 - 16
sys/src/cmd/cmp.c

@@ -1,5 +1,6 @@
 #include <u.h>
 #include <libc.h>
+#include <ctype.h>
 
 #define		BUF		65536
 
@@ -9,6 +10,24 @@ int Lflag = 0;
 
 static void usage(void);
 
+char **
+seekoff(int fd, char *name, char **argv)
+{
+	vlong o;
+
+	if(*argv){
+		if (!isascii(**argv) || !isdigit(**argv))
+			usage();
+		o = strtoll(*argv++, 0, 0);
+		if(seek(fd, o, 0) < 0){
+			if(!sflag) fprint(2, "cmp: %s: seek by %lld: %r\n",
+				name, o);
+			exits("seek");
+		}
+	}
+	return argv;
+}
+
 void
 main(int argc, char *argv[])
 {
@@ -16,7 +35,7 @@ main(int argc, char *argv[])
 	uchar *p, *q;
 	uchar buf1[BUF], buf2[BUF];
 	int f1, f2;
-	vlong nc = 1, o, l = 1;
+	vlong nc = 1, l = 1;
 	char *name1, *name2;
 	uchar *b1s, *b1e, *b2s, *b2e;
 
@@ -26,7 +45,7 @@ main(int argc, char *argv[])
 	case 'L':	Lflag = 1; break;
 	default:	usage();
 	}ARGEND
-	if(argc < 2)
+	if(argc < 2 || argc > 4)
 		usage();
 	if((f1 = open(name1 = *argv++, OREAD)) == -1){
 		if(!sflag) perror(name1);
@@ -36,22 +55,11 @@ main(int argc, char *argv[])
 		if(!sflag) perror(name2);
 		exits("open");
 	}
-	if(*argv){
-		o = strtoll(*argv++, 0, 0);
-		if(seek(f1, o, 0) < 0){
-			if(!sflag) perror("cmp: seek by offset1");
-			exits("seek 1");
-		}
-	}
-	if(*argv){
-		o = strtoll(*argv++, 0, 0);
-		if(seek(f2, o, 0) < 0){
-			if(!sflag) perror("cmp: seek by offset2");
-			exits("seek 2");
-		}
-	}
+	argv = seekoff(f1, name1, argv);
+	argv = seekoff(f2, name2, argv);
 	if(*argv)
 		usage();
+
 	b1s = b1e = buf1;
 	b2s = b2e = buf2;
 	for(;;){