2 Copyright © 1995-2007, The AROS Development Team. All rights reserved.
7 #include "icon_intern.h"
9 /*****************************************************************************
12 #include <proto/icon.h>
14 AROS_LH2(UBYTE
*, BumpRevision
,
17 AROS_LHA(UBYTE
*, newname
, A0
),
18 AROS_LHA(UBYTE
*, oldname
, A1
),
21 struct Library
*, IconBase
, 18, Icon
)
24 Computes the right copy revision for a file name.
27 newname - a buffer for the new string. Should be at leas 31 bytes.
28 oldname - the old name to be revisioned.
31 pointer to the supplied buffer.o
43 *****************************************************************************/
46 UBYTE tempstr
[50]; /* A string to hold the new string, this one is big
47 enough to hold any new possible string. Then we
48 truncate this one into the newstr */
50 BOOL founddigit
= FALSE
;
58 if (!strncmp (oldname
, "copy_", 5))
60 /* Just a usual filename */
61 strcpy (tempstr
, "copy_of_");
62 strcpy (tempstr
+ 8, oldname
);
66 /* Possible double or multiple-copy */
67 if (!strncmp (oldname
,"copy_of_", 8)) /* Is this a first copy ?*/
70 strcpy (tempstr
, "copy_2_of_");
71 strcat (tempstr
, oldname
+ 8);
75 /* Possible multiple copy */
76 /* Step past "copy_" */
79 /* Convert number from text into integer */
80 while (c
= *oldnameptr
, ((c
>='0') && (c
<='9')) )
82 /* Get the number of this copy. (copy_xxx_of_) */
84 copy_number
+= (c
- 0x30);
89 /* Valid ? (multiple copy or rubbish ?) */
91 if (((!strncmp(oldnameptr
,"_of_",4)) && founddigit
))
93 /* convert back from num to text, but first increase copycount */
105 /* Rubbish, add copy_of_ and move into tempstr */
106 strcpy (tempstr
, "copy_of_");
107 strcpy (tempstr
+ 8, oldname
);
112 /* Truncate tempstr into newstr */
113 strncpy (newname
, tempstr
, 30);
115 /* Be sure that it is nullterminated */
116 newname
[30] = 0; /* The 31th character */