]> granicus.if.org Git - sudo/commitdiff
now uses ENV_EDITOR if you want to use the EDITOR envar
authorTodd C. Miller <Todd.Miller@courtesan.com>
Wed, 26 Jan 1994 23:52:13 +0000 (23:52 +0000)
committerTodd C. Miller <Todd.Miller@courtesan.com>
Wed, 26 Jan 1994 23:52:13 +0000 (23:52 +0000)
visudo.c

index 13366b247e80d5c11c973440d54e117f92fe39e0..59f8fa6cc8e6926a60ada5ddbea98349d13a3c41 100644 (file)
--- a/visudo.c
+++ b/visudo.c
@@ -79,7 +79,9 @@ main(argc, argv)
 {
     int fd;
     struct stat sbuf;
+#ifdef ENV_EDITOR
     char * Editor;
+#endif /* ENV_EDITOR */
 
     /*
      * handle the signals
@@ -101,14 +103,14 @@ main(argc, argv)
      */
     umask(077);
 
+#ifdef ENV_EDITOR
     /*
      * set up the Editor variable correctly
      */
-#ifndef STATICEDITOR
     if ( (Editor = getenv("EDITOR")) == NULL)
        if ( (Editor = getenv("VISUAL")) == NULL )
-#endif /* !STATICEDITOR */
            Editor = EDITOR;
+#endif /* ENV_EDITOR */
 
     /*
      * open the sudoers file read only
@@ -155,8 +157,13 @@ main(argc, argv)
        /*
         * build strings in buffer to be executed by system()
         */
+#ifdef ENV_EDITOR
        (void) sprintf(buffer, "%s +%d %s", Editor, err_line_no,
            sudoers_tmp_file);
+#else
+       (void) sprintf(buffer, "%s +%d %s", EDITOR, err_line_no,
+           sudoers_tmp_file);
+#endif /* ENV_EDITOR */
 
        /* edit the file */
        if (system(buffer) == 0) {