remove -p (terse prompts)
[unix-history] / usr / src / usr.bin / more / command.c
index 5d5872c..c5453ae 100644 (file)
@@ -18,7 +18,7 @@
  */
 
 #ifndef lint
  */
 
 #ifndef lint
-static char sccsid[] = "@(#)command.c  5.12 (Berkeley) %G%";
+static char sccsid[] = "@(#)command.c  5.14 (Berkeley) %G%";
 #endif /* not lint */
 
 /*
 #endif /* not lint */
 
 /*
@@ -173,7 +173,7 @@ cmd_exec()
 prompt()
 {
        extern int terseprompt, linenums;
 prompt()
 {
        extern int terseprompt, linenums;
-       extern char *current_name, *firstsearch;
+       extern char *current_name, *firstsearch, *next_name;
        off_t len, pos, ch_length(), position(), forw_line();
        char pbuf[40];
 
        off_t len, pos, ch_length(), position(), forw_line();
        char pbuf[40];
 
@@ -227,7 +227,12 @@ prompt()
                so_enter();
                putstr(current_name);
                if (hit_eof)
                so_enter();
                putstr(current_name);
                if (hit_eof)
-                       putstr(": END");
+                       if (next_name) {
+                               (void)sprintf(pbuf, ": END (%s)", next_name);
+                               putstr(pbuf);
+                       }
+                       else
+                               putstr(": END");
                else if (linenums) {
                        (void)sprintf(pbuf, ": %d", currline(TOP));
                        putstr(pbuf);
                else if (linenums) {
                        (void)sprintf(pbuf, ": %d", currline(TOP));
                        putstr(pbuf);
@@ -513,10 +518,8 @@ again:             if (sigs)
                                clr_linenum();
                        }
                        /* FALLTHRU */
                                clr_linenum();
                        }
                        /* FALLTHRU */
-               case A_REPAINT:
-                       /*
-                        * Repaint screen.
-                        */
+
+               case A_REPAINT:         /* repaint the screen */
                        cmd_exec();
                        repaint();
                        break;
                        cmd_exec();
                        repaint();
                        break;
@@ -620,6 +623,12 @@ again:             if (sigs)
                        c = getcc();
                        goto again;
 
                        c = getcc();
                        goto again;
 
+               case A_FILE_LIST:       /* show list of file names */
+                       cmd_exec();
+                       showlist();
+                       repaint();
+                       break;
+
                case A_EXAMINE:         /* edit a new file; get the file name */
                        cmd_reset();
                        start_mca(A_EXAMINE, "Examine: ");
                case A_EXAMINE:         /* edit a new file; get the file name */
                        cmd_reset();
                        start_mca(A_EXAMINE, "Examine: ");
@@ -735,3 +744,48 @@ editfile()
                (void)sprintf(buf, "%s %s", editor, current_file);
        lsystem(buf);
 }
                (void)sprintf(buf, "%s %s", editor, current_file);
        lsystem(buf);
 }
+
+static
+showlist()
+{
+       extern int sc_width;
+       extern char **av;
+       register int indx, width;
+       int len;
+       char *p;
+
+       if (ac <= 0) {
+               error("No files provided as arguments.");
+               return;
+       }
+       for (width = indx = 0; indx < ac;) {
+               p = strcmp(av[indx], "-") ? av[indx] : "stdin";
+               len = strlen(p) + 1;
+               if (curr_ac == indx)
+                       len += 2;
+               if (width + len + 1 >= sc_width) {
+                       if (!width) {
+                               if (curr_ac == indx)
+                                       putchr('[');
+                               putstr(p);
+                               if (curr_ac == indx)
+                                       putchr(']');
+                               ++indx;
+                       }
+                       width = 0;
+                       putchr('\n');
+                       continue;
+               }
+               if (width)
+                       putchr(' ');
+               if (curr_ac == indx)
+                       putchr('[');
+               putstr(p);
+               if (curr_ac == indx)
+                       putchr(']');
+               width += len;
+               ++indx;
+       }
+       putchr('\n');
+       error((char *)NULL);
+}