/* Obtain the current power status from the APM BIOS. We return a status which gives the rough battery status, and current power source. The bat value returned give an estimate as a percentage of life and a status value for the battery. The estimated life if reported is a lifetime in secodnds/minutes at current powwer consumption.  */
static int apm_get_power_status(u_short *status, u_short *bat, u_short *life)
/* Obtain the current power status from the APM BIOS. We return a status which gives the rough battery status, and current power source. The bat value returned give an estimate as a percentage of life and a status value for the battery. The estimated life if reported is a lifetime in secodnds/minutes at current powwer consumption.  */
static int apm_get_power_status(u_short *status, u_short *bat, u_short *life)
{
	struct apm_bios_call call;
	call.func = APM_FUNC_GET_STATUS;
	call.ebx = APM_DEVICE_ALL;
	call.ecx = 0;
	if (apm_info.get_power_status_broken)
		return APM_32_UNSUPPORTED;
	if (apm_bios_call(&call))
		return call.err;
	*status = call.ebx;
	*bat = call.ecx;
	if (apm_info.get_power_status_swabinminutes) {
		*life = swab16((u16)call.edx);
		*life |= 0x8000;
	} else
		*life = call.edx;
	return APM_SUCCESS;
}