commands: Rename the command functions

Command functions are traditionally named like the command shortened
to four characters.  When this name collides with a keyword or library
function, we abbreviate more: brea(), rea().  A few are unabbreviated,
e.g.  execute().  A few have different names, e.g. explain(), not
list().

Commit 23726b379 (v4.3.0) suppressed a GCC warning about carg()
colliding with its built-in function.

Ron Koenderink reported Microsoft Visual Studio 2019 fails to link:
"_carg already defined in ucrtd.lib(ucrtbased.dll)".

Time to clean this up: rename the functions to c_FOO(), where FOO is
the unabbreviated name of the command.

Signed-off-by: Markus Armbruster <armbru@pond.sub.org>
This commit is contained in:
Markus Armbruster 2021-01-18 06:00:04 +01:00
parent a6c46316e9
commit c6ec6a41c2
158 changed files with 664 additions and 524 deletions

View file

@ -42,7 +42,7 @@ static void pr_accept(natid, natid);
* viewpoint of another country
*/
int
acce(void)
c_accept(void)
{
struct natstr *natp;
struct natstr *np;

View file

@ -36,7 +36,7 @@
#include "commands.h"
int
add(void)
c_add(void)
{
struct natstr *natp;
int i;

View file

@ -43,7 +43,7 @@
* format: anti <SECT>
*/
int
anti(void)
c_anti(void)
{
struct sctstr sect;
int nsect;

View file

@ -42,7 +42,7 @@
#include "plane.h"
int
arm(void)
c_arm(void)
{
struct nchrstr *ncp;
struct plchrstr *plc;
@ -132,7 +132,7 @@ arm(void)
}
int
disarm(void)
c_disarm(void)
{
struct plnstr pl;
struct nukstr nuke;

View file

@ -37,7 +37,7 @@
#include "land.h"
int
army(void)
c_army(void)
{
struct lndstr land;
int count;

View file

@ -45,7 +45,7 @@ static void sneak_ashore(struct combat[], struct emp_qelem *,
struct combat *);
int
assa(void)
c_assault(void)
{
struct combat off[1]; /* assaulting ship */
struct combat def[1]; /* defending sector */

View file

@ -40,7 +40,7 @@
#include "ship.h"
int
atta(void)
c_attack(void)
{
struct combat off[6]; /* attacking sectors */
struct combat def[1]; /* defending sector */

View file

@ -37,7 +37,7 @@
#include "map.h"
int
bdes(void)
c_bdes(void)
{
char *p, d;
struct nstr_sect nstr;

View file

@ -36,7 +36,7 @@
#include "path.h"
int
best(void)
c_bestpath(void)
{
double cost;
struct sctstr s1, s2;

View file

@ -40,7 +40,7 @@
#include "ship.h"
int
boar(void)
c_board(void)
{
struct combat off[1]; /* boarding ship or sector */
struct combat def[1]; /* defending ship */

View file

@ -61,7 +61,7 @@ static int pinflak_planedamage(struct plnstr *, struct plchrstr *,
natid, int);
int
bomb(void)
c_bomb(void)
{
char *p;
coord tx, ty;

View file

@ -35,7 +35,7 @@
#include "commands.h"
int
brea(void)
c_break(void)
{
struct natstr *natp;

View file

@ -46,7 +46,7 @@ static struct budget *calc_all(void);
static char *dotsprintf(char *buf, char *format, int data);
int
budg(void)
c_budget(void)
{
static struct {
char *activity;

View file

@ -65,7 +65,7 @@ static int build_can_afford(double, int, char *);
* build <WHAT> <SECTS> <TYPE|DIR|MEG> [NUMBER]
*/
int
buil(void)
c_build(void)
{
struct natstr *natp = getnatp(player->cnum);
int tlev = (int)natp->nat_level[NAT_TLEV];

View file

@ -48,7 +48,7 @@
*
*/
int
buy(void)
c_buy(void)
{
struct sctstr sect;
struct natstr *natp;

View file

@ -37,7 +37,7 @@
#include "commands.h"
int
capi(void)
c_capital(void)
{
char buf[1024];
char *p;

View file

@ -37,7 +37,7 @@
#include "ship.h"
int
carg(void)
c_cargo(void)
{
int nships;
struct nstr_item ni;
@ -86,7 +86,7 @@ carg(void)
}
int
lcarg(void)
c_lcargo(void)
{
int nunits;
struct nstr_item ni;

View file

@ -39,7 +39,7 @@
static void cens_hdr(void);
int
cens(void)
c_census(void)
{
struct sctstr sect;
int nsect;

View file

@ -37,7 +37,7 @@
#include "optlist.h"
int
chan(void)
c_change(void)
{
char *p;
int charge;

View file

@ -53,7 +53,7 @@ static int showship(struct coast **cpp, int x, int y);
* format: coastwatch [<SECTS>]
*/
int
coas(void)
c_coastwatch(void)
{
struct sctstr sect;
struct nstr_sect nstr;

View file

@ -43,7 +43,7 @@
static double appraise_sect(struct sctstr *);
int
coll(void)
c_collect(void)
{
int arg;
time_t now;

View file

@ -38,7 +38,7 @@
static void prthresh(int val);
int
comm(void)
c_commodity(void)
{
struct sctstr sect;
char dirstr[12];

View file

@ -64,7 +64,7 @@ static void late(struct ltcomstr *ltcp);
static void prev_signed(struct ltcomstr *ltcp);
int
cons(void)
c_consider(void)
{
int rv;
struct ltcomstr ltc;

View file

@ -41,7 +41,7 @@
#include "commands.h"
int
conv(void)
c_convert(void)
{
struct natstr *natp;
struct sctstr sect;

View file

@ -38,7 +38,7 @@
static void coun_list(struct natstr *natp);
int
coun(void)
c_country(void)
{
struct nstr_item ni;
struct natstr nat;

View file

@ -36,7 +36,7 @@
#include "path.h"
int
cuto(void)
c_cutoff(void)
{
struct sctstr sect;
int nsect;

View file

@ -36,7 +36,7 @@
#include "optlist.h"
int
decl(void)
c_declare(void)
{
struct natstr nat;
enum relations rel;

View file

@ -37,7 +37,7 @@
#include "path.h"
int
deli(void)
c_deliver(void)
{
struct sctstr sect;
int dir, del;

View file

@ -40,7 +40,7 @@
*/
int
demo(void)
c_demobilize(void)
{
struct natstr *natp;
int number;

View file

@ -38,7 +38,7 @@
#include "optlist.h"
int
desi(void)
c_designate(void)
{
int n;
char *p;

View file

@ -36,7 +36,7 @@
#include "game.h"
int
disa(void)
c_disable(void)
{
game_ctrl_update(0);
pr("Updates are disabled\n");

View file

@ -42,7 +42,7 @@
* distribute <SECT> <DISTSECT|.|h>
*/
int
dist(void)
c_distribute(void)
{
struct sctstr sect, dsect, tsect;
struct nstr_sect nstr;

View file

@ -39,7 +39,7 @@
#include "plane.h"
int
drop(void)
c_drop(void)
{
coord tx, ty;
coord ax, ay;

View file

@ -38,7 +38,7 @@
#include "path.h"
int
dump(void)
c_dump(void)
{
struct sctstr sect;
char dirstr[20];

View file

@ -35,7 +35,7 @@
#include "commands.h"
int
echo(void)
c_echo(void)
{
pr("%s\n", player->argp[1] ? player->argp[1] : "");

View file

@ -63,7 +63,7 @@ static int edit_plane(struct plnstr *, char *, char *);
static int edit_nuke(struct nukstr *, char *, char *);
int
edit(void)
c_edit(void)
{
union empobj_storage item;
char *what;

View file

@ -36,7 +36,7 @@
#include "game.h"
int
enab(void)
c_enable(void)
{
game_ctrl_update(1);
pr("Updates are enabled\n");

View file

@ -36,7 +36,7 @@
#include "commands.h"
int
enli(void)
c_enlist(void)
{
struct nstr_sect nstr;
struct sctstr sect;

View file

@ -42,7 +42,7 @@
static int explore_map(coord, coord, char *, char *);
int
explore(void)
c_explore(void)
{
int amount;
struct sctstr sect;

View file

@ -42,7 +42,7 @@
* format: fina
*/
int
fina(void)
c_financial(void)
{
struct lonstr loan;
struct nstr_item ni;

View file

@ -41,7 +41,7 @@ static int chat(struct natstr *, char *);
static int sendmessage(struct natstr *, char *, int);
int
flash(void)
c_flash(void)
{
struct natstr *us;
struct natstr *to;
@ -73,7 +73,7 @@ flash(void)
}
int
wall(void)
c_wall(void)
{
return chat(NULL, player->comtail[1]);
}

View file

@ -37,7 +37,7 @@
#include "ship.h"
int
flee(void)
c_fleetadd(void)
{
struct shpstr ship;
int count;

View file

@ -41,7 +41,7 @@
#include "plane.h"
int
fly(void)
c_fly(void)
{
coord tx, ty;
coord ax, ay;

View file

@ -38,7 +38,7 @@
#include "server.h"
int
force(void)
c_force(void)
{
if (shutdown_pending) {
pr("Shutdown is pending\n");

View file

@ -37,7 +37,7 @@
#include "optlist.h"
int
fort(void)
c_fortify(void)
{
int nunits;
struct nstr_item ni;

View file

@ -42,7 +42,7 @@
* format: give <commod> <sect> <amt>
*/
int
give(void)
c_give(void)
{
struct sctstr sect;
int amt;

View file

@ -36,7 +36,7 @@
#include "product.h"
int
grin(void)
c_grind(void)
{
struct nstr_sect nstr;
struct sctstr sect;

View file

@ -40,7 +40,7 @@
* harden <PLANE> <LEVEL>
*/
int
hard(void)
c_harden(void)
{
struct plchrstr *pcp;
struct plnstr pln;

View file

@ -48,7 +48,7 @@ static int head_findscoop(struct histstr (*hist)[MAXNOC],
natid maxcnum, natid *ano, natid *vno);
int
head(void)
c_headlines(void)
{
struct histstr *hp;
natid maxcnum;

View file

@ -37,7 +37,7 @@
#include "commands.h"
int
improve(void)
c_improve(void)
{
struct sctintrins *incp;
struct sctstr sect;

View file

@ -63,7 +63,7 @@ lowerit(char *buf, int n, char *orig)
#if !defined(_WIN32)
int
info(void)
c_info(void)
{
char buf[255];
FILE *fp;
@ -159,7 +159,7 @@ info(void)
}
int
apro(void)
c_apropos(void)
{
FILE *fp;
char *name, *lbp;
@ -271,7 +271,7 @@ apro(void)
#else /* _WIN32 */
int
info(void)
c_info(void)
{
char buf[255];
FILE *fp;
@ -384,7 +384,7 @@ info(void)
}
int
apro(void)
c_apropos(void)
{
HANDLE hDir;
WIN32_FIND_DATA fData;

View file

@ -37,7 +37,7 @@
#include "land.h"
int
land(void)
c_land(void)
{
int nunits, noff;
struct nstr_item ni;

View file

@ -56,7 +56,7 @@ static int msl_equip(struct plnstr *, char);
* laun <PLANES>
*/
int
laun(void)
c_launch(void)
{
struct nstr_item nstr;
struct plnstr plane;

View file

@ -38,7 +38,7 @@
#include "ship.h"
int
lboa(void)
c_lboard(void)
{
struct combat off[1]; /* boarding sector */
struct combat def[1]; /* defending land unit */

View file

@ -37,7 +37,7 @@
#include "land.h"
int
ldump(void)
c_ldump(void)
{
int nunits;
int field[128];

View file

@ -37,7 +37,7 @@
#include "optlist.h"
int
ledg(void)
c_ledger(void)
{
struct nstr_item nstr;
struct lonstr loan;

View file

@ -35,7 +35,7 @@
#include "commands.h"
int
leve(void)
c_level(void)
{
struct sctstr sect;
int nsect;

View file

@ -61,7 +61,7 @@ static int load_comm_land(struct sctstr *sectp, struct lndstr *lp,
int *nunitsp);
int
load(void)
c_load(void)
{
int loading = **player->argp == 'l';
int noisy;
@ -190,7 +190,7 @@ load(void)
}
int
lload(void)
c_lload(void)
{
int loading = player->argp[0][1] == 'l';
int noisy;

View file

@ -44,13 +44,13 @@ static void look_ship(struct shpstr *lookship);
static void look_land(struct lndstr *lookland);
int
look(void)
c_lookout(void)
{
return do_look(EF_SHIP);
}
int
llook(void)
c_llookout(void)
{
return do_look(EF_LAND);
}

View file

@ -36,7 +36,7 @@
#include "lost.h"
int
lost(void)
c_lost(void)
{
int nlost;
struct nstr_item ni;

View file

@ -36,7 +36,7 @@
#include "land.h"
int
lsta(void)
c_lstat(void)
{
int nunits;
struct nstr_item ni;

View file

@ -46,7 +46,7 @@
static void expose_land(struct shpstr *s1, struct lndstr *l1);
int
ltend(void)
c_ltend(void)
{
struct nstr_item targets;
struct nstr_item tenders;

View file

@ -39,7 +39,7 @@
#include "map.h"
int
map(void)
c_map(void)
{
int unit_type = EF_BAD;
int bmap = 0;

View file

@ -39,7 +39,7 @@
#include "unit.h"
int
march(void)
c_march(void)
{
struct nstr_item ni_land;
struct emp_qelem land_list;

View file

@ -41,7 +41,7 @@
#include "optlist.h"
int
mark(void)
c_market(void)
{
char buf[1024];
char *p;

View file

@ -66,7 +66,7 @@ static void free_flist(struct emp_qelem *);
static struct flist *search_flist(struct emp_qelem *, struct empobj *);
int
multifire(void)
c_fire(void)
{
static int ef_with_guns[] = { EF_SECTOR, EF_SHIP, EF_LAND, EF_BAD };
char *ptr;

View file

@ -41,7 +41,7 @@
* format: mine <SHIPS> <NUMBER MINES>
*/
int
mine(void)
c_mine(void)
{
struct shpstr ship;
struct sctstr sect;
@ -88,7 +88,7 @@ mine(void)
* format: landmine <UNITS> <NUMBER MINES>
*/
int
landmine(void)
c_lmine(void)
{
struct lndstr land;
struct sctstr sect;

View file

@ -45,7 +45,7 @@ static int show_mission(struct nstr_item *);
* mission <type> <planes/ships/units> <mission type> <op sector> [<radius>]
*/
int
mission(void)
c_mission(void)
{
static int ef_with_missions[] = { EF_SHIP, EF_LAND, EF_PLANE, EF_BAD };
char *p;

View file

@ -37,7 +37,7 @@
#include "optlist.h"
int
morale(void)
c_morale(void)
{
struct nstr_item np;
struct lndstr land;

View file

@ -44,7 +44,7 @@
static int cmd_move_map(coord, coord, char *, char *);
int
move(void)
c_move(void)
{
int amount;
struct sctstr sect;

View file

@ -39,7 +39,7 @@
* name <SHIP> <NAME>
*/
int
name(void)
c_name(void)
{
struct shpstr ship;
char *p;

View file

@ -36,7 +36,7 @@
#include "optlist.h"
int
nati(void)
c_nation(void)
{
struct natstr *natp;
struct sctstr sect;

View file

@ -38,7 +38,7 @@
#include "unit.h"
int
navi(void)
c_navigate(void)
{
struct nstr_item ni_ship;
struct emp_qelem ship_list;

View file

@ -37,7 +37,7 @@
#include "nuke.h"
int
ndump(void)
c_ndump(void)
{
struct nstr_item nstr;
struct nukstr nuk;

View file

@ -43,7 +43,7 @@
static void init_sanct(struct natstr *, coord, coord);
int
new(void)
c_newcap(void)
{
static struct range defrealm = { -8, -5, 10, 5, 0, 0 };
struct sctstr sect;

View file

@ -39,7 +39,7 @@
#include "update.h"
int
newe(void)
c_neweff(void)
{
struct natstr *natp;
struct sctstr sect;

View file

@ -46,7 +46,7 @@ struct sectwon {
};
int
news(void)
c_newspaper(void)
{
struct natstr *natp;
time_t now;
@ -83,7 +83,7 @@ news(void)
then = now - delta;
}
natp->nat_newstim = now;
head();
c_headlines();
pr("\nThe details of Empire news since %s", ctime(&then));
heading = 0;

View file

@ -38,7 +38,7 @@
#include "plane.h"
int
nuke(void)
c_nuke(void)
{
int nnukes, noff;
struct nstr_item nstr;

View file

@ -41,7 +41,7 @@
static int do_loan(void);
int
offe(void)
c_offer(void)
{
char *cp;

View file

@ -37,7 +37,7 @@
#include "commands.h"
int
orig(void)
c_origin(void)
{
char *p;
coord x, y;

View file

@ -44,7 +44,7 @@
static int paradrop(struct emp_qelem *list, coord x, coord y);
int
para(void)
c_paradrop(void)
{
coord tx, ty;
coord ax, ay;

View file

@ -40,7 +40,7 @@
#include "path.h"
int
path(void)
c_path(void)
{
struct nstr_sect ns;

View file

@ -37,7 +37,7 @@
#include "ship.h"
int
payo(void)
c_payoff(void)
{
struct sctstr sect;
int nships;

View file

@ -36,7 +36,7 @@
#include "plane.h"
int
pboa(void)
c_pboard(void)
{
struct sctstr sect;
struct nstr_item np;

View file

@ -38,7 +38,7 @@
#include "plane.h"
int
pdump(void)
c_pdump(void)
{
int nplanes;
struct nstr_item np;

View file

@ -37,7 +37,7 @@
#include "commands.h"
int
peek(void)
c_peek(void)
{
struct sctstr sect;
int nsect;

View file

@ -39,7 +39,7 @@
#include "plane.h"
int
plan(void)
c_plane(void)
{
int nplanes, noff;
struct nstr_item np;

View file

@ -41,7 +41,7 @@ static void play_header(void);
static int play_list(struct player *joe);
int
play(void)
c_players(void)
{
struct player *joe;
int saw = 0;

View file

@ -59,7 +59,7 @@ static float power_tech_factor(float);
static float item_power(short[]);
int
powe(void)
c_power(void)
{
struct natstr *natp;
int i;

View file

@ -77,7 +77,7 @@ count_pop(void)
}
int
prod(void)
c_production(void)
{
struct natstr *natp;
struct sctstr sect, scratch_sect;

View file

@ -36,7 +36,7 @@
#include "plane.h"
int
pstat(void)
c_pstat(void)
{
int nplanes;
struct nstr_item np;

View file

@ -36,13 +36,13 @@
#include "unit.h"
int
rada(void)
c_radar(void)
{
return radar(EF_SHIP);
}
int
lrad(void)
c_lradar(void)
{
return radar(EF_LAND);
}

View file

@ -36,7 +36,7 @@
#include "plane.h"
int
range(void)
c_range(void)
{
struct nstr_item np;
struct plnstr plane;

View file

@ -49,7 +49,7 @@
static int print_sink(char *, size_t, void *);
int
rea(void)
c_read(void)
{
static char *telnames[] = {
/* must follow TEL_ defines in tel.h */

View file

@ -47,7 +47,7 @@ list_realm(int curr, struct natstr *natp)
}
int
real(void)
c_realm(void)
{
struct realmstr realm;
struct natstr *natp;

View file

@ -39,7 +39,7 @@
#include "plane.h"
int
reco(void)
c_recon(void)
{
int mission_flags = player->argp[0][0] == 's' ? PM_R | PM_S : PM_R;
coord tx, ty;

View file

@ -35,7 +35,7 @@
#include "commands.h"
int
reje(void)
c_reject(void)
{
static char *what[] = { "teles", "annos", "loans" };
char *p;

View file

@ -41,7 +41,7 @@
* viewpoint of another country
*/
int
rela(void)
c_relations(void)
{
struct natstr *np;
natid cn;

View file

@ -37,7 +37,7 @@
#include "server.h"
int
relo(void)
c_reload(void)
{
/*
* Like SIGHUP, plus friendly chatter. If you change anything

View file

@ -39,7 +39,7 @@
#include "optlist.h"
int
repa(void)
c_repay(void)
{
struct lonstr loan;
struct natstr *natp;

Some files were not shown because too many files have changed in this diff Show more