/*			USERS			module 6
						contents = Mod_Op_Sys
    "us6.c"
*/
/*=============================================================================
			INCLUDES
*/
/*
#define		debug6		0
*/

#include	"users.os"
#include	"standard.inc"

#define		EXTERNal	0

#include	"users.dat"


/*=============================================================================
			HISTORY
date		3 February 1984
person		tpl

ver	0
rev	0
mod	b
patch	1

 ver/rev
""""""""
  0/0

     mod patch
    """""""""""
	a4		30 January 1984		tpl
		.RELEASED TO SOFTWARE TEST.

	a0		22 December 1983	tpl
		.Begin this module from 'us4b.c' since compiler is
		running out of memory.

*/
/*page*/
/*=============================================================================
			ROUTINES
*/
/*---------------------------------------------------------------------------*/

CHAR
Mod_Op_Sys( u_entry, c_entry, entry_num )
  struct users_entry	*u_entry;
  struct config_entry	*c_entry;
  CHAR	entry_num;
{
  register CHAR change_os_flag = FALSE;
  register int	ret_value;

    putz("\n\n");


    if ( (ret_value = Read_Op_Sys( RETOK ) ) == RETURN )
	switch ( u_entry->op_sys = (users_table[ entry_num ].op_sys & 0xf0) )
	{
	    case CPMsys:
			putz("CPM\n");
			break;
	    case MSDOSsys:
			putz("MSDOS\n");
			break;
	    default:
			putz("  ?\n");
			break;
	}

    else
    {
	u_entry->op_sys = ret_value;
	if ( u_entry->op_sys != (users_table[ entry_num ].op_sys & 0xf0 ) )
	{	/* then changing the O.S. and need all new assignments. */

	    printz("%c\n If you change operating systems you must also\n", BELL);
	    putz("enter all new default partition assignments to match.\n\
\nDo you still want to change operating systems?\n\
     -->                    (yes/no)");
	    repchar( BS,27 );

	    change_os_flag = Get_Yes_No( RETNOTOK );

	    if ( !change_os_flag )
		u_entry->op_sys = users_table[ entry_num].op_sys & 0xf0;
	    putz("\nOperating System --> ");
	    switch( u_entry->op_sys & 0xf0 )
	    {
		case CPMsys:
			putz("CPM\n");
			break;
		case MSDOSsys:
			putz("MSDOS\n");
			break;
		default:
			putz("  ?\n");
			break;
	    }/* switch */

	} /* if os was changed */

    } /* else new value */

/* cpm type */

    if ( (u_entry->op_sys & 0xf0) == CPMsys )
    {
	if ( change_os_flag )
	    ret_value = Do_Menu( &cpm_types, RETNOTOK );
	else
	    ret_value = Do_Menu( &cpm_types, RETOK );
	if ( ret_value == RETURN )	/* if == RETURN then use old value. */
	{
	    u_entry->op_sys |= users_table[ entry_num ].op_sys & 0x0f;
	    switch( u_entry->op_sys & 0x0f )
	    {
		case CPMeither:
			putz(" CPM2 or 86\n");
			break;
		case CPM2sys:
			putz(" CPM2\n");
			break;
	    	case CPM86sys:
			putz(" CPM86\n");
			break;
	    	case HIDOSsys:
			putz(" HiDos\n");
			break;
		default:
			putz("   ?\n");
			break;
	    }
	}
	else
	    u_entry->op_sys |= ret_value - '0';
		/* ret_value is menu value in ascii 0,1,2,3 */

    /* op_sys kind (flags) for CPM */

	putz("\n");
	if ( change_os_flag )
	    ret_value = Read_OS_Kind( RETNOTOK );
	else
	    ret_value = Read_OS_Kind( RETOK );

	if ( ret_value == RETURN )	/* if == RETURN then use old value. */
	    switch( u_entry->flags = users_table[ entry_num ].flags )
	    {
		case FULLsys:
			putz(" Full\n");
			break;
		case HiMEMsys:
			putz(" HiMEM\n");
			break;
	    }
	else
	    u_entry->flags = ret_value;

    } /* if CPM */

    else	/* else MSDOS */
	u_entry->flags = FULLsys;

    return( change_os_flag );

} /* Mod_Op_Sys */

/*---------------------------------------------------------------------------*/

/*+++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++*/

