Commit graph

87 commits

Author SHA1 Message Date
David Given d1cbb9cf60 Crudely bounds check some naked fscanf("%s") parsing. Fixes #79, mostly. 2018-06-02 20:51:41 +02:00
George Koehler 12643f1740 Solve some gcc warnings in ego.
Some of these are from gcc -Wimplicit
2018-03-08 18:51:07 -05:00
George Koehler a7bb4ec4b1 Fixes for compiling ego with -DTRACE
- In share/debug.c, undo my mistake in commit 9037d13 by changing
   vfprintf back to fprintf in OUTTRACE.

 - In ud/ud.c, move the trace output from stdout to stderr, because
   stdout has ego's output file, which becomes opt2's input file.  If
   trace output goes to stdout, it gets prepended to the output file,
   and opt2 errors with "wrong input file".

I also edit both build.lua files so ego depends on its header files;
this part isn't needed for -DTRACE.

One can now use -DTRACE by adding it to the cflags in both build.lua
files.
2018-03-01 13:19:38 -05:00
George Koehler 0a6d3de7fe Use prototypes in ego/cs, ego/sp. 2018-02-05 16:09:30 -05:00
George Koehler d99a0682fc Switch ego to libc <assert.h>
I also tried, in types.h, to switch ego to libc <stdbool.h>, but that
causes an infinite loop in the IL phase.
2017-11-15 19:48:53 -05:00
George Koehler 9037d137f5 Add prototypes, void in util/ego/share
This uncovers a problem in il/il_aux.c: it passes 3 arguments to
getlines(), but the function expects 4 arguments.  I add FALSE as the
4th argument.  TRUE would fill in the list of mesregs.  IL uses
mesregs during phase 1, but this call to getlines() is in phase 2.
TRUE would leak memory unless I added a call to Ldeleteset(mesregs).
So I pass FALSE.

Functions passed to go() now have a `void *` parameter because
no_action() now takes a `void *`.
2017-11-15 17:19:56 -05:00
George Koehler 5bbbaf4919 Use size_t and void with memory allocation in ego.
alloc.h now needs to #include <stdlib.h> to find type size_t and
function free().
2017-11-14 20:35:18 -05:00
George Koehler 87a2315037 strcmp, strncmp are in <string.h>
*Important:*  Do `make clean` to work around a problem and prevent
infinite rebuilds, https://github.com/davidgiven/ack/issues/68

I edit tokens.g in util/LLgen/src, so I regenerate tokens.c.  The
regeneration script bootstrap.sh can't find LLgen, but I can run the
same command by typing the path to llgen.
2017-11-14 17:35:35 -05:00
David Given fd91851005 Add enough return types to the K&R C that the ACK builds (on Linux) using clang
now.
2016-11-10 22:04:18 +01:00
George Koehler b1d1b5e1f8 Fix bugs with memory allocation in ego.
cf/cf_loop.c and share/put.c tried to read the next pointer in an
element of a linked list after freeing the element.  ud/ud_copy.c
tried to read beyond the end of the _defs_ array: it only has
_nrexpldefs_ elements, not _nrdefs_ elements.

These bugs caused core dumps on OpenBSD.  Its malloc() put _defs_ near
the end of a page, so reading beyond the end crossed into an unmapped
page.  Its free() wrote junk bytes and changed the next pointer to
0xdfdfdfdfdfdfdfdf.
2016-09-09 23:37:43 -04:00
David Given f67c98e239 Distributions are a pain --- let's not bother any more. Instead, we just tag
the repository and download a complete snapshot, old and ancient stuff and all.
2016-09-02 23:00:38 +02:00
David Given 612e38f1c6 Remove the old make-based build system, plus some big chunks of horribly
obsolete protomake build system.
2016-09-02 22:17:51 +02:00
David Given 2a95b1c5e3 Forgot to check a file in. 2016-08-22 22:45:32 +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 671bf250f5 Run through clang-format. 2016-08-21 19:46:19 +02:00
David Given a4f136f999 Run through clang-format. 2016-08-21 18:51:36 +02:00
David Given e9233b4712 Build ego.
--HG--
branch : dtrg-buildsystem
rename : util/arch/build.mk => util/ego/build.mk
2013-05-15 21:14:06 +01:00
George Koehler 0131ca4d46 Delete 689 undead files.
These files "magically reappeared" after the conversion from CVS to
Mercurial.  The old CVS repository deleted these files but did not
record *when* it deleted these files.  The conversion resurrected these
files because they have no history of deletion.  These files were
probably deleted before year 1995.  The CVS repository begins to record
deletions around 1995.

