appletfileunique.c

Go to the documentation of this file.
00001 
00002 /*  $Id: appletfileunique.c 355 2005-01-11 22:48:55Z andreradke $    */
00003 
00004 /* copyright 1991-96 UserLand Software, Inc. All Rights Reserved.*/
00005 
00006 
00007 #include "applet.h"
00008 #include "appletfilesinternal.h"
00009 #include "appletfileunique.h"
00010 
00011 
00012 
00013 
00014 void filepushsuffixnumber (short suffixnum, bigstring name) {
00015     
00016     if (suffixnum > 0) {
00017     
00018         pushstring ("\p #", name);
00019     
00020         pushint (suffixnum, name);
00021         }
00022     } /*filepushsuffixnumber*/
00023         
00024 
00025 boolean filegetuniquename (FSSpec *fs, short *suffixnum) {
00026     
00027     bigstring origname, name;
00028     
00029     *suffixnum = 0;
00030     
00031     copystring ((*fs).name, origname);
00032     
00033     if (stringlength (origname) == 0)
00034         return (false);
00035         
00036     while (fileexists (fs)) {
00037     
00038         copystring (origname, name);
00039         
00040         (*suffixnum)++;
00041         
00042         filepushsuffixnumber (*suffixnum, name);
00043         
00044         if (!filemakespec ((*fs).vRefNum, (*fs).parID, name, fs))
00045             return (false);
00046         } /*while*/
00047     
00048     return (true);
00049     } /*filegetuniquename*/
00050     
00051     

Generated on Wed May 31 18:19:41 2006 for frontierkernel 10.1.10a by  doxygen 1.4.6