Ejemplo n.º 1
0
const char *mkpath(const char *fmt, ...)
{
	va_list args;
	struct strbuf *pathname = get_pathname();
	va_start(args, fmt);
	strbuf_vaddf(pathname, fmt, args);
	va_end(args);
	return cleanup_path(pathname->buf);
}
Ejemplo n.º 2
0
static void
show_sharedir(bool all)
{
	char		path[MAXPGPATH];

	if (all)
		printf("SHAREDIR = ");
	get_share_path(mypath, path);
	cleanup_path(path);
	printf("%s\n", path);
}
Ejemplo n.º 3
0
static void
show_sysconfdir(bool all)
{
	char		path[MAXPGPATH];

	if (all)
		printf("SYSCONFDIR = ");
	get_etc_path(mypath, path);
	cleanup_path(path);
	printf("%s\n", path);
}
Ejemplo n.º 4
0
static void
show_localedir(bool all)
{
	char		path[MAXPGPATH];

	if (all)
		printf("LOCALEDIR = ");
	get_locale_path(mypath, path);
	cleanup_path(path);
	printf("%s\n", path);
}
Ejemplo n.º 5
0
static void
show_mandir(bool all)
{
	char		path[MAXPGPATH];

	if (all)
		printf("MANDIR = ");
	get_man_path(mypath, path);
	cleanup_path(path);
	printf("%s\n", path);
}
Ejemplo n.º 6
0
static void
show_pkglibdir(bool all)
{
	char		path[MAXPGPATH];

	if (all)
		printf("PKGLIBDIR = ");
	get_pkglib_path(mypath, path);
	cleanup_path(path);
	printf("%s\n", path);
}
Ejemplo n.º 7
0
static void
show_includedir_server(bool all)
{
	char		path[MAXPGPATH];

	if (all)
		printf("INCLUDEDIR-SERVER = ");
	get_includeserver_path(mypath, path);
	cleanup_path(path);
	printf("%s\n", path);
}
Ejemplo n.º 8
0
static void
show_pkgincludedir(bool all)
{
	char		path[MAXPGPATH];

	if (all)
		printf("PKGINCLUDEDIR = ");
	get_pkginclude_path(mypath, path);
	cleanup_path(path);
	printf("%s\n", path);
}
Ejemplo n.º 9
0
static void
show_htmldir(bool all)
{
	char		path[MAXPGPATH];

	if (all)
		printf("HTMLDIR = ");
	get_html_path(mypath, path);
	cleanup_path(path);
	printf("%s\n", path);
}
Ejemplo n.º 10
0
static void
show_docdir(bool all)
{
	char		path[MAXPGPATH];

	if (all)
		printf("DOCDIR = ");
	get_doc_path(mypath, path);
	cleanup_path(path);
	printf("%s\n", path);
}
Ejemplo n.º 11
0
static void
show_pgxs(bool all)
{
	char		path[MAXPGPATH];

	if (all)
		printf("PGXS = ");
	get_pkglib_path(mypath, path);
	strlcat(path, "/pgxs/src/makefiles/pgxs.mk", sizeof(path));
	cleanup_path(path);
	printf("%s\n", path);
}
Ejemplo n.º 12
0
Archivo: path.c Proyecto: bartman/git
char *mkpath(const char *fmt, ...)
{
	va_list args;
	unsigned len;
	char *pathname = get_pathname();

	va_start(args, fmt);
	len = vsnprintf(pathname, PATH_MAX, fmt, args);
	va_end(args);
	if (len >= PATH_MAX)
		return bad_path;
	return cleanup_path(pathname);
}
Ejemplo n.º 13
0
char *mksnpath(char *buf, size_t n, const char *fmt, ...)
{
	va_list args;
	unsigned len;

	va_start(args, fmt);
	len = vsnprintf(buf, n, fmt, args);
	va_end(args);
	if (len >= n) {
		strlcpy(buf, bad_path, n);
		return buf;
	}
	return cleanup_path(buf);
}
Ejemplo n.º 14
0
Archivo: path.c Proyecto: ni742015/git
char *mkpathdup(const char *fmt, ...)
{
	char *path;
	struct strbuf sb = STRBUF_INIT;
	va_list args;

	va_start(args, fmt);
	strbuf_vaddf(&sb, fmt, args);
	va_end(args);
	path = xstrdup(cleanup_path(sb.buf));

	strbuf_release(&sb);
	return path;
}
Ejemplo n.º 15
0
static void
show_bindir(bool all)
{
	char		path[MAXPGPATH];
	char	   *lastsep;

	if (all)
		printf("BINDIR = ");
	/* assume we are located in the bindir */
	strcpy(path, mypath);
	lastsep = strrchr(path, '/');

	if (lastsep)
		*lastsep = '\0';

	cleanup_path(path);
	printf("%s\n", path);
}
Ejemplo n.º 16
0
Archivo: path.c Proyecto: bartman/git
static char *git_vsnpath(char *buf, size_t n, const char *fmt, va_list args)
{
	const char *git_dir = get_git_dir();
	size_t len;

	len = strlen(git_dir);
	if (n < len + 1)
		goto bad;
	memcpy(buf, git_dir, len);
	if (len && !is_dir_sep(git_dir[len-1]))
		buf[len++] = '/';
	len += vsnprintf(buf + len, n - len, fmt, args);
	if (len >= n)
		goto bad;
	return cleanup_path(buf);
bad:
	strlcpy(buf, bad_path, n);
	return buf;
}
Ejemplo n.º 17
0
Archivo: path.c Proyecto: bartman/git
char *git_path(const char *fmt, ...)
{
	const char *git_dir = get_git_dir();
	char *pathname = get_pathname();
	va_list args;
	unsigned len;

	len = strlen(git_dir);
	if (len > PATH_MAX-100)
		return bad_path;
	memcpy(pathname, git_dir, len);
	if (len && git_dir[len-1] != '/')
		pathname[len++] = '/';
	va_start(args, fmt);
	len += vsnprintf(pathname + len, PATH_MAX - len, fmt, args);
	va_end(args);
	if (len >= PATH_MAX)
		return bad_path;
	return cleanup_path(pathname);
}
Ejemplo n.º 18
0
Archivo: path.c Proyecto: ni742015/git
char *git_path_submodule(const char *path, const char *fmt, ...)
{
	char *pathname = get_pathname();
	struct strbuf buf = STRBUF_INIT;
	const char *git_dir;
	va_list args;
	unsigned len;

	len = strlen(path);
	if (len > PATH_MAX-100)
		return bad_path;

	strbuf_addstr(&buf, path);
	if (len && path[len-1] != '/')
		strbuf_addch(&buf, '/');
	strbuf_addstr(&buf, ".git");

	git_dir = read_gitfile(buf.buf);
	if (git_dir) {
		strbuf_reset(&buf);
		strbuf_addstr(&buf, git_dir);
	}
	strbuf_addch(&buf, '/');

	if (buf.len >= PATH_MAX)
		return bad_path;
	memcpy(pathname, buf.buf, buf.len + 1);

	strbuf_release(&buf);
	len = strlen(pathname);

	va_start(args, fmt);
	len += vsnprintf(pathname + len, PATH_MAX - len, fmt, args);
	va_end(args);
	if (len >= PATH_MAX)
		return bad_path;
	return cleanup_path(pathname);
}
Ejemplo n.º 19
0
/*
 * get_configdata(const char *my_exec_path, size_t *configdata_len)
 *
 * Get configure-time constants. The caller is responsible
 * for pfreeing the result.
 */
