1 /***************************************************************************
2 *
3 * $Header: /usr/local/cvsroot/utils/ytree/filewin.c,v 1.36 2016/09/04 14:41:12 werner Exp $
4 *
5 * Funktionen zur Handhabung des FILE-Windows
6 *
7 ***************************************************************************/
8
9
10 #include "ytree.h"
11
12
13 #define MAX( a, b ) ( ( (a) > (b) ) ? (a) : (b) )
14
15
16 #if !defined(__NeXT__) && !defined(ultrix)
17 extern void qsort(void *, size_t, size_t, int (*) (const void *, const void *));
18 #endif /* __NeXT__ ultrix */
19
20
21
22 static BOOL reverse_sort;
23 static BOOL order;
24 static BOOL do_case = FALSE;
25 static int file_mode;
26 static int max_column;
27
28 static int window_height;
29 static int window_width;
30 static int max_disp_files;
31 static int x_step;
32 static int my_x_step;
33 static int hide_left;
34 static int hide_right;
35
36 static FileEntryList *file_entry_list;
37 static unsigned file_count;
38 static unsigned max_userview_len;
39 static unsigned max_filename_len;
40 static unsigned max_linkname_len;
41 static unsigned global_max_filename_len;
42 static unsigned global_max_linkname_len;
43
44 static void ReadFileList(DirEntry *dir_entry);
45 static void SortFileEntryList(void);
46 static int SortByName(FileEntryList *e1, FileEntryList *e2);
47 static int SortByChgTime(FileEntryList *e1, FileEntryList *e2);
48 static int SortByAccTime(FileEntryList *e1, FileEntryList *e2);
49 static int SortByModTime(FileEntryList *e1, FileEntryList *e2);
50 static int SortBySize(FileEntryList *e1, FileEntryList *e2);
51 static int SortByOwner(FileEntryList *e1, FileEntryList *e2);
52 static int SortByGroup(FileEntryList *e1, FileEntryList *e2);
53 static int SortByExtension(FileEntryList *e1, FileEntryList *e2);
54 static void DisplayFiles(DirEntry *de_ptr, int start_file_no, int hilight_no, int start_x);
55 static void ReadGlobalFileList(DirEntry *dir_entry);
56 static void WalkTaggedFiles(int start_file, int cursor_pos, int (*fkt) (/* ??? */), WalkingPackage *walking_package);
57 static BOOL IsMatchingTaggedFiles(void);
58 static void RemoveFileEntry(int entry_no);
59 static void ChangeFileEntry(void);
60 static int DeleteTaggedFiles(int max_dispfiles);
61 static void SilentWalkTaggedFiles( int (*fkt) (/* ??? */),
62 WalkingPackage *walking_package
63 );
64 static void SilentTagWalkTaggedFiles( int (*fkt) (/* ??? */),
65 WalkingPackage *walking_package
66 );
67 static void RereadWindowSize(DirEntry *dir_entry);
68 static void ListJump( DirEntry * dir_entry, char *str );
69
70
71
SetFileMode(int new_file_mode)72 void SetFileMode(int new_file_mode)
73 {
74
75 GetMaxYX( file_window, &window_height, &window_width );
76 file_mode = new_file_mode;
77 switch( file_mode )
78 {
79 case MODE_1: if( max_linkname_len)
80 max_column = window_width /
81 (max_filename_len + max_linkname_len + 45);
82 else
83 max_column = window_width / (max_filename_len + 41);
84 break;
85 case MODE_2: if( max_linkname_len)
86 max_column = window_width /
87 (max_filename_len + max_linkname_len + 41);
88 else
89 max_column = window_width / (max_filename_len + 37);
90 break;
91 case MODE_3: max_column = window_width / (max_filename_len + 3);
92 break;
93 case MODE_4: if( max_linkname_len)
94 max_column = window_width /
95 (max_filename_len + max_linkname_len + 44);
96 else
97 max_column = window_width / (max_filename_len + 40);
98 break;
99 case MODE_5: max_userview_len = GetUserFileEntryLength(max_filename_len,
100 max_linkname_len,
101 USERVIEW);
102 if(max_userview_len)
103 max_column = window_width / (max_userview_len + 1);
104 else
105 max_column = 0;
106 break;
107 }
108
109 if( max_column == 0 )
110 max_column = 1;
111 }
112
113
114
RotateFileMode(void)115 void RotateFileMode(void)
116 {
117 switch( file_mode )
118 {
119 case MODE_1: SetFileMode( MODE_3 ); break;
120 case MODE_2: SetFileMode( MODE_5 ); break;
121 case MODE_3: SetFileMode( MODE_4 ); break;
122 case MODE_4: SetFileMode( MODE_2 ); break;
123 case MODE_5: SetFileMode( MODE_1 ); break;
124 }
125 if( (mode != DISK_MODE && mode != USER_MODE) && file_mode == MODE_4 ) {
126 RotateFileMode();
127 } else if(file_mode == MODE_5 && !strcmp(USERVIEW, "")) {
128 RotateFileMode();
129 }
130 }
131
132
133
134
ReadTaggedList(DirEntry * dir_entry)135 static void ReadTaggedList(DirEntry *dir_entry)
136 {
137 FileEntry *fe_ptr;
138 unsigned int name_len;
139 unsigned int linkname_len;
140
141 max_filename_len = 0;
142 max_linkname_len = 0;
143
144 for( fe_ptr = dir_entry->file; fe_ptr; fe_ptr = fe_ptr->next )
145 {
146 if (( fe_ptr->matching ) && ( fe_ptr->tagged ))
147 {
148 file_entry_list[file_count++].file = fe_ptr;
149 name_len = strlen( fe_ptr->name );
150 if( S_ISLNK( fe_ptr->stat_struct.st_mode ) )
151 {
152 linkname_len = strlen( &fe_ptr->name[name_len+1] );
153 max_linkname_len = MAX( max_linkname_len, linkname_len );
154 }
155 max_filename_len = MAX( max_filename_len, name_len );
156 }
157 }
158 }
159
ReadTaggedFileList(DirEntry * dir_entry)160 static void ReadTaggedFileList(DirEntry *dir_entry)
161 {
162 DirEntry *de_ptr;
163
164 for( de_ptr=dir_entry; de_ptr; de_ptr=de_ptr->next )
165 {
166 if( de_ptr->sub_tree ) ReadTaggedFileList( de_ptr->sub_tree );
167 ReadTaggedList( de_ptr );
168 global_max_filename_len = MAX( global_max_filename_len, max_filename_len );
169 global_max_linkname_len = MAX( global_max_linkname_len, max_linkname_len );
170 }
171 max_filename_len = global_max_filename_len;
172 max_linkname_len = global_max_linkname_len;
173 }
174
175
176
BuildFileEntryList(DirEntry * dir_entry)177 static void BuildFileEntryList(DirEntry *dir_entry){
178
179 if( file_entry_list ) {
180 free( file_entry_list );
181 file_entry_list = NULL;
182 }
183 if( !dir_entry->global_flag ) {
184 /* ... for !ANSI-Systeme ... */
185 /*----------------------------*/
186 if( dir_entry->matching_files == 0 ) {
187 file_entry_list = NULL;
188 } else {
189 if( ( file_entry_list = (FileEntryList *)
190 calloc( dir_entry->matching_files,
191 sizeof( FileEntryList )
192 )
193 ) == NULL ) {
194 ERROR_MSG( "Calloc Failed*ABORT" );
195 exit( 1 );
196 }
197 }
198 file_count = 0;
199 ReadFileList( dir_entry );
200 SortFileEntryList();
201 SetFileMode( file_mode ); /* recalc */
202 } else if (!dir_entry->tagged_flag) {
203 if( statistic.disk_matching_files == 0 ) {
204 file_entry_list = NULL;
205 } else {
206 if( ( file_entry_list = (FileEntryList *)
207 calloc( statistic.disk_matching_files,
208 sizeof( FileEntryList )
209 ) )
210 == NULL ) {
211 ERROR_MSG( "Calloc Failed*ABORT" );
212 exit( 1 );
213 }
214 }
215 file_count = 0;
216 global_max_filename_len = 0;
217 global_max_linkname_len = 0;
218 ReadGlobalFileList( statistic.tree );
219 SortFileEntryList();
220 SetFileMode( file_mode ); /* recalc */
221 } else {
222 if( statistic.disk_matching_files == 0 ) {
223 file_entry_list = NULL;
224 } else {
225 if( ( file_entry_list = (FileEntryList *)
226 calloc( statistic.disk_tagged_files,
227 sizeof( FileEntryList )
228 ) )
229 == NULL ) {
230 ERROR_MSG( "Calloc Failed*ABORT" );
231 exit( 1 );
232 }
233 }
234 file_count = 0;
235 global_max_filename_len = 0;
236 global_max_linkname_len = 0;
237 ReadTaggedFileList( statistic.tree );
238 SortFileEntryList();
239 SetFileMode( file_mode ); /* recalc */
240 }
241 }
242
243
ReadFileList(DirEntry * dir_entry)244 static void ReadFileList(DirEntry *dir_entry)
245 {
246 FileEntry *fe_ptr;
247 unsigned int name_len;
248 unsigned int linkname_len;
249
250 max_filename_len = 0;
251 max_linkname_len = 0;
252
253 for( fe_ptr = dir_entry->file; fe_ptr; fe_ptr = fe_ptr->next )
254 {
255 if( fe_ptr->matching )
256 {
257 file_entry_list[file_count++].file = fe_ptr;
258 name_len = strlen( fe_ptr->name );
259 if( S_ISLNK( fe_ptr->stat_struct.st_mode ) )
260 {
261 linkname_len = strlen( &fe_ptr->name[name_len+1] );
262 max_linkname_len = MAX( max_linkname_len, linkname_len );
263 }
264 max_filename_len = MAX( max_filename_len, name_len );
265 }
266 }
267 }
268
269
270
ReadGlobalFileList(DirEntry * dir_entry)271 static void ReadGlobalFileList(DirEntry *dir_entry)
272 {
273 DirEntry *de_ptr;
274
275 for( de_ptr=dir_entry; de_ptr; de_ptr=de_ptr->next )
276 {
277 if( de_ptr->sub_tree ) ReadGlobalFileList( de_ptr->sub_tree );
278 ReadFileList( de_ptr );
279 global_max_filename_len = MAX( global_max_filename_len, max_filename_len );
280 global_max_linkname_len = MAX( global_max_linkname_len, max_linkname_len );
281 }
282 max_filename_len = global_max_filename_len;
283 max_linkname_len = global_max_linkname_len;
284 }
285
286
287
288
SortFileEntryList(void)289 static void SortFileEntryList(void)
290 {
291 int aux;
292 int (*compare)();
293
294 reverse_sort = FALSE;
295 if ((aux = statistic.kind_of_sort) > SORT_DSC)
296 {
297 order = FALSE;
298 aux -= SORT_DSC;
299 }
300 else
301 {
302 order = TRUE;
303 aux -= SORT_ASC;
304 }
305 switch( aux )
306 {
307 case SORT_BY_NAME : compare = SortByName; break;
308 case SORT_BY_MOD_TIME : compare = SortByModTime; break;
309 case SORT_BY_CHG_TIME : compare = SortByChgTime; break;
310 case SORT_BY_ACC_TIME : compare = SortByAccTime; break;
311 case SORT_BY_OWNER : compare = SortByOwner; break;
312 case SORT_BY_GROUP : compare = SortByGroup; break;
313 case SORT_BY_SIZE : compare = SortBySize; break;
314 case SORT_BY_EXTENSION : compare = SortByExtension; break;
315 default: compare = SortByName; beep();
316 }
317
318 qsort( (char *) file_entry_list,
319 file_count,
320 sizeof( file_entry_list[0] ),
321 compare
322 );
323 }
324
325
326
327
SortByName(FileEntryList * e1,FileEntryList * e2)328 static int SortByName(FileEntryList *e1, FileEntryList *e2)
329 {
330 if (do_case)
331 if (order)
332 return( strcmp( e1->file->name, e2->file->name ) );
333 else
334 return( - (strcmp( e1->file->name, e2->file->name ) ) );
335 else
336 if (order)
337 return( strcasecmp( e1->file->name, e2->file->name ) );
338 else
339 return( - (strcasecmp( e1->file->name, e2->file->name ) ) );
340 }
341
342
SortByExtension(FileEntryList * e1,FileEntryList * e2)343 static int SortByExtension(FileEntryList *e1, FileEntryList *e2)
344 {
345 char *ext1, *ext2;
346 int cmp, casecmp;
347
348 /* Ok, this isn't optimized */
349
350 ext1 = GetExtension(e1->file->name);
351 ext2 = GetExtension(e2->file->name);
352 cmp=strcmp( ext1, ext2 );
353 casecmp=strcasecmp( ext1, ext2 );
354
355 if (do_case && !cmp)
356 return SortByName( e1, e2 );
357 if (!do_case && !casecmp)
358 return SortByName( e1, e2 );
359
360
361 if (do_case)
362 if (order)
363 return( strcmp( ext1, ext2 ) );
364 else
365 return( - (strcmp( ext1, ext2 ) ) );
366 else
367 if (order)
368 return( strcasecmp( ext1, ext2 ) );
369 else
370 return( - (strcasecmp( ext1, ext2 ) ) );
371 }
372
373
SortByModTime(FileEntryList * e1,FileEntryList * e2)374 static int SortByModTime(FileEntryList *e1, FileEntryList *e2)
375 {
376 if (order)
377 return( e1->file->stat_struct.st_mtime - e2->file->stat_struct.st_mtime );
378 else
379 return( - (e1->file->stat_struct.st_mtime - e2->file->stat_struct.st_mtime ) );
380 }
381
SortByChgTime(FileEntryList * e1,FileEntryList * e2)382 static int SortByChgTime(FileEntryList *e1, FileEntryList *e2)
383 {
384 if (order)
385 return( e1->file->stat_struct.st_ctime - e2->file->stat_struct.st_ctime );
386 else
387 return( - (e1->file->stat_struct.st_ctime - e2->file->stat_struct.st_ctime ) );
388 }
389
SortByAccTime(FileEntryList * e1,FileEntryList * e2)390 static int SortByAccTime(FileEntryList *e1, FileEntryList *e2)
391 {
392 if (order)
393 return( e1->file->stat_struct.st_atime - e2->file->stat_struct.st_atime );
394 else
395 return( - (e1->file->stat_struct.st_atime - e2->file->stat_struct.st_atime ) );
396 }
397
SortBySize(FileEntryList * e1,FileEntryList * e2)398 static int SortBySize(FileEntryList *e1, FileEntryList *e2)
399 {
400 if (order)
401 return( e1->file->stat_struct.st_size - e2->file->stat_struct.st_size );
402 else
403 return( - (e1->file->stat_struct.st_size - e2->file->stat_struct.st_size) );
404 }
405
406
SortByOwner(FileEntryList * e1,FileEntryList * e2)407 static int SortByOwner(FileEntryList *e1, FileEntryList *e2)
408 {
409 char *o1, *o2;
410 char n1[10], n2[10];
411
412 o1 = GetPasswdName( e1->file->stat_struct.st_uid );
413 o2 = GetPasswdName( e2->file->stat_struct.st_uid );
414
415 if( o1 == NULL )
416 {
417 (void) sprintf( n1, "%d", (int) e1->file->stat_struct.st_uid );
418 o1 = n1;
419 }
420
421 if( o2 == NULL )
422 {
423 (void) sprintf( n2, "%d", (int) e2->file->stat_struct.st_uid );
424 o2 = n2;
425 }
426 if (do_case)
427 if (order)
428 return( strcmp( o1, o2 ) );
429 else
430 return( - (strcmp( o1, o2 ) ) );
431 else
432 if (order)
433 return( strcasecmp( o1, o2 ) );
434 else
435 return( - (strcasecmp( o1, o2 ) ) );
436 }
437
438
439
SortByGroup(FileEntryList * e1,FileEntryList * e2)440 static int SortByGroup(FileEntryList *e1, FileEntryList *e2)
441 {
442 char *g1, *g2;
443 char n1[10], n2[10];
444
445 g1 = GetGroupName( e1->file->stat_struct.st_gid );
446 g2 = GetGroupName( e2->file->stat_struct.st_gid );
447
448 if( g1 == NULL )
449 {
450 (void) sprintf( n1, "%d", (int) e1->file->stat_struct.st_uid );
451 g1 = n1;
452 }
453
454 if( g2 == NULL )
455 {
456 (void) sprintf( n2, "%d", (int) e2->file->stat_struct.st_uid );
457 g2 = n2;
458 }
459 if (do_case)
460 if (order)
461 return( strcmp( g1, g2 ) );
462 else
463 return( - (strcmp( g1, g2 ) ) );
464 else
465 if (order)
466 return( strcasecmp( g1, g2 ) );
467 else
468 return( - (strcasecmp( g1, g2 ) ) );
469 }
470
471
472
SetKindOfSort(int new_kind_of_sort)473 void SetKindOfSort(int new_kind_of_sort)
474 {
475 statistic.kind_of_sort = new_kind_of_sort;
476 }
477
478
479
RemoveFileEntry(int entry_no)480 static void RemoveFileEntry(int entry_no)
481 {
482 int i, n, l;
483 FileEntry *fe_ptr;
484
485 max_filename_len = 0;
486 max_linkname_len = 0;
487 n = file_count - 1;
488
489 for( i=0; i < n; i++ )
490 {
491 if( i >= entry_no ) file_entry_list[i] = file_entry_list[i+1];
492 fe_ptr = file_entry_list[i].file;
493 l = strlen( fe_ptr->name );
494 max_filename_len = MAX( (int)max_filename_len, l );
495 if( S_ISLNK( fe_ptr->stat_struct.st_mode ) )
496 {
497 max_linkname_len = MAX( max_filename_len, strlen( &fe_ptr->name[l+1] ) );
498 }
499 }
500
501 SetFileMode( file_mode ); /* recalc */
502
503 file_count--; /* no realloc */
504 }
505
506
507
ChangeFileEntry(void)508 static void ChangeFileEntry(void)
509 {
510 int i, n, l;
511 FileEntry *fe_ptr;
512
513 max_filename_len = 0;
514 max_linkname_len = 0;
515 n = file_count - 1;
516
517 for( i=0; i < n; i++ )
518 {
519 fe_ptr = file_entry_list[i].file;
520 if( fe_ptr )
521 {
522 l = strlen( fe_ptr->name );
523 max_filename_len = MAX( (int)max_filename_len, l );
524 if( S_ISLNK( fe_ptr->stat_struct.st_mode ) )
525 {
526 max_linkname_len = MAX( max_filename_len, strlen( &fe_ptr->name[l+1] ) );
527 }
528 }
529 }
530
531 SetFileMode( file_mode ); /* recalc */
532 }
533
534
GetTypeOfFile(struct stat fst)535 char GetTypeOfFile(struct stat fst)
536 {
537 if ( S_ISLNK(fst.st_mode) )
538 return '@';
539 else if ( S_ISSOCK(fst.st_mode) )
540 return '=';
541 else if ( S_ISCHR(fst.st_mode) )
542 return '-';
543 else if ( S_ISBLK(fst.st_mode) )
544 return '+';
545 else if ( S_ISFIFO(fst.st_mode) )
546 return '|';
547 else if ( S_ISREG(fst.st_mode) )
548 return ' ';
549 else
550 return '?';
551 }
552
553
PrintFileEntry(int entry_no,int y,int x,unsigned char hilight,int start_x)554 static void PrintFileEntry(int entry_no, int y, int x, unsigned char hilight, int start_x)
555 {
556 char attributes[11];
557 char modify_time[13];
558 char change_time[13];
559 char access_time[13];
560 char format[60];
561 char justify;
562 char *line_ptr;
563 int n, pos_x = 0;
564 FileEntry *fe_ptr;
565 static char *line_buffer = NULL;
566 static int old_cols = -1;
567 char owner[OWNER_NAME_MAX + 1];
568 char group[GROUP_NAME_MAX + 1];
569 char *owner_name_ptr;
570 char *group_name_ptr;
571 int ef_window_width;
572 char *sym_link_name = NULL;
573 char type_of_file = ' ';
574
575
576 ef_window_width = window_width - 2; /* Effektive Window-Width */
577
578 (reverse_sort) ? (justify='+') : (justify='-');
579
580 if( old_cols != COLS )
581 {
582 old_cols = COLS;
583 if( line_buffer ) free( line_buffer );
584
585 if( ( line_buffer = (char *) malloc( COLS + PATH_LENGTH ) ) == NULL )
586 {
587 ERROR_MSG( "Malloc failed*ABORT" );
588 exit( 1 );
589 }
590 }
591
592 fe_ptr = file_entry_list[entry_no].file;
593
594 if( fe_ptr && S_ISLNK( fe_ptr->stat_struct.st_mode ) )
595 sym_link_name = &fe_ptr->name[strlen(fe_ptr->name)+1];
596 else
597 sym_link_name = "";
598
599
600 type_of_file = GetTypeOfFile(fe_ptr->stat_struct);
601
602 switch( file_mode )
603 {
604 case MODE_1 : if( fe_ptr )
605 {
606 (void) GetAttributes( fe_ptr->stat_struct.st_mode,
607 attributes
608 );
609
610 (void) CTime( fe_ptr->stat_struct.st_mtime, modify_time );
611
612
613
614 if( S_ISLNK( fe_ptr->stat_struct.st_mode ) )
615 {
616 #ifdef HAS_LONGLONG
617 (void) sprintf( format, "%%c%%c%%-%ds %%10s %%3d %%11lld %%12s -> %%-%ds",
618 max_filename_len,
619 max_linkname_len
620 );
621
622 (void) sprintf( line_buffer, format,
623 (fe_ptr->tagged) ? TAGGED_SYMBOL : ' ',
624 type_of_file,
625 fe_ptr->name,
626 attributes,
627 fe_ptr->stat_struct.st_nlink,
628 (LONGLONG) fe_ptr->stat_struct.st_size,
629 modify_time,
630 sym_link_name
631 );
632 #else
633 (void) sprintf( format, "%%c%%c%%-%ds %%10s %%3d %%7qd %%12s -> %%-%ds",
634 max_filename_len,
635 max_linkname_len
636 );
637
638 (void) sprintf( line_buffer, format,
639 (fe_ptr->tagged) ? TAGGED_SYMBOL : ' ',
640 type_of_file,
641 fe_ptr->name,
642 attributes,
643 fe_ptr->stat_struct.st_nlink,
644 fe_ptr->stat_struct.st_size,
645 modify_time,
646 sym_link_name
647 );
648 #endif
649 }
650 else
651 {
652 #ifdef HAS_LONGLONG
653 (void) sprintf( format, "%%c%%c%%%c%ds %%10s %%3d %%11lld %%12s",
654 justify,
655 max_filename_len
656 );
657
658 (void) sprintf( line_buffer, format,
659 (fe_ptr->tagged) ? TAGGED_SYMBOL : ' ',
660 type_of_file,
661 fe_ptr->name,
662 attributes,
663 fe_ptr->stat_struct.st_nlink,
664 (LONGLONG) fe_ptr->stat_struct.st_size,
665 modify_time
666 );
667 #else
668 (void) sprintf( format, "%%c%%c%%%c%ds %%10s %%3d %%7qd %%12s",
669 justify,
670 max_filename_len
671 );
672
673 (void) sprintf( line_buffer, format,
674 (fe_ptr->tagged) ? TAGGED_SYMBOL : ' ',
675 type_of_file,
676 fe_ptr->name,
677 attributes,
678 fe_ptr->stat_struct.st_nlink,
679 fe_ptr->stat_struct.st_size,
680 modify_time
681 );
682 #endif
683 }
684 }
685 else
686 {
687 /* Empty Entry */
688 /*-------------*/
689
690 (void) sprintf( format, "%%-%ds", max_filename_len + 42 );
691 (void) sprintf( line_buffer, format, "" );
692 }
693
694 if( max_linkname_len )
695 pos_x = x * (max_filename_len + max_linkname_len + 47);
696 else
697 pos_x = x * (max_filename_len + 43);
698 break;
699
700 case MODE_2 : if( fe_ptr )
701 {
702 (void) GetAttributes( fe_ptr->stat_struct.st_mode,
703 attributes
704 );
705
706 owner_name_ptr = GetDisplayPasswdName(fe_ptr->stat_struct.st_uid);
707 group_name_ptr = GetDisplayGroupName(fe_ptr->stat_struct.st_gid);
708
709 if( owner_name_ptr == NULL )
710 {
711 (void) sprintf( owner, "%d", (int) fe_ptr->stat_struct.st_uid );
712 owner_name_ptr = owner;
713 }
714 if( group_name_ptr == NULL )
715 {
716 (void) sprintf( group, "%d", (int) fe_ptr->stat_struct.st_gid );
717 group_name_ptr = group;
718 }
719
720 if( S_ISLNK( fe_ptr->stat_struct.st_mode ) )
721 {
722 #ifdef HAS_LONGLONG
723 (void) sprintf( format, "%%c%%c%%%c%ds %%10lld %%-12s %%-12s -> %%-%ds",
724 justify,
725 max_filename_len,
726 max_linkname_len
727 );
728 (void) sprintf( line_buffer, format,
729 (fe_ptr->tagged) ? TAGGED_SYMBOL : ' ',
730 type_of_file,
731 fe_ptr->name,
732 (LONGLONG)fe_ptr->stat_struct.st_ino,
733 owner_name_ptr,
734 group_name_ptr,
735 sym_link_name
736 );
737 #else
738 (void) sprintf( format, "%%c%%c%%%c%ds %%8u %%-12s %%-12s -> %%-%ds",
739 justify,
740 max_filename_len,
741 max_linkname_len
742 );
743 (void) sprintf( line_buffer, format,
744 (fe_ptr->tagged) ? TAGGED_SYMBOL : ' ',
745 type_of_file,
746 fe_ptr->name,
747 (int)fe_ptr->stat_struct.st_ino,
748 owner_name_ptr,
749 group_name_ptr,
750 sym_link_name
751 );
752 #endif
753 }
754 else
755 {
756 #ifdef HAS_LONGLONG
757 (void) sprintf( format, "%%c%%c%%%c%ds %%10lld %%-12s %%-12s",
758 justify,
759 max_filename_len
760 );
761 (void) sprintf( line_buffer, format,
762 (fe_ptr->tagged) ? TAGGED_SYMBOL : ' ',
763 type_of_file,
764 fe_ptr->name,
765 (LONGLONG)fe_ptr->stat_struct.st_ino,
766 owner_name_ptr,
767 group_name_ptr
768 );
769 #else
770 (void) sprintf( format, "%%c%%c%%%c%ds %%8u %%-12s %%-12s",
771 justify,
772 max_filename_len
773 );
774 (void) sprintf( line_buffer, format,
775 (fe_ptr->tagged) ? TAGGED_SYMBOL : ' ',
776 type_of_file,
777 fe_ptr->name,
778 (int)fe_ptr->stat_struct.st_ino,
779 owner_name_ptr,
780 group_name_ptr
781 );
782 #endif
783
784 }
785 }
786 else
787 {
788 /* Empty-Entry */
789 /*-------------*/
790
791 (void) sprintf( format, "%%-%ds", max_filename_len + 38 );
792 (void) sprintf( line_buffer, format, "" );
793 }
794
795 if( max_linkname_len )
796 pos_x = x * (max_filename_len + max_linkname_len + 43);
797 else
798 pos_x = x * (max_filename_len + 39);
799 break;
800
801 case MODE_3 : if( fe_ptr )
802 {
803 (void) sprintf( format, "%%c%%c%%%c%ds",
804 justify,
805 max_filename_len );
806
807 (void) sprintf( line_buffer, format,
808 (fe_ptr->tagged) ? TAGGED_SYMBOL : ' ',
809 type_of_file,
810 fe_ptr->name
811 );
812 }
813 else
814 {
815 /* Empty-Entry */
816 /*-------------*/
817
818 (void) sprintf( format, "%%-%ds", max_filename_len + 2 );
819 (void) sprintf( line_buffer, format, "" );
820 }
821
822 pos_x = x * (max_filename_len + 3);
823 break;
824
825 case MODE_4 : if( fe_ptr )
826 {
827 (void) CTime( fe_ptr->stat_struct.st_ctime, change_time );
828 (void) CTime( fe_ptr->stat_struct.st_atime, access_time );
829
830 if( S_ISLNK( fe_ptr->stat_struct.st_mode ) )
831 {
832 (void) sprintf( format, "%%c%%c%%%c%ds Chg: %%12s Acc: %%12s -> %%-%ds",
833 justify,
834 max_filename_len,
835 max_linkname_len
836 );
837 (void) sprintf( line_buffer, format,
838 (fe_ptr->tagged) ? TAGGED_SYMBOL : ' ',
839 type_of_file,
840 fe_ptr->name,
841 change_time,
842 access_time,
843 sym_link_name
844 );
845 }
846 else
847 {
848 (void) sprintf( format, "%%c%%c%%%c%ds Chg: %%12s Acc: %%12s",
849 justify,
850 max_filename_len
851 );
852 (void) sprintf( line_buffer, format,
853 (fe_ptr->tagged) ? TAGGED_SYMBOL : ' ',
854 type_of_file,
855 fe_ptr->name,
856 change_time,
857 access_time
858 );
859 }
860 }
861 else
862 {
863 /* Empty-Entry */
864 /*-------------*/
865
866 (void) sprintf( format, "%%-%ds", max_filename_len + 39 );
867 (void) sprintf( line_buffer, format, "" );
868 }
869
870
871 if( max_linkname_len )
872 pos_x = x * (max_filename_len + max_linkname_len + 44);
873 else
874 pos_x = x * (max_filename_len + 40);
875 break;
876
877 case MODE_5 : if( fe_ptr )
878 {
879 BuildUserFileEntry(fe_ptr, max_filename_len, max_linkname_len,
880 USERVIEW,
881 200, line_buffer);
882 }
883 else
884 {
885 /* Empty-Entry */
886 /*-------------*/
887
888 (void) sprintf( format, "%%-%ds", max_userview_len );
889 (void) sprintf( line_buffer, format, "" );
890 }
891 pos_x = x * (max_userview_len + 1);
892 break;
893
894 }
895
896 /* display line */
897 /*--------------*/
898
899 n = StrVisualLength( line_buffer );
900
901 if( n <= ef_window_width )
902 {
903 /* line fits */
904 /*-----------*/
905
906 hide_left = 0;
907 hide_right = 0;
908 line_ptr = line_buffer;
909 }
910 else
911 {
912 /* ... does not fit; use start_x */
913 /*-------------------------------*/
914
915 if( n > ( start_x + ef_window_width ) )
916 line_ptr = &line_buffer[start_x]; /* TODO: UTF-8 */
917 else
918 line_ptr = &line_buffer[n - ef_window_width]; /* TODO: UTF-8 */
919 hide_left = start_x;
920 hide_right = n - start_x - ef_window_width;
921 line_ptr[ef_window_width] = '\0';
922 }
923
924 #ifdef NO_HIGHLIGHT
925 line_ptr[1] = (hilight) ? '>' : ' ';
926 mvwaddstr( file_window, y, pos_x + 1, line_ptr );
927 #else
928 #ifdef COLOR_SUPPORT
929 if( hilight )
930 WbkgdSet(file_window, COLOR_PAIR(HIFILE_COLOR)|A_BOLD);
931 else
932 WbkgdSet(file_window, COLOR_PAIR(FILE_COLOR));
933
934 mvwaddstr(file_window, y, pos_x + 1, line_ptr );
935 WbkgdSet(file_window, COLOR_PAIR(FILE_COLOR)|A_BOLD);
936
937 #else
938 #endif /* COLOR_SUPPORT */
939 if( hilight ) wattrset( file_window, A_REVERSE );
940 mvwaddstr( file_window, y, pos_x + 1, line_ptr );
941 if( hilight ) wattrset( file_window, 0 );
942 #endif /* NO_HIGHLIGHT */
943
944
945 }
946
947
948
949
950
DisplayFileWindow(DirEntry * dir_entry)951 void DisplayFileWindow(DirEntry *dir_entry)
952 {
953 GetMaxYX( file_window, &window_height, &window_width );
954 BuildFileEntryList( dir_entry );
955 DisplayFiles( dir_entry, dir_entry->start_file,
956 dir_entry->start_file + dir_entry->cursor_pos, 0);
957 }
958
959
960
961
DisplayFiles(DirEntry * de_ptr,int start_file_no,int hilight_no,int start_x)962 static void DisplayFiles(DirEntry *de_ptr, int start_file_no, int hilight_no, int start_x)
963 {
964 int x, y, p_x, p_y, j;
965
966 werase( file_window );
967
968 if( file_count == 0 )
969 {
970 mvwaddstr( file_window,
971 0,
972 3,
973 (de_ptr->access_denied) ? "Permission Denied!" : "No Files!"
974 );
975 }
976
977 j = start_file_no; p_x = -1; p_y = 0;
978 for( x=0; x < max_column; x++)
979 {
980 for( y=0; y < window_height; y++ )
981 {
982 if( j < (int)file_count )
983 {
984 if( j == hilight_no )
985 {
986 p_x = x;
987 p_y = y;
988 }
989 else
990 {
991 PrintFileEntry( j, y, x, FALSE, start_x);
992 }
993 }
994 j++;
995 }
996 }
997
998 if( p_x >= 0 )
999 PrintFileEntry( hilight_no, p_y, p_x, TRUE, start_x);
1000
1001 }
1002
1003
fmovedown(int * start_file,int * cursor_pos,int * start_x,DirEntry * dir_entry)1004 static void fmovedown(int *start_file, int *cursor_pos, int *start_x, DirEntry *dir_entry)
1005 {
1006 if( *start_file + *cursor_pos + 1 >= (int)file_count )
1007 {
1008 /* File nicht vorhanden */
1009 /*----------------------*/
1010 beep();
1011 }
1012 else
1013 {
1014 if( *cursor_pos < max_disp_files - 1 )
1015 {
1016 /* DOWN ohne scroll moeglich */
1017 /*---------------------------*/
1018 PrintFileEntry( *start_file + *cursor_pos,
1019 *cursor_pos % window_height,
1020 *cursor_pos / window_height,
1021 FALSE,
1022 *start_x
1023 );
1024 (*cursor_pos)++;
1025 PrintFileEntry( *start_file + *cursor_pos,
1026 *cursor_pos % window_height,
1027 *cursor_pos / window_height,
1028 TRUE ,
1029 *start_x
1030 );
1031 }
1032 else
1033 {
1034 /* Scrollen */
1035 /*----------*/
1036 (*start_file)++;
1037 DisplayFiles( dir_entry,
1038 *start_file,
1039 *start_file + *cursor_pos,
1040 *start_x
1041 );
1042 }
1043 }
1044 return;
1045 }
1046
fmoveup(int * start_file,int * cursor_pos,int * start_x,DirEntry * dir_entry)1047 static void fmoveup(int *start_file, int *cursor_pos, int *start_x, DirEntry *dir_entry)
1048 {
1049 if( *start_file + *cursor_pos < 1 )
1050 {
1051 /* File nicht vorhanden */
1052 /*----------------------*/
1053 beep();
1054 }
1055 else
1056 {
1057 if( *cursor_pos > 0 )
1058 {
1059 /* UP ohne scroll moeglich */
1060 /*-------------------------*/
1061 PrintFileEntry( *start_file + *cursor_pos,
1062 *cursor_pos % window_height,
1063 *cursor_pos / window_height,
1064 FALSE,
1065 *start_x
1066 );
1067 (*cursor_pos)--;
1068 PrintFileEntry( *start_file + *cursor_pos,
1069 *cursor_pos % window_height,
1070 *cursor_pos / window_height,
1071 TRUE,
1072 *start_x
1073 );
1074 }
1075 else
1076 {
1077 /* Scrollen */
1078 /*----------*/
1079 (*start_file)--;
1080 DisplayFiles( dir_entry,
1081 *start_file,
1082 *start_file + *cursor_pos,
1083 *start_x
1084 );
1085 }
1086 }
1087 return;
1088 }
1089
fmoveright(int * start_file,int * cursor_pos,int * start_x,DirEntry * dir_entry)1090 static void fmoveright(int *start_file, int *cursor_pos, int *start_x,DirEntry *dir_entry)
1091 {
1092 if( x_step == 1 )
1093 {
1094 /* Sonderfall: ganzes Filewindow scrollen */
1095 /*----------------------------------------*/
1096 (*start_x)++;
1097 PrintFileEntry( *start_file + *cursor_pos,
1098 *cursor_pos % window_height,
1099 *cursor_pos / window_height,
1100 TRUE ,
1101 *start_x
1102 );
1103 if( hide_right < 0 ) (*start_x)--;
1104 }
1105 else if( *start_file + *cursor_pos >= (int)file_count - 1 )
1106 {
1107 /*letzte Position erreicht */
1108 /*-------------------------*/
1109 beep();
1110 }
1111 else
1112 {
1113 if( *start_file + *cursor_pos + x_step >= (int)file_count )
1114 {
1115 /* voller Step nicht moeglich;
1116 * auf letzten Eintrag positionieren
1117 */
1118 my_x_step = file_count - *start_file - *cursor_pos - 1;
1119 }
1120 else
1121 {
1122 my_x_step = x_step;
1123 }
1124 if( *cursor_pos + my_x_step < max_disp_files )
1125 {
1126 /* RIGHT ohne scroll moeglich */
1127 /*----------------------------*/
1128 PrintFileEntry( *start_file + *cursor_pos,
1129 *cursor_pos % window_height,
1130 *cursor_pos / window_height,
1131 FALSE,
1132 *start_x
1133 );
1134 *cursor_pos += my_x_step;
1135 PrintFileEntry( *start_file + *cursor_pos,
1136 *cursor_pos % window_height,
1137 *cursor_pos / window_height,
1138 TRUE ,
1139 *start_x
1140 );
1141 }
1142 else
1143 {
1144 /* Scrollen */
1145 /*----------*/
1146 *start_file += x_step;
1147 *cursor_pos -= x_step - my_x_step;
1148 DisplayFiles( dir_entry,
1149 *start_file,
1150 *start_file + *cursor_pos,
1151 *start_x
1152 );
1153 }
1154 }
1155 return;
1156 }
1157
1158
fmoveleft(int * start_file,int * cursor_pos,int * start_x,DirEntry * dir_entry)1159 static void fmoveleft(int *start_file, int *cursor_pos, int *start_x, DirEntry *dir_entry)
1160 {
1161 if( x_step == 1 )
1162 {
1163 /* Sonderfall: ganzes Filewindow scrollen */
1164 /*----------------------------------------*/
1165 if( *start_x > 0 ) (*start_x)--;
1166 PrintFileEntry( *start_file + *cursor_pos,
1167 *cursor_pos % window_height,
1168 *cursor_pos / window_height,
1169 TRUE ,
1170 *start_x
1171 );
1172 }
1173 else if( *start_file + *cursor_pos <= 0 )
1174 {
1175 /* erste Position erreicht */
1176 /*-------------------------*/
1177 beep();
1178 }
1179 else
1180 {
1181 if( *start_file + *cursor_pos - x_step < 0 )
1182 {
1183 /* voller Step nicht moeglich;
1184 * auf ersten Eintrag positionieren
1185 */
1186 my_x_step = *start_file + *cursor_pos;
1187 }
1188 else
1189 {
1190 my_x_step = x_step;
1191 }
1192 if( *cursor_pos - my_x_step >= 0 )
1193 {
1194 /* LEFT ohne scroll moeglich */
1195 /*---------------------------*/
1196 PrintFileEntry( *start_file + *cursor_pos,
1197 *cursor_pos % window_height,
1198 *cursor_pos / window_height,
1199 FALSE,
1200 *start_x
1201 );
1202 *cursor_pos -= my_x_step;
1203 PrintFileEntry( *start_file + *cursor_pos,
1204 *cursor_pos % window_height,
1205 *cursor_pos / window_height,
1206 TRUE,
1207 *start_x
1208 );
1209 }
1210 else
1211 {
1212 /* Scrollen */
1213 /*----------*/
1214 if( ( *start_file -= x_step ) < 0 )
1215 *start_file = 0;
1216 DisplayFiles( dir_entry,
1217 *start_file,
1218 *start_file + *cursor_pos,
1219 *start_x
1220 );
1221 }
1222 }
1223 return;
1224 }
1225
1226
fmovenpage(int * start_file,int * cursor_pos,int * start_x,DirEntry * dir_entry)1227 static void fmovenpage(int *start_file, int *cursor_pos, int *start_x, DirEntry *dir_entry)
1228 {
1229 if( *start_file + *cursor_pos >= (int)file_count - 1 )
1230 {
1231 /*letzte Position erreicht */
1232 /*-------------------------*/
1233 beep();
1234 }
1235 else
1236 {
1237 if( *cursor_pos < max_disp_files - 1 )
1238 {
1239 /* Cursor steht noch nicht auf letztem
1240 * Eintrag
1241 * ==> setzen
1242 */
1243 PrintFileEntry( *start_file + *cursor_pos,
1244 *cursor_pos % window_height,
1245 *cursor_pos / window_height,
1246 FALSE,
1247 *start_x
1248 );
1249 if( *start_file + max_disp_files <= (int)file_count - 1 )
1250 *cursor_pos = max_disp_files - 1;
1251 else
1252 *cursor_pos = file_count - *start_file - 1;
1253 PrintFileEntry( *start_file + *cursor_pos,
1254 *cursor_pos % window_height,
1255 *cursor_pos / window_height,
1256 TRUE,
1257 *start_x
1258 );
1259 }
1260 else
1261 {
1262 /* Scrollen */
1263 /*----------*/
1264 if( *start_file + *cursor_pos + max_disp_files < (int)file_count )
1265 *start_file += max_disp_files;
1266 else
1267 *start_file = file_count - max_disp_files;
1268 if( *start_file + max_disp_files <= (int)file_count - 1 )
1269 *cursor_pos = max_disp_files - 1;
1270 else
1271 *cursor_pos = file_count - *start_file - 1;
1272 DisplayFiles( dir_entry,
1273 *start_file,
1274 *start_file + *cursor_pos,
1275 *start_x
1276 );
1277 }
1278 }
1279 return;
1280 }
1281
1282
1283
fmoveppage(int * start_file,int * cursor_pos,int * start_x,DirEntry * dir_entry)1284 static void fmoveppage(int *start_file, int *cursor_pos, int *start_x, DirEntry *dir_entry)
1285 {
1286 if( *start_file + *cursor_pos <= 0 )
1287 {
1288 /* erste Position erreicht */
1289 /*-------------------------*/
1290 beep();
1291 }
1292 else
1293 {
1294 if( *cursor_pos > 0 )
1295 {
1296 /* Cursor steht noch nicht auf erstem
1297 * Eintrag
1298 * ==> setzen
1299 */
1300 PrintFileEntry( *start_file + *cursor_pos,
1301 *cursor_pos % window_height,
1302 *cursor_pos / window_height,
1303 FALSE,
1304 *start_x
1305 );
1306 *cursor_pos = 0;
1307 PrintFileEntry( *start_file + *cursor_pos,
1308 *cursor_pos % window_height,
1309 *cursor_pos / window_height,
1310 TRUE,
1311 *start_x
1312 );
1313 }
1314 else
1315 {
1316 /* Scrollen */
1317 /*----------*/
1318 if( *start_file > max_disp_files )
1319 *start_file -= max_disp_files;
1320 else
1321 *start_file = 0;
1322 DisplayFiles( dir_entry,
1323 *start_file,
1324 *start_file + *cursor_pos,
1325 *start_x
1326 );
1327 }
1328 }
1329 return;
1330 }
1331
1332
1333
1334
HandleFileWindow(DirEntry * dir_entry)1335 int HandleFileWindow(DirEntry *dir_entry)
1336 {
1337 FileEntry *fe_ptr;
1338 FileEntry *new_fe_ptr;
1339 DirEntry *de_ptr = NULL;
1340 DirEntry *dest_dir_entry;
1341 WalkingPackage walking_package;
1342 int ch;
1343 int tmp2;
1344 int unput_char;
1345 int list_pos;
1346 LONGLONG file_size;
1347 int i;
1348 int owner_id;
1349 int group_id;
1350 int start_x = 0;
1351 char filepath[PATH_LENGTH +1];
1352 char modus[11];
1353 BOOL path_copy;
1354 int term;
1355 int mask;
1356 static char to_dir[PATH_LENGTH+1];
1357 static char to_path[PATH_LENGTH+1];
1358 static char to_file[PATH_LENGTH+1];
1359 BOOL need_dsp_help;
1360 BOOL maybe_change_x_step;
1361 char new_name[PATH_LENGTH+1];
1362 char new_login_path[PATH_LENGTH + 1];
1363 int dir_window_width, dir_window_height;
1364
1365
1366 unput_char = '\0';
1367 fe_ptr = NULL;
1368
1369
1370 /* Cursor-Positionsmerker zuruecksetzen */
1371 /*--------------------------------------*/
1372
1373 need_dsp_help = TRUE;
1374 maybe_change_x_step = TRUE;
1375
1376 BuildFileEntryList( dir_entry );
1377
1378 if( dir_entry->global_flag || dir_entry->big_window || dir_entry->tagged_flag)
1379 {
1380 SwitchToBigFileWindow();
1381 GetMaxYX( file_window, &window_height, &window_width );
1382 DisplayDiskStatistic();
1383 }
1384 else
1385 {
1386 GetMaxYX( file_window, &window_height, &window_width );
1387 DisplayDirStatistic( dir_entry );
1388 }
1389
1390 DisplayFiles( dir_entry,
1391 dir_entry->start_file,
1392 dir_entry->start_file + dir_entry->cursor_pos,
1393 start_x
1394 );
1395
1396 do
1397 {
1398 if( maybe_change_x_step )
1399 {
1400 maybe_change_x_step = FALSE;
1401
1402 x_step = (max_column > 1) ? window_height : 1;
1403 max_disp_files = window_height * max_column;
1404 }
1405
1406 if( need_dsp_help )
1407 {
1408 need_dsp_help = FALSE;
1409 DisplayFileHelp();
1410 }
1411
1412 if( unput_char )
1413 {
1414 ch = unput_char;
1415 unput_char = '\0';
1416 }
1417 else
1418 {
1419 fe_ptr = file_entry_list[dir_entry->start_file + dir_entry->cursor_pos].file;
1420
1421 if( dir_entry->global_flag )
1422 DisplayGlobalFileParameter( fe_ptr );
1423 else
1424 DisplayFileParameter( fe_ptr );
1425
1426 RefreshWindow( dir_window ); /* needed: ncurses-bug ? */
1427 RefreshWindow( file_window );
1428 doupdate();
1429 ch = (resize_request) ? -1 : Getch();
1430 if( ch == LF ) ch = CR;
1431 }
1432
1433 #ifdef VI_KEYS
1434
1435 ch = ViKey( ch );
1436
1437 #endif /* VI_KEYS */
1438
1439 if(resize_request) {
1440 ReCreateWindows();
1441 RereadWindowSize(dir_entry);
1442 DisplayMenu();
1443
1444 GetMaxYX(dir_window, &dir_window_height, &dir_window_width);
1445 while(statistic.cursor_pos >= dir_window_height) {
1446 statistic.cursor_pos--;
1447 statistic.disp_begin_pos++;
1448 }
1449 if(dir_entry->global_flag || dir_entry->big_window || dir_entry->tagged_flag) {
1450
1451 /* big window active */
1452
1453 SwitchToBigFileWindow();
1454 DisplayFileWindow(dir_entry);
1455
1456 if(dir_entry->global_flag) {
1457 DisplayDiskStatistic();
1458 DisplayGlobalFileParameter(fe_ptr);
1459 } else {
1460 DisplayFileWindow(dir_entry);
1461 DisplayDirStatistic(dir_entry);
1462 DisplayFileParameter(fe_ptr);
1463 }
1464 } else {
1465
1466 /* small window active */
1467
1468 SwitchToSmallFileWindow();
1469 DisplayTree( dir_window, statistic.disp_begin_pos,
1470 statistic.disp_begin_pos + statistic.cursor_pos
1471 );
1472 DisplayFileWindow(dir_entry);
1473 DisplayDirStatistic(dir_entry);
1474 DisplayFileParameter(fe_ptr);
1475 }
1476 need_dsp_help = TRUE;
1477 DisplayAvailBytes();
1478 DisplayFileSpec();
1479 DisplayDiskName();
1480 resize_request = FALSE;
1481 }
1482
1483 if( file_mode == MODE_1 )
1484 {
1485 if( ch == '\t' ) ch = KEY_DOWN;
1486 else if( ch == KEY_BTAB ) ch = KEY_UP;
1487 }
1488
1489 if( x_step == 1 && ( ch == KEY_RIGHT || ch == KEY_LEFT ) )
1490 {
1491 /* start_x nicht zuruecksetzen */
1492 /*-----------------------------*/
1493
1494 ; /* do nothing */
1495 }
1496 else
1497 {
1498 /* bei 0 beginnen */
1499 /*----------------*/
1500
1501 if( start_x )
1502 {
1503 start_x = 0;
1504
1505 PrintFileEntry( dir_entry->start_file + dir_entry->cursor_pos,
1506 dir_entry->cursor_pos % window_height,
1507 dir_entry->cursor_pos / window_height,
1508 TRUE ,
1509 start_x
1510 );
1511 }
1512 }
1513
1514 if (mode == USER_MODE) { /* FileUserMode returns (possibly remapped) ch, or -1 if it handles ch */
1515 ch = FileUserMode(&(file_entry_list[dir_entry->start_file + dir_entry->cursor_pos]), ch);
1516 }
1517
1518 switch( ch )
1519 {
1520
1521 #ifdef KEY_RESIZE
1522
1523 case KEY_RESIZE: resize_request = TRUE;
1524 break;
1525 #endif
1526
1527 case -1: break;
1528
1529 case ' ' : /* break; Quick-Key */
1530
1531 case KEY_DOWN : fmovedown(&dir_entry->start_file, &dir_entry->cursor_pos, &start_x, dir_entry);
1532 break;
1533
1534 case KEY_UP : fmoveup(&dir_entry->start_file, &dir_entry->cursor_pos, &start_x, dir_entry);
1535 break;
1536
1537 case KEY_RIGHT: fmoveright(&dir_entry->start_file, &dir_entry->cursor_pos, &start_x, dir_entry);
1538 break;
1539
1540 case KEY_LEFT : fmoveleft(&dir_entry->start_file, &dir_entry->cursor_pos, &start_x, dir_entry);
1541 break;
1542
1543 case KEY_NPAGE: fmovenpage(&dir_entry->start_file, &dir_entry->cursor_pos, &start_x, dir_entry);
1544 break;
1545
1546 case KEY_PPAGE: fmoveppage(&dir_entry->start_file, &dir_entry->cursor_pos, &start_x, dir_entry);
1547 break;
1548
1549 case KEY_END : if( dir_entry->start_file + dir_entry->cursor_pos + 1 >= (int)file_count )
1550 {
1551 /* Letzte Position erreicht */
1552 /*--------------------------*/
1553
1554 beep();
1555 }
1556 else
1557 {
1558 if( (int)file_count < max_disp_files )
1559 {
1560 dir_entry->start_file = 0;
1561 dir_entry->cursor_pos = file_count - 1;
1562 }
1563 else
1564 {
1565 dir_entry->start_file = file_count - max_disp_files;
1566 dir_entry->cursor_pos = file_count - dir_entry->start_file - 1;
1567 }
1568
1569 DisplayFiles( dir_entry,
1570 dir_entry->start_file,
1571 dir_entry->start_file + dir_entry->cursor_pos,
1572 start_x
1573 );
1574 }
1575 break;
1576
1577 case KEY_HOME : if( dir_entry->start_file + dir_entry->cursor_pos <= 0 )
1578 {
1579 /* erste Position erreicht */
1580 /*-------------------------*/
1581
1582 beep();
1583 }
1584 else
1585 {
1586 dir_entry->start_file = 0;
1587 dir_entry->cursor_pos = 0;
1588
1589 DisplayFiles( dir_entry,
1590 dir_entry->start_file,
1591 dir_entry->start_file + dir_entry->cursor_pos,
1592 start_x
1593 );
1594
1595 }
1596 break;
1597
1598 case 'A' :
1599 case 'a' : fe_ptr = file_entry_list[dir_entry->start_file + dir_entry->cursor_pos].file;
1600
1601 need_dsp_help = TRUE;
1602
1603 if( !ChangeFileModus( fe_ptr ) )
1604 {
1605 PrintFileEntry( dir_entry->start_file + dir_entry->cursor_pos,
1606 dir_entry->cursor_pos % window_height,
1607 dir_entry->cursor_pos / window_height,
1608 TRUE,
1609 start_x
1610 );
1611 }
1612 break;
1613
1614 case 'A' & 0x1F :
1615 if( (mode != DISK_MODE && mode != USER_MODE) || !IsMatchingTaggedFiles() )
1616 {
1617 beep();
1618 }
1619 else
1620 {
1621 need_dsp_help = TRUE;
1622
1623 mask = S_IFREG | S_IRUSR | S_IWUSR | S_IRGRP | S_IROTH;
1624
1625 (void) GetAttributes( mask, modus );
1626
1627 if( GetNewFileModus( LINES - 2, 1, modus, "\r\033" ) == CR )
1628 {
1629 (void) strcpy( walking_package.function_data.change_modus.new_modus,
1630 modus
1631 );
1632 WalkTaggedFiles( dir_entry->start_file,
1633 dir_entry->cursor_pos,
1634 SetFileModus,
1635 &walking_package
1636 );
1637
1638 DisplayFiles( dir_entry,
1639 dir_entry->start_file,
1640 dir_entry->start_file + dir_entry->cursor_pos,
1641 start_x
1642 );
1643 }
1644 else
1645 {
1646 beep();
1647 }
1648 }
1649 break;
1650
1651 case 'O' :
1652 case 'o' : fe_ptr = file_entry_list[dir_entry->start_file + dir_entry->cursor_pos].file;
1653
1654 need_dsp_help = TRUE;
1655
1656 if( !ChangeFileOwner( fe_ptr ) )
1657 {
1658 PrintFileEntry( dir_entry->start_file + dir_entry->cursor_pos,
1659 dir_entry->cursor_pos % window_height,
1660 dir_entry->cursor_pos / window_height,
1661 TRUE ,
1662 start_x
1663 );
1664 }
1665 break;
1666
1667 case 'O' & 0x1F :
1668 if(( mode != DISK_MODE && mode != USER_MODE) || !IsMatchingTaggedFiles() )
1669 {
1670 beep();
1671 }
1672 else
1673 {
1674 need_dsp_help = TRUE;
1675 if( ( owner_id = GetNewOwner( -1 ) ) >= 0 )
1676 {
1677 walking_package.function_data.change_owner.new_owner_id = owner_id;
1678 WalkTaggedFiles( dir_entry->start_file,
1679 dir_entry->cursor_pos,
1680 SetFileOwner,
1681 &walking_package
1682 );
1683
1684 DisplayFiles( dir_entry,
1685 dir_entry->start_file,
1686 dir_entry->start_file + dir_entry->cursor_pos,
1687 start_x
1688 );
1689 }
1690 }
1691 break;
1692
1693 case 'G' :
1694 case 'g' : fe_ptr = file_entry_list[dir_entry->start_file + dir_entry->cursor_pos].file;
1695
1696 need_dsp_help = TRUE;
1697
1698 if( !ChangeFileGroup( fe_ptr ) )
1699 {
1700 PrintFileEntry( dir_entry->start_file + dir_entry->cursor_pos,
1701 dir_entry->cursor_pos % window_height,
1702 dir_entry->cursor_pos / window_height,
1703 TRUE,
1704 start_x
1705 );
1706 }
1707 break;
1708
1709 case 'G' & 0x1F :
1710 if(( mode != DISK_MODE && mode != USER_MODE) || !IsMatchingTaggedFiles() )
1711 {
1712 beep();
1713 }
1714 else
1715 {
1716 need_dsp_help = TRUE;
1717
1718 if( ( group_id = GetNewGroup( -1 ) ) >= 0 )
1719 {
1720 walking_package.function_data.change_group.new_group_id = group_id;
1721 WalkTaggedFiles( dir_entry->start_file,
1722 dir_entry->cursor_pos,
1723 SetFileGroup,
1724 &walking_package
1725 );
1726
1727 DisplayFiles( dir_entry,
1728 dir_entry->start_file,
1729 dir_entry->start_file + dir_entry->cursor_pos,
1730 start_x
1731 );
1732 }
1733 }
1734 break;
1735
1736 case 'T' :
1737 case 't' : fe_ptr = file_entry_list[dir_entry->start_file + dir_entry->cursor_pos].file;
1738 de_ptr = fe_ptr->dir_entry;
1739
1740 if( !fe_ptr->tagged )
1741 {
1742 fe_ptr->tagged = TRUE;
1743
1744 PrintFileEntry( dir_entry->start_file + dir_entry->cursor_pos,
1745 dir_entry->cursor_pos % window_height,
1746 dir_entry->cursor_pos / window_height,
1747 TRUE,
1748 start_x
1749 );
1750 de_ptr->tagged_files++;
1751 de_ptr->tagged_bytes += fe_ptr->stat_struct.st_size;
1752 statistic.disk_tagged_files++;
1753 statistic.disk_tagged_bytes += fe_ptr->stat_struct.st_size;
1754 if( dir_entry->global_flag )
1755 DisplayDiskTagged();
1756 else
1757 DisplayDirTagged( de_ptr );
1758 }
1759 unput_char = KEY_DOWN;
1760
1761 break;
1762 case 'U' :
1763 case 'u' : fe_ptr = file_entry_list[dir_entry->start_file + dir_entry->cursor_pos].file;
1764 de_ptr = fe_ptr->dir_entry;
1765 if( fe_ptr->tagged )
1766 {
1767 fe_ptr->tagged = FALSE;
1768
1769 PrintFileEntry( dir_entry->start_file + dir_entry->cursor_pos,
1770 dir_entry->cursor_pos % window_height,
1771 dir_entry->cursor_pos / window_height,
1772 TRUE,
1773 start_x
1774 );
1775
1776 de_ptr->tagged_files--;
1777 de_ptr->tagged_bytes -= fe_ptr->stat_struct.st_size;
1778 statistic.disk_tagged_files--;
1779 statistic.disk_tagged_bytes -= fe_ptr->stat_struct.st_size;
1780 if( dir_entry->global_flag )
1781 DisplayDiskTagged();
1782 else
1783 DisplayDirTagged( de_ptr );
1784 }
1785
1786 unput_char = KEY_DOWN;
1787
1788 break;
1789
1790 case 'F' & 0x1F :
1791 list_pos = dir_entry->start_file + dir_entry->cursor_pos;
1792
1793 RotateFileMode();
1794
1795 x_step = (max_column > 1) ? window_height : 1;
1796 max_disp_files = window_height * max_column;
1797
1798 if( dir_entry->cursor_pos >= max_disp_files )
1799 {
1800 /* Cursor muss neu positioniert werden */
1801 /*-------------------------------------*/
1802
1803 dir_entry->cursor_pos = max_disp_files - 1;
1804 }
1805
1806 dir_entry->start_file = list_pos - dir_entry->cursor_pos;
1807 DisplayFiles( dir_entry,
1808 dir_entry->start_file,
1809 dir_entry->start_file + dir_entry->cursor_pos,
1810 start_x
1811 );
1812 break;
1813
1814 case 'T' & 0x1F :
1815 for(i=0; i < (int)file_count; i++)
1816 {
1817 fe_ptr = file_entry_list[i].file;
1818 de_ptr = fe_ptr->dir_entry;
1819
1820 if( !fe_ptr->tagged )
1821 {
1822 file_size = fe_ptr->stat_struct.st_size;
1823
1824 fe_ptr->tagged = TRUE;
1825 de_ptr->tagged_files++;
1826 de_ptr->tagged_bytes += file_size;
1827 statistic.disk_tagged_files++;
1828 statistic.disk_tagged_bytes += file_size;
1829 }
1830 }
1831
1832 if( dir_entry->global_flag )
1833 DisplayDiskTagged();
1834 else
1835 DisplayDirTagged( dir_entry );
1836
1837 DisplayFiles( dir_entry,
1838 dir_entry->start_file,
1839 dir_entry->start_file + dir_entry->cursor_pos,
1840 start_x
1841 );
1842 break;
1843
1844
1845 case 'U' & 0x1F :
1846 for(i=0; i < (int)file_count; i++)
1847 {
1848 fe_ptr = file_entry_list[i].file;
1849 de_ptr = fe_ptr->dir_entry;
1850
1851 if( fe_ptr->tagged )
1852 {
1853 file_size = fe_ptr->stat_struct.st_size;
1854
1855 fe_ptr->tagged = FALSE;
1856 de_ptr->tagged_files--;
1857 de_ptr->tagged_bytes -= file_size;
1858 statistic.disk_tagged_files--;
1859 statistic.disk_tagged_bytes -= file_size;
1860 }
1861 }
1862
1863 if( dir_entry->global_flag )
1864 DisplayDiskTagged();
1865 else
1866 DisplayDirTagged( dir_entry );
1867
1868 DisplayFiles( dir_entry,
1869 dir_entry->start_file,
1870 dir_entry->start_file + dir_entry->cursor_pos,
1871 start_x
1872 );
1873 break;
1874
1875
1876
1877 case ';':
1878 case 't' | 0x80 :
1879 for(i=dir_entry->start_file + dir_entry->cursor_pos; i < (int)file_count; i++)
1880 {
1881 fe_ptr = file_entry_list[i].file;
1882 de_ptr = fe_ptr->dir_entry;
1883
1884 if( !fe_ptr->tagged )
1885 {
1886 file_size = fe_ptr->stat_struct.st_size;
1887
1888 fe_ptr->tagged = TRUE;
1889 de_ptr->tagged_files++;
1890 de_ptr->tagged_bytes += file_size;
1891 statistic.disk_tagged_files++;
1892 statistic.disk_tagged_bytes += file_size;
1893 }
1894 }
1895
1896 if( dir_entry->global_flag )
1897 DisplayDiskTagged();
1898 else
1899 DisplayDirTagged( dir_entry );
1900
1901 DisplayFiles( dir_entry,
1902 dir_entry->start_file,
1903 dir_entry->start_file + dir_entry->cursor_pos,
1904 start_x
1905 );
1906 break;
1907
1908
1909 case ':':
1910 case 'u' | 0x80 :
1911 for(i=dir_entry->start_file + dir_entry->cursor_pos; i < (int)file_count; i++)
1912 {
1913 fe_ptr = file_entry_list[i].file;
1914 de_ptr = fe_ptr->dir_entry;
1915
1916 if( fe_ptr->tagged )
1917 {
1918 file_size = fe_ptr->stat_struct.st_size;
1919
1920 fe_ptr->tagged = FALSE;
1921 de_ptr->tagged_files--;
1922 de_ptr->tagged_bytes -= file_size;
1923 statistic.disk_tagged_files--;
1924 statistic.disk_tagged_bytes -= file_size;
1925 }
1926 }
1927
1928 if( dir_entry->global_flag )
1929 DisplayDiskTagged();
1930 else
1931 DisplayDirTagged( dir_entry );
1932
1933 DisplayFiles( dir_entry,
1934 dir_entry->start_file,
1935 dir_entry->start_file + dir_entry->cursor_pos,
1936 start_x
1937 );
1938 break;
1939
1940 case 'V' :
1941 case 'v' : fe_ptr = file_entry_list[dir_entry->start_file + dir_entry->cursor_pos].file;
1942 de_ptr = fe_ptr->dir_entry;
1943 (void) GetRealFileNamePath( fe_ptr, filepath );
1944 (void) View( dir_entry, filepath );
1945 need_dsp_help = TRUE;
1946 break;
1947
1948 case 'H' :
1949 case 'h' : fe_ptr = file_entry_list[dir_entry->start_file + dir_entry->cursor_pos].file;
1950 de_ptr = fe_ptr->dir_entry;
1951 (void) GetRealFileNamePath( fe_ptr, filepath );
1952 (void) ViewHex( filepath );
1953 need_dsp_help = TRUE;
1954 break;
1955
1956 case 'E':
1957 case 'e' : fe_ptr = file_entry_list[dir_entry->start_file + dir_entry->cursor_pos].file;
1958 de_ptr = fe_ptr->dir_entry;
1959 (void) GetFileNamePath( fe_ptr, filepath );
1960 (void) Edit( de_ptr, filepath );
1961 break;
1962
1963 case 'Y' :
1964 case 'y' :
1965 case 'C' :
1966 case 'c' : fe_ptr = file_entry_list[dir_entry->start_file + dir_entry->cursor_pos].file;
1967 de_ptr = fe_ptr->dir_entry;
1968
1969 path_copy = FALSE;
1970 if( ch == 'y' || ch == 'Y' ) path_copy = TRUE;
1971
1972 need_dsp_help = TRUE;
1973
1974 if( GetCopyParameter( fe_ptr->name, path_copy, to_file, to_dir ) )
1975 {
1976 beep();
1977 break;
1978 }
1979
1980 if( mode == DISK_MODE || mode == USER_MODE )
1981 {
1982 if( (tmp2 = GetDirEntry( statistic.tree,
1983 de_ptr,
1984 to_dir,
1985 &dest_dir_entry,
1986 to_path
1987 )) == -3)
1988 {
1989 }
1990 else if (tmp2 != 0)
1991 {
1992 /* beep(); */
1993 break;
1994 }
1995
1996 if( !CopyFile( &statistic,
1997 fe_ptr,
1998 TRUE,
1999 to_file,
2000 dest_dir_entry,
2001 to_path,
2002 path_copy
2003 ) )
2004 {
2005 /* File wurde kopiert */
2006 /*--------------------*/
2007
2008 DisplayAvailBytes();
2009
2010 if( dest_dir_entry )
2011 {
2012 /* Ziel befindet sich im SUB-Tree */
2013 /*--------------------------------*/
2014
2015 if( dir_entry->global_flag )
2016 DisplayDiskStatistic();
2017 else
2018 DisplayDirStatistic( de_ptr );
2019
2020 if( dest_dir_entry == de_ptr )
2021 {
2022 /* Ziel ist aktuelles Verzeichnis */
2023 /*--------------------------------*/
2024
2025 BuildFileEntryList( dir_entry );
2026
2027 DisplayFiles( dir_entry,
2028 dir_entry->start_file,
2029 dir_entry->start_file + dir_entry->cursor_pos,
2030 start_x
2031 );
2032 }
2033 }
2034 }
2035 }
2036 else
2037 {
2038 /* TAR_FILE_MODE */
2039 /*---------------*/
2040
2041 dest_dir_entry = NULL;
2042
2043 if( disk_statistic.tree )
2044 {
2045 if( GetDirEntry( disk_statistic.tree,
2046 de_ptr,
2047 to_dir,
2048 &dest_dir_entry,
2049 to_path
2050 ) )
2051 {
2052 beep();
2053 break;
2054 }
2055 }
2056 else
2057 {
2058 (void) strcpy( to_path, to_dir );
2059 }
2060 if( !CopyFile( &disk_statistic,
2061 fe_ptr,
2062 TRUE,
2063 to_file,
2064 dest_dir_entry,
2065 to_path,
2066 path_copy
2067 ) )
2068 {
2069 /* File wurde kopiert */
2070 /*--------------------*/
2071
2072 DisplayAvailBytes();
2073 }
2074 }
2075 break;
2076
2077 case 'Y' & 0x1F :
2078 case 'K' & 0x1F :
2079 case 'C' & 0x1F :
2080 de_ptr = dir_entry;
2081
2082 path_copy = FALSE;
2083 if( ch == ('Y' & 0x1F) ) path_copy = TRUE;
2084
2085 if( !IsMatchingTaggedFiles() )
2086 {
2087 beep();
2088 }
2089 else
2090 {
2091 need_dsp_help = TRUE;
2092
2093 if( GetCopyParameter( NULL, path_copy, to_file, to_dir ) )
2094 {
2095 beep();
2096 break;
2097 }
2098
2099
2100 if( mode == DISK_MODE || mode == USER_MODE )
2101 {
2102 if( GetDirEntry( statistic.tree,
2103 de_ptr,
2104 to_dir,
2105 &dest_dir_entry,
2106 to_path
2107 ) )
2108 {
2109 beep();
2110 break;
2111 }
2112
2113 term = InputChoise( "Confirm overwrite existing files (Y/N) ? ", "YN\033" );
2114 if( term == ESC )
2115 {
2116 beep();
2117 break;
2118 }
2119
2120 walking_package.function_data.copy.statistic_ptr = &statistic;
2121 walking_package.function_data.copy.dest_dir_entry = dest_dir_entry;
2122 walking_package.function_data.copy.to_file = to_file;
2123 walking_package.function_data.copy.to_path = to_path;
2124 walking_package.function_data.copy.path_copy = path_copy;
2125 walking_package.function_data.copy.confirm = (term == 'Y') ? TRUE : FALSE;
2126
2127 WalkTaggedFiles( dir_entry->start_file,
2128 dir_entry->cursor_pos,
2129 CopyTaggedFiles,
2130 &walking_package
2131 );
2132
2133 DisplayAvailBytes();
2134
2135
2136 DisplayFiles( dir_entry,
2137 dir_entry->start_file,
2138 dir_entry->start_file + dir_entry->cursor_pos,
2139 start_x
2140 );
2141 }
2142 else
2143 {
2144 /* TAR_FILE_MODE */
2145 /*---------------*/
2146
2147 dest_dir_entry = NULL;
2148
2149 if( disk_statistic.tree )
2150 {
2151 if( GetDirEntry( disk_statistic.tree,
2152 de_ptr,
2153 to_dir,
2154 &dest_dir_entry,
2155 to_path
2156 ) )
2157 {
2158 beep();
2159 break;
2160 }
2161 }
2162 else
2163 {
2164 (void) strcpy( to_path, to_dir );
2165 }
2166
2167 term = InputChoise( "Confirm overwrite existing files (Y/N) ? ", "YN\033" );
2168 if( term == ESC )
2169 {
2170 beep();
2171 break;
2172 }
2173
2174 walking_package.function_data.copy.statistic_ptr = &disk_statistic;
2175 walking_package.function_data.copy.dest_dir_entry = dest_dir_entry;
2176 walking_package.function_data.copy.to_file = to_file;
2177 walking_package.function_data.copy.to_path = to_path;
2178 walking_package.function_data.copy.path_copy = path_copy;
2179 walking_package.function_data.copy.confirm = (term == 'Y') ? TRUE : FALSE;
2180
2181 WalkTaggedFiles( dir_entry->start_file,
2182 dir_entry->cursor_pos,
2183 CopyTaggedFiles,
2184 &walking_package
2185 );
2186
2187 DisplayAvailBytes();
2188
2189 DisplayFiles( dir_entry,
2190 dir_entry->start_file,
2191 dir_entry->start_file + dir_entry->cursor_pos,
2192 start_x
2193 );
2194 }
2195 }
2196 break;
2197
2198 case 'M' :
2199 case 'm' : if( mode != DISK_MODE && mode != USER_MODE )
2200 {
2201 beep();
2202 break;
2203 }
2204
2205 fe_ptr = file_entry_list[dir_entry->start_file + dir_entry->cursor_pos].file;
2206 de_ptr = fe_ptr->dir_entry;
2207
2208 need_dsp_help = TRUE;
2209
2210 if( GetMoveParameter( fe_ptr->name, to_file, to_dir ) )
2211 {
2212 beep();
2213 break;
2214 }
2215
2216 if( GetDirEntry( statistic.tree,
2217 de_ptr,
2218 to_dir,
2219 &dest_dir_entry,
2220 to_path
2221 ) )
2222 {
2223 beep();
2224 break;
2225 }
2226
2227 if( !MoveFile( fe_ptr,
2228 TRUE,
2229 to_file,
2230 dest_dir_entry,
2231 to_path,
2232 &new_fe_ptr
2233 ) )
2234 {
2235 /* File wurde bewegt */
2236 /*-------------------*/
2237
2238 DisplayAvailBytes();
2239
2240 if( dir_entry->global_flag )
2241 DisplayDiskStatistic();
2242 else
2243 DisplayDirStatistic( de_ptr );
2244
2245 BuildFileEntryList( dir_entry );
2246
2247 if( file_count == 0 ) unput_char = ESC;
2248
2249 if( dir_entry->start_file + dir_entry->cursor_pos >= (int)file_count )
2250 {
2251 if( --dir_entry->cursor_pos < 0 )
2252 {
2253 if( dir_entry->start_file > 0 )
2254 {
2255 dir_entry->start_file--;
2256 }
2257 dir_entry->cursor_pos = 0;
2258 }
2259 }
2260
2261 DisplayFiles( dir_entry,
2262 dir_entry->start_file,
2263 dir_entry->start_file + dir_entry->cursor_pos,
2264 start_x
2265 );
2266 maybe_change_x_step = TRUE;
2267 }
2268 break;
2269
2270 case 'N' & 0x1F :
2271 if(( mode != DISK_MODE && mode != USER_MODE) || !IsMatchingTaggedFiles() )
2272 {
2273 beep();
2274 }
2275 else
2276 {
2277 need_dsp_help = TRUE;
2278
2279 if( GetMoveParameter( NULL, to_file, to_dir ) )
2280 {
2281 beep();
2282 break;
2283 }
2284
2285
2286 if( GetDirEntry( statistic.tree,
2287 de_ptr,
2288 to_dir,
2289 &dest_dir_entry,
2290 to_path
2291 ) )
2292 {
2293 beep();
2294 break;
2295 }
2296
2297 term = InputChoise( "Confirm overwrite existing files (Y/N) ? ", "YN\033" );
2298 if( term == ESC )
2299 {
2300 beep();
2301 break;
2302 }
2303
2304 walking_package.function_data.mv.dest_dir_entry = dest_dir_entry;
2305 walking_package.function_data.mv.to_file = to_file;
2306 walking_package.function_data.mv.to_path = to_path;
2307 walking_package.function_data.mv.confirm = (term == 'Y') ? TRUE : FALSE;
2308
2309 WalkTaggedFiles( dir_entry->start_file,
2310 dir_entry->cursor_pos,
2311 MoveTaggedFiles,
2312 &walking_package
2313 );
2314
2315 BuildFileEntryList( dir_entry );
2316
2317 if( file_count == 0 ) unput_char = ESC;
2318
2319 dir_entry->start_file = 0;
2320 dir_entry->cursor_pos = 0;
2321
2322 DisplayFiles( dir_entry,
2323 dir_entry->start_file,
2324 dir_entry->start_file + dir_entry->cursor_pos,
2325 start_x
2326 );
2327 maybe_change_x_step = TRUE;
2328 }
2329 break;
2330
2331 case 'D' :
2332 case 'd' : if( mode != DISK_MODE && mode != USER_MODE )
2333 {
2334 beep();
2335 break;
2336 }
2337
2338 term = InputChoise( "Delete this file (Y/N) ? ",
2339 "YN\033"
2340 );
2341
2342 need_dsp_help = TRUE;
2343
2344 if( term != 'Y' ) break;
2345
2346 fe_ptr = file_entry_list[dir_entry->start_file + dir_entry->cursor_pos].file;
2347 de_ptr = fe_ptr->dir_entry;
2348
2349 if( !DeleteFile( fe_ptr ) )
2350 {
2351 /* File wurde geloescht */
2352 /*----------------------*/
2353
2354 if( dir_entry->global_flag )
2355 DisplayDiskStatistic();
2356 else
2357 DisplayDirStatistic( de_ptr );
2358
2359 DisplayAvailBytes();
2360
2361 RemoveFileEntry( dir_entry->start_file + dir_entry->cursor_pos );
2362
2363 if( file_count == 0 ) unput_char = ESC;
2364
2365 if( dir_entry->start_file + dir_entry->cursor_pos >= (int)file_count )
2366 {
2367 if( --dir_entry->cursor_pos < 0 )
2368 {
2369 if( dir_entry->start_file > 0 )
2370 {
2371 dir_entry->start_file--;
2372 }
2373 dir_entry->cursor_pos = 0;
2374 }
2375 }
2376
2377 DisplayFiles( dir_entry,
2378 dir_entry->start_file,
2379 dir_entry->start_file + dir_entry->cursor_pos,
2380 start_x
2381 );
2382 maybe_change_x_step = TRUE;
2383 }
2384 break;
2385
2386 case 'D' & 0x1F :
2387 if(( mode != DISK_MODE && mode != USER_MODE) || !IsMatchingTaggedFiles() )
2388 {
2389 beep();
2390 }
2391 else
2392 {
2393 need_dsp_help = TRUE;
2394 (void) DeleteTaggedFiles( max_disp_files );
2395 if( file_count == 0 ) unput_char = ESC;
2396 dir_entry->start_file = 0;
2397 dir_entry->cursor_pos = 0;
2398 DisplayAvailBytes();
2399 DisplayFiles( dir_entry,
2400 dir_entry->start_file,
2401 dir_entry->start_file + dir_entry->cursor_pos,
2402 start_x
2403 );
2404 maybe_change_x_step = TRUE;
2405 }
2406 break;
2407
2408 case 'R':
2409 case 'r': if( mode != DISK_MODE && mode != USER_MODE )
2410 {
2411 beep();
2412 break;
2413 }
2414
2415 fe_ptr = file_entry_list[dir_entry->start_file + dir_entry->cursor_pos].file;
2416 de_ptr = fe_ptr->dir_entry;
2417
2418 if( !GetRenameParameter( fe_ptr->name, new_name ) )
2419 {
2420 if( !RenameFile( fe_ptr, new_name, &new_fe_ptr ) )
2421 {
2422 /* Rename OK */
2423 /*-----------*/
2424
2425 /* Maybe structure has changed... */
2426 /*--------------------------------*/
2427
2428 BuildFileEntryList( de_ptr );
2429
2430 DisplayFiles( de_ptr,
2431 dir_entry->start_file,
2432 dir_entry->start_file + dir_entry->cursor_pos,
2433 start_x
2434 );
2435 maybe_change_x_step = TRUE;
2436 }
2437 }
2438 need_dsp_help = TRUE;
2439 break;
2440
2441 case 'R' & 0x1F :
2442 if(( mode != DISK_MODE && mode != USER_MODE) || !IsMatchingTaggedFiles() )
2443 {
2444 beep();
2445 }
2446 else
2447 {
2448 need_dsp_help = TRUE;
2449
2450 if( GetRenameParameter( NULL, new_name ) )
2451 {
2452 beep();
2453 break;
2454 }
2455
2456 walking_package.function_data.rename.new_name = new_name;
2457 walking_package.function_data.rename.confirm = FALSE;
2458
2459 WalkTaggedFiles( dir_entry->start_file,
2460 dir_entry->cursor_pos,
2461 RenameTaggedFiles,
2462 &walking_package
2463 );
2464
2465 BuildFileEntryList( dir_entry );
2466
2467 if( file_count == 0 ) unput_char = ESC;
2468
2469 DisplayFiles( dir_entry,
2470 dir_entry->start_file,
2471 dir_entry->start_file + dir_entry->cursor_pos,
2472 start_x
2473 );
2474
2475 maybe_change_x_step = TRUE;
2476 }
2477 break;
2478
2479 case 'S':
2480 case 's': GetKindOfSort();
2481
2482 dir_entry->start_file = 0;
2483 dir_entry->cursor_pos = 0;
2484
2485 SortFileEntryList();
2486
2487 DisplayFiles( dir_entry,
2488 dir_entry->start_file,
2489 dir_entry->start_file + dir_entry->cursor_pos,
2490 start_x
2491 );
2492 need_dsp_help = TRUE;
2493 break;
2494
2495 case 'F':
2496 case 'f': if(ReadFileSpec() == 0) {
2497
2498 dir_entry->start_file = 0;
2499 dir_entry->cursor_pos = 0;
2500
2501 BuildFileEntryList( dir_entry );
2502
2503 DisplayFileSpec();
2504 DisplayFiles( dir_entry,
2505 dir_entry->start_file,
2506 dir_entry->start_file + dir_entry->cursor_pos,
2507 start_x
2508 );
2509
2510 if( dir_entry->global_flag )
2511 DisplayDiskStatistic();
2512 else
2513 DisplayDirStatistic( dir_entry );
2514
2515 if( file_count == 0 ) unput_char = ESC;
2516 maybe_change_x_step = TRUE;
2517 }
2518 need_dsp_help = TRUE;
2519 break;
2520
2521 #ifndef VI_KEYS
2522 case 'l':
2523 #endif /* VI_KEYS */
2524 case 'L': fe_ptr = file_entry_list[dir_entry->start_file + dir_entry->cursor_pos].file;
2525 if( mode == DISK_MODE || mode == USER_MODE )
2526 {
2527 (void) GetFileNamePath( fe_ptr, new_login_path );
2528 if( !GetNewLoginPath( new_login_path ) )
2529 {
2530 dir_entry->login_flag = TRUE;
2531
2532 (void) LoginDisk( new_login_path );
2533 unput_char = LOGIN_ESC;
2534 }
2535 need_dsp_help = TRUE;
2536 }
2537 else beep();
2538 break;
2539
2540 case LF:
2541 case CR: if( dir_entry->big_window ) break;
2542 dir_entry->big_window = TRUE;
2543 ch = '\0';
2544 SwitchToBigFileWindow();
2545 GetMaxYX( file_window, &window_height, &window_width );
2546
2547 x_step = (max_column > 1) ? window_height : 1;
2548 max_disp_files = window_height * max_column;
2549
2550 DisplayFiles( dir_entry,
2551 dir_entry->start_file,
2552 dir_entry->start_file + dir_entry->cursor_pos,
2553 start_x
2554 );
2555 break;
2556
2557 case 'P' :
2558 case 'p' : fe_ptr = file_entry_list[dir_entry->start_file + dir_entry->cursor_pos].file;
2559 de_ptr = fe_ptr->dir_entry;
2560 (void) Pipe( de_ptr, fe_ptr );
2561 need_dsp_help = TRUE;
2562 break;
2563
2564 case 'P' & 0x1F :
2565 de_ptr = dir_entry;
2566
2567 if( !IsMatchingTaggedFiles() )
2568 {
2569 beep();
2570 }
2571 else if( mode != DISK_MODE && mode != USER_MODE )
2572 {
2573 MESSAGE( "i am sorry*^P not supported in Archive-mode" );
2574 }
2575 else
2576 {
2577 need_dsp_help = TRUE;
2578
2579 if( GetPipeCommand( filepath ) )
2580 {
2581 beep();
2582 break;
2583 }
2584
2585
2586
2587 if( ( walking_package.function_data.pipe_cmd.pipe_file =
2588 popen( filepath, "w" ) ) == NULL )
2589 {
2590 (void) sprintf( message, "execution of command*%s*failed", filepath );
2591 MESSAGE( message );
2592 break;
2593 }
2594
2595
2596 WalkTaggedFiles( dir_entry->start_file,
2597 dir_entry->cursor_pos,
2598 PipeTaggedFiles,
2599 &walking_package
2600 );
2601
2602 clearok( stdscr, TRUE );
2603
2604 if( pclose( walking_package.function_data.pipe_cmd.pipe_file ) )
2605 {
2606 WARNING( "pclose failed" );
2607 }
2608
2609 (void) GetAvailBytes( &statistic.disk_space );
2610 DisplayAvailBytes();
2611
2612 DisplayFiles( dir_entry,
2613 dir_entry->start_file,
2614 dir_entry->start_file + dir_entry->cursor_pos,
2615 start_x
2616 );
2617 }
2618 break;
2619
2620 case 'X':
2621 case 'x' : fe_ptr = file_entry_list[dir_entry->start_file + dir_entry->cursor_pos].file;
2622 de_ptr = fe_ptr->dir_entry;
2623 (void) Execute( de_ptr, fe_ptr );
2624 need_dsp_help = TRUE;
2625 break;
2626
2627 case 'S' & 0x1F :
2628 if( !IsMatchingTaggedFiles() )
2629 {
2630 beep();
2631 }
2632 else if( mode != DISK_MODE && mode != USER_MODE )
2633 {
2634 MESSAGE( "Feature not available in archives." );
2635 }
2636 else
2637 {
2638 char *command_line;
2639
2640 if( ( command_line = (char *)malloc( COLS + 1 ) ) == NULL )
2641 {
2642 ERROR_MSG( "Malloc failed*ABORT" );
2643 exit( 1 );
2644 }
2645
2646 need_dsp_help = TRUE;
2647 *command_line = '\0';
2648 if( !GetSearchCommandLine( command_line ) )
2649 {
2650 refresh();
2651 endwin();
2652 SuspendClock();
2653
2654 walking_package.function_data.execute.command = command_line;
2655 SilentTagWalkTaggedFiles( ExecuteCommand,
2656 &walking_package
2657 );
2658 RefreshWindow( file_window );
2659
2660 HitReturnToContinue();
2661
2662 InitClock();
2663
2664 DisplayFiles( dir_entry,
2665 dir_entry->start_file,
2666 dir_entry->start_file + dir_entry->cursor_pos,
2667 start_x
2668 );
2669 }
2670 free( command_line );
2671 }
2672 break;
2673
2674 case 'X' & 0x1F:
2675 if( !IsMatchingTaggedFiles() )
2676 {
2677 beep();
2678 }
2679 else if( mode != DISK_MODE && mode != USER_MODE )
2680 {
2681 MESSAGE( "I am sorry*^X not supported in Archive-mode" );
2682 }
2683 else
2684 {
2685 char *command_line;
2686
2687 if( ( command_line = (char *)malloc( COLS + 1 ) ) == NULL )
2688 {
2689 ERROR_MSG( "Malloc failed*ABORT" );
2690 exit( 1 );
2691 }
2692
2693 need_dsp_help = TRUE;
2694 *command_line = '\0';
2695 if( !GetCommandLine( command_line ) )
2696 {
2697 refresh();
2698 endwin();
2699 walking_package.function_data.execute.command = command_line;
2700 SilentWalkTaggedFiles( ExecuteCommand,
2701 &walking_package
2702 );
2703 HitReturnToContinue();
2704
2705 DisplayFiles( dir_entry,
2706 dir_entry->start_file,
2707 dir_entry->start_file + dir_entry->cursor_pos,
2708 start_x
2709 );
2710 }
2711 free( command_line );
2712 }
2713 break;
2714
2715 case 'Q' & 0x1F:
2716 need_dsp_help = TRUE;
2717 fe_ptr = file_entry_list[dir_entry->start_file
2718 + dir_entry->cursor_pos].file;
2719 de_ptr = fe_ptr->dir_entry;
2720 QuitTo(de_ptr);
2721 break;
2722
2723 case 'Q':
2724 case 'q': need_dsp_help = TRUE;
2725 Quit();
2726 break;
2727
2728 case 'L' & 0x1F:
2729 clearok( stdscr, TRUE );
2730 break;
2731
2732 case '\033': break;
2733
2734 case LOGIN_ESC :
2735 break;
2736
2737 case KEY_F(12):
2738 ListJump(dir_entry, "");
2739 need_dsp_help = TRUE;
2740 break;
2741
2742 default: beep();
2743 break;
2744 }
2745 } while( ch != CR && ch != ESC && ch != LOGIN_ESC );
2746
2747 if( dir_entry->big_window )
2748 SwitchToSmallFileWindow();
2749
2750 if(ch != LOGIN_ESC) {
2751 dir_entry->global_flag = FALSE;
2752 dir_entry->tagged_flag = FALSE;
2753 dir_entry->big_window = FALSE;
2754 }
2755
2756 return( ch );
2757 }
2758
2759
2760
2761
WalkTaggedFiles(int start_file,int cursor_pos,int (* fkt)(),WalkingPackage * walking_package)2762 static void WalkTaggedFiles(int start_file,
2763 int cursor_pos,
2764 int (*fkt) (/* ??? */),
2765 WalkingPackage *walking_package
2766 )
2767 {
2768 FileEntry *fe_ptr;
2769 int i;
2770 int start_x = 0;
2771 int result = 0;
2772 BOOL maybe_change_x = FALSE;
2773
2774 if( baudrate() >= QUICK_BAUD_RATE ) typeahead( 0 );
2775
2776 /* GetMaxYX( file_window, &window_height, &window_width );*/
2777
2778 max_disp_files = window_height * max_column;
2779
2780 for( i=0; i < (int)file_count && result == 0; i++ )
2781 {
2782 fe_ptr = file_entry_list[i].file;
2783
2784 if( fe_ptr->tagged && fe_ptr->matching )
2785 {
2786 if( maybe_change_x == FALSE &&
2787 i >= start_file && i < start_file + max_disp_files )
2788 {
2789 /* Walk ohne scroll moeglich */
2790 /*---------------------------*/
2791
2792 PrintFileEntry( start_file + cursor_pos,
2793 cursor_pos % window_height,
2794 cursor_pos / window_height,
2795 FALSE,
2796 start_x
2797 );
2798
2799 cursor_pos = i - start_file;
2800
2801 PrintFileEntry( start_file + cursor_pos,
2802 cursor_pos % window_height,
2803 cursor_pos / window_height,
2804 TRUE,
2805 start_x
2806 );
2807 }
2808 else
2809 {
2810 /* Scroll noetig */
2811 /*---------------*/
2812
2813 start_file = MAX( 0, i - max_disp_files + 1 );
2814 cursor_pos = i - start_file;
2815
2816 DisplayFiles( fe_ptr->dir_entry,
2817 start_file,
2818 start_file + cursor_pos,
2819 start_x
2820 );
2821 maybe_change_x = FALSE;
2822 }
2823
2824 if( fe_ptr->dir_entry->global_flag )
2825 DisplayGlobalFileParameter( fe_ptr );
2826 else
2827 DisplayFileParameter( fe_ptr );
2828
2829 RefreshWindow( file_window );
2830 doupdate();
2831 result = fkt( fe_ptr, walking_package );
2832 if( walking_package->new_fe_ptr != fe_ptr )
2833 {
2834 file_entry_list[i].file = walking_package->new_fe_ptr;
2835 ChangeFileEntry();
2836 max_disp_files = window_height * max_column;
2837 maybe_change_x = TRUE;
2838 }
2839 }
2840 }
2841
2842 if( baudrate() >= QUICK_BAUD_RATE ) typeahead( -1 );
2843 }
2844
2845 /*
2846 ExecuteCommand (*fkt) had its retval zeroed as found.
2847 ^S needs that value, so it was unzeroed. forloop below
2848 was modified to not care about retval instead?
2849 global flag for stop-on-error? does anybody want it?
2850
2851 --crb3 12mar04
2852 */
2853
SilentWalkTaggedFiles(int (* fkt)(),WalkingPackage * walking_package)2854 static void SilentWalkTaggedFiles( int (*fkt) (/* ??? */),
2855 WalkingPackage *walking_package
2856 )
2857 {
2858 FileEntry *fe_ptr;
2859 int i;
2860
2861
2862 for( i=0; i < (int)file_count; i++ )
2863 {
2864 fe_ptr = file_entry_list[i].file;
2865
2866 if( fe_ptr->tagged && fe_ptr->matching )
2867 {
2868 (void)fkt( fe_ptr, walking_package );
2869 }
2870 }
2871 }
2872
2873 /*
2874
2875 SilentTagWalkTaggedFiles.
2876 revision of above function to provide something like
2877 XTG's <search> facility, using external grep.
2878 - loops for entire filescount.
2879 - if called program returns 1 (grep's "no-match" retcode), untags the file.
2880 repeated calls can be used to pare down tags, each with a different
2881 string, until only the intended target files are tagged.
2882
2883 ExecuteCommand must have its retval unzeroed.
2884
2885 --crb3 31dec03
2886
2887 */
2888
SilentTagWalkTaggedFiles(int (* fkt)(),WalkingPackage * walking_package)2889 static void SilentTagWalkTaggedFiles( int (*fkt) (/* ??? */),
2890 WalkingPackage *walking_package
2891 )
2892 {
2893 FileEntry *fe_ptr;
2894 int i;
2895 int result = 0;
2896
2897
2898 for( i=0; i < (int)file_count; i++ )
2899 {
2900 fe_ptr = file_entry_list[i].file;
2901
2902 if( fe_ptr->tagged && fe_ptr->matching )
2903 {
2904 result = fkt( fe_ptr, walking_package );
2905
2906 if( result == 0 ) {
2907 fe_ptr->tagged = FALSE;
2908 }
2909 }
2910 }
2911 }
2912
2913
2914
2915
IsMatchingTaggedFiles(void)2916 static BOOL IsMatchingTaggedFiles(void)
2917 {
2918 FileEntry *fe_ptr;
2919 int i;
2920
2921 for( i=0; i < (int)file_count; i++)
2922 {
2923 fe_ptr = file_entry_list[i].file;
2924
2925 if( fe_ptr->matching && fe_ptr->tagged )
2926 return( TRUE );
2927 }
2928
2929 return( FALSE );
2930 }
2931
2932
2933
2934
2935
2936
DeleteTaggedFiles(int max_disp_files)2937 static int DeleteTaggedFiles(int max_disp_files)
2938 {
2939 FileEntry *fe_ptr;
2940 DirEntry *de_ptr;
2941 int i;
2942 int start_file;
2943 int cursor_pos;
2944 BOOL deleted;
2945 BOOL confirm;
2946 int term;
2947 int start_x = 0;
2948 int result = 0;
2949
2950 term = InputChoise( "Confirm delete each file (Y/N) ? ", "YN\033" );
2951
2952 if( term == ESC ) return( -1 );
2953
2954 if( term == 'Y' ) confirm = TRUE;
2955 else confirm = FALSE;
2956
2957 if( baudrate() >= QUICK_BAUD_RATE ) typeahead( 0 );
2958
2959 for( i=0; i < (int)file_count && result == 0; )
2960 {
2961 deleted = FALSE;
2962
2963 fe_ptr = file_entry_list[i].file;
2964 de_ptr = fe_ptr->dir_entry;
2965
2966 if( fe_ptr->tagged && fe_ptr->matching )
2967 {
2968 start_file = MAX( 0, i - max_disp_files + 1 );
2969 cursor_pos = i - start_file;
2970
2971 DisplayFiles( de_ptr,
2972 start_file,
2973 start_file + cursor_pos,
2974 start_x
2975 );
2976
2977 if( fe_ptr->dir_entry->global_flag )
2978 DisplayGlobalFileParameter( fe_ptr );
2979 else
2980 DisplayFileParameter( fe_ptr );
2981
2982 RefreshWindow( file_window );
2983 doupdate();
2984
2985 if( confirm ) term = InputChoise( "Delete this file (Y/N) ? ", "YN\033" );
2986 else term = 'Y';
2987
2988 if( term == ESC )
2989 {
2990 if( baudrate() >= QUICK_BAUD_RATE ) typeahead( -1 );
2991 result = -1;
2992 break;
2993 }
2994
2995 if( term == 'Y' )
2996 {
2997 if( ( result = DeleteFile( fe_ptr ) ) == 0 )
2998 {
2999 /* File wurde geloescht */
3000 /*----------------------*/
3001
3002 deleted = TRUE;
3003
3004 if( de_ptr->global_flag )
3005 DisplayDiskStatistic();
3006 else
3007 DisplayDirStatistic( de_ptr );
3008
3009 DisplayAvailBytes();
3010
3011 RemoveFileEntry( start_file + cursor_pos );
3012 }
3013 }
3014 }
3015 if( !deleted ) i++;
3016 }
3017 if( baudrate() >= QUICK_BAUD_RATE ) typeahead( -1 );
3018
3019 return( result );
3020 }
3021
3022
3023
3024
RereadWindowSize(DirEntry * dir_entry)3025 static void RereadWindowSize(DirEntry *dir_entry)
3026 {
3027 SetFileMode(file_mode);
3028 x_step = (max_column > 1) ? window_height : 1;
3029 max_disp_files = window_height * max_column;
3030
3031
3032 if( dir_entry->start_file + dir_entry->cursor_pos < (int)file_count )
3033 {
3034 while( dir_entry->cursor_pos >= max_disp_files )
3035 {
3036 dir_entry->start_file += x_step;
3037 dir_entry->cursor_pos -= x_step;
3038 }
3039 }
3040 return;
3041 }
3042
3043
3044
3045
ListJump(DirEntry * dir_entry,char * str)3046 static void ListJump( DirEntry * dir_entry, char *str )
3047 {
3048 int incremental = (!strcmp(LISTJUMPSEARCH, "1")) ? 1 : 0; /* from ~/.ytree */
3049
3050 /* in file_window press initial char of file to jump to it */
3051
3052 char *newStr = NULL;
3053 FileEntry * fe_ptr = NULL;
3054 int i=0, j=0, n=0, start_x=0, ic=0, tmp2=0;
3055 char * jumpmsg = "Press initial of file to jump to... ";
3056
3057 ClearHelp();
3058 MvAddStr( LINES - 2, 1, jumpmsg );
3059 PrintOptions
3060 (
3061 stdscr,
3062 LINES - 2,
3063 COLS - 14,
3064 "(Escape) cancel"
3065 );
3066
3067 ic = tolower(getch());
3068
3069 if( !isprint(ic) )
3070 {
3071 beep();
3072 return;
3073 }
3074
3075 n = strlen(str);
3076 if((newStr = malloc(n+2)) == NULL) {
3077 ERROR_MSG( "Malloc failed*ABORT" );
3078 exit( 1 );
3079 }
3080 strcpy(newStr, str);
3081 newStr[n] = ic;
3082 newStr[n+1] = '\0';
3083
3084 /* index of current entry in list */
3085 tmp2 = (incremental && n == 0) ? 0 : dir_entry->start_file + dir_entry->cursor_pos;
3086
3087 if( tmp2 == file_count - 1 )
3088 {
3089 ClearHelp();
3090 MvAddStr( LINES - 2, 1, "Last entry!");
3091 beep();
3092 RefreshWindow( stdscr );
3093 RefreshWindow( file_window );
3094 doupdate();
3095 sleep(1);
3096 free(newStr);
3097 return;
3098 }
3099
3100 for( i=tmp2; i < file_count; i++ )
3101 {
3102 fe_ptr = file_entry_list[i].file;
3103 if(!strncasecmp(newStr, fe_ptr->name, n+1))
3104 break;
3105 }
3106
3107 if ( i == file_count )
3108 {
3109 ClearHelp();
3110 MvAddStr( LINES - 2, 1, "No match!");
3111 beep();
3112 RefreshWindow( stdscr );
3113 RefreshWindow( file_window );
3114 doupdate();
3115 sleep(1);
3116 free(newStr);
3117 return;
3118 }
3119
3120 /* position cursor on entry wanted and found */
3121 if( incremental && n == 0 ) {
3122 /* first search start on top */
3123 dir_entry->start_file = 0;
3124 dir_entry->cursor_pos = 0;
3125 DisplayFiles( dir_entry,
3126 dir_entry->start_file,
3127 dir_entry->start_file + dir_entry->cursor_pos,
3128 start_x
3129 );
3130 }
3131 for ( j=tmp2; j < i; j++ )
3132 fmovedown
3133 (
3134 &dir_entry->start_file,
3135 &dir_entry->cursor_pos,
3136 &start_x,
3137 dir_entry
3138 );
3139 RefreshWindow( stdscr );
3140 RefreshWindow( file_window );
3141 doupdate();
3142 ListJump( dir_entry, (incremental) ? newStr : "" );
3143 free(newStr);
3144 }
3145
3146
3147