]> git.sur5r.net Git - freertos/blob
6b276a61d15cf5c2f8630fff6e7904a34e359015
[freertos] /
1 /*\r
2     FreeRTOS V8.2.0rc1 - Copyright (C) 2014 Real Time Engineers Ltd.\r
3     All rights reserved\r
4 \r
5     VISIT http://www.FreeRTOS.org TO ENSURE YOU ARE USING THE LATEST VERSION.\r
6 \r
7     This file is part of the FreeRTOS distribution.\r
8 \r
9     FreeRTOS is free software; you can redistribute it and/or modify it under\r
10     the terms of the GNU General Public License (version 2) as published by the\r
11     Free Software Foundation >>!AND MODIFIED BY!<< the FreeRTOS exception.\r
12 \r
13     >>!   NOTE: The modification to the GPL is included to allow you to     !<<\r
14     >>!   distribute a combined work that includes FreeRTOS without being   !<<\r
15     >>!   obliged to provide the source code for proprietary components     !<<\r
16     >>!   outside of the FreeRTOS kernel.                                   !<<\r
17 \r
18     FreeRTOS is distributed in the hope that it will be useful, but WITHOUT ANY\r
19     WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS\r
20     FOR A PARTICULAR PURPOSE.  Full license text is available on the following\r
21     link: http://www.freertos.org/a00114.html\r
22 \r
23     1 tab == 4 spaces!\r
24 \r
25     ***************************************************************************\r
26      *                                                                       *\r
27      *    Having a problem?  Start by reading the FAQ "My application does   *\r
28      *    not run, what could be wrong?".  Have you defined configASSERT()?  *\r
29      *                                                                       *\r
30      *    http://www.FreeRTOS.org/FAQHelp.html                               *\r
31      *                                                                       *\r
32     ***************************************************************************\r
33 \r
34     ***************************************************************************\r
35      *                                                                       *\r
36      *    FreeRTOS provides completely free yet professionally developed,    *\r
37      *    robust, strictly quality controlled, supported, and cross          *\r
38      *    platform software that is more than just the market leader, it     *\r
39      *    is the industry's de facto standard.                               *\r
40      *                                                                       *\r
41      *    Help yourself get started quickly while simultaneously helping     *\r
42      *    to support the FreeRTOS project by purchasing a FreeRTOS           *\r
43      *    tutorial book, reference manual, or both:                          *\r
44      *    http://www.FreeRTOS.org/Documentation                              *\r
45      *                                                                       *\r
46     ***************************************************************************\r
47 \r
48     ***************************************************************************\r
49      *                                                                       *\r
50      *   Investing in training allows your team to be as productive as       *\r
51      *   possible as early as possible, lowering your overall development    *\r
52      *   cost, and enabling you to bring a more robust product to market     *\r
53      *   earlier than would otherwise be possible.  Richard Barry is both    *\r
54      *   the architect and key author of FreeRTOS, and so also the world's   *\r
55      *   leading authority on what is the world's most popular real time     *\r
56      *   kernel for deeply embedded MCU designs.  Obtaining your training    *\r
57      *   from Richard ensures your team will gain directly from his in-depth *\r
58      *   product knowledge and years of usage experience.  Contact Real Time *\r
59      *   Engineers Ltd to enquire about the FreeRTOS Masterclass, presented  *\r
60      *   by Richard Barry:  http://www.FreeRTOS.org/contact\r
61      *                                                                       *\r
62     ***************************************************************************\r
63 \r
64     ***************************************************************************\r
65      *                                                                       *\r
66      *    You are receiving this top quality software for free.  Please play *\r
67      *    fair and reciprocate by reporting any suspected issues and         *\r
68      *    participating in the community forum:                              *\r
69      *    http://www.FreeRTOS.org/support                                    *\r
70      *                                                                       *\r
71      *    Thank you!                                                         *\r
72      *                                                                       *\r
73     ***************************************************************************\r
74 \r
75     http://www.FreeRTOS.org - Documentation, books, training, latest versions,\r
76     license and Real Time Engineers Ltd. contact details.\r
77 \r
78     http://www.FreeRTOS.org/plus - A selection of FreeRTOS ecosystem products,\r
79     including FreeRTOS+Trace - an indispensable productivity tool, a DOS\r
80     compatible FAT file system, and our tiny thread aware UDP/IP stack.\r
81 \r
82     http://www.FreeRTOS.org/labs - Where new FreeRTOS products go to incubate.\r
83     Come and try FreeRTOS+TCP, our new open source TCP/IP stack for FreeRTOS.\r
84 \r
85     http://www.OpenRTOS.com - Real Time Engineers ltd license FreeRTOS to High\r
86     Integrity Systems ltd. to sell under the OpenRTOS brand.  Low cost OpenRTOS\r
87     licenses offer ticketed support, indemnification and commercial middleware.\r
88 \r
89     http://www.SafeRTOS.com - High Integrity Systems also provide a safety\r
90     engineered and independently SIL3 certified version for use in safety and\r
91     mission critical applications that require provable dependability.\r
92 \r
93     1 tab == 4 spaces!\r
94 */\r
95 \r
96 /* FreeRTOS includes. */\r
97 #include "FreeRTOS.h"\r
98 #include "task.h"\r
99 \r
100 /* Standard includes. */\r
101 #include <stdint.h>\r
102 #include <stdio.h>\r
103 #include <stdlib.h>\r
104 #include <string.h>\r
105 \r
106 /* FreeRTOS+CLI includes. */\r
107 #include "FreeRTOS_CLI.h"\r
108 \r
109 /* File system includes. */\r
110 #include "fat_sl.h"\r
111 #include "api_mdriver_ram.h"\r
112 \r
113 #ifdef _WINDOWS_\r
114         #define snprintf _snprintf\r
115 #endif\r
116 \r
117 #define cliNEW_LINE             "\r\n"\r
118 \r
119 /*******************************************************************************\r
120  * See the URL in the comments within main.c for the location of the online\r
121  * documentation.\r
122  ******************************************************************************/\r
123 \r
124 /*\r
125  * Print out information on a single file.\r
126  */\r
127 static void prvCreateFileInfoString( char *pcBuffer, F_FIND *pxFindStruct );\r
128 \r
129 /*\r
130  * Copies an existing file into a newly created file.\r
131  */\r
132 static portBASE_TYPE prvPerformCopy( const char *pcSourceFile,\r
133                                                                         int32_t lSourceFileLength,\r
134                                                                         const char *pcDestinationFile,\r
135                                                                         char *pxWriteBuffer,\r
136                                                                         size_t xWriteBufferLen );\r
137 \r
138 /*\r
139  * Implements the DIR command.\r
140  */\r
141 static portBASE_TYPE prvDIRCommand( char *pcWriteBuffer, size_t xWriteBufferLen, const char *pcCommandString );\r
142 \r
143 /*\r
144  * Implements the CD command.\r
145  */\r
146 static portBASE_TYPE prvCDCommand( char *pcWriteBuffer, size_t xWriteBufferLen, const char *pcCommandString );\r
147 \r
148 /*\r
149  * Implements the DEL command.\r
150  */\r
151 static portBASE_TYPE prvDELCommand( char *pcWriteBuffer, size_t xWriteBufferLen, const char *pcCommandString );\r
152 \r
153 /*\r
154  * Implements the TYPE command.\r
155  */\r
156 static portBASE_TYPE prvTYPECommand( char *pcWriteBuffer, size_t xWriteBufferLen, const char *pcCommandString );\r
157 \r
158 /*\r
159  * Implements the COPY command.\r
160  */\r
161 static portBASE_TYPE prvCOPYCommand( char *pcWriteBuffer, size_t xWriteBufferLen, const char *pcCommandString );\r
162 \r
163 /* Structure that defines the DIR command line command, which lists all the\r
164 files in the current directory. */\r
165 static const CLI_Command_Definition_t xDIR =\r
166 {\r
167         "dir", /* The command string to type. */\r
168         "\r\ndir:\r\n Lists the files in the current directory\r\n",\r
169         prvDIRCommand, /* The function to run. */\r
170         0 /* No parameters are expected. */\r
171 };\r
172 \r
173 /* Structure that defines the CD command line command, which changes the\r
174 working directory. */\r
175 static const CLI_Command_Definition_t xCD =\r
176 {\r
177         "cd", /* The command string to type. */\r
178         "\r\ncd <dir name>:\r\n Changes the working directory\r\n",\r
179         prvCDCommand, /* The function to run. */\r
180         1 /* One parameter is expected. */\r
181 };\r
182 \r
183 /* Structure that defines the TYPE command line command, which prints the\r
184 contents of a file to the console. */\r
185 static const CLI_Command_Definition_t xTYPE =\r
186 {\r
187         "type", /* The command string to type. */\r
188         "\r\ntype <filename>:\r\n Prints file contents to the terminal\r\n",\r
189         prvTYPECommand, /* The function to run. */\r
190         1 /* One parameter is expected. */\r
191 };\r
192 \r
193 /* Structure that defines the DEL command line command, which deletes a file. */\r
194 static const CLI_Command_Definition_t xDEL =\r
195 {\r
196         "del", /* The command string to type. */\r
197         "\r\ndel <filename>:\r\n deletes a file or directory\r\n",\r
198         prvDELCommand, /* The function to run. */\r
199         1 /* One parameter is expected. */\r
200 };\r
201 \r
202 /* Structure that defines the COPY command line command, which deletes a file. */\r
203 static const CLI_Command_Definition_t xCOPY =\r
204 {\r
205         "copy", /* The command string to type. */\r
206         "\r\ncopy <source file> <dest file>:\r\n Copies <source file> to <dest file>\r\n",\r
207         prvCOPYCommand, /* The function to run. */\r
208         2 /* Two parameters are expected. */\r
209 };\r
210 \r
211 /*-----------------------------------------------------------*/\r
212 \r
213 void vRegisterFileSystemCLICommands( void )\r
214 {\r
215         /* Register all the command line commands defined immediately above. */\r
216         FreeRTOS_CLIRegisterCommand( &xDIR );\r
217         FreeRTOS_CLIRegisterCommand( &xCD );\r
218         FreeRTOS_CLIRegisterCommand( &xTYPE );\r
219         FreeRTOS_CLIRegisterCommand( &xDEL );\r
220         FreeRTOS_CLIRegisterCommand( &xCOPY );\r
221 }\r
222 /*-----------------------------------------------------------*/\r
223 \r
224 static portBASE_TYPE prvTYPECommand( char *pcWriteBuffer, size_t xWriteBufferLen, const char *pcCommandString )\r
225 {\r
226 const char *pcParameter;\r
227 portBASE_TYPE xParameterStringLength, xReturn = pdTRUE;\r
228 static F_FILE *pxFile = NULL;\r
229 int iChar;\r
230 size_t xByte;\r
231 size_t xColumns = 50U;\r
232 \r
233         /* Ensure there is always a null terminator after each character written. */\r
234         memset( pcWriteBuffer, 0x00, xWriteBufferLen );\r
235 \r
236         /* Ensure the buffer leaves space for the \r\n. */\r
237         configASSERT( xWriteBufferLen > ( strlen( cliNEW_LINE ) * 2 ) );\r
238         xWriteBufferLen -= strlen( cliNEW_LINE );\r
239 \r
240         if( xWriteBufferLen < xColumns )\r
241         {\r
242                 /* Ensure the loop that uses xColumns as an end condition does not\r
243                 write off the end of the buffer. */\r
244                 xColumns = xWriteBufferLen;\r
245         }\r
246 \r
247         if( pxFile == NULL )\r
248         {\r
249                 /* The file has not been opened yet.  Find the file name. */\r
250                 pcParameter = FreeRTOS_CLIGetParameter\r
251                                                         (\r
252                                                                 pcCommandString,                /* The command string itself. */\r
253                                                                 1,                                              /* Return the first parameter. */\r
254                                                                 &xParameterStringLength /* Store the parameter string length. */\r
255                                                         );\r
256 \r
257                 /* Sanity check something was returned. */\r
258                 configASSERT( pcParameter );\r
259 \r
260                 /* Attempt to open the requested file. */\r
261                 pxFile = f_open( pcParameter, "r" );\r
262         }\r
263 \r
264         if( pxFile != NULL )\r
265         {\r
266                 /* Read the next chunk of data from the file. */\r
267                 for( xByte = 0; xByte < xColumns; xByte++ )\r
268                 {\r
269                         iChar = f_getc( pxFile );\r
270 \r
271                         if( iChar == -1 )\r
272                         {\r
273                                 /* No more characters to return. */\r
274                                 f_close( pxFile );\r
275                                 pxFile = NULL;\r
276                                 break;\r
277                         }\r
278                         else\r
279                         {\r
280                                 pcWriteBuffer[ xByte ] = ( char ) iChar;\r
281                         }\r
282                 }\r
283         }\r
284 \r
285         if( pxFile == NULL )\r
286         {\r
287                 /* Either the file was not opened, or all the data from the file has\r
288                 been returned and the file is now closed. */\r
289                 xReturn = pdFALSE;\r
290         }\r
291 \r
292         strcat( pcWriteBuffer, cliNEW_LINE );\r
293 \r
294         return xReturn;\r
295 }\r
296 /*-----------------------------------------------------------*/\r
297 \r
298 static portBASE_TYPE prvCDCommand( char *pcWriteBuffer, size_t xWriteBufferLen, const char *pcCommandString )\r
299 {\r
300 const char *pcParameter;\r
301 portBASE_TYPE xParameterStringLength;\r
302 unsigned char ucReturned;\r
303 size_t xStringLength;\r
304 \r
305         /* Obtain the parameter string. */\r
306         pcParameter = FreeRTOS_CLIGetParameter\r
307                                                 (\r
308                                                         pcCommandString,                /* The command string itself. */\r
309                                                         1,                                              /* Return the first parameter. */\r
310                                                         &xParameterStringLength /* Store the parameter string length. */\r
311                                                 );\r
312 \r
313         /* Sanity check something was returned. */\r
314         configASSERT( pcParameter );\r
315 \r
316         /* Attempt to move to the requested directory. */\r
317         ucReturned = f_chdir( pcParameter );\r
318 \r
319         if( ucReturned == F_NO_ERROR )\r
320         {\r
321                 sprintf( pcWriteBuffer, "In: " );\r
322                 xStringLength = strlen( pcWriteBuffer );\r
323                 f_getcwd( &( pcWriteBuffer[ xStringLength ] ), ( unsigned char ) ( xWriteBufferLen - xStringLength ) );\r
324         }\r
325         else\r
326         {\r
327                 sprintf( pcWriteBuffer, "Error" );\r
328         }\r
329 \r
330         strcat( pcWriteBuffer, cliNEW_LINE );\r
331 \r
332         return pdFALSE;\r
333 }\r
334 /*-----------------------------------------------------------*/\r
335 \r
336 static portBASE_TYPE prvDIRCommand( char *pcWriteBuffer, size_t xWriteBufferLen, const char *pcCommandString )\r
337 {\r
338 static F_FIND *pxFindStruct = NULL;\r
339 unsigned char ucReturned;\r
340 portBASE_TYPE xReturn = pdFALSE;\r
341 \r
342         /* This assumes pcWriteBuffer is long enough. */\r
343         ( void ) pcCommandString;\r
344 \r
345         /* Ensure the buffer leaves space for the \r\n. */\r
346         configASSERT( xWriteBufferLen > ( strlen( cliNEW_LINE ) * 2 ) );\r
347         xWriteBufferLen -= strlen( cliNEW_LINE );\r
348 \r
349         if( pxFindStruct == NULL )\r
350         {\r
351                 /* This is the first time this function has been executed since the Dir\r
352                 command was run.  Create the find structure. */\r
353                 pxFindStruct = ( F_FIND * ) pvPortMalloc( sizeof( F_FIND ) );\r
354 \r
355                 if( pxFindStruct != NULL )\r
356                 {\r
357                         ucReturned = f_findfirst( "*.*", pxFindStruct );\r
358 \r
359                         if( ucReturned == F_NO_ERROR )\r
360                         {\r
361                                 prvCreateFileInfoString( pcWriteBuffer, pxFindStruct );\r
362                                 xReturn = pdPASS;\r
363                         }\r
364                         else\r
365                         {\r
366                                 snprintf( pcWriteBuffer, xWriteBufferLen, "Error: f_findfirst() failed." );\r
367                         }\r
368                 }\r
369                 else\r
370                 {\r
371                         snprintf( pcWriteBuffer, xWriteBufferLen, "Failed to allocate RAM (using heap_4.c will prevent fragmentation)." );\r
372                 }\r
373         }\r
374         else\r
375         {\r
376                 /* The find struct has already been created.  Find the next file in\r
377                 the directory. */\r
378                 ucReturned = f_findnext( pxFindStruct );\r
379 \r
380                 if( ucReturned == F_NO_ERROR )\r
381                 {\r
382                         prvCreateFileInfoString( pcWriteBuffer, pxFindStruct );\r
383                         xReturn = pdPASS;\r
384                 }\r
385                 else\r
386                 {\r
387                         /* There are no more files.  Free the find structure. */\r
388                         vPortFree( pxFindStruct );\r
389                         pxFindStruct = NULL;\r
390 \r
391                         /* No string to return. */\r
392                         pcWriteBuffer[ 0 ] = 0x00;\r
393                 }\r
394         }\r
395 \r
396         strcat( pcWriteBuffer, cliNEW_LINE );\r
397 \r
398         return xReturn;\r
399 }\r
400 /*-----------------------------------------------------------*/\r
401 \r
402 static portBASE_TYPE prvDELCommand( char *pcWriteBuffer, size_t xWriteBufferLen, const char *pcCommandString )\r
403 {\r
404 const char *pcParameter;\r
405 portBASE_TYPE xParameterStringLength;\r
406 unsigned char ucReturned;\r
407 \r
408         /* This function assumes xWriteBufferLen is large enough! */\r
409         ( void ) xWriteBufferLen;\r
410 \r
411         /* Obtain the parameter string. */\r
412         pcParameter = FreeRTOS_CLIGetParameter\r
413                                                 (\r
414                                                         pcCommandString,                /* The command string itself. */\r
415                                                         1,                                              /* Return the first parameter. */\r
416                                                         &xParameterStringLength /* Store the parameter string length. */\r
417                                                 );\r
418 \r
419         /* Sanity check something was returned. */\r
420         configASSERT( pcParameter );\r
421 \r
422         /* Attempt to delete the file. */\r
423         ucReturned = f_delete( pcParameter );\r
424 \r
425         if( ucReturned == F_NO_ERROR )\r
426         {\r
427                 sprintf( pcWriteBuffer, "%s was deleted", pcParameter );\r
428         }\r
429         else\r
430         {\r
431                 sprintf( pcWriteBuffer, "Error" );\r
432         }\r
433 \r
434         strcat( pcWriteBuffer, cliNEW_LINE );\r
435 \r
436         return pdFALSE;\r
437 }\r
438 /*-----------------------------------------------------------*/\r
439 \r
440 static portBASE_TYPE prvCOPYCommand( char *pcWriteBuffer, size_t xWriteBufferLen, const char *pcCommandString )\r
441 {\r
442 const char *pcDestinationFile;\r
443 char *pcSourceFile;\r
444 portBASE_TYPE xParameterStringLength;\r
445 long lSourceLength, lDestinationLength = 0;\r
446 \r
447         /* Obtain the name of the destination file. */\r
448         pcDestinationFile = FreeRTOS_CLIGetParameter\r
449                                                         (\r
450                                                                 pcCommandString,                /* The command string itself. */\r
451                                                                 2,                                              /* Return the second parameter. */\r
452                                                                 &xParameterStringLength /* Store the parameter string length. */\r
453                                                         );\r
454 \r
455         /* Sanity check something was returned. */\r
456         configASSERT( pcDestinationFile );\r
457 \r
458         /* Obtain the name of the source file. */\r
459         pcSourceFile = ( char * ) FreeRTOS_CLIGetParameter\r
460                                                                 (\r
461                                                                         pcCommandString,                /* The command string itself. */\r
462                                                                         1,                                              /* Return the first parameter. */\r
463                                                                         &xParameterStringLength /* Store the parameter string length. */\r
464                                                                 );\r
465 \r
466         /* Sanity check something was returned. */\r
467         configASSERT( pcSourceFile );\r
468 \r
469         /* Terminate the string. */\r
470         pcSourceFile[ xParameterStringLength ] = 0x00;\r
471 \r
472         /* See if the source file exists, obtain its length if it does. */\r
473         lSourceLength = f_filelength( pcSourceFile );\r
474 \r
475         if( lSourceLength == 0 )\r
476         {\r
477                 sprintf( pcWriteBuffer, "Source file does not exist" );\r
478         }\r
479         else\r
480         {\r
481                 /* See if the destination file exists. */\r
482                 lDestinationLength = f_filelength( pcDestinationFile );\r
483 \r
484                 if( lDestinationLength != 0 )\r
485                 {\r
486                         sprintf( pcWriteBuffer, "Error: Destination file already exists" );\r
487                 }\r
488         }\r
489 \r
490         /* Continue only if the source file exists and the destination file does\r
491         not exist. */\r
492         if( ( lSourceLength != 0 ) && ( lDestinationLength == 0 ) )\r
493         {\r
494                 if( prvPerformCopy( pcSourceFile, lSourceLength, pcDestinationFile, pcWriteBuffer, xWriteBufferLen ) == pdPASS )\r
495                 {\r
496                         sprintf( pcWriteBuffer, "Copy made" );\r
497                 }\r
498                 else\r
499                 {\r
500                         sprintf( pcWriteBuffer, "Error during copy" );\r
501                 }\r
502         }\r
503 \r
504         strcat( pcWriteBuffer, cliNEW_LINE );\r
505 \r
506         return pdFALSE;\r
507 }\r
508 /*-----------------------------------------------------------*/\r
509 \r
510 static portBASE_TYPE prvPerformCopy( const char *pcSourceFile,\r
511                                                                         int32_t lSourceFileLength,\r
512                                                                         const char *pcDestinationFile,\r
513                                                                         char *pxWriteBuffer,\r
514                                                                         size_t xWriteBufferLen )\r
515 {\r
516 int32_t lBytesRead = 0, lBytesToRead, lBytesRemaining;\r
517 F_FILE *pxFile;\r
518 portBASE_TYPE xReturn = pdPASS;\r
519 \r
520         /* NOTE:  Error handling has been omitted for clarity. */\r
521 \r
522         while( lBytesRead < lSourceFileLength )\r
523         {\r
524                 /* How many bytes are left? */\r
525                 lBytesRemaining = lSourceFileLength - lBytesRead;\r
526 \r
527                 /* How many bytes should be read this time around the loop.  Can't\r
528                 read more bytes than will fit into the buffer. */\r
529                 if( lBytesRemaining > ( long ) xWriteBufferLen )\r
530                 {\r
531                         lBytesToRead = ( long ) xWriteBufferLen;\r
532                 }\r
533                 else\r
534                 {\r
535                         lBytesToRead = lBytesRemaining;\r
536                 }\r
537 \r
538                 /* Open the source file, seek past the data that has already been\r
539                 read from the file, read the next block of data, then close the\r
540                 file again so the destination file can be opened. */\r
541                 pxFile = f_open( pcSourceFile, "r" );\r
542                 if( pxFile != NULL )\r
543                 {\r
544                         f_seek( pxFile, lBytesRead, F_SEEK_SET );\r
545                         f_read( pxWriteBuffer, lBytesToRead, 1, pxFile );\r
546                         f_close( pxFile );\r
547                 }\r
548                 else\r
549                 {\r
550                         xReturn = pdFAIL;\r
551                         break;\r
552                 }\r
553 \r
554                 /* Open the destination file and write the block of data to the end of\r
555                 the file. */\r
556                 pxFile = f_open( pcDestinationFile, "a" );\r
557                 if( pxFile != NULL )\r
558                 {\r
559                         f_write( pxWriteBuffer, lBytesToRead, 1, pxFile );\r
560                         f_close( pxFile );\r
561                 }\r
562                 else\r
563                 {\r
564                         xReturn = pdFAIL;\r
565                         break;\r
566                 }\r
567 \r
568                 lBytesRead += lBytesToRead;\r
569         }\r
570 \r
571         return xReturn;\r
572 }\r
573 /*-----------------------------------------------------------*/\r
574 \r
575 static void prvCreateFileInfoString( char *pcBuffer, F_FIND *pxFindStruct )\r
576 {\r
577 const char *pcWritableFile = "writable file", *pcReadOnlyFile = "read only file", *pcDirectory = "directory";\r
578 const char * pcAttrib;\r
579 \r
580         /* Point pcAttrib to a string that describes the file. */\r
581         if( ( pxFindStruct->attr & F_ATTR_DIR ) != 0 )\r
582         {\r
583                 pcAttrib = pcDirectory;\r
584         }\r
585         else if( pxFindStruct->attr & F_ATTR_READONLY )\r
586         {\r
587                 pcAttrib = pcReadOnlyFile;\r
588         }\r
589         else\r
590         {\r
591                 pcAttrib = pcWritableFile;\r
592         }\r
593 \r
594         /* Create a string that includes the file name, the file size and the\r
595         attributes string. */\r
596         sprintf( pcBuffer, "%s [%s] [size=%d]", pxFindStruct->filename, pcAttrib, ( int ) pxFindStruct->filesize );\r
597 }\r