cvs commit: ALFS/nALFS/src init.c

kpfleming at linuxfromscratch.org kpfleming at linuxfromscratch.org
Mon May 31 13:31:10 PDT 2004


kpfleming    04/05/31 14:31:10

  Modified:    nALFS/src init.c
  Log:
  make user-specific configuration file optional
  
  Revision  Changes    Path
  1.15      +6 -8      ALFS/nALFS/src/init.c
  
  Index: init.c
  ===================================================================
  RCS file: /home/cvsroot/ALFS/nALFS/src/init.c,v
  retrieving revision 1.14
  retrieving revision 1.15
  diff -u -r1.14 -r1.15
  --- init.c	21 Mar 2004 03:40:51 -0000	1.14
  +++ init.c	31 May 2004 20:31:10 -0000	1.15
  @@ -245,7 +245,6 @@
   /*
    * Read the "system" configuration file, /etc/nALFSrc.
    */
  -
   void read_system_rc_file(void)
   {
   	char system_rc_file[] = "/etc/nALFSrc";
  @@ -256,13 +255,13 @@
   }
   
   /*
  - * Constructs a full name of configuration file and calls a parser.
  + * Read the "user" configuration file, ~/.nALFSrc.
    */
   void read_user_rc_file(void)
   {
   	char *home_dir;
  -	char *rcfile;
  -
  +	char *rcfile = NULL;
  +	struct stat st;
   
   	home_dir = get_home_directory();
   
  @@ -271,11 +270,10 @@
   		return;
   	}
   
  -	rcfile = xstrdup(home_dir);
  -	append_str(&rcfile, "/");
  -	append_str(&rcfile, RC_FILE_NAME);
  +	append_str_format(&rcfile, "%s/%s", home_dir, RC_FILE_NAME);
   
  -	parse_rc_file(rcfile);
  +	if (!stat(rcfile, &st))
  +		parse_rc_file(rcfile);
   
   	xfree(rcfile);
   }
  
  
  



More information about the alfs-log mailing list