All of lore.kernel.org
 help / color / mirror / Atom feed
* [PATCH v5 0/6] More ls improvements
@ 2025-03-01  7:50 Glenn Washburn
  2025-03-01  7:50 ` [PATCH v5 1/6] commands/ls: Return proper GRUB_ERR_* for functions returning type grub_err_t Glenn Washburn
                   ` (5 more replies)
  0 siblings, 6 replies; 7+ messages in thread
From: Glenn Washburn @ 2025-03-01  7:50 UTC (permalink / raw)
  To: grub-devel, Daniel Kiper; +Cc: Vladimir Serbinenko, Glenn Washburn

Considering Daniel's feedback on the v2 of this patch series, I've broken up
patches #1 and #2 and dropped patch #3 from the original series. These changes
make the output of the ls command a little more like the GNU ls output.

Glenn Washburn

v5:
 * Rebase onto current master
 * Change ctx->filename to pathname != NULL in tertiary conditional in patch 5

v4: Add missing parenthesis

Glenn Washburn (6):
  commands/ls: Return proper GRUB_ERR_* for functions returning type
    grub_err_t
  commands/ls: Merge print_files_long and print_files into print_file
  commands/ls: Show modification time for file paths
  commands/ls: Output path for single file arguments given with path
  commands/ls: Print full paths for file args
  commands/ls: Add directory header for dir args

 grub-core/commands/ls.c | 97 ++++++++++++++++++++---------------------
 1 file changed, 48 insertions(+), 49 deletions(-)

Range-diff against v4:
1:  9086cccd8a0f = 1:  b89e1b373694 commands/ls: Return proper GRUB_ERR_* for functions returning type grub_err_t
2:  3192dc2471d0 = 2:  6cb474ddb291 commands/ls: Merge print_files_long and print_files into print_file
3:  889e1e05a355 ! 3:  fe84e5952a0c commands/ls: Show modification time for file paths
    @@ grub-core/commands/ls.c: grub_ls_list_files (char *dirname, int longlist, int al
      
     -	  grub_file_close (file);
     -
    --	  p = grub_strrchr (dirname, '/') + 1;
    --	  ctx.dirname = grub_strndup (dirname, p - dirname);
    +-	  p = grub_strrchr (dirname, '/');
    +-	  if (p == NULL)
     +	  /* PATH might be a regular file.  */
    -+	  ctx.filename = grub_strrchr (dirname, '/') + 1;
    ++	  ctx.filename = grub_strrchr (dirname, '/');
    ++	  if (ctx.filename == NULL)
    + 	    goto fail;
    +-	  ++p;
    ++	  ++(ctx.filename);
    + 
    +-	  ctx.dirname = grub_strndup (dirname, p - dirname);
     +	  ctx.dirname = grub_strndup (dirname, ctx.filename - dirname);
      	  if (ctx.dirname == NULL)
      	    goto fail;
4:  d63e007f635b = 4:  0a6e6c6d5c1e commands/ls: Output path for single file arguments given with path
5:  39adcb21e320 ! 5:  3637f8bd2c1f commands/ls: Print full paths for file args
    @@ grub-core/commands/ls.c: print_file (const char *filename, const struct grub_dir
      		     datetime.minute, datetime.second);
          }
     -  grub_printf ("%s%s\n", filename, info->dir ? "/" : "");
    -+  grub_printf ("%s%s\n", (ctx->filename) ? pathname : filename,
    ++  grub_printf ("%s%s\n", (pathname != NULL) ? pathname : filename,
     +			 info->dir ? "/" : "");
     +
     +  grub_free (pathname);
6:  0ebbfd3b0e15 ! 6:  44bbd467b424 commands/ls: Add directory header for dir args
    @@ grub-core/commands/ls.c: grub_ls_list_files (char *dirname, int longlist, int al
      
      	  /* PATH might be a regular file.  */
     +	  ctx.print_dirhdr = 0;
    - 	  ctx.filename = grub_strrchr (dirname, '/') + 1;
    - 	  ctx.dirname = grub_strndup (dirname, ctx.filename - dirname);
    - 	  if (ctx.dirname == NULL)
    + 	  ctx.filename = grub_strrchr (dirname, '/');
    + 	  if (ctx.filename == NULL)
    + 	    goto fail;
     @@ grub-core/commands/ls.c: grub_cmd_ls (grub_extcmd_context_t ctxt, int argc, char **args)
          grub_ls_list_devices (state[0].set);
        else
-- 
2.34.1


_______________________________________________
Grub-devel mailing list
Grub-devel@gnu.org
https://lists.gnu.org/mailman/listinfo/grub-devel

^ permalink raw reply	[flat|nested] 7+ messages in thread

end of thread, other threads:[~2025-03-01  7:52 UTC | newest]

Thread overview: 7+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2025-03-01  7:50 [PATCH v5 0/6] More ls improvements Glenn Washburn
2025-03-01  7:50 ` [PATCH v5 1/6] commands/ls: Return proper GRUB_ERR_* for functions returning type grub_err_t Glenn Washburn
2025-03-01  7:50 ` [PATCH v5 2/6] commands/ls: Merge print_files_long and print_files into print_file Glenn Washburn
2025-03-01  7:50 ` [PATCH v5 3/6] commands/ls: Show modification time for file paths Glenn Washburn
2025-03-01  7:50 ` [PATCH v5 4/6] commands/ls: Output path for single file arguments given with path Glenn Washburn
2025-03-01  7:50 ` [PATCH v5 5/6] commands/ls: Print full paths for file args Glenn Washburn
2025-03-01  7:50 ` [PATCH v5 6/6] commands/ls: Add directory header for dir args Glenn Washburn

This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.