ConfigData *
get_configdata(const char *my_exec_path, size_t *configdata_len)
{
	ConfigData *configdata;
	char		path[MAXPGPATH];
	char	   *lastsep;
	int			i = 0;

	/* Adjust this to match the number of items filled below */
	*configdata_len = 23;
	configdata = (ConfigData *) palloc(*configdata_len * sizeof(ConfigData));

	configdata[i].name = pstrdup("BINDIR");
	strlcpy(path, my_exec_path, sizeof(path));
	lastsep = strrchr(path, '/');
	if (lastsep)
		*lastsep = '\0';
	cleanup_path(path);
	configdata[i].setting = pstrdup(path);
	i++;

	configdata[i].name = pstrdup("DOCDIR");
	get_doc_path(my_exec_path, path);
	cleanup_path(path);
	configdata[i].setting = pstrdup(path);
	i++;

	configdata[i].name = pstrdup("HTMLDIR");
	get_html_path(my_exec_path, path);
	cleanup_path(path);
	configdata[i].setting = pstrdup(path);
	i++;

	configdata[i].name = pstrdup("INCLUDEDIR");
	get_include_path(my_exec_path, path);
	cleanup_path(path);
	configdata[i].setting = pstrdup(path);
	i++;

	configdata[i].name = pstrdup("PKGINCLUDEDIR");
	get_pkginclude_path(my_exec_path, path);
	cleanup_path(path);
	configdata[i].setting = pstrdup(path);
	i++;

	configdata[i].name = pstrdup("INCLUDEDIR-SERVER");
	get_includeserver_path(my_exec_path, path);
	cleanup_path(path);
	configdata[i].setting = pstrdup(path);
	i++;

	configdata[i].name = pstrdup("LIBDIR");
	get_lib_path(my_exec_path, path);
	cleanup_path(path);
	configdata[i].setting = pstrdup(path);
	i++;

	configdata[i].name = pstrdup("PKGLIBDIR");
	get_pkglib_path(my_exec_path, path);
	cleanup_path(path);
	configdata[i].setting = pstrdup(path);
	i++;

	configdata[i].name = pstrdup("LOCALEDIR");
	get_locale_path(my_exec_path, path);
	cleanup_path(path);
	configdata[i].setting = pstrdup(path);
	i++;

	configdata[i].name = pstrdup("MANDIR");
	get_man_path(my_exec_path, path);
	cleanup_path(path);
	configdata[i].setting = pstrdup(path);
	i++;

	configdata[i].name = pstrdup("SHAREDIR");
	get_share_path(my_exec_path, path);
	cleanup_path(path);
	configdata[i].setting = pstrdup(path);
	i++;

	configdata[i].name = pstrdup("SYSCONFDIR");
	get_etc_path(my_exec_path, path);
	cleanup_path(path);
	configdata[i].setting = pstrdup(path);
	i++;

	configdata[i].name = pstrdup("PGXS");
	get_pkglib_path(my_exec_path, path);
	strlcat(path, "/pgxs/src/makefiles/pgxs.mk", sizeof(path));
	cleanup_path(path);
	configdata[i].setting = pstrdup(path);
	i++;

	configdata[i].name = pstrdup("CONFIGURE");
#ifdef VAL_CONFIGURE
	configdata[i].setting = pstrdup(VAL_CONFIGURE);
#else
	configdata[i].setting = pstrdup(_("not recorded"));
#endif
	i++;

	configdata[i].name = pstrdup("CC");
#ifdef VAL_CC
	configdata[i].setting = pstrdup(VAL_CC);
#else
	configdata[i].setting = pstrdup(_("not recorded"));
#endif
	i++;

	configdata[i].name = pstrdup("CPPFLAGS");
#ifdef VAL_CPPFLAGS
	configdata[i].setting = pstrdup(VAL_CPPFLAGS);
#else
	configdata[i].setting = pstrdup(_("not recorded"));
#endif
	i++;

	configdata[i].name = pstrdup("CFLAGS");
#ifdef VAL_CFLAGS
	configdata[i].setting = pstrdup(VAL_CFLAGS);
#else
	configdata[i].setting = pstrdup(_("not recorded"));
#endif
	i++;

	configdata[i].name = pstrdup("CFLAGS_SL");
#ifdef VAL_CFLAGS_SL
	configdata[i].setting = pstrdup(VAL_CFLAGS_SL);
#else
	configdata[i].setting = pstrdup(_("not recorded"));
#endif
	i++;

	configdata[i].name = pstrdup("LDFLAGS");
#ifdef VAL_LDFLAGS
	configdata[i].setting = pstrdup(VAL_LDFLAGS);
#else
	configdata[i].setting = pstrdup(_("not recorded"));
#endif
	i++;

	configdata[i].name = pstrdup("LDFLAGS_EX");
#ifdef VAL_LDFLAGS_EX
	configdata[i].setting = pstrdup(VAL_LDFLAGS_EX);
#else
	configdata[i].setting = pstrdup(_("not recorded"));
#endif
	i++;

	configdata[i].name = pstrdup("LDFLAGS_SL");
#ifdef VAL_LDFLAGS_SL
	configdata[i].setting = pstrdup(VAL_LDFLAGS_SL);
#else
	configdata[i].setting = pstrdup(_("not recorded"));
#endif
	i++;

	configdata[i].name = pstrdup("LIBS");
#ifdef VAL_LIBS
	configdata[i].setting = pstrdup(VAL_LIBS);
#else
	configdata[i].setting = pstrdup(_("not recorded"));
#endif
	i++;

	configdata[i].name = pstrdup("VERSION");
	configdata[i].setting = pstrdup("PostgreSQL " PG_VERSION);
	i++;

	Assert(i == *configdata_len);

	return configdata;
}
Ejemplo n.º 20
0
static void strbuf_cleanup_path(struct strbuf *sb)
{
	char *path = cleanup_path(sb->buf);
	if (path > sb->buf)
		strbuf_remove(sb, 0, path - sb->buf);
}
Ejemplo n.º 21
0
int
main(int argc, char *argv[])
{
	long pagesize, npages;
	int c, ret;
	char hw_provider[SYS_NMLN];

	setpname(argv[0]);
	opts.o_promdev = "/dev/openprom";

	while ((c = getopt(argc, argv, optstring)) != -1)  {
		switch (c)  {
		case 'a':
			++opts.o_ancestors;
			break;
		case 'b':
			++opts.o_productinfo;
			break;
		case 'c':
			++opts.o_children;
			break;
		case 'd':
			++opts.o_pciid;
			break;
		case 'D':
			++opts.o_drv_name;
			break;
		case 'v':
			++opts.o_verbose;
			break;
		case 'm':
			++opts.o_memory;
			break;
		case 'p':
			++opts.o_prominfo;
			break;
		case 'f':
			opts.o_promdev = optarg;
			break;
		case 'V':
			++opts.o_promversion;
			break;
		case 'x':
			++opts.o_prom_ready64;
			break;
		case 'F':
			++opts.o_fbname;
			++opts.o_noheader;
			break;
		case 'P':
			++opts.o_pseudodevs;
			break;
		case 'C':
			++opts.o_forcecache;
			break;
#ifdef	DEBUG
		case 'M':
			dbg.d_drivername = optarg;
			++dbg.d_bydriver;
			break;
		case 'L':
			++dbg.d_forceload;
			break;
#endif	/* DEBUG */

		default:
			(void) fprintf(stderr, usage, opts.o_progname);
			return (1);
		}
	}

	(void) uname(&opts.o_uts);

	if (opts.o_fbname)
		return (do_fbname());

	if (opts.o_promversion)
		return (do_promversion());

	if (opts.o_prom_ready64)
		return (do_prom_version64());

	if (opts.o_productinfo)
		return (do_productinfo());

	opts.o_devices_path = NULL;
	opts.o_devt = DDI_DEV_T_NONE;
	opts.o_target = 0;
	if (optind < argc) {
		struct stat	sinfo;
		char		*path = argv[optind];
		int		error;

		if (opts.o_prominfo) {
			/* PROM tree cannot be used with path */
			(void) fprintf(stderr, "%s: path and -p option are "
			    "mutually exclusive\n", opts.o_progname);
			return (1);
		}

		if (strlen(path) >= MAXPATHLEN) {
			(void) fprintf(stderr, "%s: "
			    "path specified is too long\n", opts.o_progname);
			return (1);
		}

		if (error = stat(path, &sinfo)) {

			/* an invalid path was specified */
			(void) fprintf(stderr, "%s: invalid path specified\n",
			    opts.o_progname);
			return (1);

		} else if (((sinfo.st_mode & S_IFMT) == S_IFCHR) ||
		    ((sinfo.st_mode & S_IFMT) == S_IFBLK)) {

			opts.o_devt = sinfo.st_rdev;
			error = 0;

		} else if ((sinfo.st_mode & S_IFMT) == S_IFDIR) {
			size_t	len, plen;

			/* clean up the path */
			cleanup_path(path, new_path);

			len = strlen(new_path);
			plen = strlen("/devices");
			if (len < plen) {
				/* This is not a valid /devices path */
				error = 1;
			} else if ((len == plen) &&
			    (strcmp(new_path, "/devices") == 0)) {
				/* /devices is the root nexus */
				opts.o_devices_path = "/";
				error = 0;
			} else if (strncmp(new_path, "/devices/", plen + 1)) {
				/* This is not a valid /devices path */
				error = 1;
			} else {
				/* a /devices/ path was specified */
				opts.o_devices_path = new_path + plen;
				error = 0;
			}

		} else {
			/* an invalid device path was specified */
			error = 1;
		}

		if (error) {
			(void) fprintf(stderr, "%s: "
			    "invalid device path specified\n",
			    opts.o_progname);
			return (1);
		}

		opts.o_target = 1;
	}

	if ((opts.o_ancestors || opts.o_children) && (!opts.o_target)) {
		(void) fprintf(stderr, "%s: options require a device path\n",
		    opts.o_progname);
		return (1);
	}

	if (opts.o_target) {
		prtconf_devinfo();
		return (0);
	}

	if (!opts.o_memory) {
		ret = sysinfo(SI_HW_PROVIDER, hw_provider,
		    sizeof (hw_provider));
		/*
		 * If 0 bytes are returned (the system returns '1', for the \0),
		 * we're probably on x86, and there has been no si-hw-provider
		 * set in /etc/bootrc, default to Joyent.
		 */
		if (ret <= 1) {
			(void) strncpy(hw_provider, "Joyent",
			    sizeof (hw_provider));
		}
		(void) printf("System Configuration:  %s  %s\n", hw_provider,
		    opts.o_uts.machine);
	}

	pagesize = sysconf(_SC_PAGESIZE);
	npages = sysconf(_SC_PHYS_PAGES);
	if (pagesize == -1 || npages == -1)
		if (opts.o_memory) {
			(void) printf("0\n");
			return (1);
		} else {
			(void) printf("Memory size: unable to determine\n");
		}
	else {
		const int64_t kbyte = 1024;
		const int64_t mbyte = 1024 * 1024;
		int64_t ii = (int64_t)pagesize * npages;

		if (opts.o_memory) {
			(void) printf("%ld\n", (long)((ii+mbyte-1) / mbyte));
			return (0);
		} else {
			(void) printf("Memory size: %ld Megabytes\n",
			    (long)((ii+mbyte-1) / mbyte));
		}
	}

	if (opts.o_prominfo) {
		(void) printf("System Peripherals (PROM Nodes):\n\n");
		if (do_prominfo() == 0)
			return (0);
		(void) fprintf(stderr, "%s: Defaulting to non-PROM mode...\n",
		    opts.o_progname);
	}

	(void) printf("System Peripherals (Software Nodes):\n\n");

	(void) prtconf_devinfo();

	return (0);
}
Ejemplo n.º 22
0
static PyObject *Py_cleanup_path(PyObject *self, PyObject *args, PyObject *kwds)
{
    py::PathIterator path;
    agg::trans_affine trans;
    bool remove_nans;
    agg::rect_d clip_rect;
    e_snap_mode snap_mode;
    double stroke_width;
    PyObject *simplifyobj;
    bool simplify = false;
    bool return_curves;
    SketchParams sketch;

    if (!PyArg_ParseTuple(args,
                          "O&O&O&O&O&dOO&O&:cleanup_path",
                          &convert_path,
                          &path,
                          &convert_trans_affine,
                          &trans,
                          &convert_bool,
                          &remove_nans,
                          &convert_rect,
                          &clip_rect,
                          &convert_snap,
                          &snap_mode,
                          &stroke_width,
                          &simplifyobj,
                          &convert_bool,
                          &return_curves,
                          &convert_sketch_params,
                          &sketch)) {
        return NULL;
    }

    if (simplifyobj == Py_None) {
        simplify = path.should_simplify();
    } else if (PyObject_IsTrue(simplifyobj)) {
        simplify = true;
    }

    bool do_clip = (clip_rect.x1 < clip_rect.x2 && clip_rect.y1 < clip_rect.y2);

    std::vector<double> vertices;
    std::vector<npy_uint8> codes;

    CALL_CPP("cleanup_path",
             (cleanup_path(path,
                           trans,
                           remove_nans,
                           do_clip,
                           clip_rect,
                           snap_mode,
                           stroke_width,
                           simplify,
                           return_curves,
                           sketch,
                           vertices,
                           codes)));

    size_t length = codes.size();

    npy_intp vertices_dims[] = {(npy_intp)length, 2 };
    numpy::array_view<double, 2> pyvertices(vertices_dims);

    npy_intp codes_dims[] = {(npy_intp)length };
    numpy::array_view<unsigned char, 1> pycodes(codes_dims);

    memcpy(pyvertices.data(), &vertices[0], sizeof(double) * 2 * length);
    memcpy(pycodes.data(), &codes[0], sizeof(unsigned char) * length);

    return Py_BuildValue("NN", pyvertices.pyobj(), pycodes.pyobj());
}
Ejemplo n.º 23
0
int collisionfinding(parameters_type& parameters)
{
	bool usetunnelbitconditions = parameters.usetunnelbitconditions;

	sha1messagespace tmpspace;
	vector< vector<uint32> > bitrels, tmpbitrel, tmpbitrel2;
	for (unsigned i = 0; i < parameters.rnd234_m_bitrelationfiles.size(); ++i) {
		try {
			cout << "Loading '" << parameters.rnd234_m_bitrelationfiles[i] << "'..." << flush;
			load_bz2(tmpspace, text_archive, parameters.rnd234_m_bitrelationfiles[i]);
			cout << "done" << flush;
			tmpspace.tobitrelations_80(tmpbitrel);
			bitrels.insert(bitrels.end(), tmpbitrel.begin(), tmpbitrel.end());
			cout << " (" << tmpbitrel.size() << " bitrels, new total: " << bitrels.size() << ")" << endl;
		} catch (std::exception& e) {
			cerr << "Exception:" << endl << e.what() << endl;
			return 1;
		}
	}
	vector< sha1differentialpath > paths;

	cout << "Loading round 1 paths from '" << parameters.rnd1_pathsfile << "'..." << flush;
	try {
		load_bz2(paths, text_archive, parameters.rnd1_pathsfile);
		cout << "done (" << paths.size() << " paths)." << endl;
	} catch (std::exception& e) {
		cerr << "Exception:" << endl << e.what() << endl;
		return 1;
	}
	if (paths.size() == 0) exit(0);

	vector< vector<uint32> > bitrelsbu = bitrels;
for (unsigned pi = 0; pi < paths.size(); ++pi) { try {
	bitrels = bitrelsbu;
	sha1differentialpath upperpath;
	cout << "Loading round 2,3,4 path from '" << parameters.rnd234_pathfile << "'..." << flush;
	try {
		load_bz2(upperpath, text_archive, parameters.rnd234_pathfile);
		cout << "done." << endl;
	} catch (std::exception& e) {
		cerr << "Exception:" << endl << e.what() << endl;
		return 1;
	}
	for (int t = paths[pi].tbegin(); t < paths[pi].tend(); ++t)
		upperpath[t] = paths[pi][t];
	for (unsigned t = 0; t < paths[pi].tend()-1; ++t)
		upperpath.getme(t) = paths[pi].getme(t);
	cleanup_path(upperpath);
	maindiffpath = upperpath;

	bool bad = false;
	for (int t = maindiffpath.tbegin()+4; t < maindiffpath.tend()-1; ++t) {
		if (maindiffpath.getme(t).mask != parameters.m_mask[t]) {
			uint32 dm = maindiffpath.getme(t).adddiff();
			uint32 mcur = 0;
			uint32 mmask = parameters.m_mask[t];
			uint32 madd = (~mmask)+1;
			sdr msdr;
			msdr.mask = mmask;
			do {
				mcur += madd; mcur &= mmask;
				msdr.sign = mcur;
				if (msdr.adddiff() == dm) {
					cout << "corrected: \t" << t << ":\t" << msdr << " == " << sdr(parameters.m_mask[t]) << endl;
					break;
				}
			} while (mcur != 0);
			if (msdr.adddiff() == dm) {
				maindiffpath.getme(t) = msdr;
			} else {
				bad = true;
				cout << "failed: \t" << t << ":\t" << maindiffpath.getme(t) << " != " << sdr(parameters.m_mask[t]) << endl;
			}
		}
	}
	if (bad) exit(0);
	show_path(maindiffpath);

	
	// remove bitrelations possibly limiting me[0],...,me[19]
	const unsigned tend_fix_me = parameters.tend_rnd1_me;
	cout << "Fixed me diffs for t=[0," << tend_fix_me << "): (" << bitrels.size() << "=>" << flush;
	filter_bitconditions(bitrels, tend_fix_me, 80);
	cout << bitrels.size() << ")" << endl;
	for (unsigned i = 0; i < bitrels.size(); ++i) {
		cout << " - ";
		bool firstone = true;
		for (unsigned t = 0; t < 80; ++t)
			for (unsigned b = 0; b < 32; ++b)
				if (bitrels[i][t] & (1<<b)) {
					if (firstone)
						firstone = false;
					else
						cout << " + ";
					cout << "M[" << t << "," << b << "]";
				}
		cout << " = " << (bitrels[i][80]&1) << endl;
	}
	
	tmpspace.clear();
	for (unsigned t = 0; t < 80; ++t) {
		if (t < tend_fix_me) {
			for (unsigned b = 0; b < 31; ++b) {
				int bit = maindiffpath.getme(t).get(b);
				if (bit == 0)
					tmpspace.buildbasis_addfreebit(t,b);
				else
					tmpspace.buildbasis_setbit(t,b,bit==-1);
			}
			tmpspace.buildbasis_addfreebit(t,31);
		} else {
			for (unsigned b = 0; b < 32; ++b)
				tmpspace.buildbasis_addfreebit(t,b);
		}
	}
	tmpspace.tobitrelations_80(tmpbitrel);
	bitrels.insert(bitrels.end(), tmpbitrel.begin(), tmpbitrel.end());
	cout << "Extra me [0," << tend_fix_me << ") bitrelations: " << tmpbitrel.size() << endl;
	{
		cout << "Extra tunnel me bitrelations: " << endl;
		ifstream ifs("tunnel_bitconditions.txt");
		read_message_bitconditions(ifs, tmpbitrel);
		for (unsigned i = 0; i < tmpbitrel.size(); ++i) {
			bool firstone = true;
			for (unsigned t = 0; t < 80; ++t)
				if (tmpbitrel[i][t]) {
					if (firstone) firstone = false;
					else cout << "+ ";
					cout << "m" << t << sdr(tmpbitrel[i][t]) << " ";
				}
			cout << "= " << (tmpbitrel[i][80]&1) << endl;
		}
		bitrels.insert(bitrels.end(), tmpbitrel.begin(), tmpbitrel.end());
	}
	tmpspace.frombitrelations_80(bitrels);
	mainmespace = tmpspace;
	tmpspace.tobitrelations_16(bitrels);
	cout << "Total bitrelations: " << bitrels.size() << endl;
#if 0
	cout << "Independent message bits: " << endl;
	uint32 meindep[16];
	for (unsigned i = 0; i < 16; ++i)
		meindep[16] = ~uint32(0);
	for (unsigned i = 0; i < bitrels.size(); ++i)
		for (unsigned t = 0; t < 16; ++t)
			meindep[t] &= ~bitrels[i][t];
	for (unsigned i = 0; i < 16; ++i) {
		cout << "m[" << i << "] indep:\t";
		for (int b = 31; b >= 0; --b)
			cout << ((meindep[i]&(1<<b))?"1":"0");
		cout << endl;
	}
#endif
	pathbitrelations = bitrels;
	pathbitrelationsmatrix.clear();
	pathbitrelationsmatrix.resize(16);
	for (unsigned i = 0; i < 16; ++i)
		pathbitrelationsmatrix[i].resize(32);
	for (unsigned i = 0; i < pathbitrelations.size(); ++i) {
		int lastcol = -1;
		for (int col = 16*32-1; col >= 0; --col)
			if (pathbitrelations[i][col>>5]&(1<<(col&31))) {
				lastcol = col;
				unsigned t = lastcol>>5;
				unsigned b = lastcol&31;
				pathbitrelationsmatrix[t][b] = pathbitrelations[i];
				break;
			}
		if (lastcol == -1) throw;
	}
#if 0
	//needs diffpath & pathbitrelationsmatrix
	analyze_indepsection_prob();
#endif
	if (parameters.tunnelfile.size()) {
		vector<sha1differentialpath> tunnels;
		cout << "Loading tunnels from '" << parameters.tunnelfile << "'..." << flush;
		try {
			load_bz2(tunnels, text_archive, parameters.tunnelfile);
		} 
		catch (std::exception &e) { tunnels.clear(); cout << "failed:" << endl << e.what() << endl; }
		catch (...) { tunnels.clear(); cout << "failed." << endl; }
		if (tunnels.size())
			analyze_tunnels_diffpath(maindiffpath, bitrels, tunnels);
		exit(0);
	}
	if (!usetunnelbitconditions) {
		// if not using tunnel bit conditions then we'll assume we want to analyze tunnels
		analyze_tunnels_diffpath(maindiffpath, bitrels);
		exit(0);
	}
	// if we're using tunnel bit conditions we'll assume we want to generate the collision finding program

	generate_program();
	break;
} catch (std::exception& e) { cerr << "c: " << e.what() << endl; } catch (...) {} 
} // for (unsigned pi = 0; pi < paths.size(); ++pi)
}