<p dir="ltr">argv[0] would be more standard but requires a symlink on the target.  This just requires the binary.</p>
<div class="gmail_quote">On Feb 10, 2015 5:32 PM, "Ed Maste" <<a href="mailto:emaste@freebsd.org">emaste@freebsd.org</a>> wrote:<br type="attribution"><blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex">In <a href="http://reviews.llvm.org/D7545#121674" target="_blank">http://reviews.llvm.org/D7545#121674</a>, @silvas wrote:<br>
<br>
> Can you maybe use the trick of looking at argv[0] instead of taking a command line option to know which program to be? (assuming it makes sense to do this change). See llvm-ar for an example.<br>
<br>
<br>
Or look at lld as a good example. It chooses appropriate behaviour based on argv[0] but also has a `-flavor` argument for use when argv[0] does not match any of the known names.<br>
<br>
  % ./lld<br>
  Select the appropriate flavor<br>
  OVERVIEW: LLVM Linker<br>
<br>
  USAGE: lld [options] <inputs><br>
<br>
  OPTIONS:<br>
  ...<br>
    -flavor <value> Flavor for linking, options are gnu/darwin/link<br>
<br>
<br>
  % ln -s lld ld<br>
  % ./ld<br>
  No input files<br>
<br>
<br>
<br>
<br>
REPOSITORY<br>
  rL LLVM<br>
<br>
<a href="http://reviews.llvm.org/D7545" target="_blank">http://reviews.llvm.org/D7545</a><br>
<br>
EMAIL PREFERENCES<br>
  <a href="http://reviews.llvm.org/settings/panel/emailpreferences/" target="_blank">http://reviews.llvm.org/settings/panel/emailpreferences/</a><br>
<br>
<br>
</blockquote></div>