/***********************************************************************1* *2* This software is part of the ast package *3* Copyright (c) 1992-2012 AT&T Intellectual Property *4* and is licensed under the *5* Eclipse Public License, Version 1.0 *6* by AT&T Intellectual Property *7* *8* A copy of the License is available at *9* http://www.eclipse.org/org/documents/epl-v10.html *10* (with md5 checksum b35adb5213ca9657e911e9befb180842) *11* *12* Information and Software Systems Research *13* AT&T Research *14* Florham Park NJ *15* *16* Glenn Fowler <[email protected]> *17* David Korn <[email protected]> *18* *19***********************************************************************/20#pragma prototyped21/*22* command initialization23*/2425#include <cmd.h>26#include <shcmd.h>2728int29_cmd_init(int argc, char** argv, Shbltin_t* context, const char* catalog, int flags)30{31register char* cp;3233if (argc <= 0)34return -1;35if (context)36{37if (flags & ERROR_CALLBACK)38{39flags &= ~ERROR_CALLBACK;40flags |= ERROR_NOTIFY;41}42else if (flags & ERROR_NOTIFY)43{44context->notify = 1;45flags &= ~ERROR_NOTIFY;46}47error_info.flags |= flags;48}49if (cp = strrchr(argv[0], '/'))50cp++;51else52cp = argv[0];53error_info.id = cp;54if (!error_info.catalog)55error_info.catalog = catalog;56opt_info.index = 0;57return 0;58}5960#if __OBSOLETE__ < 200801016162#if defined(__EXPORT__)63#define extern __EXPORT__64#endif6566#undef cmdinit6768extern void69cmdinit(char** argv, Shbltin_t* context, const char* catalog, int flags)70{71_cmd_init(0, argv, context, catalog, flags);72}7374#endif757677