Script 'mail_helper' called by obssrc Hello community, here is the log from the commit of package ytree for openSUSE:Factory checked in at 2024-04-10 17:49:53 ++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++ Comparing /work/SRC/openSUSE:Factory/ytree (Old) and /work/SRC/openSUSE:Factory/.ytree.new.29460 (New) ++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
Package is "ytree" Wed Apr 10 17:49:53 2024 rev:7 rq:1166614 version:2.08 Changes: -------- --- /work/SRC/openSUSE:Factory/ytree/ytree.changes 2024-03-17 22:18:00.576816281 +0100 +++ /work/SRC/openSUSE:Factory/.ytree.new.29460/ytree.changes 2024-04-10 17:50:48.717404455 +0200 @@ -1,0 +2,9 @@ +Sun Apr 7 15:21:48 UTC 2024 - Martin Hauke <mar...@gmx.de> + +- Update to version 2.08 + * "Show tagged files only" in file windows (Shift-F4 or Ctrl-F4 + (if system allows Ctrl function keys / Thanks to frank) + * Lots of UTF_8 improvements/bugfixes + * Improve compatibility with old unix systems / some minor fixes + +------------------------------------------------------------------- Old: ---- ytree-2.07.tar.gz New: ---- ytree-2.08.tar.gz ++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++ Other differences: ------------------ ++++++ ytree.spec ++++++ --- /var/tmp/diff_new_pack.eqe9vI/_old 2024-04-10 17:50:49.169421090 +0200 +++ /var/tmp/diff_new_pack.eqe9vI/_new 2024-04-10 17:50:49.173421236 +0200 @@ -17,7 +17,7 @@ Name: ytree -Version: 2.07 +Version: 2.08 Release: 0 Summary: A filemanager similar to XTree License: GPL-2.0-only ++++++ ytree-2.07.tar.gz -> ytree-2.08.tar.gz ++++++ diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/ytree-2.07/CHANGES new/ytree-2.08/CHANGES --- old/ytree-2.07/CHANGES 2024-02-18 16:03:17.000000000 +0100 +++ new/ytree-2.08/CHANGES 2024-04-05 14:24:38.000000000 +0200 @@ -178,3 +178,7 @@ New in 2.07 Removed -O compiler switch due to problems with UTF_8 code Added workaround when resizing ytree window during string input +New in 2.08 + "Show tagged files only" in file windows (Shift-F4 or Ctrl-F4 (if system allows Ctrl function keys / Thanks to frank) + Lots of UTF_8 improvements/bugfixes + Improve compatibility with old unix systems / some minor fixes diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/ytree-2.07/Makefile new/ytree-2.08/Makefile --- old/ytree-2.07/Makefile 2024-02-18 16:03:17.000000000 +0100 +++ new/ytree-2.08/Makefile 2024-04-05 14:24:38.000000000 +0200 @@ -23,9 +23,7 @@ # Uncomment the lines for your system (default is linux) ########################### -# LINUX (tested with ncurses 5.6) -# Attention Slackware users: -# Maybe you have to change the MANDIR to $(DESTDIR)/man/man1 +# LINUX (tested with ncurses 6) ########################### COLOR = -DCOLOR_SUPPORT #CLOCK = -DCLOCK_SUPPORT # Experimental! @@ -34,7 +32,7 @@ LDFLAGS += -lncurses -ltinfo -lreadline ########################### -# LINUX with Wide character support (tested with ncurses 5.4) +# LINUX with Wide character support (tested with ncurses 6) # Requires libncursesw! ########################### #COLOR = -DCOLOR_SUPPORT @@ -44,9 +42,7 @@ #LDFLAGS = -lncursesw -ltinfo -lreadline ########################### -# LINUX without libreadline (tested with ncurses 5.2) -# Attention Slackware users: -# Maybe you have to change the MANDIR to $(DESTDIR)/man/man1 +# LINUX without libreadline (tested with ncurses 6) ########################### #COLOR = -DCOLOR_SUPPORT #CLOCK = -DCLOCK_SUPPORT # Experimental! diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/ytree-2.07/dirwin.c new/ytree-2.08/dirwin.c --- old/ytree-2.07/dirwin.c 2024-02-18 16:03:17.000000000 +0100 +++ new/ytree-2.08/dirwin.c 2024-04-05 14:24:38.000000000 +0200 @@ -23,8 +23,7 @@ static void HandlePlus(DirEntry *dir_entry, DirEntry *de_ptr, char *new_login_path, DirEntry *start_dir_entry, BOOL *need_dsp_help); static void HandleTagDir(DirEntry *dir_entry, BOOL value); static void HandleTagAllDirs(DirEntry *dir_entry, BOOL value ); -static void HandleShowAllTagged(DirEntry *dir_entry,DirEntry *start_dir_entry, BOOL *need_dsp_help, int *ch); -static void HandleShowAll(DirEntry *dir_entry, DirEntry *start_dir_entry, BOOL *need_dsp_help, int *ch); +static void HandleShowAll(BOOL tagged_only, DirEntry *dir_entry, DirEntry *start_dir_entry, BOOL *need_dsp_help, int *ch); static void HandleSwitchWindow(DirEntry *dir_entry, DirEntry *start_dir_entry, BOOL *need_dsp_help, int *ch); static int dir_mode; @@ -705,48 +704,11 @@ return; } -static void HandleShowAllTagged(DirEntry *dir_entry,DirEntry *start_dir_entry, BOOL *need_dsp_help, int *ch) -{ - if( statistic.disk_tagged_files ) - { - if(dir_entry->login_flag) - { - dir_entry->login_flag = FALSE; - } else { - dir_entry->big_window = TRUE; - dir_entry->global_flag = TRUE; - dir_entry->tagged_flag = TRUE; - dir_entry->start_file = 0; - dir_entry->cursor_pos = 0; - } - if( HandleFileWindow(dir_entry) != LOGIN_ESC ) - { - DisplayDiskStatistic(); - dir_entry->start_file = 0; - dir_entry->cursor_pos = -1; - DisplayFileWindow( dir_entry ); - RefreshWindow( small_file_window ); - RefreshWindow( big_file_window ); - BuildDirEntryList( start_dir_entry ); - DisplayTree( dir_window, statistic.disp_begin_pos, - statistic.disp_begin_pos + statistic.cursor_pos); - }else{ - BuildDirEntryList( statistic.tree ); - DisplayTree( dir_window, statistic.disp_begin_pos, - statistic.disp_begin_pos + statistic.cursor_pos); - *ch = 'L'; - } - }else{ - dir_entry->login_flag = FALSE; - beep(); - } - *need_dsp_help = TRUE; - return; -} -static void HandleShowAll(DirEntry *dir_entry, DirEntry *start_dir_entry, BOOL *need_dsp_help, int *ch) + +static void HandleShowAll(BOOL tagged_only, DirEntry *dir_entry, DirEntry *start_dir_entry, BOOL *need_dsp_help, int *ch) { - if( statistic.disk_matching_files ) + if( (tagged_only) ? statistic.disk_tagged_files : statistic.disk_matching_files ) { if(dir_entry->login_flag) { @@ -754,7 +716,7 @@ } else { dir_entry->big_window = TRUE; dir_entry->global_flag = TRUE; - dir_entry->tagged_flag = FALSE; + dir_entry->tagged_flag = tagged_only; dir_entry->start_file = 0; dir_entry->cursor_pos = 0; } @@ -768,7 +730,7 @@ RefreshWindow( big_file_window ); BuildDirEntryList( start_dir_entry ); DisplayTree( dir_window, statistic.disp_begin_pos, - statistic.disp_begin_pos + statistic.cursor_pos); + statistic.disp_begin_pos + statistic.cursor_pos); } else { BuildDirEntryList( statistic.tree ); DisplayTree( dir_window, statistic.disp_begin_pos, @@ -1029,11 +991,11 @@ need_dsp_help = TRUE; break; case 'S' & 0x1F : - HandleShowAllTagged(dir_entry, start_dir_entry, &need_dsp_help, &ch); + HandleShowAll(TRUE, dir_entry, start_dir_entry, &need_dsp_help, &ch); break; case 'S': - case 's': HandleShowAll(dir_entry, start_dir_entry, &need_dsp_help, &ch); + case 's': HandleShowAll(FALSE, dir_entry, start_dir_entry, &need_dsp_help, &ch); break; case LF : case CR : HandleSwitchWindow(dir_entry, start_dir_entry, &need_dsp_help, &ch); diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/ytree-2.07/error.c new/ytree-2.08/error.c --- old/ytree-2.07/error.c 2024-02-18 16:03:17.000000000 +0100 +++ new/ytree-2.08/error.c 2024-04-05 14:24:38.000000000 +0200 @@ -22,7 +22,7 @@ void Message(char *msg) { MapErrorWindow( "E R R O R" ); - (void) PrintMessage( msg, true ); + (void) PrintMessage( msg, TRUE ); } @@ -38,7 +38,7 @@ void Warning(char *msg) { MapErrorWindow( "W A R N I N G" ); - (void) PrintMessage( msg, true ); + (void) PrintMessage( msg, TRUE ); } @@ -47,13 +47,17 @@ static char version[80]; (void) sprintf( version, +#ifdef WITH_UTF8 + "ytree (UTF8) Version %s %s*(Werner Bregulla)", +#else "ytree Version %s %s*(Werner Bregulla)", +#endif VERSION, VERSIONDATE ); MapErrorWindow( "ABOUT" ); - (void) PrintMessage( version, false ); + (void) PrintMessage( version, FALSE ); } @@ -65,7 +69,7 @@ (void) sprintf( buffer, "%s*In Module \"%s\"*Line %d", msg, module, line ); - (void) PrintMessage( buffer, true ); + (void) PrintMessage( buffer, TRUE ); } diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/ytree-2.07/filewin.c new/ytree-2.08/filewin.c --- old/ytree-2.07/filewin.c 2024-02-18 16:03:17.000000000 +0100 +++ new/ytree-2.08/filewin.c 2024-04-05 14:24:38.000000000 +0200 @@ -33,13 +33,13 @@ static FileEntryList *file_entry_list; static unsigned file_count; -static unsigned max_userview_len; -static unsigned max_filename_len; -static unsigned max_linkname_len; -static unsigned global_max_filename_len; -static unsigned global_max_linkname_len; +static unsigned max_visual_userview_len; +static unsigned max_visual_filename_len; +static unsigned max_visual_linkname_len; +static unsigned global_max_visual_filename_len; +static unsigned global_max_visual_linkname_len; -static void ReadFileList(DirEntry *dir_entry); +static void ReadFileList(BOOL tagged_only, DirEntry *dir_entry); static void SortFileEntryList(void); static int SortByName(FileEntryList *e1, FileEntryList *e2); static int SortByChgTime(FileEntryList *e1, FileEntryList *e2); @@ -50,7 +50,7 @@ static int SortByGroup(FileEntryList *e1, FileEntryList *e2); static int SortByExtension(FileEntryList *e1, FileEntryList *e2); static void DisplayFiles(DirEntry *de_ptr, int start_file_no, int hilight_no, int start_x); -static void ReadGlobalFileList(DirEntry *dir_entry); +static void ReadGlobalFileList(BOOL tagged_only, DirEntry *dir_entry); static void WalkTaggedFiles(int start_file, int cursor_pos, int (*fkt) (/* ??? */), WalkingPackage *walking_package); static BOOL IsMatchingTaggedFiles(void); static void RemoveFileEntry(int entry_no); @@ -75,31 +75,31 @@ file_mode = new_file_mode; switch( file_mode ) { - case MODE_1: if( max_linkname_len) + case MODE_1: if( max_visual_linkname_len) max_column = window_width / - (max_filename_len + max_linkname_len + 45); + (max_visual_filename_len + max_visual_linkname_len + 45); else - max_column = window_width / (max_filename_len + 41); + max_column = window_width / (max_visual_filename_len + 41); break; - case MODE_2: if( max_linkname_len) + case MODE_2: if( max_visual_linkname_len) max_column = window_width / - (max_filename_len + max_linkname_len + 41); + (max_visual_filename_len + max_visual_linkname_len + 41); else - max_column = window_width / (max_filename_len + 37); + max_column = window_width / (max_visual_filename_len + 37); break; - case MODE_3: max_column = window_width / (max_filename_len + 3); + case MODE_3: max_column = window_width / (max_visual_filename_len + 3); break; - case MODE_4: if( max_linkname_len) + case MODE_4: if( max_visual_linkname_len) max_column = window_width / - (max_filename_len + max_linkname_len + 44); + (max_visual_filename_len + max_visual_linkname_len + 44); else - max_column = window_width / (max_filename_len + 40); + max_column = window_width / (max_visual_filename_len + 40); break; - case MODE_5: max_userview_len = GetUserFileEntryLength(max_filename_len, - max_linkname_len, - USERVIEW); - if(max_userview_len) - max_column = window_width / (max_userview_len + 1); + case MODE_5: max_visual_userview_len = GetVisualUserFileEntryLength(max_visual_filename_len, + max_visual_linkname_len, + USERVIEW); + if(max_visual_userview_len) + max_column = window_width / (max_visual_userview_len + 1); else max_column = 0; break; @@ -130,61 +130,18 @@ - -static void ReadTaggedList(DirEntry *dir_entry) -{ - FileEntry *fe_ptr; - unsigned int name_len; - unsigned int linkname_len; - - max_filename_len = 0; - max_linkname_len = 0; - - for( fe_ptr = dir_entry->file; fe_ptr; fe_ptr = fe_ptr->next ) - { - if (( fe_ptr->matching ) && ( fe_ptr->tagged )) - { - file_entry_list[file_count++].file = fe_ptr; - name_len = strlen( fe_ptr->name ); - if( S_ISLNK( fe_ptr->stat_struct.st_mode ) ) - { - linkname_len = strlen( &fe_ptr->name[name_len+1] ); - max_linkname_len = MAX( max_linkname_len, linkname_len ); - } - max_filename_len = MAX( max_filename_len, name_len ); - } - } -} - -static void ReadTaggedFileList(DirEntry *dir_entry) -{ - DirEntry *de_ptr; - - for( de_ptr=dir_entry; de_ptr; de_ptr=de_ptr->next ) - { - if( de_ptr->sub_tree ) ReadTaggedFileList( de_ptr->sub_tree ); - ReadTaggedList( de_ptr ); - global_max_filename_len = MAX( global_max_filename_len, max_filename_len ); - global_max_linkname_len = MAX( global_max_linkname_len, max_linkname_len ); - } - max_filename_len = global_max_filename_len; - max_linkname_len = global_max_linkname_len; -} - - - static void BuildFileEntryList(DirEntry *dir_entry){ if( file_entry_list ) { free( file_entry_list ); file_entry_list = NULL; } + if( !dir_entry->global_flag ) { - /* ... for !ANSI-Systeme ... */ - /*----------------------------*/ - if( dir_entry->matching_files == 0 ) { - file_entry_list = NULL; - } else { + /* ... for !ANSI-Systeme ... */ + /*---------------------------*/ + if( dir_entry->matching_files > 0 ) { + if( ( file_entry_list = (FileEntryList *) calloc( dir_entry->matching_files, sizeof( FileEntryList ) @@ -193,93 +150,76 @@ ERROR_MSG( "Calloc Failed*ABORT" ); exit( 1 ); } - } - file_count = 0; - ReadFileList( dir_entry ); - SortFileEntryList(); - SetFileMode( file_mode ); /* recalc */ - } else if (!dir_entry->tagged_flag) { - if( statistic.disk_matching_files == 0 ) { - file_entry_list = NULL; - } else { - if( ( file_entry_list = (FileEntryList *) - calloc( statistic.disk_matching_files, + } + file_count = 0; + ReadFileList( dir_entry->tagged_flag, dir_entry ); + SortFileEntryList(); + SetFileMode( file_mode ); /* recalc */ + + } else { + + if( statistic.disk_matching_files > 0 ) { + + if( ( file_entry_list = (FileEntryList *) + calloc( (dir_entry->tagged_flag) ? statistic.disk_tagged_files : statistic.disk_matching_files, sizeof( FileEntryList ) - ) ) - == NULL ) { + ) ) == NULL ) { ERROR_MSG( "Calloc Failed*ABORT" ); exit( 1 ); } } file_count = 0; - global_max_filename_len = 0; - global_max_linkname_len = 0; - ReadGlobalFileList( statistic.tree ); + global_max_visual_filename_len = 0; + global_max_visual_linkname_len = 0; + ReadGlobalFileList( dir_entry->tagged_flag, statistic.tree ); SortFileEntryList(); SetFileMode( file_mode ); /* recalc */ - } else { - if( statistic.disk_matching_files == 0 ) { - file_entry_list = NULL; - } else { - if( ( file_entry_list = (FileEntryList *) - calloc( statistic.disk_tagged_files, - sizeof( FileEntryList ) - ) ) - == NULL ) { - ERROR_MSG( "Calloc Failed*ABORT" ); - exit( 1 ); - } - } - file_count = 0; - global_max_filename_len = 0; - global_max_linkname_len = 0; - ReadTaggedFileList( statistic.tree ); - SortFileEntryList(); - SetFileMode( file_mode ); /* recalc */ - } + } } -static void ReadFileList(DirEntry *dir_entry) +static void ReadFileList(BOOL tagged_only, DirEntry *dir_entry) { FileEntry *fe_ptr; unsigned int name_len; - unsigned int linkname_len; + unsigned int visual_name_len; + unsigned int visual_linkname_len; - max_filename_len = 0; - max_linkname_len = 0; + max_visual_filename_len = 0; + max_visual_linkname_len = 0; for( fe_ptr = dir_entry->file; fe_ptr; fe_ptr = fe_ptr->next ) { - if( fe_ptr->matching ) + if( fe_ptr->matching && (!tagged_only || fe_ptr->tagged) ) { file_entry_list[file_count++].file = fe_ptr; + visual_name_len = StrVisualLength( fe_ptr->name ); name_len = strlen( fe_ptr->name ); if( S_ISLNK( fe_ptr->stat_struct.st_mode ) ) { - linkname_len = strlen( &fe_ptr->name[name_len+1] ); - max_linkname_len = MAX( max_linkname_len, linkname_len ); + visual_linkname_len = StrVisualLength( &fe_ptr->name[name_len+1] ); + max_visual_linkname_len = MAX( max_visual_linkname_len, visual_linkname_len ); } - max_filename_len = MAX( max_filename_len, name_len ); + max_visual_filename_len = MAX( max_visual_filename_len, visual_name_len ); } } } -static void ReadGlobalFileList(DirEntry *dir_entry) +static void ReadGlobalFileList(BOOL tagged_only, DirEntry *dir_entry) { DirEntry *de_ptr; for( de_ptr=dir_entry; de_ptr; de_ptr=de_ptr->next ) { - if( de_ptr->sub_tree ) ReadGlobalFileList( de_ptr->sub_tree ); - ReadFileList( de_ptr ); - global_max_filename_len = MAX( global_max_filename_len, max_filename_len ); - global_max_linkname_len = MAX( global_max_linkname_len, max_linkname_len ); + if( de_ptr->sub_tree ) ReadGlobalFileList( tagged_only, de_ptr->sub_tree ); + ReadFileList( tagged_only, de_ptr ); + global_max_visual_filename_len = MAX( global_max_visual_filename_len, max_visual_filename_len ); + global_max_visual_linkname_len = MAX( global_max_visual_linkname_len, max_visual_linkname_len ); } - max_filename_len = global_max_filename_len; - max_linkname_len = global_max_linkname_len; + max_visual_filename_len = global_max_visual_filename_len; + max_visual_linkname_len = global_max_visual_linkname_len; } @@ -333,9 +273,9 @@ return( - (strcmp( e1->file->name, e2->file->name ) ) ); else if (order) - return( strcasecmp( e1->file->name, e2->file->name ) ); + return( StrCaseCmp( e1->file->name, e2->file->name ) ); else - return( - (strcasecmp( e1->file->name, e2->file->name ) ) ); + return( - (StrCaseCmp( e1->file->name, e2->file->name ) ) ); } @@ -349,7 +289,7 @@ ext1 = GetExtension(e1->file->name); ext2 = GetExtension(e2->file->name); cmp=strcmp( ext1, ext2 ); - casecmp=strcasecmp( ext1, ext2 ); + casecmp=StrCaseCmp( ext1, ext2 ); if (do_case && !cmp) return SortByName( e1, e2 ); @@ -364,9 +304,9 @@ return( - (strcmp( ext1, ext2 ) ) ); else if (order) - return( strcasecmp( ext1, ext2 ) ); + return( StrCaseCmp( ext1, ext2 ) ); else - return( - (strcasecmp( ext1, ext2 ) ) ); + return( - (StrCaseCmp( ext1, ext2 ) ) ); } @@ -436,9 +376,9 @@ return( - (strcmp( o1, o2 ) ) ); else if (order) - return( strcasecmp( o1, o2 ) ); + return( StrCaseCmp( o1, o2 ) ); else - return( - (strcasecmp( o1, o2 ) ) ); + return( - (StrCaseCmp( o1, o2 ) ) ); } @@ -469,9 +409,9 @@ return( - (strcmp( g1, g2 ) ) ); else if (order) - return( strcasecmp( g1, g2 ) ); + return( StrCaseCmp( g1, g2 ) ); else - return( - (strcasecmp( g1, g2 ) ) ); + return( - (StrCaseCmp( g1, g2 ) ) ); } @@ -485,22 +425,24 @@ static void RemoveFileEntry(int entry_no) { - int i, n, l; + int i, n; FileEntry *fe_ptr; + int visual_name_len, name_len; - max_filename_len = 0; - max_linkname_len = 0; + max_visual_filename_len = 0; + max_visual_linkname_len = 0; n = file_count - 1; for( i=0; i < n; i++ ) { if( i >= entry_no ) file_entry_list[i] = file_entry_list[i+1]; fe_ptr = file_entry_list[i].file; - l = strlen( fe_ptr->name ); - max_filename_len = MAX( (int)max_filename_len, l ); + visual_name_len = StrVisualLength( fe_ptr->name ); + name_len = strlen( fe_ptr->name ); + max_visual_filename_len = MAX( (int)max_visual_filename_len, visual_name_len ); if( S_ISLNK( fe_ptr->stat_struct.st_mode ) ) { - max_linkname_len = MAX( max_filename_len, strlen( &fe_ptr->name[l+1] ) ); + max_visual_linkname_len = MAX( max_visual_filename_len, StrVisualLength( &fe_ptr->name[name_len+1] ) ); } } @@ -513,11 +455,12 @@ static void ChangeFileEntry(void) { - int i, n, l; + int i, n; FileEntry *fe_ptr; + int visual_name_len, name_len; - max_filename_len = 0; - max_linkname_len = 0; + max_visual_filename_len = 0; + max_visual_linkname_len = 0; n = file_count - 1; for( i=0; i < n; i++ ) @@ -525,11 +468,12 @@ fe_ptr = file_entry_list[i].file; if( fe_ptr ) { - l = strlen( fe_ptr->name ); - max_filename_len = MAX( (int)max_filename_len, l ); + visual_name_len = StrVisualLength( fe_ptr->name ); + name_len = strlen( fe_ptr->name ); + max_visual_filename_len = MAX( (int)max_visual_filename_len, visual_name_len ); if( S_ISLNK( fe_ptr->stat_struct.st_mode ) ) { - max_linkname_len = MAX( max_filename_len, strlen( &fe_ptr->name[l+1] ) ); + max_visual_linkname_len = MAX( max_visual_filename_len, StrVisualLength( &fe_ptr->name[name_len+1] ) ); } } } @@ -577,6 +521,8 @@ int ef_window_width; char *sym_link_name = NULL; char type_of_file = ' '; + int filename_width = 0; + int linkname_width = 0; ef_window_width = window_width - 2; /* Effektive Window-Width */ @@ -603,6 +549,16 @@ sym_link_name = ""; +#ifdef WITH_UTF8 + filename_width = max_visual_filename_len + ( strlen(fe_ptr->name) - StrVisualLength(fe_ptr->name) ); + if( fe_ptr && S_ISLNK( fe_ptr->stat_struct.st_mode ) ) + linkname_width = max_visual_linkname_len + ( strlen(sym_link_name) - StrVisualLength(sym_link_name) ); +#else + filename_width = max_visual_filename_len; + linkname_width = max_visual_linkname_len; +#endif + + type_of_file = GetTypeOfFile(fe_ptr->stat_struct); switch( file_mode ) @@ -621,8 +577,8 @@ { #ifdef HAS_LONGLONG (void) sprintf( format, "%%c%%c%%-%ds %%10s %%3d %%11lld %%12s -> %%-%ds", - max_filename_len, - max_linkname_len + filename_width, + linkname_width ); (void) sprintf( line_buffer, format, @@ -637,8 +593,8 @@ ); #else (void) sprintf( format, "%%c%%c%%-%ds %%10s %%3d %%7d %%12s -> %%-%ds", - max_filename_len, - max_linkname_len + filename_width, + linkname_width ); (void) sprintf( line_buffer, format, @@ -658,7 +614,7 @@ #ifdef HAS_LONGLONG (void) sprintf( format, "%%c%%c%%%c%ds %%10s %%3d %%11lld %%12s", justify, - max_filename_len + filename_width ); (void) sprintf( line_buffer, format, @@ -673,7 +629,7 @@ #else (void) sprintf( format, "%%c%%c%%%c%ds %%10s %%3d %%7d %%12s", justify, - max_filename_len + filename_width ); (void) sprintf( line_buffer, format, @@ -693,14 +649,14 @@ /* Empty Entry */ /*-------------*/ - (void) sprintf( format, "%%-%ds", max_filename_len + 42 ); + (void) sprintf( format, "%%-%ds", max_visual_filename_len + 42 ); (void) sprintf( line_buffer, format, "" ); } - if( max_linkname_len ) - pos_x = x * (max_filename_len + max_linkname_len + 47); + if( max_visual_linkname_len ) + pos_x = x * (max_visual_filename_len + max_visual_linkname_len + 47); else - pos_x = x * (max_filename_len + 43); + pos_x = x * (max_visual_filename_len + 43); break; case MODE_2 : if( fe_ptr ) @@ -728,8 +684,8 @@ #ifdef HAS_LONGLONG (void) sprintf( format, "%%c%%c%%%c%ds %%10lld %%-12s %%-12s -> %%-%ds", justify, - max_filename_len, - max_linkname_len + filename_width, + linkname_width ); (void) sprintf( line_buffer, format, (fe_ptr->tagged) ? TAGGED_SYMBOL : ' ', @@ -743,8 +699,8 @@ #else (void) sprintf( format, "%%c%%c%%%c%ds %%8u %%-12s %%-12s -> %%-%ds", justify, - max_filename_len, - max_linkname_len + filename_width, + linkname_width ); (void) sprintf( line_buffer, format, (fe_ptr->tagged) ? TAGGED_SYMBOL : ' ', @@ -762,7 +718,7 @@ #ifdef HAS_LONGLONG (void) sprintf( format, "%%c%%c%%%c%ds %%10lld %%-12s %%-12s", justify, - max_filename_len + filename_width ); (void) sprintf( line_buffer, format, (fe_ptr->tagged) ? TAGGED_SYMBOL : ' ', @@ -775,7 +731,7 @@ #else (void) sprintf( format, "%%c%%c%%%c%ds %%8u %%-12s %%-12s", justify, - max_filename_len + filename_width ); (void) sprintf( line_buffer, format, (fe_ptr->tagged) ? TAGGED_SYMBOL : ' ', @@ -794,21 +750,21 @@ /* Empty-Entry */ /*-------------*/ - (void) sprintf( format, "%%-%ds", max_filename_len + 38 ); + (void) sprintf( format, "%%-%ds", max_visual_filename_len + 38 ); (void) sprintf( line_buffer, format, "" ); } - if( max_linkname_len ) - pos_x = x * (max_filename_len + max_linkname_len + 43); + if( max_visual_linkname_len ) + pos_x = x * (max_visual_filename_len + max_visual_linkname_len + 43); else - pos_x = x * (max_filename_len + 39); + pos_x = x * (max_visual_filename_len + 39); break; case MODE_3 : if( fe_ptr ) { (void) sprintf( format, "%%c%%c%%%c%ds", justify, - max_filename_len ); + filename_width ); (void) sprintf( line_buffer, format, (fe_ptr->tagged) ? TAGGED_SYMBOL : ' ', @@ -821,11 +777,11 @@ /* Empty-Entry */ /*-------------*/ - (void) sprintf( format, "%%-%ds", max_filename_len + 2 ); + (void) sprintf( format, "%%-%ds", max_visual_filename_len + 2 ); (void) sprintf( line_buffer, format, "" ); } - pos_x = x * (max_filename_len + 3); + pos_x = x * (max_visual_filename_len + 3); break; case MODE_4 : if( fe_ptr ) @@ -837,8 +793,8 @@ { (void) sprintf( format, "%%c%%c%%%c%ds Chg: %%12s Acc: %%12s -> %%-%ds", justify, - max_filename_len, - max_linkname_len + filename_width, + linkname_width ); (void) sprintf( line_buffer, format, (fe_ptr->tagged) ? TAGGED_SYMBOL : ' ', @@ -853,7 +809,7 @@ { (void) sprintf( format, "%%c%%c%%%c%ds Chg: %%12s Acc: %%12s", justify, - max_filename_len + filename_width ); (void) sprintf( line_buffer, format, (fe_ptr->tagged) ? TAGGED_SYMBOL : ' ', @@ -869,20 +825,20 @@ /* Empty-Entry */ /*-------------*/ - (void) sprintf( format, "%%-%ds", max_filename_len + 39 ); + (void) sprintf( format, "%%-%ds", max_visual_filename_len + 39 ); (void) sprintf( line_buffer, format, "" ); } - if( max_linkname_len ) - pos_x = x * (max_filename_len + max_linkname_len + 44); + if( max_visual_linkname_len ) + pos_x = x * (max_visual_filename_len + max_visual_linkname_len + 44); else - pos_x = x * (max_filename_len + 40); + pos_x = x * (max_visual_filename_len + 40); break; case MODE_5 : if( fe_ptr ) { - BuildUserFileEntry(fe_ptr, max_filename_len, max_linkname_len, + BuildUserFileEntry(fe_ptr, filename_width, linkname_width, USERVIEW, 200, line_buffer); } @@ -891,10 +847,10 @@ /* Empty-Entry */ /*-------------*/ - (void) sprintf( format, "%%-%ds", max_userview_len ); + (void) sprintf( format, "%%-%ds", max_visual_userview_len ); (void) sprintf( line_buffer, format, "" ); } - pos_x = x * (max_userview_len + 1); + pos_x = x * (max_visual_userview_len + 1); break; } @@ -915,16 +871,20 @@ } else { + int line_end_pos; + /* ... does not fit; use start_x */ /*-------------------------------*/ if( n > ( start_x + ef_window_width ) ) - line_ptr = &line_buffer[start_x]; /* TODO: UTF-8 */ + line_ptr = &line_buffer[VisualPositionToBytePosition(line_buffer, start_x)]; else - line_ptr = &line_buffer[n - ef_window_width]; /* TODO: UTF-8 */ + line_ptr = &line_buffer[VisualPositionToBytePosition(line_buffer, n - ef_window_width)]; + hide_left = start_x; - hide_right = n - start_x - ef_window_width; - line_ptr[ef_window_width] = '\0'; + line_end_pos = VisualPositionToBytePosition(line_ptr, ef_window_width); + hide_right = StrVisualLength(&line_ptr[line_end_pos]); + line_ptr[line_end_pos] = '\0'; } #ifdef NO_HIGHLIGHT @@ -947,7 +907,10 @@ if( hilight ) wattrset( file_window, 0 ); #endif /* NO_HIGHLIGHT */ - +#ifdef WITH_UTF8 + if(x_step == 1 && start_x > 0) + wclrtoeol(file_window); /* maybe needed if filename contains wide characters */ +#endif } @@ -1106,7 +1069,7 @@ TRUE , *start_x ); - if( hide_right < 0 ) (*start_x)--; + if( hide_right <= 0 ) (*start_x)--; } else if( *start_file + *cursor_pos >= (int)file_count - 1 ) { @@ -2745,7 +2708,31 @@ need_dsp_help = TRUE; break; - default: beep(); + case KEY_F(28): /* Ctrl-F4 */ + case KEY_F(4+12): /* Shift-F4 */ + + /* Toggle mode (if possible) */ + if(dir_entry->tagged_files) + dir_entry->tagged_flag = !dir_entry->tagged_flag; + else + dir_entry->tagged_flag = FALSE; + + BuildFileEntryList ( dir_entry ); + + dir_entry->start_file = 0; + dir_entry->cursor_pos = 0; + DisplayFiles + ( + dir_entry, + dir_entry->start_file, + dir_entry->start_file + dir_entry->cursor_pos, + start_x + ); + maybe_change_x_step = TRUE; + break; + + default: + beep(); break; } } while( ch != CR && ch != ESC && ch != LOGIN_ESC ); @@ -3079,7 +3066,7 @@ } n = strlen(str); - if((newStr = malloc(n+2)) == NULL) { + if((newStr = (char *)malloc(n+2)) == NULL) { ERROR_MSG( "Malloc failed*ABORT" ); exit( 1 ); } @@ -3106,7 +3093,7 @@ for( i=tmp2; i < file_count; i++ ) { fe_ptr = file_entry_list[i].file; - if(!strncasecmp(newStr, fe_ptr->name, n+1)) + if(!StrNCaseCmp(newStr, fe_ptr->name, n+1)) break; } diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/ytree-2.07/init.c new/ytree-2.08/init.c --- old/ytree-2.07/init.c 2024-02-18 16:03:17.000000000 +0100 +++ new/ytree-2.08/init.c 2024-04-05 14:24:38.000000000 +0200 @@ -71,10 +71,10 @@ ReadHistory(buffer); } - SetFileMode( strtod(FILEMODE, NULL) ); + SetFileMode( strtol(FILEMODE, NULL, 0) ); SetKindOfSort( SORT_BY_NAME ); number_seperator = *(NUMBERSEP); - bypass_small_window = (BOOL)strtod(NOSMALLWINDOW, NULL ); + bypass_small_window = (strtol(NOSMALLWINDOW, NULL, 0 )) ? TRUE : FALSE; initial_directory = INITIALDIR; InitClock(); diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/ytree-2.07/input.c new/ytree-2.08/input.c --- old/ytree-2.07/input.c 2024-02-18 16:03:17.000000000 +0100 +++ new/ytree-2.08/input.c 2024-04-05 14:24:38.000000000 +0200 @@ -13,98 +13,226 @@ ***************************************************************************/ -char *StrLeft(const char *str, size_t count) +char *StrLeft(const char *str, size_t visible_count) { + char *result; + size_t len; + int left_bytes; + #ifdef WITH_UTF8 mbstate_t state; - char *p; + const char *s, *s_start;; + int pos = 0; #endif - char *rez, *tmp; - size_t len, i; -#ifdef WITH_UTF8 - memset(&state, 0, sizeof(state)); -#endif - if (count == 0) return(Strdup("")); + if (visible_count == 0) + return(Strdup("")); + len = StrVisualLength(str); - if (count >= len) return(Strdup(str)); + if (visible_count >= len) + return(Strdup(str)); - len = 0; - - tmp = Strdup(str); -#ifdef WITH_UTF8 - p = tmp; -#endif - for (i = 0; i < count; i++) { #ifdef WITH_UTF8 - len += mbrlen(p, 4, &state); - p = tmp + len; + + s_start = s = str; + + while(*s) { + + wchar_t wc; + size_t sz; + int width; + + s_start = s; + memset(&state, 0, sizeof(state)); + sz = mbrtowc(&wc, s, 4, &state); + if(sz == (size_t)-1 || sz == (size_t)-2) { + if( (*s++ & 0xc0) == 0xc0) { /* skip to next char */ + while( (*s & 0xc0) == 0x80) + s++; + } + pos += 4; /* assume worst case */ + } else { + s += sz; + width = wcwidth(wc); + if(width >= 0) + pos += width; + else + pos++; + } + + if(pos > visible_count) + break; /* exceeds limit */ + } + + if(*s) + left_bytes = s_start - str; + else + left_bytes = s - str; + #else - len++; + left_bytes = visible_count; #endif - } - free(tmp); - - rez = Strndup(str, len); - rez[len] = '\0'; - return(rez); + + result = Strndup(str, left_bytes); + return(result); } -char *StrRight(const char *str, size_t count) + +char *StrRight(const char *str, size_t visible_count) { + char *result; + size_t visual_len; + #ifdef WITH_UTF8 + int left_bytes, pos = 0; mbstate_t state; + const char *s, *s_start; #endif - char *rez, *p, *tmp; - size_t byte_len, char_len, tmp_len, i; + if (visible_count == 0) + return(Strdup("")); + + visual_len = StrVisualLength(str); + if(visual_len <= visible_count) + return(Strdup(str)); + #ifdef WITH_UTF8 - memset(&state, 0, sizeof(state)); -#endif - if (count == 0) return(Strdup("")); + s_start = s = str; - byte_len = strlen(str); - char_len = StrVisualLength(str); - - if (count > char_len) count = char_len; - - tmp = Strdup(str); - p = tmp; - i = 0; - rez = NULL; - while ( (p - tmp) < byte_len ) { - if (i == (char_len - count) ) { - rez = Strdup(p); + while(*s) { + + wchar_t wc; + size_t sz; + int width; + + s_start = s; + memset(&state, 0, sizeof(state)); + sz = mbrtowc(&wc, s, 4, &state); + if(sz == (size_t)-1 || sz == (size_t)-2) { + if( (*s++ & 0xc0) == 0xc0) { /* skip to next char */ + while( (*s & 0xc0) == 0x80) + s++; + } + pos += 4; /* assume worst case */ + } else { + s += sz; + width = wcwidth(wc); + if(width >= 0) + pos += width; + else + pos++; } -#ifdef WITH_UTF8 - tmp_len = mbrlen(p, 4, &state); + + if((visual_len - pos) < visible_count) + break; /* fits */ + } + + if(*s) + left_bytes = s_start - str; + else + left_bytes = s - str; + + result = Strdup(&str[left_bytes]); + #else - tmp_len = 1; + result = Strdup( &str[visual_len - visible_count] ); #endif - p += tmp_len; - i++; - } - free(tmp); - return(rez); + return(result); } + + int StrVisualLength(const char *str) { + int len; + #ifdef WITH_UTF8 + + int pos = 0; + size_t sz; mbstate_t state; - int len = 0; - - memset(&state, '\0', sizeof(state)); - len = mbsrtowcs(NULL, &str, strlen(str), &state); - if(len < 0) { - /* Invalid multibyte sequence */ - len = strlen(str); + const char *s = str; + wchar_t buffer[PATH_LENGTH+1]; + + do { + memset(&state, 0, sizeof(state)); + sz = mbrtowc(&buffer[pos], s, 4, &state); + if( sz == (size_t) -1 || sz == (size_t)-2 ) { + if( (*s++ & 0xc0) == 0xc0) { /* skip to next char */ + while( (*s & 0xc0) == 0x80) + s++; + } + buffer[pos++] = L'#'; /* Assume worst case: */ + buffer[pos++] = L'#'; /* 1 wide char produces 4 visible chars */ + buffer[pos++] = L'#'; + buffer[pos] = L'#'; + } else { + s += sz; + } + pos++; + } while(sz != 0); + + len = wcswidth(buffer, PATH_LENGTH); + + if(len < 0) + len = pos; /* should not happen */ + +#else + len = strlen(str); +#endif + + return len; +} + + +/* returns byte position for visual position */ +int VisualPositionToBytePosition(const char *str, int visual_pos) +{ + +#ifdef WITH_UTF8 + + mbstate_t state; + const char *s, *s_start; + int pos = 0; + + s_start = s = str; + + while(*s) { + + wchar_t wc; + size_t sz; + int width; + + s_start = s; + memset(&state, 0, sizeof(state)); + sz = mbrtowc(&wc, s, 4, &state); + if(sz == (size_t)-1 || sz == (size_t)-2) { + if( (*s++ & 0xc0) == 0xc0) { /* skip to next char */ + while( (*s & 0xc0) == 0x80) + s++; + } + pos += 4; /* assume worst case */ + } else { + s += sz; + width = wcwidth(wc); + if(width > 0) + pos += width; + else + pos++; + } + + if(pos > visual_pos) + return( s_start - str ); } + + return( s - str ); + #else - return(strlen(str)); + return visual_pos; #endif + } @@ -116,7 +244,7 @@ { int p; /* Aktuelle Position */ int c1; /* Gelesenes Zeichen */ - int i; /* Laufvariable */ + int i, n; /* Laufvariable */ char *pp; BOOL len_flag = FALSE; char path[PATH_LENGTH + 1]; @@ -192,30 +320,34 @@ break; case KEY_END : p = StrVisualLength( s ); break; - case KEY_DC : if( p < StrVisualLength(s) ) + case KEY_DC : n = StrVisualLength(s); + if( p < n ) { ls = StrLeft(s, p); - rs = StrRight(s, StrVisualLength(s) - p - 1); + rs = StrRight(s, n - p - 1); strcpy(s, ls); strcat(s, rs); free(ls); free(rs); MvAddStr( y, x, s ); - addch( '_' ); + for(i=StrVisualLength(s); i < n; i++) + addch( '_' ); } break; case 0x08 : case 0x7F : case KEY_BACKSPACE : if( p > 0 ) { + n = StrVisualLength(s); ls = StrLeft(s, p - 1); - rs = StrRight(s, StrVisualLength(s) - p); + rs = StrRight(s, n - p); strcpy(s, ls); strcat(s, rs); free(ls); free(rs); MvAddStr( y, x, s ); - addch( '_' ); + for(i=StrVisualLength(s); i < n; i++) + addch( '_' ); p--; } else diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/ytree-2.07/login.c new/ytree-2.08/login.c --- old/ytree-2.07/login.c 2024-02-18 16:03:17.000000000 +0100 +++ new/ytree-2.08/login.c 2024-04-05 14:24:38.000000000 +0200 @@ -570,7 +570,7 @@ (void) strcpy( statistic.tree->name, path ); statistic.tree->next = statistic.tree->prev = NULL; - depth = strtod(TREEDEPTH, NULL); + depth = strtol(TREEDEPTH, NULL, 0); if( ReadTree( statistic.tree, path, depth ) ) { ERROR_MSG( "ReadTree Failed" ); diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/ytree-2.07/patchlev.h new/ytree-2.08/patchlev.h --- old/ytree-2.07/patchlev.h 2024-02-18 16:03:17.000000000 +0100 +++ new/ytree-2.08/patchlev.h 2024-04-05 14:24:38.000000000 +0200 @@ -5,6 +5,6 @@ ***************************************************************************/ -#define VERSION "2.07" -#define PATCHLEVEL 0 -#define VERSIONDATE "18 Feb 2024" +#define VERSION "2.08" +#define PATCHLEVEL 2 +#define VERSIONDATE "05 Apr 2024" diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/ytree-2.07/readtree.c new/ytree-2.08/readtree.c --- old/ytree-2.07/readtree.c 2024-02-18 16:03:17.000000000 +0100 +++ new/ytree-2.08/readtree.c 2024-04-05 14:24:38.000000000 +0200 @@ -118,13 +118,13 @@ /*-----------------*/ if( ( den_ptr = (DirEntry *) - malloc( sizeof( DirEntry ) + strlen( dirent->d_name ) ) + calloc( 1, sizeof( DirEntry ) + strlen( dirent->d_name ) ) ) == NULL ) { ERROR_MSG( "Malloc Failed*ABORT" ); exit( 1 ); } - + den_ptr->up_tree = dir_entry; (void) strcpy( den_ptr->name, dirent->d_name ); @@ -192,7 +192,7 @@ link_path[n] = '\0'; if( ( fen_ptr = (FileEntry *) - malloc( sizeof( FileEntry ) + + calloc( 1, sizeof( FileEntry ) + strlen( dirent->d_name ) + n + 1 ) ) == NULL ) @@ -208,7 +208,7 @@ else { if( ( fen_ptr = (FileEntry *) - malloc( sizeof( FileEntry ) + strlen( dirent->d_name ) ) + calloc( 1, sizeof( FileEntry ) + strlen( dirent->d_name ) ) ) == NULL ) { ERROR_MSG( "Malloc Failed*ABORT" ); diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/ytree-2.07/stat.c new/ytree-2.08/stat.c --- old/ytree-2.07/stat.c 2024-02-18 16:03:17.000000000 +0100 +++ new/ytree-2.08/stat.c 2024-04-05 14:24:38.000000000 +0200 @@ -75,7 +75,7 @@ (void) GetPath( dir_entry, statistic.path ); if (dir_entry -> not_scanned) strcat(statistic.path,"*"); - sprintf(auxbuff, format, FormFilename( buffer, statistic.path, COLS - 10 )); + sprintf(auxbuff, format, FormFilename( buffer, statistic.path, MAXIMUM(COLS - 10, 0))); wmove( stdscr, 0, 6); wclrtoeol( stdscr); Print( stdscr, 0, 6, auxbuff, HIMENUS_COLOR); @@ -131,7 +131,7 @@ (void) GetPath( dir_entry, statistic.path ); if (dir_entry -> not_scanned) strcat(statistic.path,"*"); - sprintf(auxbuff, format, FormFilename(buffer,statistic.path, COLS-10)); + sprintf(auxbuff, format, FormFilename(buffer,statistic.path, MAXIMUM(COLS-10,0))); wmove( stdscr, 0, 6); wclrtoeol( stdscr); Print( stdscr, 0, 6, auxbuff, HIMENUS_COLOR); @@ -155,7 +155,7 @@ (void) sprintf( format, "[%%-%ds]", COLS - 10 ); (void) GetPath( file_entry->dir_entry, buffer1 ); - FormFilename( buffer2, buffer1, COLS - 10 ); + FormFilename( buffer2, buffer1, MAXIMUM(COLS - 10, 0) ); sprintf(buffer1, format, buffer2); wmove( stdscr, 0, 6); wclrtoeol( stdscr); diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/ytree-2.07/util.c new/ytree-2.08/util.c --- old/ytree-2.07/util.c 2024-02-18 16:03:17.000000000 +0100 +++ new/ytree-2.08/util.c 2024-04-05 14:24:38.000000000 +0200 @@ -504,18 +504,36 @@ int begin; unsigned int l; - l = strlen(src); + l = strlen(src); /* TODO: UTF-8 */ begin = 0; if( l <= max_len ) return( strcpy( dest, src ) ); else { - for(i=0; i < (int) max_len - 4; i++) - if( src[l - i] == FILE_SEPARATOR_CHAR || src[l - i] == '\\' ) - begin = l - i; (void) strcpy( dest, "/..." ); - return( strcat(dest, &src[begin] ) ); + + if(max_len < 4) { + dest[max_len] = '\0'; + } else { + for(i=0; i < (int) max_len - 4; i++) + if( src[l - i] == FILE_SEPARATOR_CHAR || src[l - i] == '\\' ) + begin = l - i; + + if(begin > 0) { + strcat(dest, &src[begin] ); + if(strlen(dest) > max_len) + strcpy( &dest[max_len - 3], "..." ); + } else { + for(i=0; i < l; i++) + if( src[i] == FILE_SEPARATOR_CHAR || src[i] == '\\' ) + begin = i; /* find last '/' */ + strcat(dest, &src[begin] ); + if(strlen(dest) > max_len) + strcpy( &dest[max_len - 3], "..." ); + } + } + return dest; } } @@ -842,6 +860,43 @@ +int StrNCaseCmp(char *s1, char *s2, unsigned int n) +{ + int c1, c2; + unsigned char *us1 = (unsigned char*)s1; + unsigned char *us2 = (unsigned char*)s2; + + if(n == 0) + return(0); + + do + { + c1 = toupper(*us1++); + c2 = toupper(*us2++); + } while((c1 == c2) && (c1 != '\0') && (--n != 0)); + + return(c1 - c2); +} + + + +int StrCaseCmp(char *s1, char *s2) +{ + int c1, c2; + unsigned char *us1 = (unsigned char*)s1; + unsigned char *us2 = (unsigned char*)s2; + + do + { + c1 = toupper(*us1++); + c2 = toupper(*us2++); + } while((c1 == c2) && (c1 != '\0')); + + return(c1 - c2); +} + + + /* NeXT does not define strdup */ char *Strdup(const char *s) { @@ -883,7 +938,7 @@ if(cptr == NULL) return ""; if(cptr == filename) return ""; - // filenames beginning with a dot are not an extension + /* filenames beginning with a dot are not an extension */ return(cptr + 1); } @@ -908,7 +963,7 @@ int BuildUserFileEntry(FileEntry *fe_ptr, - int max_filename_len, int max_linkname_len, + int filename_width, int linkname_width, char *template, int linelen, char *line) { char attributes[11]; @@ -956,8 +1011,8 @@ } - sprintf(format1, "%%-%ds", max_filename_len); - sprintf(format2, "%%-%ds", max_linkname_len); + sprintf(format1, "%%-%ds", filename_width); + sprintf(format2, "%%-%ds", linkname_width); for(sptr=template, dptr=buffer; *sptr; ) { @@ -973,7 +1028,7 @@ n = sprintf(dptr, "%3d", (int)fe_ptr->stat_struct.st_nlink); } else if(!strncmp(sptr, FILESIZE_VIEWNAME, 3)) { #ifdef HAS_LONGLONG - n = sprintf(dptr, "%7lld", (LONGLONG) fe_ptr->stat_struct.st_size); + n = sprintf(dptr, "%11lld", (LONGLONG) fe_ptr->stat_struct.st_size); #else n = sprintf(dptr, "%7d", fe_ptr->stat_struct.st_size); #endif @@ -987,7 +1042,7 @@ n = sprintf(dptr, "%-8s", group_name_ptr); } else if(!strncmp(sptr, INODE_VIEWNAME, 3)) { #ifdef HAS_LONGLONG - n = sprintf(dptr, "%7lld", (LONGLONG)fe_ptr->stat_struct.st_ino); + n = sprintf(dptr, "%11lld", (LONGLONG)fe_ptr->stat_struct.st_ino); #else n = sprintf(dptr, "%7ld", (int)fe_ptr->stat_struct.st_ino); #endif @@ -1018,7 +1073,7 @@ -int GetUserFileEntryLength( int max_filename_len, int max_linkname_len, char *template) +int GetVisualUserFileEntryLength( int max_visual_filename_len, int max_visual_linkname_len, char *template) { int len, n; char *sptr; @@ -1031,7 +1086,7 @@ if(!strncmp(sptr, TAGSYMBOL_VIEWNAME, 3)) { n=1; } else if(!strncmp(sptr, FILENAME_VIEWNAME, 3)) { - n = max_filename_len; + n = max_visual_filename_len; } else if(!strncmp(sptr, ATTRIBUTE_VIEWNAME, 3)) { n = 10; } else if(!strncmp(sptr, LINKCOUNT_VIEWNAME, 3)) { @@ -1041,7 +1096,7 @@ } else if(!strncmp(sptr, MODTIME_VIEWNAME, 3)) { n = 12; } else if(!strncmp(sptr, SYMLINK_VIEWNAME, 3)) { - n = max_linkname_len; + n = max_visual_linkname_len; } else if(!strncmp(sptr, UID_VIEWNAME, 3)) { n = 8; } else if(!strncmp(sptr, GID_VIEWNAME, 3)) { diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/ytree-2.07/ytree-2.07.lsm new/ytree-2.08/ytree-2.07.lsm --- old/ytree-2.07/ytree-2.07.lsm 2024-02-18 16:05:04.000000000 +0100 +++ new/ytree-2.08/ytree-2.07.lsm 1970-01-01 01:00:00.000000000 +0100 @@ -1,18 +0,0 @@ -Begin4 -Title: ytree-2.07 -Version: 2.07 -Entered-date: 2024-02-18 -Description: Ytree is a nifty filemanager similar to xtree. - With some helper-applications (zip/zoo/tar/rpm etc.) - you can also browse archive files. Viewers for - "special" files are configurable (*.wav, *.gif etc.). - Even the commands/menus are now user configurable. - For a screenshot visit http://www.han.de/~werner/ytree.html -Keywords: file manager, browser, xtree -Author: wer...@frolix.han.de (Werner Bregulla) -Maintained-by: wer...@frolix.han.de (Werner Bregulla) -Primary-site: http://www.han.de/~werner/ytree.html - ytree-2.07.tar.gz - ytree-2.07.lsm -Copying-policy: GPL -End diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/ytree-2.07/ytree-2.08.lsm new/ytree-2.08/ytree-2.08.lsm --- old/ytree-2.07/ytree-2.08.lsm 1970-01-01 01:00:00.000000000 +0100 +++ new/ytree-2.08/ytree-2.08.lsm 2024-04-05 14:24:38.000000000 +0200 @@ -0,0 +1,18 @@ +Begin4 +Title: ytree-2.08 +Version: 2.08 +Entered-date: 2024-03-17 +Description: Ytree is a nifty filemanager similar to xtree. + With some helper-applications (zip/zoo/tar/rpm etc.) + you can also browse archive files. Viewers for + "special" files are configurable (*.wav, *.gif etc.). + Even the commands/menus are now user configurable. + For a screenshot visit http://www.han.de/~werner/ytree.html +Keywords: file manager, browser, xtree +Author: wer...@frolix.han.de (Werner Bregulla) +Maintained-by: wer...@frolix.han.de (Werner Bregulla) +Primary-site: http://www.han.de/~werner/ytree.html + ytree-2.08.tar.gz + ytree-2.08.lsm +Copying-policy: GPL +End diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/ytree-2.07/ytree.h new/ytree-2.08/ytree.h --- old/ytree-2.07/ytree.h 2024-02-18 16:03:17.000000000 +0100 +++ new/ytree-2.08/ytree.h 2024-04-05 14:24:38.000000000 +0200 @@ -12,7 +12,7 @@ #include <ctype.h> #include <math.h> -#if defined(__OpenBSD__) || defined(__NetBSD__) || defined(__FreeBSD__) || defined(__NetBSD__) || defined(__APPLE__) +#if defined(__OpenBSD__) || defined(__NetBSD__) || defined(__FreeBSD__) || defined(__NetBSD__) || defined(__APPLE__) || defined(SVR4) #include <locale.h> #endif @@ -1081,10 +1081,10 @@ extern char *GetExtension(char *filename); extern void StrCp(char *dest, const char *src); extern int BuildUserFileEntry(FileEntry *fe_ptr, - int max_filename_len, int max_linkname_len, + int filename_width, int linkname_width, char *template, int linelen, char *line); -extern int GetUserFileEntryLength(int max_filename_len, - int max_linkname_len, char *template); +extern int GetVisualUserFileEntryLength( int max_visual_filename_len, + int max_visual_linkname_len, char *template); extern LONGLONG AtoLL(char* cptr); extern void DisplayTree(WINDOW *win, int start_entry_no, int hilight_no); extern void ReCreateWindows(void); @@ -1099,6 +1099,9 @@ extern char *StrLeft(const char *str, size_t count); extern char *StrRight(const char *str, size_t count); extern int StrVisualLength(const char *str); +extern int VisualPositionToBytePosition(const char *str, int visual_pos); extern int WAttrAddStr(WINDOW *win, int attr, char *str); extern char *Strndup(const char *s, int len); extern char *CutName(char *dest, char *src, unsigned int max_len); +extern int StrCaseCmp(char *s1, char *s2); +extern int StrNCaseCmp(char *s1, char *s2, unsigned int n);