These files may still appear in older revisions of this Mercurial
repository, when they should already be deleted.  There is no way to fix
this, because the CVS repository provides no dates of deletion.

See http://sourceforge.net/mailarchive/message.php?msg_id=29823032
2012-09-20 22:26:32 -04:00
dtrg ee72886e54 Renamed 'switch' variable to avoid conflict with a keyword in modern awks. 2010-08-01 10:35:04 +00:00
dtrg 6a0dd9377d Removed a dynamically generated file from the distribution. 2007-02-25 22:49:22 +00:00
dtrg b611731ec3 Updated .distr files for the new release. 2007-02-25 12:51:55 +00:00
dtrg f371b251d2 Rationalised use of #includes to be more standards-compliant. 2006-07-22 00:46:16 +00:00
dtrg 86e20aa483 Added a concrete definition of nrglobals, because this was not always happening
otherwise.
2006-07-22 00:44:52 +00:00
ceriel 2985469116 Fix: wrong offsets for locals when < -32768, installation error for 'show' 1995-11-08 11:09:14 +00:00
ceriel 5c83e7dbb5 Header --> Id 1994-06-24 11:31:16 +00:00
ceriel 0c60f4c22f Fixed several lint complaints 1993-11-16 11:35:23 +00:00
ceriel 549dfcc99d Fixed: functions were implicitly declared extern and later static 1993-10-07 17:47:26 +00:00
ceriel a56e1f25ff Was wrong when compiled with ANSI compiler 1992-07-22 13:49:15 +00:00
ceriel 50e8baa624 Removed # in commands, removed call to _cleanup() 1992-06-26 12:42:31 +00:00
ceriel 8394d5a4e1 Added 'extern' 1991-12-12 16:01:46 +00:00
ceriel d747702ae9 Corrected lintlib entry 1991-10-29 09:24:48 +00:00
ceriel e8d165a4a6 cleanup better 1991-10-21 13:26:50 +00:00
ceriel 64eacb4c9f Do not install lintlib by default: maybe lint is not installed yet 1991-10-09 19:12:52 +00:00
ceriel 2b7aae3b44 Added support for volatile 1991-10-02 13:03:31 +00:00
ceriel e5052d73e4 fix: make directory lib.bin/ego 1991-09-13 10:07:37 +00:00
ceriel 3bbf316395 Added Makefile to do a 'make distr' 1991-09-10 09:55:38 +00:00
ceriel 8caa154b25 new installation mechanism 1991-09-06 15:37:13 +00:00
ceriel d9f98bc411 New installation mechanism 1991-08-27 10:18:09 +00:00
ceriel 9f565afcc2 removed unused variable 1991-06-26 17:29:58 +00:00
ceriel ac83fe3815 Removed WORDLENGTH generation program; no longer assume that the machine
on which we compile is the machine on which we run
1991-03-05 13:06:00 +00:00
ceriel 27d53b0d33 Changed #include's 1991-03-05 12:44:05 +00:00
ceriel 2c31a9b1ac removed -i flag 1991-02-19 16:51:50 +00:00
ceriel 1139272435 Changed types in core allocation routines, changed lint flags 1990-12-17 14:55:03 +00:00
ceriel f936a3f35a time optimization is default now 1990-08-01 14:33:08 +00:00
ceriel e2b59f6517 Removed some erroneous fclose() calls 1990-05-31 13:54:33 +00:00
ceriel ab1b682800 changed lint flags 1989-03-07 10:27:22 +00:00
ceriel 79ac11bd40 Made to compile with DEBUG off 1988-09-02 13:55:54 +00:00
ceriel e8d1bdb192 make to work with modified installation script 1988-04-29 09:12:29 +00:00
ceriel 7fbb57dea4 clean entry should not throw away distributed files 1988-04-27 10:57:37 +00:00
ceriel 31b2f7d9e0 take care of GTO 1987-10-02 12:53:04 +00:00