summaryrefslogtreecommitdiff
path: root/apps/plugins/md5sum.c
diff options
context:
space:
mode:
Diffstat (limited to 'apps/plugins/md5sum.c')
-rw-r--r--apps/plugins/md5sum.c22
1 files changed, 19 insertions, 3 deletions
diff --git a/apps/plugins/md5sum.c b/apps/plugins/md5sum.c
index 6845c4c473..1c27fe53ac 100644
--- a/apps/plugins/md5sum.c
+++ b/apps/plugins/md5sum.c
@@ -24,12 +24,15 @@ PLUGIN_HEADER
24 24
25static const struct plugin_api *rb; 25static const struct plugin_api *rb;
26 26
27MEM_FUNCTION_WRAPPERS(rb);
28
27int hash( char *string, const char *path ) 29int hash( char *string, const char *path )
28{ 30{
29 char *buffer[512]; 31 char *buffer[512];
30 ssize_t len; 32 ssize_t len;
31 struct md5_s md5; 33 struct md5_s md5;
32 int in = rb->open( path, O_RDONLY ); 34 int in = rb->open( path, O_RDONLY );
35 rb->splash( 0, path );
33 if( in < 0 ) return -1; 36 if( in < 0 ) return -1;
34 37
35 InitMD5( &md5 ); 38 InitMD5( &md5 );
@@ -50,7 +53,7 @@ void hash_file( int out, const char *path )
50 rb->write( out, "error", 5 ); 53 rb->write( out, "error", 5 );
51 else 54 else
52 rb->write( out, string, MD5_STRING_LENGTH ); 55 rb->write( out, string, MD5_STRING_LENGTH );
53 rb->write( out, " ", 1 ); 56 rb->write( out, " ", 2 );
54 rb->write( out, path, rb->strlen( path ) ); 57 rb->write( out, path, rb->strlen( path ) );
55 rb->write( out, "\n", 1 ); 58 rb->write( out, "\n", 1 );
56} 59}
@@ -129,7 +132,8 @@ void hash_check( int out, const char *path )
129 else 132 else
130 { 133 {
131 char string[MD5_STRING_LENGTH+1]; 134 char string[MD5_STRING_LENGTH+1];
132 filename++; 135 while( *filename == ' ' )
136 filename++;
133 rb->write( out, filename, rb->strlen( filename ) ); 137 rb->write( out, filename, rb->strlen( filename ) );
134 rb->write( out, ": ", 2 ); 138 rb->write( out, ": ", 2 );
135 if( hash( string, filename ) ) 139 if( hash( string, filename ) )
@@ -151,6 +155,9 @@ enum plugin_status plugin_start(const struct plugin_api* api, const void* parame
151 155
152 md5_init( api ); 156 md5_init( api );
153 rb = api; 157 rb = api;
158#ifdef HAVE_ADJUSTABLE_CPU_FREQ
159 rb->cpu_boost( true );
160#endif
154 161
155 if( arg && *arg ) 162 if( arg && *arg )
156 { 163 {
@@ -158,7 +165,13 @@ enum plugin_status plugin_start(const struct plugin_api* api, const void* parame
158 DIR *dir; 165 DIR *dir;
159 rb->snprintf( filename, MAX_PATH, "%s.md5sum", arg ); 166 rb->snprintf( filename, MAX_PATH, "%s.md5sum", arg );
160 out = rb->open( filename, O_WRONLY|O_CREAT ); 167 out = rb->open( filename, O_WRONLY|O_CREAT );
161 if( out < 0 ) return PLUGIN_ERROR; 168 if( out < 0 )
169 {
170#ifdef HAVE_ADJUSTABLE_CPU_FREQ
171 rb->cpu_boost( false );
172#endif
173 return PLUGIN_ERROR;
174 }
162 175
163 if( ext ) 176 if( ext )
164 { 177 {
@@ -202,5 +215,8 @@ enum plugin_status plugin_start(const struct plugin_api* api, const void* parame
202 215
203 exit: 216 exit:
204 rb->close( out ); 217 rb->close( out );
218#ifdef HAVE_ADJUSTABLE_CPU_FREQ
219 rb->cpu_boost( false );
220#endif
205 return PLUGIN_OK; 221 return PLUGIN_OK;
206} 222}