X-Git-Url: http://git.annexia.org/?a=blobdiff_plain;f=fish%2Ffish.c;h=90740d56eb702385fb0663f2dd392dc81bca00d9;hb=107a76ad3680fda05cfd58136d62eeab4e77a8dc;hp=5b0a06560ee9c11f2d11c15f8896170a4ee344df;hpb=88da5cf8a32e683ed1d78419fcde609a389a2f65;p=libguestfs.git diff --git a/fish/fish.c b/fish/fish.c index 5b0a065..90740d5 100644 --- a/fish/fish.c +++ b/fish/fish.c @@ -724,6 +724,9 @@ issue_command (const char *cmd, char *argv[], const char *pipecmd) r = do_lcd (cmd, argc, argv); else if (strcasecmp (cmd, "glob") == 0) r = do_glob (cmd, argc, argv); + else if (strcasecmp (cmd, "more") == 0 || + strcasecmp (cmd, "less") == 0) + r = do_more (cmd, argc, argv); else r = run_action (cmd, argc, argv); @@ -818,6 +821,21 @@ display_builtin_command (const char *cmd) " Glob runs with wildcards expanded in any\n" " command args. Note that the command is run repeatedly\n" " once for each expanded argument.\n")); + else if (strcasecmp (cmd, "more") == 0 || + strcasecmp (cmd, "less") == 0) + printf (_("more - view a file in the pager\n" + " more \n" + "\n" + " This is used to view a file in the pager.\n" + "\n" + " It is the equivalent of (and is implemented by)\n" + " running \"cat\" and using the pager.\n" + "\n" + " Normally it uses $PAGER, but if you use the alias\n" + " \"less\" then it always uses \"less\".\n" + "\n" + " NOTE: This will not work reliably for large files\n" + " (> 2 MB) or binary files containing \\0 bytes.\n")); else if (strcasecmp (cmd, "help") == 0) printf (_("help - display a list of commands or help on a command\n" " help cmd\n" @@ -959,3 +977,21 @@ add_history_line (const char *line) nr_history_lines++; #endif } + +int +xwrite (int fd, const void *buf, size_t len) +{ + int r; + + while (len > 0) { + r = write (fd, buf, len); + if (r == -1) { + perror ("write"); + return -1; + } + buf += r; + len -= r; + } + + return 0; +}