Re: request for help



On 2001.08.21 11:01:23 +0200 christophe barbé wrote:
> > 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.

hi,

well the idea with that custom string to show other people what os you
prefer is indeed a good idea. i have to share this and i would be glad
you gonna implement this. but yes, i must agree to the statement of
brian s. using the systemcall is the better solution than executing an
external program and grep the string then.

a) the command may not be present on the system,
b) doesnt support all the flags,
c) command may be outdated and never got replaced
   with a newer version for a bunch of years.

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

yeah this one is the right way to go.

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

i am into this right now. i will report within the next couple of mins.
but my first impression is the callbacks.. but i am not sure right now
please hold for my next reply.

-- 
Name....: Ali Akcaagac
Status..: Student Of Computer & Economic Science
E-Mail..: mailto:ali.akcaagac@stud.fh-wilhelmshaven.de
WWW.....: http://www.fh-wilhelmshaven.de/~akcaagaa




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