/***********************************************************************1* *2* This software is part of the ast package *3* Copyright (c) 1999-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* *18***********************************************************************/19#include "sftest.h"2021static char *Mystr = "abc";22#if __STD_C23int myprint(Sfio_t* f, Void_t* v, Sffmt_t* fe)24#else25int myprint(f, v, fe)26Sfio_t* f;27Void_t* v;28Sffmt_t* fe;29#endif30{31switch(fe->fmt)32{33case 's' :34*((char**)v) = Mystr;35fe->flags |= SFFMT_VALUE;36return 0;37}3839return 0;40}4142tmain()43{44char buf1[1024], buf2[1024];45Sffmt_t fe;4647memset(&fe, 0, sizeof(Sffmt_t));48fe.version = SFIO_VERSION;49fe.form = "%1$s";50fe.extf = myprint;5152sfsprintf(buf1,sizeof(buf1),"%s",Mystr);53sfsprintf(buf2,sizeof(buf2),"%!", &fe);54if(strcmp(buf1,buf2) != 0)55terror("Failed testing $position");5657return 0;58}596061