[Author Prev][Author Next][Thread Prev][Thread Next][Author Index][Thread Index]

gEDA-cvs: pcb.git: branch: master updated (11700ba8c3c951a788c8190073eb09822060dfdd)



The branch, master has been updated
       via  11700ba8c3c951a788c8190073eb09822060dfdd (commit)
      from  fd5399c67b988f2f7c9d1a0b4ab7c13bc2e95158 (commit)

Those revisions listed above that are new to this repository have
not appeared on any other notification email; so we list those
revisions in full, below.


=========
 Summary
=========

 src/file.c |  131 +++++++++++++++++++++++++++++++----------------------------
 src/main.c |    9 +++-
 2 files changed, 76 insertions(+), 64 deletions(-)


=================
 Commit Messages
=================

commit 11700ba8c3c951a788c8190073eb09822060dfdd
Author: DJ Delorie <dj@xxxxxxxxxxx>
Commit: DJ Delorie <dj@xxxxxxxxxxx>

    Skip the M4 library on Windows
    
    On Windows, set the LibraryContentsCommand to the magic string "*NONE*"
    and check for that string while loading the libraries.  This avoids the
    windows pcb.exe from trying to run bash or m4 scripts, which are
    normally not available, yet allows the user a way to re-enable them if
    they want.

:100644 100644 be7f6a5... a9575b1... M	src/file.c
:100644 100644 d371c8f... 3f692e4... M	src/main.c

=========
 Changes
=========

commit 11700ba8c3c951a788c8190073eb09822060dfdd
Author: DJ Delorie <dj@xxxxxxxxxxx>
Commit: DJ Delorie <dj@xxxxxxxxxxx>

    Skip the M4 library on Windows
    
    On Windows, set the LibraryContentsCommand to the magic string "*NONE*"
    and check for that string while loading the libraries.  This avoids the
    windows pcb.exe from trying to run bash or m4 scripts, which are
    normally not available, yet allows the user a way to re-enable them if
    they want.

diff --git a/src/file.c b/src/file.c
index be7f6a5..a9575b1 100644
--- a/src/file.c
+++ b/src/file.c
@@ -1414,82 +1414,89 @@ ReadLibraryContents (void)
   LibraryEntryTypePtr entry;
 
 
