/* integral mismatch, due to misuse of sector short */
#pragma warning (disable : 4761 )
-#define bzero(d, s) memset(d, 0, s)
-#define bcopy(s, d, z) memcpy(d, s, z)
-
#include <minmax.h>
#include <io.h>
fprintf(stderr, "%s: No such host\n", name);
return 0;
}
- bcopy(hp->h_addr, (s_char *)&addr->sin_addr,
- sizeof(addr->sin_addr));
+ memcpy(&addr->sin_addr, hp->h_addr, sizeof(addr->sin_addr));
#ifdef _WIN32
printf("Trying to connect to '%s'\n", inet_ntoa(addr->sin_addr));
fflush(stdout);
return NULL;
}
-bzero(ptr, len)
-s_char *ptr;
-int len;
-{
- memset(ptr, 0, len);
-}
-
-bcopy(src, dst, len)
-s_char *src;
-s_char *dst;
-int len;
-{
- memcpy(dst, src, len);
-}
#endif
if (nbytes > 0) {
if (nleft < nbytes)
nbytes = nleft;
- bcopy(io->data + io->offset, offset, nbytes);
+ memcpy(offset, io->data + io->offset, nbytes);
offset += nbytes;
nleft -= nbytes;
}
}
(void)printf("\n");
(void)sendcmd(s, PASS, cpass);
- bzero(cpass, strlen(cpass)); /* for core dumps */
+ memset(cpass, 0, strlen(cpass)); /* for core dumps */
if (!expect(s, C_CMDOK, buf)) {
(void)fprintf(stderr, "Bad password\n");
return 0;
return (s_char *)0;
}
-bzero(ptr, size)
-s_char *ptr;
-int size;
-{
- int i;
-
- for (i = 0; i < size; i++)
- ptr[i] = 0;
-}
-
-bcopy(src, dest, size)
-unsigned char *src, *dest;
-int size;
-{
- int i;
- unsigned char *d = dest, *s = src;
-
- for (i = 0; i < size; i++)
- *d++ = *s++;
-}
#endif
int
mask = bit_newfdmask();
savemask = bit_newfdmask();
#endif
- bzero((s_char *)argv, sizeof(argv));
+ memset(argv, 0, sizeof(argv));
saveargv(ac, av, argv);
auxout_fname = 0;
auxout_fp = 0;
}
/* Note we don't free the fromhead here, we just zero it. That way,
we can use it next time without mallocing int */
- bzero((s_char *)fromhead, (sizeof(struct as_frompath *) * WORLD_Y));
+ memset(fromhead, 0, (sizeof(struct as_frompath *) * WORLD_Y));
}
struct as_path *
natp->nat_xorg = 0;
natp->nat_dayno = 0;
natp->nat_minused = 0;
- bzero((s_char *)natp->nat_b, sizeof(natp->nat_b));
+ memset(natp->nat_b, 0, sizeof(natp->nat_b));
(void)time(&natp->nat_last_login);
(void)time(&natp->nat_last_logout);
natp->nat_money = 0;
while ((r = nxtitem(&ni, (s_char *)&land2)) &&
(land2.lnd_army != c)) ;
if (r) {
- bcopy(land2.lnd_rpath, land.lnd_rpath, 10);
+ memcpy(land.lnd_rpath, land2.lnd_rpath, sizeof(land.lnd_rpath));
land.lnd_rflags = land2.lnd_rflags;
}
putland(land.lnd_uid, &land);
int gun;
int shell;
- bzero((s_char *)&head, sizeof(struct shiplook));
+ memset(&head, 0, sizeof(struct shiplook));
head.uid = -1;
onsea = (target->sct_type == SCT_WATER) ? 1 : 0;
for (qp = list->q_forw; qp != list && !player->aborted;
free(s2);
}
}
- bzero((s_char *)&head, sizeof(struct shiplook));
+ memset(&head, 0, sizeof(struct shiplook));
head.uid = -1;
plp = (struct plist *)qp;
if ((plp->pcp->pl_flags & P_C) && (!(plp->pcp->pl_flags & P_T)))
eff = pp->pln_effic;
if (dam <= 0)
return 0;
- bzero(dmess, 255);
+ memset(dmess, 0, sizeof(dmess));
eff -= dam;
if (eff < 0)
eff = 0;
s_char buf[1024];
s_char in[80];
- bzero((s_char *)p_sect, sizeof(p_sect));
+ memset(p_sect, 0, sizeof(p_sect));
etu = etu_per_update;
np = getnatp(player->cnum);
if (freeship == 0) {
ef_extend(EF_SHIP, 50);
}
- bzero(&ship, sizeof(struct shpstr));
+ memset(&ship, 0, sizeof(struct shpstr));
ship.shp_x = sp->sct_x;
ship.shp_y = sp->sct_y;
ship.shp_destx[0] = sp->sct_x;
if (freeland == 0) {
ef_extend(EF_LAND, 50);
}
- bzero(&land, sizeof(struct lndstr));
+ memset(&land, 0, sizeof(struct lndstr));
land.lnd_x = sp->sct_x;
land.lnd_y = sp->sct_y;
land.lnd_own = player->cnum;
land.lnd_fuel = lp->l_fuelc;
land.lnd_nxlight = 0;
land.lnd_rflags = 0;
- bzero(land.lnd_rpath, 10);
+ memset(land.lnd_rpath, 0, sizeof(land.lnd_rpath));
land.lnd_rad_max = 0;
land.lnd_nv = 0;
land.lnd_att = (float)LND_ATTDEF(lp->l_att, tlev - lp->l_tech);
vec[I_FOOD] -= max_amt;
- bzero(lvec, sizeof(lvec));
+ memset(lvec, 0, sizeof(lvec));
getvec(VT_ITEM, lvec, (s_char *)&land, EF_LAND);
lvec[I_FOOD] += max_amt;
putvec(VT_ITEM, lvec, (s_char *)&land, EF_LAND);
if (freeplane == 0) {
ef_extend(EF_PLANE, 50);
}
- bzero(&plane, sizeof(struct plnstr));
+ memset(&plane, 0, sizeof(struct plnstr));
plane.pln_x = sp->sct_x;
plane.pln_y = sp->sct_y;
plane.pln_own = sp->sct_own;
int vec[I_MAX + 1];
/* Wipe all the distribution info */
- bzero((s_char *)vec, sizeof(vec));
+ memset(vec, 0, sizeof(vec));
putvec(VT_DIST, vec, (s_char *)sp, EF_SECTOR);
putvec(VT_DEL, vec, (s_char *)sp, EF_SECTOR);
sp->sct_dist_x = sp->sct_x;
makenotlost(EF_SECTOR, player->cnum, 0, sect.sct_x, sect.sct_y);
sect.sct_own = player->cnum;
- bzero((s_char *)vec, sizeof(vec));
+ memset(vec, 0, sizeof(vec));
putvec(VT_DIST, vec, (s_char *)§, EF_SECTOR);
putvec(VT_DEL, vec, (s_char *)§, EF_SECTOR);
sect.sct_off = 1;
s_char prompt[128];
s_char buf[1024];
- bzero((s_char *)ltcp, sizeof(*ltcp));
+ memset(ltcp, 0, sizeof(*ltcp));
if (getstarg(player->argp[1], "loan or treaty? ", buf) == 0)
return RET_SYN;
ltcp->type = ef_byname(buf);
putvar(V_PTIME, arg, (s_char *)ship, EF_SHIP);
break;
case 'R':
- bcopy(p, ship->shp_rpath, 10);
+ memcpy(ship->shp_rpath, p, sizeof(ship->shp_rpath));
break;
case 'W':
ship->shp_rflags = arg;
land->lnd_retreat = arg;
break;
case 'R':
- bcopy(p, land->lnd_rpath, 10);
+ memcpy(land->lnd_rpath, p, sizeof(land->lnd_rpath));
break;
case 'W':
land->lnd_rflags = arg;
explore(void)
{
register int amount;
- struct sctstr orig, sect;
+ struct sctstr sect;
struct sctstr endsect;
struct sctstr start;
struct sctstr chksect;
pr("Not yours\n");
return RET_FAIL;
}
- bcopy((s_char *)§, (s_char *)&orig, sizeof(struct sctstr));
infected = getvar(V_PSTAGE, (s_char *)§, EF_SECTOR) == PLG_INFECT;
if ((amt_src = getvar(vtype, (s_char *)§, EF_SECTOR)) <= 0) {
pr("No %s in %s\n", ip->i_name,
while ((r = nxtitem(&ni, (s_char *)&ship2))
&& (ship2.shp_fleet != c)) ;
if (r) {
- bcopy(ship2.shp_rpath, ship.shp_rpath, 10);
+ memcpy(ship.shp_rpath, ship2.shp_rpath, sizeof(ship.shp_rpath));
ship.shp_rflags = ship2.shp_rflags;
}
putship(ship.shp_uid, &ship);
pr("::::::::::::::::::::::::::::::::::::::::::::::::::\n");
pr(" %s", ctime(&now));
pr("\n");
- bzero((s_char *)hist, sizeof(hist));
+ memset(hist, 0, sizeof(hist));
snxtitem_all(&nstr, EF_NEWS);
maxcnum = 0;
while (nxtitem(&nstr, (s_char *)&news)) {
pr("Memory error. Tell the deity.\n");
return RET_FAIL;
}
- bzero((s_char *)bitmap, (WORLD_X * WORLD_Y) / 8);
+ memset(bitmap, 0, (WORLD_X * WORLD_Y) / 8);
while (nxtitem(&ni, (s_char *)&myship)) {
if (!player->owner)
continue;
pr("Memory error. Tell the deity.\n");
return RET_FAIL;
}
- bzero((s_char *)bitmap, (WORLD_X * WORLD_Y) / 8);
+ memset(bitmap, 0, (WORLD_X * WORLD_Y) / 8);
while (nxtitem(&ni, (s_char *)&myland)) {
if (!player->owner)
continue;
if (nfiring > *nd)
*nd = nfiring;
fp = (struct flist *)malloc(sizeof(struct flist));
- bzero((s_char *)fp, sizeof(struct flist));
+ memset(fp, 0, sizeof(struct flist));
fp->defdam = dam;
fp->victim = vict;
switch (attacker) {
(*nfiring)++;
fp = (struct flist *)malloc(sizeof(struct flist));
- bzero((s_char *)fp, sizeof(struct flist));
+ memset(fp, 0, sizeof(struct flist));
fp->type = targ_ship;
fp->uid = ship.shp_uid;
add_to_fired_queue(&fp->queue, list);
continue;
(*nfiring)++;
fp = (struct flist *)malloc(sizeof(struct flist));
- bzero((s_char *)fp, sizeof(struct flist));
+ memset(fp, 0, sizeof(struct flist));
fp->type = targ_ship;
fp->uid = ship.shp_uid;
add_to_fired_queue(&fp->queue, list);
(*nfiring)++;
fp = (struct flist *)malloc(sizeof(struct flist));
- bzero((s_char *)fp, sizeof(struct flist));
+ memset(fp, 0, sizeof(struct flist));
fp->type = targ_unit;
fp->uid = land.lnd_uid;
add_to_fired_queue(&fp->queue, list);
continue;
(*nfiring)++;
fp = (struct flist *)malloc(sizeof(struct flist));
- bzero((s_char *)fp, sizeof(struct flist));
+ memset(fp, 0, sizeof(struct flist));
fp->x = firing.sct_x;
fp->y = firing.sct_y;
fp->type = targ_land;
int
would_abandon(struct sctstr *sp, int vtype, int amnt, struct lndstr *lp)
{
- struct sctstr sect;
int mil, civs, loyalcivs;
if ((vtype != V_CIVIL) && (vtype != V_MILIT))
return 0;
- bcopy((s_char *)sp, (s_char *)§, sizeof(struct sctstr));
-
mil = getvar(V_MILIT, (s_char *)sp, EF_SECTOR);
civs = getvar(V_CIVIL, (s_char *)sp, EF_SECTOR);
logerror("malloc failed in navi\n");
return RET_FAIL;
}
- bzero((s_char *)bitmap, (WORLD_X * WORLD_Y) / 8);
+ memset(bitmap, 0, (WORLD_X * WORLD_Y) / 8);
/* zap any conditionals */
ns.ncond = 0;
xyrelrange(np, &ns.range, &range);
pr("Memory error. Tell the deity.\n");
return 0;
}
- bzero((s_char *)map, (WORLD_X * WORLD_Y) / 2);
+ memset(map, 0, (WORLD_X * WORLD_Y) / 2);
ok(map, x, y);
free((s_char *)map);
if (nfree < 5)
land.lnd_fuel = lp->l_fuelc;
land.lnd_nxlight = 0;
land.lnd_rflags = 0;
- bzero((s_char *)land.lnd_rpath, 10);
+ memset(land.lnd_rpath, 0, sizeof(land.lnd_rpath));
land.lnd_rad_max = lp->l_rad;
land.lnd_nv = 0;
land.lnd_maxlight = (int)LND_XPL(lp->l_nxlight, tlev - lp->l_tech);
land.lnd_maxland = (int)LND_MXL(lp->l_mxland, tlev - lp->l_tech);
- bzero((s_char *)lvec, sizeof(lvec));
+ memset(lvec, 0, sizeof(lvec));
getvec(VT_ITEM, lvec, (s_char *)&land, EF_LAND);
lvec[I_FOOD] +=
vl_find(V_FOOD, lp->l_vtype, lp->l_vamt, (int)lp->l_nv);
s_char num[128];
s_char *verb;
- bzero((s_char *)page_has_news, sizeof(page_has_news));
- bzero((s_char *)sectors_taken, sizeof(sectors_taken));
+ memset(page_has_news, 0, sizeof(page_has_news));
+ memset(sectors_taken, 0, sizeof(sectors_taken));
(void)head();
(void)time(&now);
natp = getnatp(player->cnum);
xyrelrange(natp, &absrange, &relrange);
blankfill((s_char *)mapbuf, &ns.range, 3);
while (*pp && (i = chkdir(*pp, DIR_STOP, DIR_LAST)) >= 0) {
- bcopy(routech[i][0], &map[deltay(cy, ns.range.ly)]
- [deltax(cx, ns.range.lx) * 2], 3);
+ memcpy(&map[deltay(cy, ns.range.ly)][deltax(cx, ns.range.lx) * 2],
+ routech[i][0],
+ 3);
cx += diroff[i][0];
cy += diroff[i][1];
++pp;
int no_numbers = 0;
s_char *p;
- bzero((s_char *)targets, sizeof(targets));
+ memset(targets, 0, sizeof(targets));
natp = getnatp(player->cnum);
num = MAXNOC;
if (player->argp[1] && player->argp[1][0] == 'n') {
float f;
player->btused += powe_cost;
- bzero((s_char *)powbuf, sizeof(powbuf));
+ memset(powbuf, 0, sizeof(powbuf));
snxtsct_all(&ns);
while (nxtsct(&ns, §)) {
if (sect.sct_own == 0)
int first = 1;
int readit;
- bzero(kind, 80);
+ memset(kind, 0, sizeof(kind));
(void)time(&now);
if (*player->argp[0] == 'w') {
return RET_SYN;
prdate();
natp = getnatp(player->cnum);
- bzero((s_char *)&mystat, sizeof(struct stats));
+ memset(&mystat, 0, sizeof(struct stats));
mystat.stat = natp->nat_stat;
if (mystat.stat & STAT_NORM) {
mystat.res = natp->nat_level[NAT_RLEV];
continue;
}
if (zero)
- bzero(ship.shp_rpath, RET_LEN);
+ memset(ship.shp_rpath, 0, sizeof(ship.shp_rpath));
if (pq != (s_char *)0) {
- bzero(ship.shp_rpath, RET_LEN);
- bcopy(pq, ship.shp_rpath, strlen(pq));
+ strncpy(ship.shp_rpath, pq, sizeof(ship.shp_rpath));
putship(ship.shp_uid, &ship);
}
if (rflags >= 0) {
continue;
}
if (zero)
- bzero(land.lnd_rpath, RET_LEN);
+ memset(land.lnd_rpath, 0, sizeof(land.lnd_rpath));
if (pq != (s_char *)0) {
- bzero(land.lnd_rpath, RET_LEN);
- bcopy(pq, land.lnd_rpath, strlen(pq));
+ strncpy(land.lnd_rpath, pq, sizeof(land.lnd_rpath));
putland(land.lnd_uid, &land);
}
if (rflags >= 0) {
return RET_FAIL;
}
ncond = ns.ncond;
- bcopy((s_char *)ns.cond, (s_char *)cond,
- sizeof(struct nscstr) * ncond);
+ memcpy(cond, ns.cond, sizeof(struct nscstr) * ncond);
ns.ncond = 0;
natp = getnatp(player->cnum);
xyrelrange(natp, &ns.range, &relrange);
- bzero((s_char *)mapbuf, ((WORLD_Y * MAPWIDTH(3)) * sizeof(s_char)));
+ memset(mapbuf, 0, ((WORLD_Y * MAPWIDTH(3))));
blankfill((s_char *)mapbuf, &ns.range, 3);
border(&relrange, " ", " ");
p = &map[ns.dy][ns.dx * 2];
if ((dir = getvar(i_del, (s_char *)§, EF_SECTOR) & 0x7) &&
nstr_exec(cond, ncond, (s_char *)§, EF_SECTOR))
- bcopy(routech[dir][0], p, 3);
+ memcpy(p, routech[dir][0], 3);
p[1] = dchr[sect.sct_type].d_mnem;
}
for (row = 0, y = ns.range.ly; row < ns.range.height; y++, row++) {
ry = yrel(natp, y);
- bzero(buf, (MAPWIDTH(3) + 10) * sizeof(s_char));
+ memset(buf, 0, (MAPWIDTH(3) + 10));
sprintf(buf, "%4d ", ry);
- bcopy(map[row], buf + 5, ns.range.width * 2 + 1);
+ memcpy(buf + 5, map[row], ns.range.width * 2 + 1);
sprintf(buf + 5 + ns.range.width * 2 + 1, " %-4d\n", ry);
pr("%s", buf);
if (y >= WORLD_Y)
if (!check_ship_ok(&ship))
continue;
if (!player->aborted) {
- bzero(ship.shp_path, sizeof(ship.shp_path));
strncpy(ship.shp_path, cp, sizeof(ship.shp_path) - 2);
ship.shp_mission = 0;
putship(ship.shp_uid, &ship);
|| islist(p))) {
s_char y_or_n[80], bbuf[80];
- bzero(y_or_n, 80);
+ memset(y_or_n, 0, sizeof(y_or_n));
if (type == EF_SHIP) {
if (*p == '*')
sprintf(bbuf, "all ships");
}
np = getnatp(player->cnum);
ncond = ns.ncond;
- bcopy((s_char *)ns.cond, (s_char *)cond, sizeof(*cond) * ncond);
+ memcpy(cond, ns.cond, sizeof(*cond) * ncond);
ns.ncond = 0;
xyrelrange(getnatp(player->cnum), &ns.range, &range);
border(&range, " ", "");
rad[ns.dy][ns.dx], 0);
}
- bzero((s_char *)visbuf, (WORLD_Y * (WORLD_X + 1)));
+ memset(visbuf, 0, (WORLD_Y * (WORLD_X + 1)));
snxtitem_dist(&nit, EF_SHIP, ship.shp_x, ship.shp_y, range);
while (nxtitem(&nit, (caddr_t)&targ)) {
* 6 = neighbors, 2 = x,y
*/
table = (coord *)malloc((nsects + 1) * 6 * 2 * sizeof(coord));
- bzero((s_char *)table, (nsects + 1) * 6 * 2 * sizeof(coord));
+ memset(table, 0, (nsects + 1) * 6 * 2 * sizeof(coord));
pr("SPY report\n");
prdate();
pr(" old sct rd rl def\n");
return RET_FAIL;
}
ncond = nstr.ncond;
- bcopy((s_char *)nstr.cond, (s_char *)cond,
- sizeof(struct nscstr) * ncond);
+ memcpy(cond, nstr.cond, sizeof(struct nscstr) * ncond);
nstr.ncond = 0;
np = getnatp(player->cnum);
xyrelrange(np, &nstr.range, &range);
pr("Ship #%d has insufficient mobility\n", sub.shp_uid);
continue;
}
- bzero(buf, 80);
subno = sub.shp_uid;
sprintf(prompt, "Ship %d, target? ", sub.shp_uid);
if ((ptr = getstarg(player->argp[2], prompt, buf)) == 0)
if (!snxtsct(&nstr, player->argp[1]))
return RET_SYN;
- bzero((s_char *)vec, sizeof(vec));
+ memset(vec, 0, sizeof(vec));
while (nxtsct(&nstr, §)) {
if (!player->owner)
continue;
fillcache(ep, id);
from = ep->cache + (id - ep->baseid) * ep->size;
}
- bcopy(from, ptr, ep->size);
+ memcpy(ptr, from, ep->size);
if (ep->postread)
ep->postread(id, ptr);
if (id >= ep->baseid && id < ep->baseid + ep->cids) {
/* update the cache if necessary */
to = ep->cache + (id - ep->baseid) * ep->size;
- bcopy(ptr, to, ep->size);
+ memcpy(to, ptr, ep->size);
}
if (id > ep->fids) {
logerror("WARNING ef_write: expanded %s by more than one id",
struct sctstr sect;
if ((!player->god || country)) {
- bzero((s_char *)bitmap, (WORLD_X * WORLD_Y) / 8);
+ memset(bitmap, 0, (WORLD_X * WORLD_Y) / 8);
bitinit2(nsp, bitmap, country);
}
while (nxtsct(nsp, §) && !player->aborted) {
int changed = 0;
if ((!player->god || country)) {
- bzero((s_char *)bitmap, (WORLD_X * WORLD_Y) / 8);
+ memset(bitmap, 0, (WORLD_X * WORLD_Y) / 8);
bitinit2(nsp, bitmap, country);
}
while (nxtsct(nsp, §) && !player->aborted) {
ep = &empfile[EF_SECTOR];
bp = (struct bestp *)malloc(sizeof(*bp));
- bzero((s_char *)bp, sizeof(*bp));
+ memset(bp, 0, sizeof(*bp));
bp->adp = as_init(BP_NEIGHBORS, BP_ASHASHSIZE, bp_coord_hash,
bp_neighbors, bp_lbcost, bp_realcost,
bp_seccost, (s_char *)bp);
void
snxtitem_area(register struct nstr_item *np, int type, struct range *range)
{
- bzero((s_char *)np, sizeof(*np));
+ memset(np, 0, sizeof(*np));
np->cur = -1;
np->type = type;
np->sel = NS_AREA;
{
struct range range;
- bzero((s_char *)np, sizeof(*np));
+ memset(np, 0, sizeof(*np));
xydist_range(cx, cy, dist, &range);
np->cur = -1;
np->type = type;
void
snxtitem_xy(register struct nstr_item *np, int type, coord x, coord y)
{
- bzero((s_char *)np, sizeof(*np));
+ memset(np, 0, sizeof(*np));
np->cur = -1;
np->type = type;
np->sel = NS_XY;
void
snxtitem_all(register struct nstr_item *np, int type)
{
- bzero((s_char *)np, sizeof(*np));
+ memset(np, 0, sizeof(*np));
np->cur = -1;
np->sel = NS_ALL;
np->type = type;
{
if (group == '~')
group = ' ';
- bzero((s_char *)np, sizeof(*np));
+ memset(np, 0, sizeof(*np));
np->cur = -1;
np->sel = NS_GROUP;
np->group = group;
{
int i;
- bzero((s_char *)np, sizeof(*np));
+ memset(np, 0, sizeof(*np));
np->cur = -1;
np->type = type;
np->sel = NS_LIST;
void
snxtsct_area(register struct nstr_sect *np, struct range *range)
{
- bzero((s_char *)np, sizeof(*np));
+ memset(np, 0, sizeof(*np));
np->range = *range;
np->ncond = 0;
np->type = NS_AREA;
void
snxtsct_dist(register struct nstr_sect *np, coord cx, coord cy, int dist)
{
- bzero((s_char *)np, sizeof(*np));
+ memset(np, 0, sizeof(*np));
xydist_range(cx, cy, dist, &np->range);
np->cx = cx;
np->cy = cy;
#include "gen.h"
#include "optlist.h"
-#ifdef hpux
-#include <memory.h>
-
-void
-bzero(s_char *ptr, int len)
-{
- memset(ptr, 0, len);
-}
-
-void
-bcopy(s_char *src, s_char *dst, int len)
-{
- memcpy(dst, src, len);
-}
-#endif
-
/*
* space-fill a map or radar scan;
* null terminate
if (nbytes > 0) {
if (nleft < nbytes)
nbytes = nleft;
- bcopy(io->data + io->offset, offset, nbytes);
+ memcpy(offset, io->data + io->offset, nbytes);
offset += nbytes;
nleft -= nbytes;
}
if (avail > 0) {
/* append to existing buffer */
len = cc > avail ? avail : cc;
- bcopy(buf, io->data + io->nbytes, len);
+ memcpy(io->data + io->nbytes, buf, len);
io->nbytes += len;
ioq->cc += len;
if (avail < cc)
/* create a new buffer, minimum bufsize bytes */
len = cc > ioq->bufsize ? cc : ioq->bufsize;
ptr = malloc(len);
- bcopy(buf, ptr, cc);
+ memcpy(ptr, buf, cc);
io = (struct io *)malloc(sizeof(struct io));
io->nbytes = cc;
io->size = len;
if (nbytes > nleft)
break;
- bcopy(io->data + io->offset, offset, nbytes);
+ memcpy(offset, io->data + io->offset, nbytes);
offset += nbytes;
nleft -= nbytes;
ncopied += nbytes;
static jmp_buf *cpp;
extern struct lwpProc *LwpCurrent;
- bzero(newp->context, sizeof(newp->context));
+ memset(newp->context, 0, sizeof(newp->context));
newp->context[0] = (int)sp;
/* preserve cpp for new context */
cpp = (jmp_buf *) & newp->context;
}
lwpStatus(us, "selecting; sleep %ld secs", (long)delta);
- bcopy((s_char *)&LwpSelect.readmask, (s_char *)&readmask,
- sizeof(fd_set));
- bcopy((s_char *)&LwpSelect.writemask, (s_char *)&writemask,
- sizeof(fd_set));
+ memcpy(&readmask, &LwpSelect.readmask, sizeof(fd_set));
+ memcpy(&writemask, &LwpSelect.writemask, sizeof(fd_set));
n = select(LwpSelect.maxfd + 1, &readmask, &writemask,
(fd_set *) 0, &tv);
struct player *lp;
struct hostent *hostp;
- lp = (struct player *)calloc(1, sizeof(struct player));
- bzero((s_char *)lp, sizeof(struct player));
+ lp = (struct player *)malloc(sizeof(struct player));
+ memset(lp, 0, sizeof(struct player));
if (sin) {
/* update uses dummy player */
/* so does the market updater */
a sector, and then overfly some land units or ships, we don't want to
potentially intercept 3 times. */
- bzero((s_char *)&head, sizeof(struct shiplook));
+ memset(&head, 0, sizeof(struct shiplook));
head.uid = -1;
plp = (struct plist *)bomb_list->q_forw;
plane_owner = plp->plane.pln_own;
- bzero((s_char *)mypath, 1024);
- bcopy(path, mypath, strlen(path));
+ strncpy(mypath, path, sizeof(mypath));
myp = 0;
- bzero((s_char *)overfly, sizeof(overfly));
- bzero((s_char *)gotilist, sizeof(gotilist));
- bzero((s_char *)unfriendly, sizeof(unfriendly));
+ memset(overfly, 0, sizeof(overfly));
+ memset(gotilist, 0, sizeof(gotilist));
+ memset(unfriendly, 0, sizeof(unfriendly));
for (cn = 1; cn < MAXNOC; cn++) {
if ((mynatp = getnatp(cn)) == 0)
continue;
/* Something made it through */
/* Go figure out if there are ships in this sector, and who's they are */
- bzero((s_char *)nats, sizeof(nats));
+ memset(nats, 0, sizeof(nats));
snxtitem_xy(&ni, EF_SHIP, x, y);
while (nxtitem(&ni, (s_char *)&ship)) {
if (mchr[(int)ship.shp_type].m_flags & M_SUB)
nats[ship.shp_own]++;
}
/* Go figure out if there are units in this sector, and who's they are */
- bzero((s_char *)lnats, sizeof(lnats));
+ memset(lnats, 0, sizeof(lnats));
snxtitem_xy(&ni, EF_LAND, x, y);
while (nxtitem(&ni, (s_char *)&land)) {
lnats[land.lnd_own]++;
strcpy(mesg, dmess);
return;
}
- bzero(dmess, 255);
+ memset(dmess, 0, sizeof(dmess));
eff -= dam;
if (eff < 0)
eff = 0;
plp = (struct plist *)list->q_forw;
plane_owner = plp->plane.pln_own;
- bzero((s_char *)nats, sizeof(nats));
+ memset(nats, 0, sizeof(nats));
guns = 0;
snxtitem_xy(&ni, EF_SHIP, x, y);
while (!QEMPTY(list) && nxtitem(&ni, (s_char *)&ship)) {
plp = (struct plist *)list->q_forw;
plane_owner = plp->plane.pln_own;
- bzero((s_char *)nats, sizeof(nats));
+ memset(nats, 0, sizeof(nats));
guns = 0;
snxtitem_xy(&ni, EF_LAND, x, y);
while (!QEMPTY(list) && nxtitem(&ni, (s_char *)&land)) {
ip->bombs = 0;
ip->misc = 0;
ip->pcp = &plchr[(int)plane.pln_type];
- bcopy((s_char *)&plane, (s_char *)&ip->plane, sizeof(plane));
+ ip->plane = plane;
emp_insque(&ip->queue, list);
}
}
}
s = (struct shiplook *)malloc(sizeof(struct shiplook));
- bzero((s_char *)s, sizeof(struct shiplook));
+ memset(s, 0, sizeof(struct shiplook));
s2->next = s;
s->uid = uid;
s->looked = 1;
}
s = (struct shiplook *)malloc(sizeof(struct shiplook));
- bzero((s_char *)s, sizeof(struct shiplook));
+ memset(s, 0, sizeof(struct shiplook));
s2->next = s;
s->uid = uid;
s->found = 1;
int
att_combat_init(struct combat *com, int type)
{
- bzero((s_char *)com, sizeof(*com));
+ memset(com, 0, sizeof(*com));
com->type = type;
return type;
}
if (com->own == player->cnum) {
land.lnd_mission = 0;
land.lnd_rflags = 0;
- bzero(land.lnd_rpath, RET_LEN);
+ memset(land.lnd_rpath, 0, sizeof(land.lnd_rpath));
}
putland(com->lnd_uid, &land);
break;
if (com->own == player->cnum) {
ship.shp_mission = 0;
ship.shp_rflags = 0;
- bzero(ship.shp_rpath, RET_LEN);
+ memset(ship.shp_rpath, 0, sizeof(ship.shp_rpath));
}
putship(com->shp_uid, &ship);
}
emp_initque(olist);
if (att_abort(combat_mode, off, def))
return 0;
- bzero(land_answer, sizeof(land_answer));
+ memset(land_answer, 0, sizeof(land_answer));
for (n = 0; n <= off->last; ++n) {
off[n].troops = ask_off(combat_mode, off + n, def);
if (att_abort(combat_mode, off, def))
abort_attack();
return;
}
- bzero((s_char *)llp, sizeof(struct llist));
+ memset(llp, 0, sizeof(struct llist));
emp_insque(&llp->queue, olist);
llp->mobil = mobcost;
if (!get_land(combat_mode, def, land.lnd_uid, llp, 0))
abort_attack();
return 0;
}
- bzero((s_char *)llp, sizeof(struct llist));
+ memset(llp, 0, sizeof(struct llist));
emp_insque(&llp->queue, list);
llp->supplied = has_supply(&land);
if (!get_land(A_DEFEND, def, land.lnd_uid, llp, 1))
llp = (struct llist *)
malloc(sizeof(struct llist));
- bzero((s_char *)llp, sizeof(struct llist));
+ memset(llp, 0, sizeof(struct llist));
llp->supplied = supply_state;
llp->x = origx;
llp->y = origy;
llp->lcp = &lchr[(int)land.lnd_type];
- bcopy((s_char *)&land, (s_char *)&llp->land,
- sizeof(struct lndstr));
+ llp->land = land;
emp_insque(&llp->queue, list);
if (lnd_spyval(&land) > *d_spyp)
*d_spyp = lnd_spyval(&land);
if (QEMPTY(olist))
return;
- bzero(land_answer, sizeof(land_answer));
+ memset(land_answer, 0, sizeof(land_answer));
for (qp = olist->q_forw; qp != olist; qp = next) {
next = qp->q_forw;
llp = (struct llist *)qp;
if (llp->lnd_uid != n) {
logerror("lnd_postread: Error - %d != %d, zeroing.\n",
llp->lnd_uid, n);
- bzero(ptr, sizeof(struct lndstr));
+ memset(llp, 0, sizeof(struct lndstr));
}
if (llp->lnd_ship >= 0 && llp->lnd_own
&& llp->lnd_effic >= LAND_MINEFF) {
lcp = &lchr[(int)lp->lnd_type];
- bzero(buf1, 80);
- bzero(buf2, 80);
- bzero(buf3, 80);
+ memset(buf1, 0, sizeof(buf1));
+ memset(buf2, 0, sizeof(buf2));
+ memset(buf3, 0, sizeof(buf3));
if (chance((double)(spy + lp->lnd_vis) / 10.0)) {
if (destination == player->cnum)
pr("%s %s", mess, prland(lp));
land.lnd_mission = 0;
land.lnd_rflags = 0;
land.lnd_harden = 0;
- bzero(land.lnd_rpath, RET_LEN);
+ memset(land.lnd_rpath, 0, sizeof(land.lnd_rpath));
putland(land.lnd_uid, &land);
llp = (struct llist *)malloc(sizeof(struct llist));
llp->lcp = lcp;
- bcopy((s_char *)&land, (s_char *)&llp->land,
- sizeof(struct lndstr));
+ llp->land = land;
llp->mobil = (double)land.lnd_mobil;
emp_insque(&llp->queue, list);
}
*minmobp = llp->mobil;
if (llp->mobil > *maxmobp)
*maxmobp = llp->mobil;
- bcopy((s_char *)&land, (s_char *)&llp->land,
- sizeof(struct lndstr));
+ llp->land = land;
}
}
struct genlist mi[MAXNOC];
int z;
- bzero((s_char *)mi, sizeof(mi));
+ memset(mi, 0, sizeof(mi));
for (z = 1; z < MAXNOC; z++)
emp_initque((struct emp_qelem *)&mi[z]);
int z;
int osubs;
- bzero((s_char *)mi, sizeof(mi));
+ memset(mi, 0, sizeof(mi));
for (z = 1; z < MAXNOC; z++)
emp_initque((struct emp_qelem *)&mi[z]);
struct genlist mi[MAXNOC];
int z;
- bzero((s_char *)mi, sizeof(mi));
+ memset(mi, 0, sizeof(mi));
for (z = 1; z < MAXNOC; z++)
emp_initque((struct emp_qelem *)&mi[z]);
struct genlist mi[MAXNOC];
int z;
- bzero((s_char *)mi, sizeof(mi));
+ memset(mi, 0, sizeof(mi));
for (z = 1; z < MAXNOC; z++)
emp_initque((struct emp_qelem *)&mi[z]);
}
glp = (struct genlist *)malloc(sizeof(struct genlist));
- bzero((s_char *)glp, sizeof(struct genlist));
+ memset(glp, 0, sizeof(struct genlist));
glp->x = gp->x;
glp->y = gp->y;
glp->type = type;
break;
}
glp->thing = (s_char *)malloc(size);
- bcopy(block, glp->thing, size);
+ memcpy(glp->thing, block, size);
emp_insque(&glp->queue, &mi[gp->own].queue);
}
}
continue;
plp = (struct plist *)malloc(sizeof(struct plist));
- bzero((s_char *)plp, sizeof(struct plist));
+ memset(plp, 0, sizeof(struct plist));
plp->pcp = &plchr[(int)plane.pln_type];
- bcopy((s_char *)&plane, (s_char *)&plp->plane,
- sizeof(struct plnstr));
+ plp->plane = plane;
emp_insque(&plp->queue, escorts);
}
}
/* save planes for later */
plp = (struct plist *)malloc(sizeof(struct plist));
- bzero((s_char *)plp, sizeof(struct plist));
+ memset(plp, 0, sizeof(struct plist));
plp->pcp = pcp;
- bcopy(glp->thing, (s_char *)&plp->plane,
- sizeof(struct plnstr));
+ memcpy(&plp->plane, glp->thing, sizeof(struct plnstr));
if (plp->pcp->pl_flags & P_M)
emp_insque(&plp->queue, &missiles);
else
for (qp = esc_list->q_forw; qp != esc_list; qp = qp->q_forw)
count++;
- bzero((s_char *)mi, sizeof(mi));
+ memset(mi, 0, sizeof(mi));
for (z = 1; z < MAXNOC; z++)
emp_initque((struct emp_qelem *)&mi[z]);
dist = mapdist(x, y, gp->x, gp->y);
plp = (struct plist *)malloc(sizeof(struct plist));
- bzero((s_char *)plp, sizeof(struct plist));
+ memset(plp, 0, sizeof(struct plist));
plp->pcp = (struct plchrstr *)glp->cp;
- bcopy(glp->thing, (s_char *)&plp->plane,
- sizeof(struct plnstr));
+ memcpy(&plp->plane, glp->thing, sizeof(struct plnstr));
/* missiles go one way, so we can use all the range */
if (!(plp->pcp->pl_flags & P_M))
else {
pr("Using best path '%s', movement cost %1.3f\n",
path, total_mcost);
- bzero(bpath, 512);
- bcopy(path, bpath, strlen(path));
+ strncpy(bpath, path, sizeof(bpath));
path = bpath;
}
if ((total_mcost * weight) > mobility) {
} else {
pr("Using best path '%s', movement cost %1.3f\n",
movstr, mv_cost);
- bzero(bpath, 512);
- bcopy(movstr, bpath, strlen(movstr));
+ strncpy(bpath, movstr, sizeof(bpath));
movstr = bpath;
}
}
{
struct plist pl;
- bzero((s_char *)&pl, sizeof(struct plist));
+ memset(&pl, 0, sizeof(struct plist));
pl.pcp = plchr + pp->pln_type;
- bcopy((s_char *)pp, (s_char *)&pl.plane, sizeof(struct plnstr));
+ pl.plane = *pp;
return mission_pln_equip(&pl, 0, 0, 'p');
}
irv->bombs = 0;
irv->misc = 0;
irv->pcp = &plchr[(int)plane.pln_type];
- bcopy((s_char *)&plane, (s_char *)&irv->plane, sizeof(plane));
+ irv->plane = plane;
emp_insque(&irv->queue, list);
}
}
if (np->nuk_uid != n) {
logerror("nuk_postread: Error - %d != %d, zeroing.\n", np->nuk_uid,
n);
- bzero(ptr, sizeof(struct nukstr));
+ memset(np, 0, sizeof(struct nukstr));
}
player->owner = (player->god || np->nuk_own == player->cnum);
return 1;
nuk_uid = n;
if (getnuke(nuk_uid, &nuke) == 0) {
ef_extend(EF_NUKE, 10);
- bzero((s_char *)&nuke, sizeof(struct nukstr));
+ memset(&nuke, 0, sizeof(struct nukstr));
nuke.nuk_uid = nuk_uid;
nuke.nuk_ship = -1;
nuke.nuk_n = 0;
if (pp->pln_uid != n) {
logerror("pln_postread: Error - %d != %d, zeroing.\n", pp->pln_uid,
n);
- bzero(ptr, sizeof(struct plnstr));
+ memset(pp, 0, sizeof(struct plnstr));
}
if (pp->pln_ship >= 0 && pp->pln_own && pp->pln_effic >= PLANE_MINEFF) {
plp->misc = 0;
plp->bombs = 0;
plp->pcp = pcp;
- bcopy((s_char *)&plane, (s_char *)&plp->plane,
- sizeof(struct plnstr));
+ plp->plane = plane;
emp_insque(&plp->queue, list);
}
}
return;
}
- bzero((s_char *)visbuf, (WORLD_Y * (WORLD_X + 1)));
+ memset(visbuf, 0, (WORLD_Y * (WORLD_X + 1)));
range = (int)(range * (eff / 100.0));
if (range < 1)
range = 1;
*
*/
+#include <string.h>
#include "misc.h"
#include "player.h"
#include "nat.h"
s_char buf[2];
if (sp->shp_rflags & RET_GROUP) {
- bzero(buf, 2);
buf[0] = sp->shp_fleet;
+ buf[1] = 0;
snxtitem(&ni, EF_SHIP, buf);
while (nxtitem(&ni, (s_char *)&ship))
if ((ship.shp_fleet == buf[0]) &&
struct mchrstr *mcp;
int vec[I_MAX + 1];
int time_to_stop;
- s_char buf[RET_LEN - 1];
sp->shp_mission = 0;
if (sp->shp_own == 0)
return 0;
}
dir = chkdir(sp->shp_rpath[0], DIR_STOP, DIR_VIEW);
- bzero(buf, RET_LEN - 1);
- bcopy(&sp->shp_rpath[1], buf, RET_LEN - 1);
- bzero(sp->shp_rpath, RET_LEN);
- bcopy(buf, sp->shp_rpath, RET_LEN - 1);
+ memmove(sp->shp_rpath, sp->shp_rpath+1, sizeof(sp->shp_rpath) - 1);
if (dir == -1)
continue;
if (dir == DIR_STOP)
s_char buf[2];
if (lp->lnd_rflags & RET_GROUP) {
- bzero(buf, 2);
buf[0] = lp->lnd_army;
+ buf[1] = 0;
snxtitem(&ni, EF_SHIP, buf);
while (nxtitem(&ni, (s_char *)&land))
if ((land.lnd_army == buf[0]) && (land.lnd_own == lp->lnd_own)) {
return 0;
}
dir = chkdir(lp->lnd_rpath[0], DIR_STOP, DIR_VIEW);
- bzero(buf, RET_LEN - 1);
- bcopy(&lp->lnd_rpath[1], buf, RET_LEN - 1);
- bzero(lp->lnd_rpath, RET_LEN);
- bcopy(buf, lp->lnd_rpath, RET_LEN - 1);
+ memmove(lp->lnd_rpath, lp->lnd_rpath+1, sizeof(lp->lnd_rpath) - 1);
if (dir == -1)
continue;
if (dir == DIR_STOP)
range = range * (eff / 100.0);
pr("%s efficiency %d%%, max range %d\n", xyas(x, y, player->cnum),
eff, range);
- bzero(noise, sizeof(noise));
+ memset(noise, 0, sizeof(noise));
if (eff < 100) {
pr("Some noise on the transmission...\n");
for (n = 0; n < (100 - eff); ++n)
if (sp->shp_uid != n) {
logerror("shp_postread: Error - %d != %d, zeroing.\n", sp->shp_uid,
n);
- bzero(ptr, sizeof(struct shpstr));
+ memset(sp, 0, sizeof(struct shpstr));
}
if (opt_MOB_ACCESS)
*/
ship.shp_mission = 0;
ship.shp_rflags = 0;
- bzero(ship.shp_rpath, RET_LEN);
+ memset(ship.shp_rpath, 0, sizeof(ship.shp_rpath));
putship(ship.shp_uid, &ship);
mlp = (struct mlist *)malloc(sizeof(struct mlist));
mlp->mcp = mcp;
- bcopy((s_char *)&ship, (s_char *)&mlp->ship,
- sizeof(struct shpstr));
+ mlp->ship = ship;
mlp->mobil = (double)ship.shp_mobil;
emp_insque(&mlp->queue, list);
}
*minmobp = mlp->mobil;
if (mlp->mobil > *maxmobp)
*maxmobp = mlp->mobil;
- bcopy((s_char *)&ship, (s_char *)&mlp->ship,
- sizeof(struct shpstr));
+ mlp->ship = ship;
}
}
mlp = (struct mlist *)malloc(sizeof(struct mlist));
mlp->mcp = &mchr[(int)sp->shp_type];
- bcopy((s_char *)sp, (s_char *)&mlp->ship, sizeof(struct shpstr));
+ mlp->ship = *sp;
mlp->mobil = (double)sp->shp_mobil;
emp_insque(&mlp->queue, &list);
sprintf(buf, "%s", prship(&mlp->ship));
int hold;
struct lndstr l2;
- bcopy((s_char *)&land, (s_char *)&l2, sizeof(struct lndstr));
+ l2 = land;
hold = vec[type];
vec[type] = 0;
putvec(VT_ITEM, vec, (s_char *)&land, EF_LAND);
extern int sect_mob_neg_factor;
/* Wipe all the distribution info */
- bzero((s_char *)vec, sizeof(vec));
+ memset(vec, 0, sizeof(vec));
putvec(VT_DIST, vec, (s_char *)sp, EF_SECTOR);
putvec(VT_DEL, vec, (s_char *)sp, EF_SECTOR);
if (sp->sct_own == 0)
sp->shp_rflags = 0;
/* Keep track of when this was taken over */
time(&sp->shp_access);
- bzero(sp->shp_rpath, RET_LEN);
+ memset(sp->shp_rpath, 0, sizeof(sp->shp_rpath));
pp = &p;
lp = &llp;
/* Take over planes */
}
/* Wipe it clean */
- bzero((s_char *)g_distptrs, ((WORLD_X * WORLD_Y) *
- sizeof(struct distinfo)));
+ memset(g_distptrs, 0, ((WORLD_X * WORLD_Y) * sizeof(struct distinfo)));
logerror("delivering...\n");
/* Do deliveries */
cost */
infptr->excost = pathcost(sp, p, MOB_ROAD);
#ifdef SAVE_FINISH_PATHS
- bcopy(p, infptr->path, len);
+ memcpy(infptr->path, p, len);
#else
infptr->path = finish_path;
#endif /* SAVE_FINISH_PATHS */
leftp = ((float)left / 100.0);
- bzero((s_char *)mvec, sizeof(mvec));
+ memset(mvec, 0, sizeof(mvec));
mvec[I_LCM] = lcm_needed = ldround((double)(lp->l_lcm * leftp), 1);
mvec[I_HCM] = hcm_needed = ldround((double)(lp->l_hcm * leftp), 1);
/*
build = ldround((double)(buildp * 100.0), 1);
- bzero((s_char *)mvec, sizeof(mvec));
+ memset(mvec, 0, sizeof(mvec));
mvec[I_LCM] = lcm_needed = roundavg((double)(lp->l_lcm * buildp));
mvec[I_HCM] = hcm_needed = roundavg((double)(lp->l_hcm * buildp));
/*
* happiness, and printing out the state of the nation)
*/
logerror("production update (%d etus)", etu);
- bzero((s_char *)pops, sizeof(pops));
- bzero((s_char *)air_money, sizeof(air_money));
- bzero((s_char *)sea_money, sizeof(sea_money));
- bzero((s_char *)lnd_money, sizeof(lnd_money));
+ memset(pops, 0, sizeof(pops));
+ memset(air_money, 0, sizeof(air_money));
+ memset(sea_money, 0, sizeof(sea_money));
+ memset(lnd_money, 0, sizeof(lnd_money));
bp = (int *)calloc(WORLD_X * WORLD_Y * 7, sizeof(int));
for (n = 0; n < MAXNOC; n++) {
money[n] = 0;
int y, z, sb = 0, sm = 0, pb = 0, pm = 0, lm = 0, lb = 0;
long p_sect[SCT_MAXDEF + 1][2];
- bzero((s_char *)p_sect, sizeof(p_sect));
+ memset(p_sect, 0, sizeof(p_sect));
mil_dbl_pay = 0;
if ((np = getnatp(x)) == (struct natstr *)0)
continue;
if (ally_factor > 0.0)
share_incr(res, tech);
else {
- bzero((s_char *)res, sizeof(res));
- bzero((s_char *)tech, sizeof(tech));
+ memset(res, 0, sizeof(res));
+ memset(tech, 0, sizeof(tech));
}
for (n = 0; NULL != (np = getnatp(n)); n++) {
if ((np->nat_stat & STAT_NORM) == 0)
emp_initque(&ship_list);
mlp = (struct mlist *)malloc(sizeof(struct mlist));
mlp->mcp = mchr + sp->shp_type;
- bcopy((s_char *)sp, (s_char *)&mlp->ship, sizeof(struct shpstr));
+ mlp->ship = *sp;
mlp->mobil = (double)sp->shp_mobil;
emp_insque(&mlp->queue, &ship_list);
if (getvec(VT_ITEM, vec, (s_char *)sp, EF_SECTOR) <= 0)
return;
if (getvec(VT_COND, cvec, (s_char *)sp, EF_SECTOR) <= 0)
- bzero((s_char *)cvec, sizeof(cvec));
+ memset(cvec, 0, sizeof(cvec));
if (cvec[C_PSTAGE] == 0) {
cvec[C_PSTAGE] = infect_people(np, vec, sp->sct_effic,
left = delta;
leftp = ((float)left / 100.0);
- bzero((s_char *)mvec, sizeof(mvec));
+ memset(mvec, 0, sizeof(mvec));
mvec[I_MILIT] = mil_needed =
ldround((double)(plp->pl_crew * leftp), 1);
mvec[I_LCM] = lcm_needed =
(float)plp->pl_hcm));
build = ldround((double)(buildp * 100.0), 1);
- bzero((s_char *)mvec, sizeof(mvec));
+ memset(mvec, 0, sizeof(mvec));
mvec[I_MILIT] = mil_needed =
roundavg((double)(plp->pl_crew * buildp));
mvec[I_LCM] = lcm_needed =
struct natstr *np;
int n, civ_tax, uw_tax, mil_pay;
- bzero((s_char *)levels, sizeof(levels));
+ memset(levels, 0, sizeof(levels));
/* Process all the fallout. */
if (opt_FALLOUT) {
if (!fltp) {
fltp = (struct fltheadstr *)malloc(sizeof(*fltp));
- bzero((s_char *)fltp, sizeof(*fltp));
+ memset(fltp, 0, sizeof(*fltp));
/* Fix the links. */
fltp->next = (*head);
}
this = (struct fltelemstr *)malloc(sizeof(*this));
- bzero((s_char *)this, sizeof(*this));
+ memset(this, 0, sizeof(*this));
this->num = sp->shp_uid;
this->own = sp->shp_own;
this->next = fltp->head;
mlp = (struct mlist *)malloc(sizeof(struct mlist));
sp = getshipp(fe->num);
mlp->mcp = mchr + sp->shp_type;
- bcopy((s_char *)sp, (s_char *)&mlp->ship, sizeof(struct shpstr));
+ mlp->ship = *sp;
mlp->mobil = fe->mobil;
emp_insque(&mlp->queue, list);
}
left = delta;
leftp = ((float)left / 100.0);
- bzero((s_char *)mvec, sizeof(mvec));
+ memset(mvec, 0, sizeof(mvec));
mvec[I_LCM] = lcm_needed = ldround((double)(mp->m_lcm * leftp), 1);
mvec[I_HCM] = hcm_needed = ldround((double)(mp->m_hcm * leftp), 1);
buildp = MIN(buildp, ((float)mvec[I_HCM] / (float)mp->m_hcm));
build = ldround((double)(buildp * 100.0), 1);
- bzero((s_char *)mvec, sizeof(mvec));
+ memset(mvec, 0, sizeof(mvec));
mvec[I_LCM] = lcm_needed = roundavg((double)(mp->m_lcm * buildp));
mvec[I_HCM] = hcm_needed = roundavg((double)(mp->m_hcm * buildp));
exit(1);
}
}
- bzero((s_char *)&nat, sizeof(nat));
+ memset (&nat, 0, sizeof(nat));
nat.ef_type = EF_NATION;
if (nat.nat_cnam[0] == 0)
strcpy(nat.nat_cnam, "POGO");
nat.nat_priorities[x] = -1;
putnat((&nat));
printf("All praise to %s!\n", nat.nat_cnam);
- bzero((s_char *)&nat, sizeof(nat));
+ memset (&nat, 0, sizeof(nat));
for (x = 0; x < SCT_MAXDEF + 8; x++)
nat.nat_priorities[x] = -1;
for (i = 1; i < MAXNOC; i++) {
chmod(teldir, 0770);
/* create a zero-filled sector file */
- bzero((s_char *)&sct, sizeof(sct));
+ memset(&sct, 0, sizeof(sct));
for (y = 0; y < WORLD_Y; y++) {
for (x = 0; x < WORLD_X / 2; x++) {
file_sct_init(x * 2 + (y & 01), y, (s_char *)&sct);
x2 = x1;
y2 = y1;
- bzero((s_char *)tried, sizeof(tried));
+ memset(tried, 0, sizeof(tried));
numtried = 0;
while ((sects[y2 * XPLATES + x2 / 2].sct_type == SCT_WATER) ||
(*