From: <ai...@us...> - 2008-10-17 22:44:28
|
Revision: 8917 http://plplot.svn.sourceforge.net/plplot/?rev=8917&view=rev Author: airwin Date: 2008-10-17 22:44:26 +0000 (Fri, 17 Oct 2008) Log Message: ----------- Drop %n from filenames if familying is not enabled. This makes it much easier to use %n for filenames in our test scripts. Modified Paths: -------------- trunk/doc/docbook/src/advanced.xml trunk/src/plctrl.c Modified: trunk/doc/docbook/src/advanced.xml =================================================================== --- trunk/doc/docbook/src/advanced.xml 2008-10-17 22:34:35 UTC (rev 8916) +++ trunk/doc/docbook/src/advanced.xml 2008-10-17 22:44:26 UTC (rev 8917) @@ -500,7 +500,10 @@ the byte limit is large you can still insure a new file is automatically started after a page break if you precede the call to &pleop; with a call to &plfamadv;.</para> + <para> If familying is not enabled, <filename>%n</filename> is dropped + from the filename if that string appears anywhere in it.</para> + <para> The &plgfam; routine can be used from within the user program to find out more about the graphics file being written. In particular, by Modified: trunk/src/plctrl.c =================================================================== --- trunk/src/plctrl.c 2008-10-17 22:34:35 UTC (rev 8916) +++ trunk/src/plctrl.c 2008-10-17 22:44:26 UTC (rev 8917) @@ -1863,13 +1863,15 @@ /*--------------------------------------------------------------------------*\ * plP_sfnam() * - * Sets up file name & family stem name. - * Reserve some extra space (5 chars) to hold an optional member number. + * Sets up file name (with "%n" removed if present) & family stem name. + * Reserve some extra space (10 chars) to hold an optional member number. \*--------------------------------------------------------------------------*/ void plP_sfnam(PLStream *pls, const char *fnam) { + char prefix[256]; + char* suffix; pls->OutFile = NULL; if (pls->FileName != NULL) @@ -1880,8 +1882,16 @@ plexit("plP_sfnam: Insufficient memory"); } - strcpy(pls->FileName, fnam); + suffix = strstr (fnam, "%n"); + if (suffix == NULL) + strcpy(pls->FileName, fnam); + else { + strncpy (prefix, fnam, 256); + prefix [suffix - fnam] = 0; + sprintf (pls->FileName, "%s%s", prefix, suffix + 2); + } + if (pls->BaseName != NULL) free((void *) pls->BaseName); This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |