[PD-cvs] pd/src s_path.c,1.1.1.2.2.2,1.1.1.2.2.3

timblech at users.sourceforge.net timblech at users.sourceforge.net
Fri Mar 5 21:58:12 CET 2004


Update of /cvsroot/pure-data/pd/src
In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv29992

Modified Files:
      Tag: devel_0_37
	s_path.c 
Log Message:
added feature of writing comments to the .pdrc file


Index: s_path.c
===================================================================
RCS file: /cvsroot/pure-data/pd/src/s_path.c,v
retrieving revision 1.1.1.2.2.2
retrieving revision 1.1.1.2.2.3
diff -C2 -d -r1.1.1.2.2.2 -r1.1.1.2.2.3
*** s_path.c	23 Sep 2003 00:58:23 -0000	1.1.1.2.2.2
--- s_path.c	5 Mar 2004 20:58:09 -0000	1.1.1.2.2.3
***************
*** 340,352 ****
      rcargv[0] = ".";	/* this no longer matters to sys_argparse() */
  
!     for (i = 1; i < NUMARGS-1; i++)
      {
!     	if (fscanf(file, "%999s", buf) < 0)
! 	    break;
! 	buf[1000] = 0;
! 	if (!(rcargv[i] = malloc(strlen(buf) + 1)))
! 	    return (1);
! 	strcpy(rcargv[i], buf);
      }
      if (i >= NUMARGS-1)
      	fprintf(stderr, "startup file too long; extra args dropped\n");
--- 340,372 ----
      rcargv[0] = ".";	/* this no longer matters to sys_argparse() */
  
!     //support for comments added by Tim Blechmann
!     i=1;
!     char c[MAXPDSTRING];
!     while ( (fgets(c,MAXPDSTRING,file)) != 0)
      {
! 	if ( c[strlen(c)-1] !='\n')
! 	{
! 	    //it is unlikely that this is ever the case
! 	    fprintf(stderr, "startup file contains a line that's too long\n");
! 	    while ( fgetc(file) != '\n');
! 	}
! 
! 	if (c[0] != '#')
! 	{
! 	    while (sscanf(c,"%999s",buf) != EOF)
! 	    {
! 		buf[1000] = 0;
! 		if (!(rcargv[i] = malloc(strlen(buf) + 1)))
! 		    return (1);
! 		strcpy(rcargv[i], buf);
! 		strcpy(buf,c+strlen(buf)+1);
! 		strcpy(c,buf);
! 		++i;
! 	    }
! 	}
      }
+     //end of support for comments added by Tim Blechmann
+ 
+ 
      if (i >= NUMARGS-1)
      	fprintf(stderr, "startup file too long; extra args dropped\n");





More information about the Pd-cvs mailing list