/*	Copyright (c) 1988 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.	*/
/* $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.
 */

#ident	"$Header: gettxt.c 1.3 90/06/20 $@(#)gettxt:gettxt.c 1.2 AT&T-UP"

#include <stdio.h>

extern	char	*gettxt();
extern	char	*strccpy();
extern	char	*malloc();

main(argc, argv)
int	argc;
char	*argv[];
{
	char	*dfltp;

	if (argc != 2 && argc != 3) {
		fprintf(stderr, "Incorrect usage.\n");
		fprintf(stderr, "usage: gettxt msg_name:msg_num [ dflt_msg ]\n");
		exit(1);
	}

	if (argc == 2) {
		fputs(gettxt(argv[1], ""), stdout);
		exit(0);
	}

	if ((dfltp = malloc(strlen(argv[2]) + 1)) == (char *)NULL) {
		fprintf(stderr, "malloc failed\n");
		exit(1);
	}

	strccpy(dfltp, argv[2]);

	fputs(gettxt(argv[1], dfltp), stdout);

	(void)free(dfltp);

	exit(0);
}
