Re: [PATCH 2/2] connect: improve check for plink to reduce false positives
- From
Johannes Schindelin <johannes.schindelin@gmx.de>
- Date
- Apr 23, 2015, 06:50 UTC
- Message-ID
- <b6b4da1f7735b834043375e3d8eaa331@www.dscho.org>
- In-Reply-To
- <1429747595-298095-2-git-send-email-sandals@crustytoothpaste.net>
Hi Brian,
On 2015-04-23 02:06, brian m. carlson wrote:
> + tortoiseplink = tplink == ssh || > + (tplink && is_dir_sep(tplink[-1]));
Maybe have a helper function here? Something like `basename_matches(const char *path, const char *basename, int ignore_case)`? That would be easier to read (I have to admit that I had to wrap my head around the logic to ensure that tplink[-1] is valid; It is, but it requires more brain cycles to verify than I would like).
Also, I am really hesitant to just test the start of the basename; I would rather have an entire basename match so that something like "PLinKoeln" would not match. (And of course, for Windows I would want that hypothetical `basename_matches()` function to allow basenames to end in `.exe` automatically).
In contrast to Torsten, I am not so concerned about `myplink` scripts: that only affects power users who can easily add the `-batch` into the script, where it actually belongs.
Ciao, Dscho