Home | History | Annotate | Line # | Download | only in mtree
      1  1.1  matt BEGIN { split(COMPATDIRS, dirs); n = 1; last_prefix = "" }
      2  1.1  matt /^#/ { print; }
      3  1.1  matt {
      4  1.1  matt 	if (NF > 0) {
      5  1.1  matt 		pos = index($0, S);
      6  1.1  matt 		if (pos == 0) {
      7  1.1  matt 			print;
      8  1.1  matt 			next;
      9  1.1  matt 		}
     10  1.1  matt 		prefix = substr($0, 1, pos)
     11  1.1  matt 		if (prefix != last_prefix) {
     12  1.1  matt 			for (d in dirs) {
     13  1.1  matt 				for (f = 1; f < n; f++) {
     14  1.1  matt 					x=files[f]; sub(S, S "/" dirs[d], x);
     15  1.1  matt 					print x;
     16  1.1  matt 				}
     17  1.1  matt 			}
     18  1.1  matt 			delete files;
     19  1.1  matt 			n = 1;
     20  1.1  matt 			last_prefix = prefix;
     21  1.1  matt 		}
     22  1.1  matt 		files[n++] = $0;
     23  1.1  matt 	}
     24  1.1  matt 	next
     25  1.1  matt }
     26  1.1  matt END {
     27  1.1  matt 	for (d in dirs) {
     28  1.1  matt 		for (f = 1; f < n; f++) {
     29  1.1  matt 		    x=files[f]; sub(S, S "/" dirs[d], x); print x;
     30  1.1  matt 		}
     31  1.1  matt 	}
     32  1.1  matt }
     33