When an application forks a Vim that is not compiled with the
netbeans_intg feature, the application waits for Vim to establish the
socket connection and Vim silently ignores the "-nb" command line
argument. It is difficult for the user to understand what is wrong.

The attached patch causes Vim to exit with an error message when it is
invoked with "-nb" and not compiled with the netbeans_intg feature.
This is already what is happening when the diff feature is missing and
vim is invoked as vimdiff.

Xavier

--~--~---------~--~----~------------~-------~--~----~
You received this message from the "vim_dev" maillist.
For more information, visit http://www.vim.org/maillist.php
-~----------~----~----~----~------~----~------~--~---

diff -r -c vim72.orig/src/gui_gtk_x11.c vim72/src/gui_gtk_x11.c
*** vim72.orig/src/gui_gtk_x11.c	2008-07-04 12:46:24.000000000 +0200
--- vim72/src/gui_gtk_x11.c	2008-10-18 22:00:52.000000000 +0200
***************
*** 346,353 ****
  #ifdef HAVE_GTK2
      {"--role",		ARG_ROLE|ARG_HAS_VALUE},
  #endif
- #ifdef FEAT_NETBEANS_INTG
      {"-nb",		ARG_NETBEANS},	      /* non-standard value format */
      {"-xrm",		ARG_XRM|ARG_HAS_VALUE},		/* not implemented */
      {"-mf",		ARG_MENUFONT|ARG_HAS_VALUE},	/* not implemented */
      {"-menufont",	ARG_MENUFONT|ARG_HAS_VALUE},	/* not implemented */
--- 346,353 ----
  #ifdef HAVE_GTK2
      {"--role",		ARG_ROLE|ARG_HAS_VALUE},
  #endif
      {"-nb",		ARG_NETBEANS},	      /* non-standard value format */
+ #ifdef FEAT_NETBEANS_INTG
      {"-xrm",		ARG_XRM|ARG_HAS_VALUE},		/* not implemented */
      {"-mf",		ARG_MENUFONT|ARG_HAS_VALUE},	/* not implemented */
      {"-menufont",	ARG_MENUFONT|ARG_HAS_VALUE},	/* not implemented */
***************
*** 486,497 ****
  		/* allow --foo=bar style */
  		if (argv[i][len] == '=' && (option->flags & ARG_HAS_VALUE))
  		    break;
- #ifdef FEAT_NETBEANS_INTG
  		/* darn, -nb has non-standard syntax */
  		if (vim_strchr((char_u *)":=", argv[i][len]) != NULL
  			&& (option->flags & ARG_INDEX_MASK) == ARG_NETBEANS)
  		    break;
- #endif
  	    }
  	    else if ((option->flags & ARG_COMPAT_LONG)
  			&& strcmp(argv[i], option->name + 1) == 0)
--- 486,495 ----
***************
*** 558,570 ****
  		    role_argument = value; /* used later in gui_mch_open() */
  		    break;
  #endif
- #ifdef FEAT_NETBEANS_INTG
  		case ARG_NETBEANS:
  		    ++usingNetbeans;
  		    gui.dofork = FALSE; /* don't fork() when starting GUI */
  		    netbeansArg = argv[i];
! 		    break;
  #endif
  		default:
  		    break;
  	    }
--- 556,573 ----
  		    role_argument = value; /* used later in gui_mch_open() */
  		    break;
  #endif
  		case ARG_NETBEANS:
+ #ifdef FEAT_NETBEANS_INTG
  		    ++usingNetbeans;
  		    gui.dofork = FALSE; /* don't fork() when starting GUI */
  		    netbeansArg = argv[i];
! #else
!                     mch_errmsg(_("This Vim was not compiled with the netbeans_intg feature."));
!                     mch_errmsg("\n");
!                     mch_exit(2);
  #endif
+ 		    break;
+ 
  		default:
  		    break;
  	    }
diff -r -c vim72.orig/src/gui_x11.c vim72/src/gui_x11.c
*** vim72.orig/src/gui_x11.c	2008-06-08 17:13:45.000000000 +0200
--- vim72/src/gui_x11.c	2008-10-18 21:37:40.000000000 +0200
***************
*** 1259,1267 ****
  	}
  	else
  #endif
- #ifdef FEAT_NETBEANS_INTG
  	    if (strncmp("-nb", argv[arg], 3) == 0)
  	{
  	    usingNetbeans++;
  	    gui.dofork = FALSE;	/* don't fork() when starting GUI */
  	    netbeansArg = argv[arg];
--- 1259,1267 ----
  	}
  	else
  #endif
  	    if (strncmp("-nb", argv[arg], 3) == 0)
  	{
+ #ifdef FEAT_NETBEANS_INTG
  	    usingNetbeans++;
  	    gui.dofork = FALSE;	/* don't fork() when starting GUI */
  	    netbeansArg = argv[arg];
***************
*** 1270,1275 ****
--- 1270,1281 ----
  	    argv[*argc] = NULL;
  	}
  	else
+ # else
+             mch_errmsg(_("This Vim was not compiled with the netbeans_intg feature."));
+             mch_errmsg("\n");
+             mch_exit(2);
+ 	}
+ 	else
  #endif
  	    arg++;
      }

Raspunde prin e-mail lui