14887Schin /*********************************************************************** 24887Schin * * 34887Schin * This software is part of the ast package * 4*12068SRoger.Faulkner@Oracle.COM * Copyright (c) 1985-2010 AT&T Intellectual Property * 54887Schin * and is licensed under the * 64887Schin * Common Public License, Version 1.0 * 78462SApril.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 * Phong Vo <kpv@research.att.com> * 204887Schin * * 214887Schin ***********************************************************************/ 224887Schin #pragma prototyped 234887Schin /* 244887Schin * Xopen 4.2 compatibility 254887Schin */ 264887Schin 278462SApril.Chin@Sun.COM #include <ast.h> 284887Schin 294887Schin #undef _lib_getsubopt /* we can satisfy the api */ 304887Schin 314887Schin #if _lib_getsubopt 324887Schin 334887Schin NoN(getsubopt) 344887Schin 354887Schin #else 364887Schin 378462SApril.Chin@Sun.COM #undef _BLD_ast /* enable ast imports since we're user static */ 384887Schin 394887Schin #include <error.h> 404887Schin 414887Schin extern int 424887Schin getsubopt(register char** op, char* const* tp, char** vp) 434887Schin { 444887Schin register char* b; 454887Schin register char* s; 464887Schin register char* v; 474887Schin 484887Schin if (*(b = *op)) 494887Schin { 504887Schin v = 0; 514887Schin s = b; 524887Schin for (;;) 534887Schin { 544887Schin switch (*s++) 554887Schin { 564887Schin case 0: 574887Schin s--; 584887Schin break; 594887Schin case ',': 604887Schin *(s - 1) = 0; 614887Schin break; 624887Schin case '=': 634887Schin if (!v) 644887Schin { 654887Schin *(s - 1) = 0; 664887Schin v = s; 674887Schin } 684887Schin continue; 694887Schin default: 704887Schin continue; 714887Schin } 724887Schin break; 734887Schin } 744887Schin *op = s; 754887Schin *vp = v; 764887Schin for (op = (char**)tp; *op; op++) 774887Schin if (streq(b, *op)) 784887Schin return op - (char**)tp; 794887Schin } 804887Schin *vp = b; 814887Schin return -1; 824887Schin } 834887Schin 844887Schin #endif 85