-  /*  First load the M4 stuff.  The variable Settings.LibraryPath
-   *  points to it.
-   */
-  free (command);
-  command = EvaluateFilename (Settings.LibraryContentsCommand,
-			      Settings.LibraryPath, Settings.LibraryFilename,
-			      NULL);
+  /* On Windows, the magic string '*NONE*' is set in main.c as we
+     normally cannot run shell scripts or expect to have m4.  This
+     allows the user to still override it if they have a
+     windows-compatible library generator.  */
+  if (strcmp (Settings.LibraryContentsCommand, "*NONE*"))
+    {
+      /*  First load the M4 stuff.  The variable Settings.LibraryPath
+       *  points to it.
+       */
+      free (command);
+      command = EvaluateFilename (Settings.LibraryContentsCommand,
+				  Settings.LibraryPath, Settings.LibraryFilename,
+				  NULL);
 
 #ifdef DEBUG
-  printf("In ReadLibraryContents, about to execute command %s\n", command);
+      printf("In ReadLibraryContents, about to execute command %s\n", command);
 #endif
 
-  /* This uses a pipe to execute a shell script which provides the names of
-   * all M4 libs and footprints.  The results are placed in resultFP.
-   */
-  if (command && *command && (resultFP = popen (command, "r")) == NULL)
-    {
-      PopenErrorMessage (command);
-    }
-
-  /* the M4 library contents are separated by colons;
-   * template : package : name : description
-   */
-  while (resultFP != NULL && fgets (inputline, MAX_LIBRARY_LINE_LENGTH, resultFP))
-    {
-      size_t len = strlen (inputline);
-
-      /* check for maximum linelength */
-      if (len)
+      /* This uses a pipe to execute a shell script which provides the names of
+       * all M4 libs and footprints.  The results are placed in resultFP.
+       */
+      if (command && *command && (resultFP = popen (command, "r")) == NULL)
 	{
-	  len--;
-	  if (inputline[len] != '\n')
-	    Message
-	      ("linelength (%i) exceeded; following characters will be ignored\n",
-	       MAX_LIBRARY_LINE_LENGTH);
-	  else
-	    inputline[len] = '\0';
+	  PopenErrorMessage (command);
 	}
 
-      /* if the line defines a menu */
-      if (!strncmp (inputline, "TYPE=", 5))
-	{
-	  menu = GetLibraryMenuMemory (&Library);
-	  menu->Name = strdup (UNKNOWN (&inputline[5]));
-	  menu->directory = strdup (Settings.LibraryFilename);
-	}
-      else
+      /* the M4 library contents are separated by colons;
+       * template : package : name : description
+       */
+      while (resultFP != NULL && fgets (inputline, MAX_LIBRARY_LINE_LENGTH, resultFP))
 	{
-	  /* allocate a new menu entry if not already done */
-	  if (!menu)
+	  size_t len = strlen (inputline);
+
+	  /* check for maximum linelength */
+	  if (len)
+	    {
+	      len--;
+	      if (inputline[len] != '\n')
+		Message
+		  ("linelength (%i) exceeded; following characters will be ignored\n",
+		   MAX_LIBRARY_LINE_LENGTH);
+	      else
+		inputline[len] = '\0';
+	    }
+
+	  /* if the line defines a menu */
+	  if (!strncmp (inputline, "TYPE=", 5))
 	    {
 	      menu = GetLibraryMenuMemory (&Library);
-	      menu->Name = strdup (UNKNOWN ((char *) NULL));
+	      menu->Name = strdup (UNKNOWN (&inputline[5]));
 	      menu->directory = strdup (Settings.LibraryFilename);
 	    }
-	  entry = GetLibraryEntryMemory (menu);
-	  entry->AllocatedMemory = strdup (inputline);
-
-	  /* now break the line into pieces separated by colons */
-	  if ((entry->Template = strtok (entry->AllocatedMemory, ":")) !=
-	      NULL)
-	    if ((entry->Package = strtok (NULL, ":")) != NULL)
-	      if ((entry->Value = strtok (NULL, ":")) != NULL)
-		entry->Description = strtok (NULL, ":");
-
-	  /* create the list entry */
-	  len = strlen (EMPTY (entry->Value)) +
-	    strlen (EMPTY (entry->Description)) + 4;
-	  entry->ListEntry = (char *)calloc (len, sizeof (char));
-	  sprintf (entry->ListEntry,
-		   "%s, %s", EMPTY (entry->Value),
-		   EMPTY (entry->Description));
+	  else
+	    {
+	      /* allocate a new menu entry if not already done */
+	      if (!menu)
+		{
+		  menu = GetLibraryMenuMemory (&Library);
+		  menu->Name = strdup (UNKNOWN ((char *) NULL));
+		  menu->directory = strdup (Settings.LibraryFilename);
+		}
+	      entry = GetLibraryEntryMemory (menu);
+	      entry->AllocatedMemory = strdup (inputline);
+
+	      /* now break the line into pieces separated by colons */
+	      if ((entry->Template = strtok (entry->AllocatedMemory, ":")) !=
+		  NULL)
+		if ((entry->Package = strtok (NULL, ":")) != NULL)
+		  if ((entry->Value = strtok (NULL, ":")) != NULL)
+		    entry->Description = strtok (NULL, ":");
+
+	      /* create the list entry */
+	      len = strlen (EMPTY (entry->Value)) +
+		strlen (EMPTY (entry->Description)) + 4;
+	      entry->ListEntry = (char *)calloc (len, sizeof (char));
+	      sprintf (entry->ListEntry,
+		       "%s, %s", EMPTY (entry->Value),
+		       EMPTY (entry->Description));
+	    }
 	}
+      if (resultFP != NULL)
+	pclose (resultFP);
     }
-  if (resultFP != NULL)
-    pclose (resultFP);
 
   /* Now after reading in the M4 libs, call a function to
    * read the newlib footprint libraries.  Then sort the whole
diff --git a/src/main.c b/src/main.c
index d371c8f..3f692e4 100644
--- a/src/main.c
+++ b/src/main.c
@@ -1122,11 +1122,16 @@ Defaults to @code{"QueryLibrary.sh '%p' '%f' %a"}
 @ftable @code
 @item --lib-contents-command <string>
 Command to query the contents of the library. @*
-Defaults to @code{"ListLibraryContents.sh %p %f"}
+Defaults to @code{"ListLibraryContents.sh %p %f"} or, on Windows, *NONE*
 @end ftable
 %end-doc
 */
-  SSET (LibraryContentsCommand, "ListLibraryContents.sh '%p' '%f'",
+  SSET (LibraryContentsCommand,
+#ifdef __WIN32__
+	"*NONE*",
+#else
+	"ListLibraryContents.sh '%p' '%f'",
+#endif
 	"lib-contents-command", "Command to query the contents of the library"),
 
 /* %start-doc options "5 Paths"




_______________________________________________
geda-cvs mailing list
geda-cvs@xxxxxxxxxxxxxx
http://www.seul.org/cgi-bin/mailman/listinfo/geda-cvs