+
+static
+editfile()
+{
+ extern char *current_file;
+ static int dolinenumber;
+ static char *editor;
+ int c;
+ char buf[MAXPATHLEN * 2 + 20], *getenv();
+
+ if (editor == NULL) {
+ editor = getenv("EDITOR");
+ /* pass the line number to vi */
+ if (editor == NULL || *editor == '\0') {
+ editor = _PATH_VI;
+ dolinenumber = 1;
+ }
+ else
+ dolinenumber = 0;
+ }
+ if (dolinenumber && (c = currline(MIDDLE)))
+ (void)sprintf(buf, "%s +%d %s", editor, c, current_file);
+ else
+ (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);
+}