+
+static
+editfile()
+{
+ static int dolinenumber;
+ static char *editor;
+ int c;
+ char buf[MAXPATHLEN], *getenv();
+
+ if (editor == NULL) {
+ editor = getenv("EDITOR");
+ /* pass the line number to vi */
+ if (editor == NULL || *editor == '\0') {
+ editor = "/usr/ucb/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);
+}