@@ -5469,17 +5469,17 @@ cob_acuw_file_delete (unsigned char *file_name, unsigned char *file_type)
54695469}
54705470
54715471int
5472- cob_listdir_open (cob_field * f_dirname , cob_field * f_pattern )
5472+ cob_listdir_open (cob_field * f_dirname , cob_field * f_pattern )
54735473{
54745474 //FIXME: now not use file pattern(ex. *).
54755475#ifdef _WIN32
5476- char * dirname = cob_str_from_fld (f_dirname );
5477- char * pattern = cob_str_from_fld (f_pattern );
5476+ char * dirname = cob_str_from_fld (f_dirname );
5477+ char * pattern = cob_str_from_fld (f_pattern );
54785478
5479- LPCTSTR lpFileName = cob_malloc (strlen (dirname ) + 1 + strlen (pattern ) + 1 );
5479+ LPCTSTR lpFileName = cob_malloc (strlen (dirname ) + 1 + strlen (pattern ) + 1 );
54805480
5481- if (listdir_filedata == NULL ){
5482- listdir_filedata = cob_malloc (sizeof (LPWIN32_FIND_DATA ));
5481+ if (listdir_filedata == NULL ) {
5482+ listdir_filedata = cob_malloc (sizeof (LPWIN32_FIND_DATA ));
54835483 }
54845484
54855485 strcpy (lpFileName , dirname );
@@ -5494,9 +5494,9 @@ cob_listdir_open(cob_field *f_dirname, cob_field *f_pattern)
54945494 }
54955495
54965496#else
5497- char * dirname = cob_str_from_fld (f_dirname );
5498- listdir_handle = opendir (dirname );
5499- free (dirname );
5497+ char * dirname = cob_str_from_fld (f_dirname );
5498+ listdir_handle = opendir (dirname );
5499+ free (dirname );
55005500 if (listdir_handle == NULL ) {
55015501 return 0 ;
55025502 }
@@ -5506,42 +5506,42 @@ cob_listdir_open(cob_field *f_dirname, cob_field *f_pattern)
55065506}
55075507
55085508int
5509- cob_listdir_next (cob_field * f_handle , cob_field * f_filename )
5509+ cob_listdir_next (cob_field * f_handle , cob_field * f_filename )
55105510{
55115511 //FIXME: now not use handle.
55125512 char * filename ;
55135513 int length ;
55145514
55155515#ifndef _WIN32
5516- listdir_filedata = readdir (listdir_handle );
5516+ listdir_filedata = readdir (listdir_handle );
55175517#endif
55185518#ifdef _WIN32
55195519 filename = listdir_filedata -> cFileName ;
55205520#else
5521- listdir_filedata = readdir (listdir_handle );
5522- if (listdir_filedata == NULL ){
5521+ listdir_filedata = readdir (listdir_handle );
5522+ if (listdir_filedata == NULL ) {
55235523 filename = " " ;
55245524 }else {
55255525 filename = listdir_filedata -> d_name ;
55265526 }
55275527#endif
5528- length = strlen (filename );
5528+ length = strlen (filename );
55295529
55305530 if (length > f_filename -> size ) {
55315531 length = f_filename -> size ;
55325532 }
5533- memset (f_filename -> data , ' ' , f_filename -> size );
5534- memcpy (f_filename -> data , filename , length );
5533+ memset (f_filename -> data , ' ' , f_filename -> size );
5534+ memcpy (f_filename -> data , filename , length );
55355535#ifdef _WIN32
5536- if (!FindNextFile (listdir_handle , listdir_filedata )) {
5537- strcpy (listdir_filedata -> cFileName , " " );
5536+ if (!FindNextFile (listdir_handle , listdir_filedata )) {
5537+ strcpy (listdir_filedata -> cFileName , " " );
55385538 }
55395539#endif
55405540 return 0 ;
55415541}
55425542
55435543int
5544- cob_listdir_close (cob_field * f_handle )
5544+ cob_listdir_close (cob_field * f_handle )
55455545{
55465546 //FIXME: now not use handle.
55475547#ifdef _WIN32
@@ -5558,26 +5558,26 @@ cob_acuw_list_directory (unsigned char *data, ...)
55585558 int operation_code = -1 ;
55595559 int return_code ;
55605560
5561- COB_CHK_PARMS (C$LIST - DIRECTORY , 1 );
5561+ COB_CHK_PARMS (C$LIST - DIRECTORY , 1 );
55625562
5563- if (cob_current_module -> cob_procedure_parameters [0 ] == NULL ){
5563+ if (cob_current_module -> cob_procedure_parameters [0 ] == NULL ) {
55645564 return -1 ;
55655565 }
55665566
5567- operation_code = cob_get_int (cob_current_module -> cob_procedure_parameters [0 ]);
5567+ operation_code = cob_get_int (cob_current_module -> cob_procedure_parameters [0 ]);
55685568
55695569 switch (operation_code )
55705570 {
55715571 case 1 ://LISTDIR-OPEN(value:1)
5572- return_code = cob_listdir_open (cob_current_module -> cob_procedure_parameters [1 ],
5572+ return_code = cob_listdir_open (cob_current_module -> cob_procedure_parameters [1 ],
55735573 cob_current_module -> cob_procedure_parameters [2 ]);
55745574 break ;
55755575 case 2 ://LISTDIR-NEXT(value:2)
5576- return_code = cob_listdir_next (cob_current_module -> cob_procedure_parameters [1 ],
5576+ return_code = cob_listdir_next (cob_current_module -> cob_procedure_parameters [1 ],
55775577 cob_current_module -> cob_procedure_parameters [2 ]);
55785578 break ;
55795579 case 3 ://LISTDIR-CLOSE(value:3)
5580- return_code = cob_listdir_close (cob_current_module -> cob_procedure_parameters [1 ]);
5580+ return_code = cob_listdir_close (cob_current_module -> cob_procedure_parameters [1 ]);
55815581 break ;
55825582 default :
55835583 //error
0 commit comments