Convert spaces to tabs
This commit is contained in:
parent
7465574195
commit
243a15052f
19 changed files with 100 additions and 100 deletions
|
@ -273,21 +273,21 @@ w32_ring_from_file_or_bounce_buf(struct ring *r, int fd)
|
|||
int i, res;
|
||||
|
||||
if (fd)
|
||||
return ring_from_file(r, fd);
|
||||
return ring_from_file(r, fd);
|
||||
|
||||
if (bounce_status < 0) {
|
||||
errno = bounce_error;
|
||||
res = bounce_status;
|
||||
errno = bounce_error;
|
||||
res = bounce_status;
|
||||
} else {
|
||||
for (i = 0; i < bounce_status; i++) {
|
||||
if (ring_putc(r, bounce_buf[i]) == EOF) {
|
||||
/* more work to do, hold on to bounce_buf */
|
||||
memmove(bounce_buf, bounce_buf + i, bounce_status - i);
|
||||
bounce_status -= i;
|
||||
return i;
|
||||
}
|
||||
}
|
||||
res = i;
|
||||
for (i = 0; i < bounce_status; i++) {
|
||||
if (ring_putc(r, bounce_buf[i]) == EOF) {
|
||||
/* more work to do, hold on to bounce_buf */
|
||||
memmove(bounce_buf, bounce_buf + i, bounce_status - i);
|
||||
bounce_status -= i;
|
||||
return i;
|
||||
}
|
||||
}
|
||||
res = i;
|
||||
}
|
||||
|
||||
ResetEvent(bounce_full);
|
||||
|
|
|
@ -142,7 +142,7 @@ struct as_frompath {
|
|||
AS_NEW_ARRAY((p), type, 1, err);
|
||||
|
||||
#define AS_NEW_MALLOC(p, type, err) \
|
||||
(p) = (type *)malloc(sizeof(type)); \
|
||||
(p) = (type *)malloc(sizeof(type)); \
|
||||
if ((p) == NULL) \
|
||||
return err; \
|
||||
|
||||
|
|
|
@ -64,7 +64,7 @@ conv(void)
|
|||
continue;
|
||||
if (sect.sct_oldown == player->cnum)
|
||||
continue;
|
||||
natp = getnatp(sect.sct_own);
|
||||
natp = getnatp(sect.sct_own);
|
||||
maxpop = max_pop(natp->nat_level[NAT_RLEV], §);
|
||||
civ = sect.sct_item[I_CIVIL];
|
||||
mil = sect.sct_item[I_MILIT];
|
||||
|
|
|
@ -69,7 +69,7 @@ coun_list(struct natstr *natp)
|
|||
&& (player->god
|
||||
|| natp->nat_stat == STAT_GOD
|
||||
|| cn == player->cnum || getrel(natp, player->cnum) == ALLIED))
|
||||
pr(" Now logged on ");
|
||||
pr(" Now logged on ");
|
||||
else if (player->god) {
|
||||
if (natp->nat_last_login == 0)
|
||||
pr(" Never logged on ");
|
||||
|
|
|
@ -319,7 +319,7 @@ lload(void)
|
|||
|
||||
static int
|
||||
move_amount(int sect_amt, int unit_amt, int unit_max,
|
||||
int load_unload, int amount)
|
||||
int load_unload, int amount)
|
||||
{
|
||||
int move_amt;
|
||||
|
||||
|
@ -641,11 +641,11 @@ load_land_ship(struct sctstr *sectp, struct shpstr *sp, int noisy,
|
|||
land.lnd_harden = 0;
|
||||
putland(land.lnd_uid, &land);
|
||||
#if 0
|
||||
/*
|
||||
* FIXME if this supplies from the sector, the putsect in
|
||||
* load() / lload() duplicates those supplies, causing a
|
||||
* seqno mismatch
|
||||
*/
|
||||
/*
|
||||
* FIXME if this supplies from the sector, the putsect in
|
||||
* load() / lload() duplicates those supplies, causing a
|
||||
* seqno mismatch
|
||||
*/
|
||||
if (!lnd_supply_all(&land))
|
||||
pr("WARNING: %s is out of supply!\n", prland(&land));
|
||||
#else
|
||||
|
@ -995,7 +995,7 @@ load_land_land(struct sctstr *sectp, struct lndstr *lp, int noisy,
|
|||
land.lnd_harden = 0;
|
||||
putland(land.lnd_uid, &land);
|
||||
#if 0
|
||||
/* FIXME same issue as in load_land_ship() */
|
||||
/* FIXME same issue as in load_land_ship() */
|
||||
if (!lnd_supply_all(&land))
|
||||
pr("WARNING: %s is out of supply!\n", prland(&land));
|
||||
#else
|
||||
|
|
|
@ -359,11 +359,11 @@ switch_leader(struct emp_qelem *list, int uid)
|
|||
|
||||
save = qp = list->q_back;
|
||||
do {
|
||||
emp_remque(qp);
|
||||
emp_insque(qp, list);
|
||||
qp = list->q_back;
|
||||
ulp = (struct ulist *)qp;
|
||||
if (ulp->unit.gen.uid == uid || uid == -1)
|
||||
break;
|
||||
emp_remque(qp);
|
||||
emp_insque(qp, list);
|
||||
qp = list->q_back;
|
||||
ulp = (struct ulist *)qp;
|
||||
if (ulp->unit.gen.uid == uid || uid == -1)
|
||||
break;
|
||||
} while (list->q_back != save);
|
||||
}
|
||||
|
|
|
@ -155,7 +155,7 @@ vers(void)
|
|||
pr("The maximum amount of mobility used for land unit combat is %0.2f.\n",
|
||||
combat_mob);
|
||||
if (opt_MOB_ACCESS)
|
||||
pr("The starting mobility when acquiring a sector or unit is %d.\n",
|
||||
pr("The starting mobility when acquiring a sector or unit is %d.\n",
|
||||
-(etu_per_update / sect_mob_neg_factor));
|
||||
pr("\n");
|
||||
pr("Ships on autonavigation may use %i cargo holds per ship.\n", TMAX);
|
||||
|
|
|
@ -179,7 +179,7 @@ verify_row(int type, int row)
|
|||
} while (++j < n);
|
||||
}
|
||||
if (!(flags & EFF_MEM))
|
||||
free(row_ref);
|
||||
free(row_ref);
|
||||
return ret_val;
|
||||
}
|
||||
|
||||
|
|
|
@ -766,9 +766,9 @@ xuheader(FILE *fp, int expected_table)
|
|||
human = ch == 'c';
|
||||
res = -1;
|
||||
if ((human
|
||||
? fscanf(fp, "config%*[ \t]%63[^ \t#\n]%n", name, &res) != 1
|
||||
: fscanf(fp, "XDUMP%*[ \t]%63[^ \t#\n]%*[ \t]%*[^ \t#\n]%n",
|
||||
name, &res) != 1) || res < 0)
|
||||
? fscanf(fp, "config%*[ \t]%63[^ \t#\n]%n", name, &res) != 1
|
||||
: fscanf(fp, "XDUMP%*[ \t]%63[^ \t#\n]%*[ \t]%*[^ \t#\n]%n",
|
||||
name, &res) != 1) || res < 0)
|
||||
return gripe("Expected xdump header");
|
||||
|
||||
type = ef_byname(name);
|
||||
|
|
|
@ -376,7 +376,7 @@ empth_init(void **ctx_ptr, int flags)
|
|||
/* Manual reset */
|
||||
hShutdownEvent = CreateEvent(NULL, TRUE, FALSE, NULL);
|
||||
if (!hShutdownEvent) {
|
||||
logerror("Failed to create shutdown event %lu", GetLastError());
|
||||
logerror("Failed to create shutdown event %lu", GetLastError());
|
||||
return 0;
|
||||
}
|
||||
SetConsoleCtrlHandler(loc_Exit_Handler, TRUE);
|
||||
|
|
|
@ -135,9 +135,9 @@ double bankint = 0.25; /* bank interest rate (dt * bars) */
|
|||
|
||||
/* Note in the taxes below:
|
||||
tradetax - this is charged to the seller, so it is < 1 (because the seller
|
||||
gets the (price paid * tradetax)
|
||||
gets the (price paid * tradetax)
|
||||
buytax - this is charged to the buyer, so it is > 1 (because the buyer is
|
||||
charged (price paid * buytax).
|
||||
charged (price paid * buytax).
|
||||
Not perfect, but it works. :) */
|
||||
|
||||
double tradetax = 0.99; /* Tax charged on trade */
|
||||
|
|
|
@ -209,9 +209,9 @@ update_timeused(time_t now)
|
|||
time_t dt = now - player->lasttime;
|
||||
|
||||
if (dt > midnight_secs)
|
||||
natp->nat_timeused = midnight_secs;
|
||||
natp->nat_timeused = midnight_secs;
|
||||
else
|
||||
natp->nat_timeused += dt;
|
||||
natp->nat_timeused += dt;
|
||||
player->lasttime = now;
|
||||
putnat(natp);
|
||||
}
|
||||
|
|
|
@ -605,7 +605,7 @@ perform_mission_msl(int dam, struct emp_qelem *missiles, coord x, coord y,
|
|||
use_up_msl:
|
||||
plp->plane.pln_effic = 0;
|
||||
putplane(plp->plane.pln_uid, &plp->plane);
|
||||
}
|
||||
}
|
||||
emp_remque(qp);
|
||||
free(qp);
|
||||
}
|
||||
|
|
|
@ -88,7 +88,7 @@ pr(char *format, ...)
|
|||
upr_player(player, C_DATA, buf);
|
||||
else
|
||||
/* normal text and user text are identical */
|
||||
pr_player(player, C_DATA, buf);
|
||||
pr_player(player, C_DATA, buf);
|
||||
}
|
||||
|
||||
/*
|
||||
|
@ -621,9 +621,9 @@ ufindpfx(char *s, int n)
|
|||
|
||||
while (n && s[i]) {
|
||||
if ((s[i++] & 0xc0) == 0xc0)
|
||||
while ((s[i] & 0xc0) == 0x80)
|
||||
while ((s[i] & 0xc0) == 0x80)
|
||||
i++;
|
||||
--n;
|
||||
--n;
|
||||
}
|
||||
return i;
|
||||
}
|
||||
|
|
|
@ -63,7 +63,7 @@ unit_list(struct emp_qelem *unit_list)
|
|||
if (type == EF_LAND)
|
||||
pr("lnd# land type x,y a eff sh gun xl mu tech retr\n");
|
||||
else
|
||||
pr("shp# ship type x,y fl eff mil sh gun pn he xl ln mob tech\n");
|
||||
pr("shp# ship type x,y fl eff mil sh gun pn he xl ln mob tech\n");
|
||||
|
||||
for (; qp != unit_list; qp = next) {
|
||||
next = qp->q_back;
|
||||
|
|
|
@ -248,7 +248,7 @@ sail_nav_fleet(struct fltheadstr *fltp)
|
|||
fe->num, cname(fe->own));
|
||||
error = 1;
|
||||
}
|
||||
if ((shp_check_nav(sectp, sp) == CN_LANDLOCKED) &&
|
||||
if ((shp_check_nav(sectp, sp) == CN_LANDLOCKED) &&
|
||||
(dchr[sectp->sct_type].d_nav == NAV_CANAL)) {
|
||||
wu(0, fltp->own,
|
||||
"Your ship #%d (%s) is too big to fit through the canal.\n",
|
||||
|
|
|
@ -147,7 +147,7 @@ upd_ship(struct shpstr *sp, int etus,
|
|||
product = &pchr[dchr[SCT_OIL].d_prd];
|
||||
oil_gained = roundavg(total_work(100, etus,
|
||||
sp->shp_item[I_CIVIL],
|
||||
sp->shp_item[I_MILIT],
|
||||
sp->shp_item[I_MILIT],
|
||||
sp->shp_item[I_UW],
|
||||
ITEM_MAX)
|
||||
* sp->shp_effic / 100.0
|
||||
|
|
|
@ -56,35 +56,35 @@ install_service(char *program_name, char *service_name, char *config_file)
|
|||
schSCManager = OpenSCManager(NULL,NULL,SC_MANAGER_ALL_ACCESS);
|
||||
|
||||
if (schSCManager == NULL) {
|
||||
fprintf(stderr, "install_service failed to open Service Control Manager\n");
|
||||
fprintf(stderr, "install_service failed to open Service Control Manager\n");
|
||||
return EXIT_FAILURE;
|
||||
}
|
||||
|
||||
schService = CreateService(schSCManager,
|
||||
service_name,
|
||||
service_name, /* service name to display */
|
||||
SERVICE_ALL_ACCESS, /* desired access */
|
||||
SERVICE_WIN32_OWN_PROCESS, /* service type */
|
||||
SERVICE_AUTO_START, /* start type */
|
||||
SERVICE_ERROR_NORMAL, /* error control type */
|
||||
program_name, /* service's binary */
|
||||
NULL, /* no load ordering group */
|
||||
NULL, /* no tag identifier */
|
||||
NULL, /* database service dependency */
|
||||
NULL, /* LocalSystem account */
|
||||
NULL); /* no password */
|
||||
SERVICE_ALL_ACCESS, /* desired access */
|
||||
SERVICE_WIN32_OWN_PROCESS, /* service type */
|
||||
SERVICE_AUTO_START, /* start type */
|
||||
SERVICE_ERROR_NORMAL, /* error control type */
|
||||
program_name, /* service's binary */
|
||||
NULL, /* no load ordering group */
|
||||
NULL, /* no tag identifier */
|
||||
NULL, /* database service dependency */
|
||||
NULL, /* LocalSystem account */
|
||||
NULL); /* no password */
|
||||
|
||||
if (schService == NULL) {
|
||||
fprintf(stderr, "install_service failed to create service %s\n", service_name);
|
||||
return EXIT_FAILURE;
|
||||
return EXIT_FAILURE;
|
||||
}
|
||||
sdBuf.lpDescription = "Server for Empire game";
|
||||
|
||||
if(!ChangeServiceConfig2(
|
||||
schService, /* handle to service */
|
||||
SERVICE_CONFIG_DESCRIPTION, /* change: description */
|
||||
&sdBuf)) { /* value: new description */
|
||||
fprintf(stderr, "install_service failed to set the description\n");
|
||||
schService, /* handle to service */
|
||||
SERVICE_CONFIG_DESCRIPTION, /* change: description */
|
||||
&sdBuf)) { /* value: new description */
|
||||
fprintf(stderr, "install_service failed to set the description\n");
|
||||
}
|
||||
|
||||
printf("Service %s installed.\n", service_name);
|
||||
|
@ -106,28 +106,28 @@ remove_service(char *service_name)
|
|||
schSCManager = OpenSCManager(NULL, NULL, SC_MANAGER_ALL_ACCESS);
|
||||
|
||||
if (schSCManager == NULL) {
|
||||
fprintf(stderr, "remove_service failed to open Service Control Manager\n");
|
||||
fprintf(stderr, "remove_service failed to open Service Control Manager\n");
|
||||
return EXIT_FAILURE;
|
||||
}
|
||||
|
||||
hService = OpenService(schSCManager, service_name, SERVICE_ALL_ACCESS);
|
||||
|
||||
if (hService == NULL) {
|
||||
fprintf(stderr, "remove_service failed to open service %s\n", service_name);
|
||||
fprintf(stderr, "remove_service failed to open service %s\n", service_name);
|
||||
return EXIT_FAILURE;
|
||||
}
|
||||
|
||||
if (DeleteService(hService) == 0) {
|
||||
fprintf(stderr, "remove_service failed to remove service %s\n", service_name);
|
||||
fprintf(stderr, "remove_service failed to remove service %s\n", service_name);
|
||||
return EXIT_FAILURE;
|
||||
}
|
||||
|
||||
if (CloseServiceHandle(hService) == 0) {
|
||||
fprintf(stderr, "remove_service failed to close service %s\n", service_name);
|
||||
return EXIT_FAILURE;
|
||||
fprintf(stderr, "remove_service failed to close service %s\n", service_name);
|
||||
return EXIT_FAILURE;
|
||||
} else {
|
||||
printf("Service %s removed.\n", service_name);
|
||||
return EXIT_SUCCESS;
|
||||
printf("Service %s removed.\n", service_name);
|
||||
return EXIT_SUCCESS;
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -138,33 +138,33 @@ static void WINAPI
|
|||
service_ctrl_handler(DWORD Opcode)
|
||||
{
|
||||
switch(Opcode) {
|
||||
case SERVICE_CONTROL_PAUSE:
|
||||
service_status.dwCurrentState = SERVICE_PAUSED;
|
||||
case SERVICE_CONTROL_PAUSE:
|
||||
service_status.dwCurrentState = SERVICE_PAUSED;
|
||||
logerror("Pausing the service not supported");
|
||||
break;
|
||||
break;
|
||||
|
||||
case SERVICE_CONTROL_CONTINUE:
|
||||
case SERVICE_CONTROL_CONTINUE:
|
||||
logerror("Continuing the service not supported");
|
||||
service_status.dwCurrentState = SERVICE_RUNNING;
|
||||
break;
|
||||
service_status.dwCurrentState = SERVICE_RUNNING;
|
||||
break;
|
||||
|
||||
case SERVICE_CONTROL_STOP:
|
||||
case SERVICE_CONTROL_STOP:
|
||||
logerror("Service stopping");
|
||||
empth_request_shutdown();
|
||||
return;
|
||||
return;
|
||||
|
||||
case SERVICE_CONTROL_INTERROGATE:
|
||||
/* Fall through to send current status. */
|
||||
break;
|
||||
case SERVICE_CONTROL_INTERROGATE:
|
||||
/* Fall through to send current status. */
|
||||
break;
|
||||
|
||||
default:
|
||||
logerror("Unrecognized opcode %ld in ServiceCtrlHandler",
|
||||
Opcode);
|
||||
default:
|
||||
logerror("Unrecognized opcode %ld in ServiceCtrlHandler",
|
||||
Opcode);
|
||||
}
|
||||
|
||||
/* Send current status. */
|
||||
if (!SetServiceStatus (service_status_handle, &service_status))
|
||||
logerror("SetServiceStatus error %ld",GetLastError());
|
||||
logerror("SetServiceStatus error %ld",GetLastError());
|
||||
return;
|
||||
}
|
||||
|
||||
|
@ -173,32 +173,32 @@ service_main(DWORD argc, LPTSTR *argv)
|
|||
{
|
||||
int sig;
|
||||
|
||||
service_status.dwServiceType = SERVICE_WIN32;
|
||||
service_status.dwCurrentState = SERVICE_START_PENDING;
|
||||
service_status.dwControlsAccepted = SERVICE_ACCEPT_STOP;
|
||||
service_status.dwWin32ExitCode = 0;
|
||||
service_status.dwServiceType = SERVICE_WIN32;
|
||||
service_status.dwCurrentState = SERVICE_START_PENDING;
|
||||
service_status.dwControlsAccepted = SERVICE_ACCEPT_STOP;
|
||||
service_status.dwWin32ExitCode = 0;
|
||||
service_status.dwServiceSpecificExitCode = 0;
|
||||
service_status.dwCheckPoint = 0;
|
||||
service_status.dwWaitHint = 0;
|
||||
service_status.dwCheckPoint = 0;
|
||||
service_status.dwWaitHint = 0;
|
||||
|
||||
service_status_handle = RegisterServiceCtrlHandler(
|
||||
DEFAULT_SERVICE_NAME, service_ctrl_handler);
|
||||
DEFAULT_SERVICE_NAME, service_ctrl_handler);
|
||||
|
||||
if (service_status_handle == (SERVICE_STATUS_HANDLE)0) {
|
||||
logerror("RegisterServiceCtrlHandler failed %lu\n", GetLastError());
|
||||
logerror("RegisterServiceCtrlHandler failed %lu\n", GetLastError());
|
||||
finish_server();
|
||||
return;
|
||||
return;
|
||||
}
|
||||
|
||||
start_server(0);
|
||||
|
||||
/* Initialization complete - report running status. */
|
||||
service_status.dwCurrentState = SERVICE_RUNNING;
|
||||
service_status.dwCheckPoint = 0;
|
||||
service_status.dwWaitHint = 0;
|
||||
service_status.dwCurrentState = SERVICE_RUNNING;
|
||||
service_status.dwCheckPoint = 0;
|
||||
service_status.dwWaitHint = 0;
|
||||
|
||||
if (!SetServiceStatus (service_status_handle, &service_status)) {
|
||||
logerror("SetServiceStatus error %ld\n", GetLastError());
|
||||
logerror("SetServiceStatus error %ld\n", GetLastError());
|
||||
}
|
||||
|
||||
sig = empth_wait_for_signal();
|
||||
|
@ -215,8 +215,8 @@ stop_service(void)
|
|||
logerror("Service stopped");
|
||||
service_status.dwWin32ExitCode = 0;
|
||||
service_status.dwCurrentState = SERVICE_STOPPED;
|
||||
service_status.dwCheckPoint = 0;
|
||||
service_status.dwWaitHint = 0;
|
||||
service_status.dwCheckPoint = 0;
|
||||
service_status.dwWaitHint = 0;
|
||||
|
||||
if (!SetServiceStatus (service_status_handle, &service_status))
|
||||
logerror("Error while stopping service SetServiceStatus"
|
||||
|
|
|
@ -220,7 +220,7 @@ main(int argc, char **argv)
|
|||
}
|
||||
|
||||
if (remove_service_set)
|
||||
return remove_service(service_name);
|
||||
return remove_service(service_name);
|
||||
if (install_service_set) {
|
||||
program_name = _fullpath(NULL, argv[0], 0);
|
||||
if (config_file != NULL)
|
||||
|
@ -452,7 +452,7 @@ shutdwn(int sig)
|
|||
|
||||
#if defined(_WIN32)
|
||||
if (daemonize)
|
||||
stop_service();
|
||||
stop_service();
|
||||
#endif
|
||||
exit(0);
|
||||
}
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue