diff options
Diffstat (limited to 'fmtqfn.c')
| -rw-r--r-- | fmtqfn.c | 24 |
1 files changed, 24 insertions, 0 deletions
diff --git a/fmtqfn.c b/fmtqfn.c new file mode 100644 index 0000000..6229b4a --- /dev/null +++ b/fmtqfn.c | |||
| @@ -0,0 +1,24 @@ | |||
| 1 | #include "fmtqfn.h" | ||
| 2 | #include "fmt.h" | ||
| 3 | #include "auto_split.h" | ||
| 4 | |||
| 5 | unsigned int fmtqfn(s,dirslash,id,flagsplit) | ||
| 6 | char *s; | ||
| 7 | char *dirslash; | ||
| 8 | unsigned long id; | ||
| 9 | int flagsplit; | ||
| 10 | { | ||
| 11 | unsigned int len; | ||
| 12 | unsigned int i; | ||
| 13 | |||
| 14 | len = 0; | ||
| 15 | i = fmt_str(s,dirslash); len += i; if (s) s += i; | ||
| 16 | if (flagsplit) | ||
| 17 | { | ||
| 18 | i = fmt_ulong(s,id % auto_split); len += i; if (s) s += i; | ||
| 19 | i = fmt_str(s,"/"); len += i; if (s) s += i; | ||
| 20 | } | ||
| 21 | i = fmt_ulong(s,id); len += i; if (s) s += i; | ||
| 22 | if (s) *s++ = 0; ++len; | ||
| 23 | return len; | ||
| 24 | } | ||
