14887Schin /***********************************************************************
24887Schin *                                                                      *
34887Schin *               This software is part of the ast package               *
4*8462SApril.Chin@Sun.COM *          Copyright (c) 1992-2008 AT&T Intellectual Property          *
54887Schin *                      and is licensed under the                       *
64887Schin *                  Common Public License, Version 1.0                  *
7*8462SApril.Chin@Sun.COM *                    by AT&T Intellectual Property                     *
84887Schin *                                                                      *
94887Schin *                A copy of the License is available at                 *
104887Schin *            http://www.opensource.org/licenses/cpl1.0.txt             *
114887Schin *         (with md5 checksum 059e8cd6165cb4c31e351f2b69388fd9)         *
124887Schin *                                                                      *
134887Schin *              Information and Software Systems Research               *
144887Schin *                            AT&T Research                             *
154887Schin *                           Florham Park NJ                            *
164887Schin *                                                                      *
174887Schin *                 Glenn Fowler <gsf@research.att.com>                  *
184887Schin *                  David Korn <dgk@research.att.com>                   *
194887Schin *                                                                      *
204887Schin ***********************************************************************/
214887Schin #pragma prototyped
224887Schin /*
234887Schin  * command initialization
244887Schin  */
254887Schin 
264887Schin #include <cmd.h>
274887Schin 
284887Schin int
294887Schin _cmd_init(int argc, char** argv, void* context, const char* catalog, int flags)
304887Schin {
314887Schin 	register char*	cp;
324887Schin 
334887Schin 	if (argc < 0)
344887Schin 		return -1;
354887Schin 	if (cp = strrchr(argv[0], '/'))
364887Schin 		cp++;
374887Schin 	else
384887Schin 		cp = argv[0];
394887Schin 	error_info.id = cp;
404887Schin 	if (!error_info.catalog)
414887Schin 		error_info.catalog = catalog;
424887Schin 	opt_info.index = 0;
434887Schin 	if (context)
444887Schin 		error_info.flags |= flags;
454887Schin 	return 0;
464887Schin }
474887Schin 
484887Schin #if __OBSOLETE__ < 20080101
494887Schin 
504887Schin #if defined(__EXPORT__)
514887Schin #define extern	__EXPORT__
524887Schin #endif
534887Schin 
544887Schin #undef	cmdinit
554887Schin 
564887Schin extern void
574887Schin cmdinit(char** argv, void* context, const char* catalog, int flags)
584887Schin {
594887Schin 	_cmd_init(0, argv, context, catalog, flags);
604887Schin }
614887Schin 
624887Schin #endif
63