about summary refs log tree commit diff
path: root/mseq.c
diff options
context:
space:
mode:
authorChristian Neukirchen <chneukirchen@gmail.com>2016-07-26 16:55:55 +0200
committerChristian Neukirchen <chneukirchen@gmail.com>2016-07-26 16:55:55 +0200
commit2b81707c51f2ae26db5129d15741fe89a3b781d2 (patch)
tree7233dfbcd955317fb708698cff46c35f2df7b3e2 /mseq.c
parent1fd83bf1a8279cd9b2be83db0eaba67831ebc6ca (diff)
downloadmblaze-2b81707c51f2ae26db5129d15741fe89a3b781d2.tar.gz
mblaze-2b81707c51f2ae26db5129d15741fe89a3b781d2.tar.xz
mblaze-2b81707c51f2ae26db5129d15741fe89a3b781d2.zip
rename map to seq
The old terminology didn't make much sense to users.
Diffstat (limited to 'mseq.c')
-rw-r--r--mseq.c13
1 files changed, 7 insertions, 6 deletions
diff --git a/mseq.c b/mseq.c
index 7ce843f..f20ec5a 100644
--- a/mseq.c
+++ b/mseq.c
@@ -1,4 +1,5 @@
 #include <dirent.h>
+#include <errno.h>
 #include <limits.h>
 #include <search.h>
 #include <string.h>
@@ -181,9 +182,9 @@ stdinmode()
 
 	if (Sflag) {
 		// XXX locking?
-		seqfile = getenv("MAILMAP");
+		seqfile = getenv("MAILSEQ");
 		if (!seqfile)
-			seqfile = blaze822_home_file(".santoku/map");
+			seqfile = blaze822_home_file(".santoku/seq");
 		snprintf(tmpfile, sizeof tmpfile, "%s-", seqfile);
 		snprintf(oldfile, sizeof oldfile, "%s.old", seqfile);
 		outfile = fopen(tmpfile, "w+");
@@ -223,7 +224,7 @@ stdinmode()
 
 	if (Sflag) {
 		fflush(outfile);
-		if (rename(seqfile, oldfile) < 0) {
+		if (rename(seqfile, oldfile) < 0 && errno != ENOENT) {
 			perror("rename");
 			exit(2);
 		}
@@ -270,8 +271,8 @@ main(int argc, char *argv[])
 	if (optind == argc && !isatty(0))
 		return stdinmode();
 
-	char *map = blaze822_seq_open(0);
-	if (!map)
+	char *seq = blaze822_seq_open(0);
+	if (!seq)
 		return 1;
 
 	int i;
@@ -291,7 +292,7 @@ hack:
 			printf("%s\n", a);
 			continue;
 		}
-		while ((f = blaze822_seq_next(map, a, &iter))) {
+		while ((f = blaze822_seq_next(seq, a, &iter))) {
 			if (nflag) {
 				printf("%ld\n", iter.line-1);
 			} else {