Adding configurable overloaded library search path http://patch-tracker.debian.org/patch/misc/dl/trickle/1.07-9/trickle.c --- ./trickle.c +++ ./trickle.c @@ -46,18 +46,14 @@ main(int argc, char **argv) *uplim = "10", *downlim = "10", *tsmooth = "3.0", *lsmooth = "20", *latency = "0"; int opt, verbose = 0, standalone = 0; - char buf[MAXPATHLEN], sockname[MAXPATHLEN], *path, **pathp; + char buf[MAXPATHLEN], sockname[MAXPATHLEN]; struct stat sb; - char *trypaths[] = { - LIBNAME, - LIBDIR "/" LIBNAME, - NULL - }; + char *path = LIBDIR "/" LIBNAME; __progname = get_progname(argv[0]); sockname[0] = '\0'; - while ((opt = getopt(argc, argv, "hvVsw:n:u:d:t:l:L:")) != -1) + while ((opt = getopt(argc, argv, "hvVsw:n:u:d:t:l:L:P:")) != -1) switch (opt) { case 'v': verbose++; @@ -86,6 +82,9 @@ main(int argc, char **argv) case 's': standalone = 1; break; + case 'P': + path = optarg; + break; case 'L': latency = optarg; break; @@ -100,13 +99,9 @@ main(int argc, char **argv) if (argc == 0) usage(); - for (pathp = trypaths; *pathp != NULL; pathp++) - if (lstat(*pathp, &sb) == 0) - break; - - path = *pathp; - if (path == NULL) + if (lstat(path, &sb) != 0) { errx(1, "Could not find overload object"); + } if (path[0] != '/') { if (getcwd(buf, sizeof(buf)) == NULL) @@ -167,7 +162,8 @@ usage(void) "\t-t Set default smoothing time to s\n" "\t-l Set default smoothing length to KB\n" "\t-n Use trickled socket name \n" - "\t-L Set latency to milliseconds\n", + "\t-L Set latency to milliseconds\n" + "\t-P Preload the specified .so instead of the default one\n", __progname, (int)strlen(__progname), ' ', __progname); exit(1); --- ./trickle.1 +++ ./trickle.1 @@ -20,6 +20,7 @@ .Op Fl t Ar time .Op Fl l Ar length .Op Fl n Ar path +.Op Fl P Ar path .Ar command ... .Sh DESCRIPTION .Nm @@ -94,6 +95,10 @@ to communicate with By default, .Ar /tmp/.trickled.sock is used. +.It Fl P Ar path +Use the specified .so instead of the standard one, this is usefull if you don't +run trickle from a standard installation. +.El .Sh EXAMPLES .Cm trickle -u 10 -d 20 ncftp .Pp