Commit graph

45 commits

Author SHA1 Message Date
73e25ff21e Update copyright notice 2010-01-19 08:40:17 +01:00
6ae4eca045 Don't use 0 as null pointer constant, part 3
This part replaces E == 0 by !E, where E has pointer type.
2009-03-24 21:46:01 +01:00
90f8f2b099 Don't use 0 as null pointer constant, part 2
This part replaces E != 0 by E, where E has pointer type.
2009-03-24 21:46:01 +01:00
35ef345ecb Update copyright notice 2009-02-08 09:33:18 +01:00
Ron Koenderink
08b9455682 Reimplement max_idle without a separate thread
Remove the KillIdle thread.  Add timeout to struct iop, initialized in
io_open().  Obey it in io_input() by passing it to empth_select().  If
empth_select() times out, report that back through io_input() to
recvclient() and player_login().  If player_login() receives a timeout
indication, print a message and terminate the session.  If
recvclient() receives a timeout indication, flash a message to the
player and initiate a shut down the player's session.

Create WIN32 sys/time.h to define struct timeval.  This creates some
conflicts with WIN32 windows.h definitions.  Including windows.h in
show.c and info.c creates conflicts, so remove that.  Modify service.c
to include sys/socket.h instead of windows.h to remove the conflict
with sys/time.h.
2009-02-01 17:06:33 +01:00
a4b0aae1e5 Change info not to prepend a header line to the info page
The contents of the line was partly useless (repetition of the command
argument) and partly misleading (modification time of the formatted
info file, ifndef _WIN32).
2008-12-28 19:54:16 +01:00
d702068457 Fix trailing whitespace 2008-09-17 21:31:40 -04:00
29aefc356f Get rid of RET_SYS, just use RET_FAIL
RET_SYS was used for commands failing due to internal or environmental
errors, but not really systematically.  The difference to RET_FAIL is
how dispatch() treats them: RET_SYS got logged, and cost no BTUs.

More specific logging is possible at the point of failure than in
dispatch().  Make sure that's done for all failures that used to
return RET_SYS.

The change in BTU charging affects commands consider, offer, repay,
trade failing due to internal errors.  It also affects deity commands
reload and turn (irrelevant because deities get unlimited BTUs), and
commands apropos, info and motd (irrelevant because they cost no
BTUs).
2008-08-03 11:34:00 -04:00
db02dda32f Update copyright notice 2008-01-19 10:15:37 +01:00
Ron Koenderink
2a0597be8f (snprintf) [_WIN32]: snprintf() should have <stdio.h>. 2007-08-24 20:19:53 +00:00
63bdc89835 Update copyright notice. 2007-01-09 19:09:31 +00:00
dbfd0c5aa3 (apro) [!_WIN32]: Silently ignore directory entries starting with '.'.
Before, apro() logged complaints about . and .. not being regular
files.
2006-09-23 15:00:01 +00:00
e42053d928 Break inclusion cycle: prototypes.h and commands.h included each
other.  Ensure headers in include/ can be included in any order
(except for econfig-spec.h, which is special).  New header types.h to
help avoid inclusion cycles.  Sort include directives.  Remove some
superflous includes.
2006-07-10 06:37:23 +00:00
Ron Koenderink
0e4eb6bf0a (install_service, info, apro) [_WIN32]: Convert to standard snprintf()
from _snprintf().

[_WIN32]: Add #define snprintf to convert to _snprintf for WIN32
Visual Studio.
2006-06-23 00:13:21 +00:00
b812435762 (lowerit): Simplify. 2006-04-30 08:37:06 +00:00
a988b907fc s_char purge directed by compiler warnings. 2006-04-29 06:41:45 +00:00
f5a9284867 Update known contributors comment. 2006-02-24 21:35:27 +00:00
4515b84c59 COPYING duplicates information from README. Remove. Move GPL from
LICENSE to COPYING, because that's where it usually is.  Update all
the references to these files.
2006-01-21 19:48:41 +00:00
3e400c018c Update copyright notice. 2006-01-05 13:36:57 +00:00
Ron Koenderink
ce4190caf7 (info) [_WIN32]: Add brackets to ensure the right combination of
ORs and ANDs.

