On Sat, 2005-10-01 at 13:39 -0400, Joey Hess wrote:
> Dean Michael Berris wrote:
> > Added support for external configuration file defined through -C.
> > Currently, the supported options in the configuration file are "cpuid=",
> > "msr=", and "verbose". The default configuration file is set at
> > /etc/longrun.conf when -C is invoked without an argument.
> 
> This is contrary to how almost all unix programs work -- having to
> specify an option to turn on use of a configuration file is weird.
> Expected behavior is for a config file to be used if it's present.
> What's the reason for this weirdness?
> 

The reason is because I wasn't sure if it should be the default behavior
-- and just to make it optional first. If it should be the default
behavior, then it can be made so in the future. Since this is an
"experimental" feature, it would be best put as a command line option
first so as not to break other applications that rely on this program
_not_ having a configuration file.

Aside from these, I have chosen to make it first a flag in the command
line so as to be able to specify different configuration files instead
of just a default configuration file.

> > -utility is used to control and query LongRun settings on Transmeta
> > -Crusoe processors.
> > +utility is used to control and query LongRun settings on Transmeta(tm)
> > +Crusoe(tm) processors.
> > +.P
> >  This program requires that the Linux CPUID and MSR devices be compiled
> >  into the kernel (or loaded as kernel modules), that the CPUID character
> >  device be readable, and that the MSR character device be both readable
> >  and writable.
> > +.P
> >  #define VERSION "0.9"
> > -#define REVDATE "2001-02-14"
> > +#define REVDATE "2005-10-1"
> 
> The above changes seem to have nothing to do with adding the config
> file.
> 

Yes, they are aesthetic changes for the (1) manual page and (2) for
wherever REVDATE is used.

> > +#define _GNU_SOURCE
> 
> > +           /* use GNU getline to read the lines and extract pertinent 
> > informationa
> 
> This makes longrun require glibc to work, which seems undesirable and
> not really needed since the config file contains very short and simple
> lines that could be esily read using standard C functions.
> 

I used getline to avoid possible problems when dealing with fixed size
stack/heap allocated variables. And also so that file reading would look
really simple compared to having fgets() that need previously allocated
memory before being able to properly read the contents of the file.

I just thought that using fscanf() and/or fgets() were not very good to
look at in the code.

But you are right with it going to need glibc. I should try going about
it some other way then.

-- 
Dean Michael C. Berris <[EMAIL PROTECTED]>
GPG Key: 0x08AE6EAC
http://mikhailberis.blogspot.com
Mobile: +63 928 7291459

Attachment: signature.asc
Description: This is a digitally signed message part

Reply via email to