Re: request for help



Le mar, 21 aoû 2001 10:50:01, Brian Stafford a écrit :
> On Mon, 20 August 20:07 christophe barbe wrote:
> > I've attached to this mail a patch which is supposed to add an option
> in
> > the preferences dialogbox.
> 
> I don't understand why you are using the uname command to get the system
> name.
> After all uname() is a system call and it is Posix.  Why not take the
> simpler
> approach and use that?  You also avoid the overhead of creating pipes,
> fork
> and exec and then reading from a file descriptor.  Lost of system calls
> replaced with just one.  Got to be better.

My goal was to allow custom system identification string.
I've not looked in the Mutt code but seeing various mails headers I guess
that it's customisable.

> Call it once during initialisation to get the system name and just save
> the
> string for use later.

This is what I do. I update the string during startup and when you change
the command in the preferences dialog box.

> Try something like
> 
> #include <sys/utsname.h>
> 
> char *
> get_system_name (void)
> {
>   struct utsname buf;
>   char *sysname;
> 
>   uname (&buf);
>   sysname = malloc (strlen (buf.sysname) + strlen (buf.release) + 2);
>   sprintf (sysname, "%s %s", buf.sysname, buf.release);
>   return sysname;
> }
> 
> obviously that needs error checks but its the right sequence of actions.

I've not think about this function. Perhaps I can let the user choose a
format string and provide substitution (%n : system name, %r release, ...).
This would certainly be better.

BTW I'm also interesting in knowing where my patch fail.

> Brian

Thank you for your comments,
Christophe

> 
> _______________________________________________
> balsa-list mailing list
> balsa-list@gnome.org
> http://mail.gnome.org/mailman/listinfo/balsa-list
> 
-- 
Christophe Barbé
Software Engineer - christophe.barbe@lineo.fr
Lineo France - Lineo High Availability Group
42-46, rue Médéric - 92110 Clichy - France
phone (33).1.41.40.02.12 - fax (33).1.41.40.02.01
http://www.lineo.com




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