Commit graph

14 commits

Author SHA1 Message Date
George Koehler 50a7031007 Don't use '-' in option string to getopt().
@dram reported a build failure in FreeBSD at
https://github.com/davidgiven/ack/issues/1#issuecomment-273668299

Linux manual for getopt(3) says:
> If the first character of optstring is '-', then each nonoption
> argv-element is handled as if it were the argument of an option with
> character code 1....
>
> The use of '+' and '-' in optstring is a GNU extension.

GNU/Linux and OpenBSD handle '-' in this special way, but FreeBSD
seems not to.  If '-' is not special, then em_ego can't find its input
file, so the build must fail.  This commit stops using '-' in both
em_b and em_ego, but doesn't change mcg.

Also fix em_ego -O3 to not act like -O4.
2017-10-29 23:25:07 -04:00
David Given 1203e8afd2 mkstemp() is a bit more complex than it looks; because ego wants to use the
same base name and generate multiple files based on it, we can't really use
mkstemp() for every temporary file. Instead, use mkstemp() once on a
placeholder, then generate temporary names based on this. (And delete the
placeholder once we've finished.)
2017-08-06 14:25:12 +02:00
David Given 64f2fa9d46 Stop using mktemp() --- on Haiku, it always generates the same filenames,
pretty much guaranteeing temporary file overwrites on parallel builds. Use
mkstemp() instead which creates the files atomically.
2017-08-06 13:22:05 +02:00
David Given 3e69d1185a Fix a whole lot more stray prototypes. 2016-11-24 21:47:40 +01:00
David Given 2b6d251dec Fix a fun bug where, every now again, ego would get its temporary files mangled
and generate invalid calls to the optimisers.

Previously ego would generate a temporary file template that looked like
/tmp/ego.A.BB.XXXXXX, call mktemp() on it to randomise the XXXXXX, and then
replace A and BB with data.

However, it used strrchr to find the A and B. Which would fine, except when
mktemp produced an A or a B in the randomised part...

This code was written on 4 March 1991. I was 16.
2016-08-22 23:53:01 +02:00
David Given 5bae29a00c ego now builds and is used.
This needed lots of refactoring to ego --- not all platforms have ego descr
files, and ego will just crash if you invoke it without one. I think originally
it was never intended that these platforms would be used at -O2 or above.

Plats now only specify the ego descr file if they have one.
2016-08-21 22:01:19 +02:00
David Given 03a0b182c4 Push em_ego.c through clang-format before working on it. 2016-08-21 18:45:25 +02:00
dtrg 014be56fb0 Replaced calls to the custom strindex() and strrindex() functions with the
exactly equivalent and standard strchr() and strrchr() functions instead.
2006-07-23 20:01:02 +00:00
ceriel 5c83e7dbb5 Header --> Id 1994-06-24 11:31:16 +00:00
ceriel a4a2ae8f96 catch is a signal arg, and should be void catch() 1993-11-12 16:57:15 +00:00
ceriel 8583ee73f3 Added verbose flag 1991-06-26 17:28:15 +00:00
ceriel e264b45120 Changed #include's 1991-03-05 12:16:17 +00:00
ceriel e340cea7be Under -t option, temporaries are in the current directory 1991-03-04 15:00:54 +00:00
ceriel 5a8012b084 Replaced driver by C version 1991-03-04 12:59:46 +00:00