Re: request for help



On Tue, 21 August 10:01 christophe barbé wrote:

> My goal was to allow custom system identification string.

OK.

> I've not looked in the Mutt code but seeing various mails headers I guess
> that it's customisable.

Hmmm.  arbitrary headers are probably OK in moderation but IMO they are best
avoided.  At most a few "X-" headers.  I'm not sure that because mutt does
something that balsa should as well.

> > 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.

Seems good to me.  It would certainly permit your "custom system identification
string".

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

Can't help there, sorry.  Using uname() avoids the fork/exec and associated
threading problems - I know there are pthreads functions designed to prevent
potential deadlock when threaded processes fork but I forget what they are.

Brian




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