|
|
@ -1,4 +1,5 @@
|
|
|
|
#include <dirent.h>
|
|
|
|
#include <dirent.h>
|
|
|
|
|
|
|
|
#include <errno.h>
|
|
|
|
#include <limits.h>
|
|
|
|
#include <limits.h>
|
|
|
|
#include <search.h>
|
|
|
|
#include <search.h>
|
|
|
|
#include <string.h>
|
|
|
|
#include <string.h>
|
|
|
@ -181,9 +182,9 @@ stdinmode()
|
|
|
|
|
|
|
|
|
|
|
|
if (Sflag) {
|
|
|
|
if (Sflag) {
|
|
|
|
// XXX locking?
|
|
|
|
// XXX locking?
|
|
|
|
seqfile = getenv("MAILMAP");
|
|
|
|
seqfile = getenv("MAILSEQ");
|
|
|
|
if (!seqfile)
|
|
|
|
if (!seqfile)
|
|
|
|
seqfile = blaze822_home_file(".santoku/map");
|
|
|
|
seqfile = blaze822_home_file(".santoku/seq");
|
|
|
|
snprintf(tmpfile, sizeof tmpfile, "%s-", seqfile);
|
|
|
|
snprintf(tmpfile, sizeof tmpfile, "%s-", seqfile);
|
|
|
|
snprintf(oldfile, sizeof oldfile, "%s.old", seqfile);
|
|
|
|
snprintf(oldfile, sizeof oldfile, "%s.old", seqfile);
|
|
|
|
outfile = fopen(tmpfile, "w+");
|
|
|
|
outfile = fopen(tmpfile, "w+");
|
|
|
@ -223,7 +224,7 @@ stdinmode()
|
|
|
|
|
|
|
|
|
|
|
|
if (Sflag) {
|
|
|
|
if (Sflag) {
|
|
|
|
fflush(outfile);
|
|
|
|
fflush(outfile);
|
|
|
|
if (rename(seqfile, oldfile) < 0) {
|
|
|
|
if (rename(seqfile, oldfile) < 0 && errno != ENOENT) {
|
|
|
|
perror("rename");
|
|
|
|
perror("rename");
|
|
|
|
exit(2);
|
|
|
|
exit(2);
|
|
|
|
}
|
|
|
|
}
|
|
|
@ -270,8 +271,8 @@ main(int argc, char *argv[])
|
|
|
|
if (optind == argc && !isatty(0))
|
|
|
|
if (optind == argc && !isatty(0))
|
|
|
|
return stdinmode();
|
|
|
|
return stdinmode();
|
|
|
|
|
|
|
|
|
|
|
|
char *map = blaze822_seq_open(0);
|
|
|
|
char *seq = blaze822_seq_open(0);
|
|
|
|
if (!map)
|
|
|
|
if (!seq)
|
|
|
|
return 1;
|
|
|
|
return 1;
|
|
|
|
|
|
|
|
|
|
|
|
int i;
|
|
|
|
int i;
|
|
|
@ -291,7 +292,7 @@ hack:
|
|
|
|
printf("%s\n", a);
|
|
|
|
printf("%s\n", a);
|
|
|
|
continue;
|
|
|
|
continue;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
while ((f = blaze822_seq_next(map, a, &iter))) {
|
|
|
|
while ((f = blaze822_seq_next(seq, a, &iter))) {
|
|
|
|
if (nflag) {
|
|
|
|
if (nflag) {
|
|
|
|
printf("%ld\n", iter.line-1);
|
|
|
|
printf("%ld\n", iter.line-1);
|
|
|
|
} else {
|
|
|
|
} else {
|
|
|
|