bug-mailutils
[Top][All Lists]
Advanced

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

ef.c for GNU Mailutils


From: Jean Louis
Subject: ef.c for GNU Mailutils
Date: Mon, 10 May 2021 14:01:20 +0300

Dear Sergey,

Maybe you remember you made this small C program and I have been using
it for long time. But maybe something on my system changed, so I
cannot compile the program again, it misses this one library.

the `ef' program is what I use very often every day to read people's
email and locating the person by using their email address.

Do you know how to solve this problem?

./ef: error while loading shared libraries: libmu_mbox.so.7: cannot open shared 
object file: No such file or directory

I do have these:

locate libmu_mbox.so.
/usr/lib/libmu_mbox.so.8
/usr/lib/libmu_mbox.so.8.0.0

And I am trying to figure out why it is searching version 7. I have
freshly compiled GNU Mailutils.

  /home/data1/protected/Programming/Software/Mail/mailutils-tools/TODO-ef:
  total used in directory 28K available 37.6 GiB
  -rwxr-xr-x 1 17K May 10 13:21 ef
  -rw------- 1 943 Jul 25  2019 ef.c
  -rw------- 1 150 Dec 27  2017 ef.mk
  lrwxrwxrwx 1   5 Jul 25  2019 Makefile -> ef.mk

ef.mk:

# Extracts the email from

CPPFLAGS=`mailutils cflags`
LIBS=`mailutils ldflags mbox`
ef: ef.c
        cc $(CPPFLAGS) $(CFLAGS) -oef ef.c $(LDFLAGS) $(LIBS)



ef.c:

#include <mailutils/mailutils.h>

int
main (int argc, char **argv)
{
  int rc;
  mu_message_t msg;
  mu_header_t hdr;
  struct mu_address hint;
  mu_address_t addr;
  char *val;
  char const *email;

  mu_stdstream_setup (MU_STDSTREAM_RESET_NONE);
  MU_ASSERT (mu_stdio_stream_create (&mu_strin, MU_STDIN_FD,
                                     MU_STREAM_READ|MU_STREAM_SEEK));
  mu_set_program_name (argv[0]);
  mu_registrar_record (mu_mbox_record);

  MU_ASSERT (mu_stream_to_message (mu_strin, &msg));
  MU_ASSERT (mu_message_get_header (msg, &hdr));
  rc = mu_header_aget_value_unfold (hdr, MU_HEADER_FROM, &val);
  if (rc == MU_ERR_NOENT)
    return 1;
  memset (&hint, 0, sizeof hint);
  rc = mu_address_create_hint (&addr, val, &hint, MU_ADDR_HINT_DOMAIN);
  if (rc)
    {
      mu_error ("can't parse address %s: %s", val, mu_strerror (rc));
      return 1;
    }
  MU_ASSERT (mu_address_sget_email (addr, 1, &email));
  mu_printf ("%s\n", email);
  return 0;
}



reply via email to

[Prev in Thread] Current Thread [Next in Thread]