(apro) [_WIN32]: Remove space to fix formatting for logerror().
Fix printing type for lhitlim in the format string for logerror() call.
2006-01-01 19:55:53 +00:00
Ron Koenderink
f1d9a5eba3 (info, apro) [_WIN32]: Correct parameter order for calls
to logerror() where GetLastError() is used.
Change the format to "lu" for printing GetLastError().
2006-01-01 19:47:46 +00:00
0d267e0b24 There's no reason to include <time.h> in empio.h, except it's missing
in a couple of other files.  Include it where it's needed.
2005-12-28 21:25:39 +00:00
3aebb68ee7 Include config.h. 2005-12-27 18:04:19 +00:00
cae225a94a (info): Remove dead code. 2005-10-26 16:22:32 +00:00
4f59fc9967 Remove a bunch of redundant casts. 2005-06-12 06:31:48 +00:00
345ad3dfe0 Update copyright notice. 2005-03-16 22:03:16 +00:00
0595ff4d4e Indentation fixes. 2005-03-12 15:05:23 +00:00
Ron Koenderink
55e6aca9e0 (wrmakesrc,wripglob,wrgamesdef,info,apro,mobupdate,rea,turn
upda,ef_open,logerror,emp_config,match_user,show_motd,gamedown,
typed_wu,delete_old_announcements,mobility_check,mobility_init,
allocate_memory,write_newcap_script,main,files,fairland,doconfig,)
[_WIN32]: Switchback to default mode of text.
"t" (text) is not included the ISO/ANSI C standard but "b" (binary)
is included.
2005-03-02 12:47:15 +00:00
Ron Koenderink
537735f512 switched comment from // format to /* */ format. 2004-12-21 03:16:18 +00:00
0ad644b11b (info): Polish output for ambigous topic argument. 2004-12-17 13:58:10 +00:00
Ron Koenderink
d40ea86b61 (info): Print the info topics found when the abbreviation is not unique. Closes #1018302. 2004-11-11 01:58:35 +00:00
Ron Koenderink
8fdd0259f2 (info): Fix when with last character is special.
Also reorganized to check for special characters then blank.

(info): Add length boundary check to filename variable.
Change WIN32 to use the same code.

(info) [_WIN32]: Fix check for invalid file attributes.

(apro): Ensure the user does not see the directory information on error.
See #1028552 for reference.

(apro): Ensure the directories, operating system files, and
hidden files are skipped.
2004-11-10 00:02:29 +00:00
Ron Koenderink
1b8eaffce4 (info): Don't leak potentially sensitive information to player in
error messages.  Properly log all system errors and return RET_SYS.
Closes #1028552.

(info): Fix use of uninitialized variable when fopen() succeeds but
fstat() or the st_mode check fails.

(info) [_WIN32]: Fix '//' to be '\\'.  Add file type check to prevent
opening hidden or operating system files.
2004-10-05 01:17:08 +00:00
Ron Koenderink
d895fe1d00 Remove the unused/not needed code. 2004-10-03 16:16:05 +00:00
fac342ed49 Update copyright notice. 2004-09-07 15:07:16 +00:00
Ron Koenderink
9e670d8dc7 (info): `info' was not checking for all types of common files in
Windows, therefore could miss info files depending on the status
(archive, read-only).  Also changed the error message to user to
provide a more accurate description of the problem.  Closes #1018297.
2004-09-07 14:04:19 +00:00
e7d75b2279 Use gcc function attribute `format' to catch bad format strings. Fix
them.  From Marc Olzheim.
Type modifier 'l' was missing in many places, probably rendering the
server useless on 64-bit hosts.
(ef_flush, ef_write, ef_extend, lwpCreate, lwpDestroy): Use conversion
specifier 'p' to print pointers.
(check_market): Fix display of loan amount.
(doland): Fix unescaped '%' (undefined behavior).
(ldump, ndump, pdump, sdump): Don't use flag '0' with conversion
specifier 's' (undefined behavior).
(dump, ldump, lost, ndump, pdump, sdump, empth_create, update_sched):
Cast time_t and pthread_t to long for printing.
(lwpStackCheck, lwpStackCheckUsed, finish_sects): Insert cast to fix
argument type on all platforms.
(prod): Remove extra argument.
(perform_mission, airdamage, retreat_land1, lwpReschedule): Format
string missed arguments.
2004-03-09 12:27:40 +00:00
4a3f0b8146 Add some missing declarations to headers. Remove some redundant
declarations elsewhere.  Change linkage of some functions to static.
2004-02-20 10:51:03 +00:00
8cd0160176 Declare all configuration variables in optlist.h. Include that
instead of declaring them all over the place.  This uncovered type
errors:
(s_p_etu, adj_update): Defined long, sometimes declared int.  Kills
big endian machines where sizeof(long) != sizeof(int).  Change to
int.

(set_option, delete_option, optstrset, intset, floatset, doubleset,
longset, optionset, optiondel, worldxset): Change linkage to static.
2004-02-17 22:58:04 +00:00
0696bb190d Indentation fix. 2004-02-06 23:26:25 +00:00
64afd7747b (index, rindex): Obsolete BSDisms; remove. Use standard strchr() and
strrchr() instead.
(setbuffer): Obsolete BSDism, unused; remove.
2004-01-08 18:15:13 +00:00
1333a40bb8 (info): Use ANSI strerror() instead of non-portable sys_errlist[]. 2004-01-06 20:08:53 +00:00
3bf2b1b47f errno may not be a variable; users must include errno.h instead of
declaring it like `extern int errno'.
2003-12-17 21:18:12 +00:00
9b7adfbecc Indented with src/scripts/indent-emp. 2003-09-02 20:48:48 +00:00
d8b7fdfae1 Import of Empire 4.2.12 2003-08-23 12:23:04 +00:00