summaryrefslogtreecommitdiff
path: root/apps/misc.c
diff options
context:
space:
mode:
authorFrank Gevaerts <frank@gevaerts.be>2008-08-29 21:08:38 +0000
committerFrank Gevaerts <frank@gevaerts.be>2008-08-29 21:08:38 +0000
commit5d22e3cbdd251819a4d2d07b9a12994d5aef778d (patch)
tree4c6a81187ccf065a5f296a903b9f7da88503e403 /apps/misc.c
parentcc31b1fbdae455f975b69dd6bffc23d8bd021566 (diff)
downloadrockbox-5d22e3cbdd251819a4d2d07b9a12994d5aef778d.zip
rockbox-5d22e3cbdd251819a4d2d07b9a12994d5aef778d.tar.gz
rockbox-5d22e3cbdd251819a4d2d07b9a12994d5aef778d.tar.bz2
rockbox-5d22e3cbdd251819a4d2d07b9a12994d5aef778d.tar.xz
Add wpseditor, the Google Summer of Code 2008 project of Rostislav Chekan. Closes FS#9327
git-svn-id: svn://svn.rockbox.org/rockbox/trunk@18362 a1c6a512-1295-4272-9138-f99709370657
Diffstat (limited to 'apps/misc.c')
-rw-r--r--apps/misc.c47
1 files changed, 26 insertions, 21 deletions
diff --git a/apps/misc.c b/apps/misc.c
index f3a937f..cd59dbc 100644
--- a/apps/misc.c
+++ b/apps/misc.c
@@ -27,7 +27,10 @@
#ifdef __PCTOOL__
#include <stdint.h>
#include <stdarg.h>
-#include <unistd.h>
+#include <stdio.h>
+#ifdef WPSEDITOR
+#include "string.h"
+#endif
#else
#include "sprintf.h"
#include "lang.h"
@@ -196,26 +199,6 @@ char *create_numbered_filename(char *buffer, const char *path,
return buffer;
}
-/* Format time into buf.
- *
- * buf - buffer to format to.
- * buf_size - size of buffer.
- * t - time to format, in milliseconds.
- */
-void format_time(char* buf, int buf_size, long t)
-{
- if ( t < 3600000 )
- {
- snprintf(buf, buf_size, "%d:%02d",
- (int) (t / 60000), (int) (t % 60000 / 1000));
- }
- else
- {
- snprintf(buf, buf_size, "%d:%02d:%02d",
- (int) (t / 3600000), (int) (t % 3600000 / 60000),
- (int) (t % 60000 / 1000));
- }
-}
#if CONFIG_RTC
/* Create a filename with a date+time part.
@@ -1179,6 +1162,28 @@ char *strip_extension(char* buffer, int buffer_size, const char *filename)
}
#endif /* !defined(__PCTOOL__) */
+/* Format time into buf.
+ *
+ * buf - buffer to format to.
+ * buf_size - size of buffer.
+ * t - time to format, in milliseconds.
+ */
+void format_time(char* buf, int buf_size, long t)
+{
+ if ( t < 3600000 )
+ {
+ snprintf(buf, buf_size, "%d:%02d",
+ (int) (t / 60000), (int) (t % 60000 / 1000));
+ }
+ else
+ {
+ snprintf(buf, buf_size, "%d:%02d:%02d",
+ (int) (t / 3600000), (int) (t % 3600000 / 60000),
+ (int) (t % 60000 / 1000));
+ }
+}
+
+
/** Open a UTF-8 file and set file descriptor to first byte after BOM.
* If no BOM is present this behaves like open().
* If the file is opened for writing and O_TRUNC is set, write a BOM to