/***********************************************************************1* *2* This software is part of the ast package *3* Copyright (c) 1985-2011 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* Phong Vo <[email protected]> *19* *20***********************************************************************/21#pragma prototyped22/*23* Glenn Fowler24* AT&T Bell Laboratories25*26* generate ast traps for botched standard prototypes27*/2829#include <sys/types.h>3031#include "FEATURE/lib"32#include "FEATURE/sys"3334#if _lib_getgroups35extern int getgroups(int, gid_t*);36#endif3738int39main()40{41#if _lib_getgroups42if (sizeof(int) > sizeof(gid_t))43{44int n;45int i;46int r;47gid_t groups[32 * sizeof(int) / sizeof(gid_t)];4849r = sizeof(int) / sizeof(gid_t);50if ((n = getgroups((sizeof(groups) / sizeof(groups[0])) / r, groups)) > 0)51for (i = 1; i <= n; i++)52{53groups[i] = ((gid_t)0);54if (getgroups(i, groups) != i)55goto botched;56if (groups[i] != ((gid_t)0))57goto botched;58groups[i] = ((gid_t)-1);59if (getgroups(i, groups) != i)60goto botched;61if (groups[i] != ((gid_t)-1))62goto botched;63}64}65return 0;66botched:67printf("#undef getgroups\n");68printf("#define getgroups _ast_getgroups /* implementation botches gid_t* arg */\n");69#endif70return 0;71}727374