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

gEDA-user: Patch for PCB fab file author



My name is Karel Kulhavy and that was also set in the system. PCB was
inserting Karel Kulhavy,,, into the fab file. I fixed it:

Will you put this patch into the official version of PCB?

CL<

--- pcb-20050609/src/print.c	2005-03-12 03:17:13.000000000 +0100
+++ pcb-20050609_new/src/print.c	2006-03-03 15:47:35.000000000 +0100
@@ -1358,9 +1358,22 @@
 	fab_author = Settings.FabAuthor;
       else
 	{
+	  int len;
+	  unsigned char *comma, *gecos;
+
 	  /* ID the user. */
 	  pwentry = getpwuid (getuid ());
-	  fab_author = pwentry->pw_gecos;
+	  gecos = pwentry->pw_gecos;
+	  comma=strchr(gecos,',');
+	  if (comma) len=comma-gecos;
+	  else len=strlen(gecos);
+	  fab_author=malloc(len+1);
+	  if (!fab_author){
+	    perror("pcb: out of memory.\n");
+	    exit(-1);
+	  }
+	  memcpy(fab_author, gecos, len);
+	  fab_author[len]=0;
 	}
     }
   return fab_author;