From: Wilfried Goesgens Date: Tue, 24 Jul 2012 19:50:39 +0000 (+0200) Subject: TEXTCLIENT: getutline also belongs to the textclient. Tnx to Lightspeed for pointing... X-Git-Tag: v8.20~287 X-Git-Url: https://code.citadel.org/?a=commitdiff_plain;h=5f0099f90e7a26a0d5942cb8fdbf8221f95f6d79;p=citadel.git TEXTCLIENT: getutline also belongs to the textclient. Tnx to Lightspeed for pointing this out. --- diff --git a/citadel/Makefile.in b/citadel/Makefile.in index b855fae7c..e6018be85 100644 --- a/citadel/Makefile.in +++ b/citadel/Makefile.in @@ -78,7 +78,7 @@ SOURCES=utils/aidepost.c utils/citmail.c \ utils/ctdlmigrate.c utils/base64.c utils/chkpwd.c \ utillib/citadel_dirs.c \ citserver.c clientsocket.c config.c control.c $(DATABASE) \ - domain.c serv_extensions.c file_ops.c genstamp.c getutline.c \ + domain.c serv_extensions.c file_ops.c genstamp.c \ housekeeping.c ical_dezonify.c internet_addressing.c ecrash.c \ locate_host.c md5.c auth.c msgbase.c parsedate.c \ room_ops.c euidindex.c server_main.c snprintf.c ldap.c \ diff --git a/citadel/configure.ac b/citadel/configure.ac index 41c00e0d9..c140e7640 100644 --- a/citadel/configure.ac +++ b/citadel/configure.ac @@ -990,8 +990,6 @@ if test "$ac_cv_func_pthread_create" = yes; then test "$DATABASE" && TARGETS="server utils" fi -AC_REPLACE_FUNCS(snprintf getutline) - AC_CACHE_CHECK([the weather], ac_cv_weather, [ sleep 1 echo $ECHO_N "opening your window... $ECHO_C" >&6 diff --git a/citadel/getutline.c b/citadel/getutline.c deleted file mode 100644 index 7c6b78e2f..000000000 --- a/citadel/getutline.c +++ /dev/null @@ -1,39 +0,0 @@ -/* - * getutline.c: not-quite-compatible replacement for getutline(3) - * by nathan bryant, feb 1999 - */ - -#include "sysdep.h" -#ifdef HAVE_UTMP_H -#include -#include -#include -#ifdef HAVE_PATHS_H -#include -#endif -#include - -struct utmp *getutline(struct utmp *ut) -{ - static struct utmp retval; - FILE *utmp; - -#ifdef UTMP_FILE - if ((utmp = fopen(UTMP_FILE, "rb")) == NULL) -#else - if ((utmp = fopen(_PATH_UTMP, "rb")) == NULL) -#endif - return NULL; - - do - if (!fread(&retval, sizeof retval, 1, utmp)) - { - fclose(utmp); - return NULL; - } - while (strcmp(ut->ut_line, retval.ut_line)); - - fclose(utmp); - return &retval; -} -#endif /* HAVE_UTMP_H */ diff --git a/textclient/Makefile.in b/textclient/Makefile.in index a10ed3fd4..12a9372e5 100644 --- a/textclient/Makefile.in +++ b/textclient/Makefile.in @@ -72,6 +72,7 @@ SOURCES=src/client_chat.c \ src/citadel_ipc.c \ src/ecrash.c \ src/ipc_c_tcp.c \ + src/getutline.c \ src/screen.c # for VPATH builds (invoked by configure) diff --git a/textclient/src/getutline.c b/textclient/src/getutline.c new file mode 100644 index 000000000..7c6b78e2f --- /dev/null +++ b/textclient/src/getutline.c @@ -0,0 +1,39 @@ +/* + * getutline.c: not-quite-compatible replacement for getutline(3) + * by nathan bryant, feb 1999 + */ + +#include "sysdep.h" +#ifdef HAVE_UTMP_H +#include +#include +#include +#ifdef HAVE_PATHS_H +#include +#endif +#include + +struct utmp *getutline(struct utmp *ut) +{ + static struct utmp retval; + FILE *utmp; + +#ifdef UTMP_FILE + if ((utmp = fopen(UTMP_FILE, "rb")) == NULL) +#else + if ((utmp = fopen(_PATH_UTMP, "rb")) == NULL) +#endif + return NULL; + + do + if (!fread(&retval, sizeof retval, 1, utmp)) + { + fclose(utmp); + return NULL; + } + while (strcmp(ut->ut_line, retval.ut_line)); + + fclose(utmp); + return &retval; +} +#endif /* HAVE_UTMP_H */