/*
 * $Copyright:	$
 * Copyright (c) 1984, 1985, 1986, 1987, 1988, 1989, 1990 
 * Sequent Computer Systems, Inc.   All rights reserved.
 *  
 * This software is furnished under a license and may be used
 * only in accordance with the terms of that license and with the
 * inclusion of the above copyright notice.   This software may not
 * be provided or otherwise made available to, or used by, any
 * other person.  No title to or ownership of the software is
 * hereby transferred.
 *
 */

/*	Copyright (c) 1984 AT&T	*/
/*	  All Rights Reserved  	*/

/*	THIS IS UNPUBLISHED PROPRIETARY SOURCE CODE OF AT&T	*/
/*	The copyright notice above does not evidence any   	*/
/*	actual or intended publication of such source code.	*/

#ident	"$Header: default.c 1.3 89/12/01 $@(#)nlp:cmd/lpadmin/default.c	1.5"

#include "stdio.h"
#include "errno.h"
#include "sys/types.h"

#include "lp.h"
#include "printers.h"

#define	WHO_AM_I	I_AM_LPADMIN
#include "oam.h"

#include "lpadmin.h"

extern char		*gettxt();

/**
 ** getdflt() - RETURN DEFAULT DESTINATION
 **/

char			*getdflt ()
{
	char			*name;

	if ((name = getdefault()))
		return (name);
	else
		return ("");
}

/**
 ** newdflt() - ESTABLISH NEW DEFAULT DESTINATION
 **/

void			newdflt (name)
	char			*name;
{
	char	msgid[16];

	BEGIN_CRITICAL
		if (name && *name && !STREQU(name, NAME_NONE)) {
			if (putdefault(name) == -1) {
				sprintf(msgid,"syserr:%d",errno+1);
				LP_ERRMSG1 (ERROR, E_ADM_WRDEFAULT, G_PERROR);
				done (1);
			}

		} else {
			if (deldefault() == -1) {
				sprintf(msgid,"syserr:%d",errno+1);
				LP_ERRMSG1 (ERROR, E_ADM_WRDEFAULT, G_PERROR);
				done (1);
			}

		}
	END_CRITICAL

	return;
}
