aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorltoetsch <ltoetsch@3ae390bd-cb1e-0410-b409-cd5a39f66f1f>2001-03-15 14:25:05 +0000
committerltoetsch <ltoetsch@3ae390bd-cb1e-0410-b409-cd5a39f66f1f>2001-03-15 14:25:05 +0000
commitcafef33d38d19a9075897b7484a5cb2c594da1da (patch)
tree4c16c32fcf95beb1bfef9bbac846dd183e83a43b
parent05ed83934da5b17841c34009456e9e27073a488a (diff)
downloadlcd4linux-cafef33d38d19a9075897b7484a5cb2c594da1da.tar.gz
[lcd4linux @ 2001-03-15 14:25:05 by ltoetsch]
added unread/total news git-svn-id: https://ssl.bulix.org/svn/lcd4linux/trunk@124 3ae390bd-cb1e-0410-b409-cd5a39f66f1f
Diffstat (limited to '')
-rw-r--r--CREDITS2
-rw-r--r--NEWS2
-rw-r--r--README14
-rw-r--r--TODO3
-rwxr-xr-xconfigure207
-rw-r--r--display.c7
-rw-r--r--lcd4linux.conf.sample16
-rw-r--r--mail.c9
-rw-r--r--mail.h7
-rw-r--r--mail2.c129
-rw-r--r--socket.c7
11 files changed, 278 insertions, 125 deletions
diff --git a/CREDITS b/CREDITS
index c814a41..15d7af1 100644
--- a/CREDITS
+++ b/CREDITS
@@ -5,7 +5,7 @@ Herbert Rosmanith <herp@wildsau.idv-edu.uni-linz.ac.at>
Leopold Tötsch <lt@toetsch.at>
PNG driver
- POP & IMAP client
+ POP, IMAP & NEWS client
simple web interface
lots of (well, sometimes too much :-) ideas
diff --git a/NEWS b/NEWS
index 8bf3ffb..8cf0b70 100644
--- a/NEWS
+++ b/NEWS
@@ -47,3 +47,5 @@ lcd4linux-0.98
(which is propably incorrect for normal mbox)
- added another verbose level (-vvv) for debugging socket traffic
+
+- added nntp support for count of news/unread messages in subscribed NGs
diff --git a/README b/README
index 70eeba1..2970b86 100644
--- a/README
+++ b/README
@@ -1,5 +1,5 @@
#
-# $Id: README,v 1.18 2001/03/14 13:19:29 ltoetsch Exp $
+# $Id: README,v 1.19 2001/03/15 14:25:05 ltoetsch Exp $
#
This is the README file for lcd4linux
@@ -158,16 +158,26 @@ Data-specific options:
battery: Battwarning 10 (default 10)
Mailbox:
- The option string may be a plain mbox file or a pop3/imap4 server
+ The option string may be a plain mbox file or a pop3/imap4/nntp server
string with the following format:
pop3:[user[:pass]@]machine[:port]
imap4:[user[:pass]@]machine[:port][/dir]
+ nntp:[user[:pass]@]machine[:port][/dir]
Port defaults to 110 and 143 respectively.
If /dir is not given, INBOX is assumed.
+ If dir is given for nntp: it should be a valid group name
+ with '.' separating items
+ If dir is not given for nntp: all/unread news of subscribed groups
+ from Newsrc are calcualted.
Delay_e1..e9 delay in seconds for querying the MailboxN (default 5)
+ Newsrc ... path/name of your .newsrc file containing subscribed news
+
+ Note: authorization on newsservers is untested.
+ Note: user and pass may not contain a '/' with above syntax, I hope
+ that's ok.
Driver-specific options:
diff --git a/TODO b/TODO
index 939fbb1..a7c15ca 100644
--- a/TODO
+++ b/TODO
@@ -77,3 +77,6 @@ add a new Token 'nc' for 'network collisions'
2001-03-14 Michael Reinelt <reinelt@eunet.at>
add translation tables ('german umlauts' don't
follow any scheme on most displays)
+
+2001-03-15 Leopold Toetsch <lt@toetsch.at>
+Text display has troubles with '\r'
diff --git a/configure b/configure
index 499aad8..769afc7 100755
--- a/configure
+++ b/configure
@@ -1,7 +1,7 @@
#! /bin/sh
# Guess values for system-dependent variables and create Makefiles.
-# Generated automatically using autoconf version 2.13
+# Generated automatically using autoconf version 2.14
# Copyright (C) 1992, 93, 94, 95, 96 Free Software Foundation, Inc.
#
# This configure script is free software; the Free Software Foundation
@@ -344,7 +344,7 @@ EOF
verbose=yes ;;
-version | --version | --versio | --versi | --vers)
- echo "configure generated by autoconf version 2.13"
+ echo "configure generated by autoconf version 2.14"
exit 0 ;;
-with-* | --with-*)
@@ -1680,6 +1680,7 @@ else
/* We use char because int might match the return type of a gcc2
builtin and then its argument prototype would still apply. */
char gethostbyname();
+char (*f)();
int main() {
@@ -1689,12 +1690,12 @@ int main() {
#if defined (__stub_gethostbyname) || defined (__stub___gethostbyname)
choke me
#else
-gethostbyname();
+f = gethostbyname;
#endif
; return 0; }
EOF
-if { (eval echo configure:1698: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext}; then
+if { (eval echo configure:1699: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext}; then
rm -rf conftest*
eval "ac_cv_func_gethostbyname=yes"
else
@@ -1715,7 +1716,7 @@ fi
if test $ac_cv_func_gethostbyname = no; then
echo $ac_n "checking for gethostbyname in -lnsl""... $ac_c" 1>&6
-echo "configure:1719: checking for gethostbyname in -lnsl" >&5
+echo "configure:1720: checking for gethostbyname in -lnsl" >&5
ac_lib_var=`echo nsl'_'gethostbyname | sed 'y%./+-%__p_%'`
if eval "test \"`echo '$''{'ac_cv_lib_$ac_lib_var'+set}'`\" = set"; then
echo $ac_n "(cached) $ac_c" 1>&6
@@ -1723,7 +1724,7 @@ else
ac_save_LIBS="$LIBS"
LIBS="-lnsl $LIBS"
cat > conftest.$ac_ext <<EOF
-#line 1727 "configure"
+#line 1728 "configure"
#include "confdefs.h"
/* Override any gcc2 internal prototype to avoid an error. */
/* We use char because int might match the return type of a gcc2
@@ -1734,7 +1735,7 @@ int main() {
gethostbyname()
; return 0; }
EOF
-if { (eval echo configure:1738: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext}; then
+if { (eval echo configure:1739: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext}; then
rm -rf conftest*
eval "ac_cv_lib_$ac_lib_var=yes"
else
@@ -1764,12 +1765,12 @@ fi
# -lsocket must be given before -lnsl if both are needed.
# We assume that if connect needs -lnsl, so does gethostbyname.
echo $ac_n "checking for connect""... $ac_c" 1>&6
-echo "configure:1768: checking for connect" >&5
+echo "configure:1769: checking for connect" >&5
if eval "test \"`echo '$''{'ac_cv_func_connect'+set}'`\" = set"; then
echo $ac_n "(cached) $ac_c" 1>&6
else
cat > conftest.$ac_ext <<EOF
-#line 1773 "configure"
+#line 1774 "configure"
#include "confdefs.h"
/* System header to define __stub macros and hopefully few prototypes,
which can conflict with char connect(); below. */
@@ -1778,6 +1779,7 @@ else
/* We use char because int might match the return type of a gcc2
builtin and then its argument prototype would still apply. */
char connect();
+char (*f)();
int main() {
@@ -1787,12 +1789,12 @@ int main() {
#if defined (__stub_connect) || defined (__stub___connect)
choke me
#else
-connect();
+f = connect;
#endif
; return 0; }
EOF
-if { (eval echo configure:1796: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext}; then
+if { (eval echo configure:1798: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext}; then
rm -rf conftest*
eval "ac_cv_func_connect=yes"
else
@@ -1813,7 +1815,7 @@ fi
if test $ac_cv_func_connect = no; then
echo $ac_n "checking for connect in -lsocket""... $ac_c" 1>&6
-echo "configure:1817: checking for connect in -lsocket" >&5
+echo "configure:1819: checking for connect in -lsocket" >&5
ac_lib_var=`echo socket'_'connect | sed 'y%./+-%__p_%'`
if eval "test \"`echo '$''{'ac_cv_lib_$ac_lib_var'+set}'`\" = set"; then
echo $ac_n "(cached) $ac_c" 1>&6
@@ -1821,7 +1823,7 @@ else
ac_save_LIBS="$LIBS"
LIBS="-lsocket $X_EXTRA_LIBS $LIBS"
cat > conftest.$ac_ext <<EOF
-#line 1825 "configure"
+#line 1827 "configure"
#include "confdefs.h"
/* Override any gcc2 internal prototype to avoid an error. */
/* We use char because int might match the return type of a gcc2
@@ -1832,7 +1834,7 @@ int main() {
connect()
; return 0; }
EOF
-if { (eval echo configure:1836: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext}; then
+if { (eval echo configure:1838: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext}; then
rm -rf conftest*
eval "ac_cv_lib_$ac_lib_var=yes"
else
@@ -1856,12 +1858,12 @@ fi
# gomez@mi.uni-erlangen.de says -lposix is necessary on A/UX.
echo $ac_n "checking for remove""... $ac_c" 1>&6
-echo "configure:1860: checking for remove" >&5
+echo "configure:1862: checking for remove" >&5
if eval "test \"`echo '$''{'ac_cv_func_remove'+set}'`\" = set"; then
echo $ac_n "(cached) $ac_c" 1>&6
else
cat > conftest.$ac_ext <<EOF
-#line 1865 "configure"
+#line 1867 "configure"
#include "confdefs.h"
/* System header to define __stub macros and hopefully few prototypes,
which can conflict with char remove(); below. */
@@ -1870,6 +1872,7 @@ else
/* We use char because int might match the return type of a gcc2
builtin and then its argument prototype would still apply. */
char remove();
+char (*f)();
int main() {
@@ -1879,12 +1882,12 @@ int main() {
#if defined (__stub_remove) || defined (__stub___remove)
choke me
#else
-remove();
+f = remove;
#endif
; return 0; }
EOF
-if { (eval echo configure:1888: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext}; then
+if { (eval echo configure:1891: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext}; then
rm -rf conftest*
eval "ac_cv_func_remove=yes"
else
@@ -1905,7 +1908,7 @@ fi
if test $ac_cv_func_remove = no; then
echo $ac_n "checking for remove in -lposix""... $ac_c" 1>&6
-echo "configure:1909: checking for remove in -lposix" >&5
+echo "configure:1912: checking for remove in -lposix" >&5
ac_lib_var=`echo posix'_'remove | sed 'y%./+-%__p_%'`
if eval "test \"`echo '$''{'ac_cv_lib_$ac_lib_var'+set}'`\" = set"; then
echo $ac_n "(cached) $ac_c" 1>&6
@@ -1913,7 +1916,7 @@ else
ac_save_LIBS="$LIBS"
LIBS="-lposix $LIBS"
cat > conftest.$ac_ext <<EOF
-#line 1917 "configure"
+#line 1920 "configure"
#include "confdefs.h"
/* Override any gcc2 internal prototype to avoid an error. */
/* We use char because int might match the return type of a gcc2
@@ -1924,7 +1927,7 @@ int main() {
remove()
; return 0; }
EOF
-if { (eval echo configure:1928: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext}; then
+if { (eval echo configure:1931: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext}; then
rm -rf conftest*
eval "ac_cv_lib_$ac_lib_var=yes"
else
@@ -1948,12 +1951,12 @@ fi
# BSDI BSD/OS 2.1 needs -lipc for XOpenDisplay.
echo $ac_n "checking for shmat""... $ac_c" 1>&6
-echo "configure:1952: checking for shmat" >&5
+echo "configure:1955: checking for shmat" >&5
if eval "test \"`echo '$''{'ac_cv_func_shmat'+set}'`\" = set"; then
echo $ac_n "(cached) $ac_c" 1>&6
else
cat > conftest.$ac_ext <<EOF
-#line 1957 "configure"
+#line 1960 "configure"
#include "confdefs.h"
/* System header to define __stub macros and hopefully few prototypes,
which can conflict with char shmat(); below. */
@@ -1962,6 +1965,7 @@ else
/* We use char because int might match the return type of a gcc2
builtin and then its argument prototype would still apply. */
char shmat();
+char (*f)();
int main() {
@@ -1971,12 +1975,12 @@ int main() {
#if defined (__stub_shmat) || defined (__stub___shmat)
choke me
#else
-shmat();
+f = shmat;
#endif
; return 0; }
EOF
-if { (eval echo configure:1980: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext}; then
+if { (eval echo configure:1984: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext}; then
rm -rf conftest*
eval "ac_cv_func_shmat=yes"
else
@@ -1997,7 +2001,7 @@ fi
if test $ac_cv_func_shmat = no; then
echo $ac_n "checking for shmat in -lipc""... $ac_c" 1>&6
-echo "configure:2001: checking for shmat in -lipc" >&5
+echo "configure:2005: checking for shmat in -lipc" >&5
ac_lib_var=`echo ipc'_'shmat | sed 'y%./+-%__p_%'`
if eval "test \"`echo '$''{'ac_cv_lib_$ac_lib_var'+set}'`\" = set"; then
echo $ac_n "(cached) $ac_c" 1>&6
@@ -2005,7 +2009,7 @@ else
ac_save_LIBS="$LIBS"
LIBS="-lipc $LIBS"
cat > conftest.$ac_ext <<EOF
-#line 2009 "configure"
+#line 2013 "configure"
#include "confdefs.h"
/* Override any gcc2 internal prototype to avoid an error. */
/* We use char because int might match the return type of a gcc2
@@ -2016,7 +2020,7 @@ int main() {
shmat()
; return 0; }
EOF
-if { (eval echo configure:2020: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext}; then
+if { (eval echo configure:2024: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext}; then
rm -rf conftest*
eval "ac_cv_lib_$ac_lib_var=yes"
else
@@ -2049,7 +2053,7 @@ fi
# libraries we check for below, so use a different variable.
# --interran@uluru.Stanford.EDU, kb@cs.umb.edu.
echo $ac_n "checking for IceConnectionNumber in -lICE""... $ac_c" 1>&6
-echo "configure:2053: checking for IceConnectionNumber in -lICE" >&5
+echo "configure:2057: checking for IceConnectionNumber in -lICE" >&5
ac_lib_var=`echo ICE'_'IceConnectionNumber | sed 'y%./+-%__p_%'`
if eval "test \"`echo '$''{'ac_cv_lib_$ac_lib_var'+set}'`\" = set"; then
echo $ac_n "(cached) $ac_c" 1>&6
@@ -2057,7 +2061,7 @@ else
ac_save_LIBS="$LIBS"
LIBS="-lICE $X_EXTRA_LIBS $LIBS"
cat > conftest.$ac_ext <<EOF
-#line 2061 "configure"
+#line 2065 "configure"
#include "confdefs.h"
/* Override any gcc2 internal prototype to avoid an error. */
/* We use char because int might match the return type of a gcc2
@@ -2068,7 +2072,7 @@ int main() {
IceConnectionNumber()
; return 0; }
EOF
-if { (eval echo configure:2072: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext}; then
+if { (eval echo configure:2076: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext}; then
rm -rf conftest*
eval "ac_cv_lib_$ac_lib_var=yes"
else
@@ -2094,7 +2098,7 @@ fi
echo $ac_n "checking which drivers to compile""... $ac_c" 1>&6
-echo "configure:2098: checking which drivers to compile" >&5
+echo "configure:2102: checking which drivers to compile" >&5
# Check whether --with-drivers or --without-drivers was given.
if test "${with_drivers+set}" = set; then
withval="$with_drivers"
@@ -2285,12 +2289,12 @@ fi
echo $ac_n "checking for ANSI C header files""... $ac_c" 1>&6
-echo "configure:2289: checking for ANSI C header files" >&5
+echo "configure:2293: checking for ANSI C header files" >&5
if eval "test \"`echo '$''{'ac_cv_header_stdc'+set}'`\" = set"; then
echo $ac_n "(cached) $ac_c" 1>&6
else
cat > conftest.$ac_ext <<EOF
-#line 2294 "configure"
+#line 2298 "configure"
#include "confdefs.h"
#include <stdlib.h>
#include <stdarg.h>
@@ -2298,7 +2302,7 @@ else
#include <float.h>
EOF
ac_try="$ac_cpp conftest.$ac_ext >/dev/null 2>conftest.out"
-{ (eval echo configure:2302: \"$ac_try\") 1>&5; (eval $ac_try) 2>&5; }
+{ (eval echo configure:2306: \"$ac_try\") 1>&5; (eval $ac_try) 2>&5; }
ac_err=`grep -v '^ *+' conftest.out | grep -v "^conftest.${ac_ext}\$"`
if test -z "$ac_err"; then
rm -rf conftest*
@@ -2315,7 +2319,7 @@ rm -f conftest*
if test $ac_cv_header_stdc = yes; then
# SunOS 4.x string.h does not declare mem*, contrary to ANSI.
cat > conftest.$ac_ext <<EOF
-#line 2319 "configure"
+#line 2323 "configure"
#include "confdefs.h"
#include <string.h>
EOF
@@ -2333,7 +2337,7 @@ fi
if test $ac_cv_header_stdc = yes; then
# ISC 2.0.2 stdlib.h does not declare free, contrary to ANSI.
cat > conftest.$ac_ext <<EOF
-#line 2337 "configure"
+#line 2341 "configure"
#include "confdefs.h"
#include <stdlib.h>
EOF
@@ -2354,7 +2358,7 @@ if test "$cross_compiling" = yes; then
:
else
cat > conftest.$ac_ext <<EOF
-#line 2358 "configure"
+#line 2362 "configure"
#include "confdefs.h"
#include <ctype.h>
#define ISLOWER(c) ('a' <= (c) && (c) <= 'z')
@@ -2365,7 +2369,7 @@ if (XOR (islower (i), ISLOWER (i)) || toupper (i) != TOUPPER (i)) exit(2);
exit (0); }
EOF
-if { (eval echo configure:2369: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext} && (./conftest; exit) 2>/dev/null
+if { (eval echo configure:2373: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext} && (./conftest; exit) 2>/dev/null
then
:
else
@@ -2393,12 +2397,12 @@ for ac_hdr in dirent.h sys/ndir.h sys/dir.h ndir.h
do
ac_safe=`echo "$ac_hdr" | sed 'y%./+-%__p_%'`
echo $ac_n "checking for $ac_hdr that defines DIR""... $ac_c" 1>&6
-echo "configure:2397: checking for $ac_hdr that defines DIR" >&5
+echo "configure:2401: checking for $ac_hdr that defines DIR" >&5
if eval "test \"`echo '$''{'ac_cv_header_dirent_$ac_safe'+set}'`\" = set"; then
echo $ac_n "(cached) $ac_c" 1>&6
else
cat > conftest.$ac_ext <<EOF
-#line 2402 "configure"
+#line 2406 "configure"
#include "confdefs.h"
#include <sys/types.h>
#include <$ac_hdr>
@@ -2406,7 +2410,7 @@ int main() {
DIR *dirp = 0;
; return 0; }
EOF
-if { (eval echo configure:2410: \"$ac_compile\") 1>&5; (eval $ac_compile) 2>&5; }; then
+if { (eval echo configure:2414: \"$ac_compile\") 1>&5; (eval $ac_compile) 2>&5; }; then
rm -rf conftest*
eval "ac_cv_header_dirent_$ac_safe=yes"
else
@@ -2431,7 +2435,7 @@ done
# Two versions of opendir et al. are in -ldir and -lx on SCO Xenix.
if test $ac_header_dirent = dirent.h; then
echo $ac_n "checking for opendir in -ldir""... $ac_c" 1>&6
-echo "configure:2435: checking for opendir in -ldir" >&5
+echo "configure:2439: checking for opendir in -ldir" >&5
ac_lib_var=`echo dir'_'opendir | sed 'y%./+-%__p_%'`
if eval "test \"`echo '$''{'ac_cv_lib_$ac_lib_var'+set}'`\" = set"; then
echo $ac_n "(cached) $ac_c" 1>&6
@@ -2439,7 +2443,7 @@ else
ac_save_LIBS="$LIBS"
LIBS="-ldir $LIBS"
cat > conftest.$ac_ext <<EOF
-#line 2443 "configure"
+#line 2447 "configure"
#include "confdefs.h"
/* Override any gcc2 internal prototype to avoid an error. */
/* We use char because int might match the return type of a gcc2
@@ -2450,7 +2454,7 @@ int main() {
opendir()
; return 0; }
EOF
-if { (eval echo configure:2454: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext}; then
+if { (eval echo configure:2458: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext}; then
rm -rf conftest*
eval "ac_cv_lib_$ac_lib_var=yes"
else
@@ -2472,7 +2476,7 @@ fi
else
echo $ac_n "checking for opendir in -lx""... $ac_c" 1>&6
-echo "configure:2476: checking for opendir in -lx" >&5
+echo "configure:2480: checking for opendir in -lx" >&5
ac_lib_var=`echo x'_'opendir | sed 'y%./+-%__p_%'`
if eval "test \"`echo '$''{'ac_cv_lib_$ac_lib_var'+set}'`\" = set"; then
echo $ac_n "(cached) $ac_c" 1>&6
@@ -2480,7 +2484,7 @@ else
ac_save_LIBS="$LIBS"
LIBS="-lx $LIBS"
cat > conftest.$ac_ext <<EOF
-#line 2484 "configure"
+#line 2488 "configure"
#include "confdefs.h"
/* Override any gcc2 internal prototype to avoid an error. */
/* We use char because int might match the return type of a gcc2
@@ -2491,7 +2495,7 @@ int main() {
opendir()
; return 0; }
EOF
-if { (eval echo configure:2495: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext}; then
+if { (eval echo configure:2499: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext}; then
rm -rf conftest*
eval "ac_cv_lib_$ac_lib_var=yes"
else
@@ -2514,12 +2518,12 @@ fi
fi
echo $ac_n "checking for sys/wait.h that is POSIX.1 compatible""... $ac_c" 1>&6
-echo "configure:2518: checking for sys/wait.h that is POSIX.1 compatible" >&5
+echo "configure:2522: checking for sys/wait.h that is POSIX.1 compatible" >&5
if eval "test \"`echo '$''{'ac_cv_header_sys_wait_h'+set}'`\" = set"; then
echo $ac_n "(cached) $ac_c" 1>&6
else
cat > conftest.$ac_ext <<EOF
-#line 2523 "configure"
+#line 2527 "configure"
#include "confdefs.h"
#include <sys/types.h>
#include <sys/wait.h>
@@ -2535,7 +2539,7 @@ wait (&s);
s = WIFEXITED (s) ? WEXITSTATUS (s) : 1;
; return 0; }
EOF
-if { (eval echo configure:2539: \"$ac_compile\") 1>&5; (eval $ac_compile) 2>&5; }; then
+if { (eval echo configure:2543: \"$ac_compile\") 1>&5; (eval $ac_compile) 2>&5; }; then
rm -rf conftest*
ac_cv_header_sys_wait_h=yes
else
@@ -2559,17 +2563,17 @@ for ac_hdr in fcntl.h limits.h strings.h sys/ioctl.h sys/time.h syslog.h unistd.
do
ac_safe=`echo "$ac_hdr" | sed 'y%./+-%__p_%'`
echo $ac_n "checking for $ac_hdr""... $ac_c" 1>&6
-echo "configure:2563: checking for $ac_hdr" >&5
+echo "configure:2567: checking for $ac_hdr" >&5
if eval "test \"`echo '$''{'ac_cv_header_$ac_safe'+set}'`\" = set"; then
echo $ac_n "(cached) $ac_c" 1>&6
else
cat > conftest.$ac_ext <<EOF
-#line 2568 "configure"
+#line 2572 "configure"
#include "confdefs.h"
#include <$ac_hdr>
EOF
ac_try="$ac_cpp conftest.$ac_ext >/dev/null 2>conftest.out"
-{ (eval echo configure:2573: \"$ac_try\") 1>&5; (eval $ac_try) 2>&5; }
+{ (eval echo configure:2577: \"$ac_try\") 1>&5; (eval $ac_try) 2>&5; }
ac_err=`grep -v '^ *+' conftest.out | grep -v "^conftest.${ac_ext}\$"`
if test -z "$ac_err"; then
rm -rf conftest*
@@ -2599,17 +2603,17 @@ for ac_hdr in sys/io.h asm/io.h
do
ac_safe=`echo "$ac_hdr" | sed 'y%./+-%__p_%'`
echo $ac_n "checking for $ac_hdr""... $ac_c" 1>&6
-echo "configure:2603: checking for $ac_hdr" >&5
+echo "configure:2607: checking for $ac_hdr" >&5
if eval "test \"`echo '$''{'ac_cv_header_$ac_safe'+set}'`\" = set"; then
echo $ac_n "(cached) $ac_c" 1>&6
else
cat > conftest.$ac_ext <<EOF
-#line 2608 "configure"
+#line 2612 "configure"
#include "confdefs.h"
#include <$ac_hdr>
EOF
ac_try="$ac_cpp conftest.$ac_ext >/dev/null 2>conftest.out"
-{ (eval echo configure:2613: \"$ac_try\") 1>&5; (eval $ac_try) 2>&5; }
+{ (eval echo configure:2617: \"$ac_try\") 1>&5; (eval $ac_try) 2>&5; }
ac_err=`grep -v '^ *+' conftest.out | grep -v "^conftest.${ac_ext}\$"`
if test -z "$ac_err"; then
rm -rf conftest*
@@ -2639,17 +2643,17 @@ for ac_hdr in linux/parport.h linux/ppdev.h
do
ac_safe=`echo "$ac_hdr" | sed 'y%./+-%__p_%'`
echo $ac_n "checking for $ac_hdr""... $ac_c" 1>&6
-echo "configure:2643: checking for $ac_hdr" >&5
+echo "configure:2647: checking for $ac_hdr" >&5
if eval "test \"`echo '$''{'ac_cv_header_$ac_safe'+set}'`\" = set"; then
echo $ac_n "(cached) $ac_c" 1>&6
else
cat > conftest.$ac_ext <<EOF
-#line 2648 "configure"
+#line 2652 "configure"
#include "confdefs.h"
#include <$ac_hdr>
EOF
ac_try="$ac_cpp conftest.$ac_ext >/dev/null 2>conftest.out"
-{ (eval echo configure:2653: \"$ac_try\") 1>&5; (eval $ac_try) 2>&5; }
+{ (eval echo configure:2657: \"$ac_try\") 1>&5; (eval $ac_try) 2>&5; }
ac_err=`grep -v '^ *+' conftest.out | grep -v "^conftest.${ac_ext}\$"`
if test -z "$ac_err"; then
rm -rf conftest*
@@ -2679,17 +2683,17 @@ for ac_hdr in gd/gd.h gd.h
do
ac_safe=`echo "$ac_hdr" | sed 'y%./+-%__p_%'`
echo $ac_n "checking for $ac_hdr""... $ac_c" 1>&6
-echo "configure:2683: checking for $ac_hdr" >&5
+echo "configure:2687: checking for $ac_hdr" >&5
if eval "test \"`echo '$''{'ac_cv_header_$ac_safe'+set}'`\" = set"; then
echo $ac_n "(cached) $ac_c" 1>&6
else
cat > conftest.$ac_ext <<EOF
-#line 2688 "configure"
+#line 2692 "configure"
#include "confdefs.h"
#include <$ac_hdr>
EOF
ac_try="$ac_cpp conftest.$ac_ext >/dev/null 2>conftest.out"
-{ (eval echo configure:2693: \"$ac_try\") 1>&5; (eval $ac_try) 2>&5; }
+{ (eval echo configure:2697: \"$ac_try\") 1>&5; (eval $ac_try) 2>&5; }
ac_err=`grep -v '^ *+' conftest.out | grep -v "^conftest.${ac_ext}\$"`
if test -z "$ac_err"; then
rm -rf conftest*
@@ -2719,17 +2723,17 @@ for ac_hdr in net/if_ppp.h
do
ac_safe=`echo "$ac_hdr" | sed 'y%./+-%__p_%'`
echo $ac_n "checking for $ac_hdr""... $ac_c" 1>&6
-echo "configure:2723: checking for $ac_hdr" >&5
+echo "configure:2727: checking for $ac_hdr" >&5
if eval "test \"`echo '$''{'ac_cv_header_$ac_safe'+set}'`\" = set"; then
echo $ac_n "(cached) $ac_c" 1>&6
else
cat > conftest.$ac_ext <<EOF
-#line 2728 "configure"
+#line 2732 "configure"
#include "confdefs.h"
#include <$ac_hdr>
EOF
ac_try="$ac_cpp conftest.$ac_ext >/dev/null 2>conftest.out"
-{ (eval echo configure:2733: \"$ac_try\") 1>&5; (eval $ac_try) 2>&5; }
+{ (eval echo configure:2737: \"$ac_try\") 1>&5; (eval $ac_try) 2>&5; }
ac_err=`grep -v '^ *+' conftest.out | grep -v "^conftest.${ac_ext}\$"`
if test -z "$ac_err"; then
rm -rf conftest*
@@ -2759,17 +2763,17 @@ for ac_hdr in asm/msr.h
do
ac_safe=`echo "$ac_hdr" | sed 'y%./+-%__p_%'`
echo $ac_n "checking for $ac_hdr""... $ac_c" 1>&6
-echo "configure:2763: checking for $ac_hdr" >&5
+echo "configure:2767: checking for $ac_hdr" >&5
if eval "test \"`echo '$''{'ac_cv_header_$ac_safe'+set}'`\" = set"; then
echo $ac_n "(cached) $ac_c" 1>&6
else
cat > conftest.$ac_ext <<EOF
-#line 2768 "configure"
+#line 2772 "configure"
#include "confdefs.h"
#include <$ac_hdr>
EOF
ac_try="$ac_cpp conftest.$ac_ext >/dev/null 2>conftest.out"
-{ (eval echo configure:2773: \"$ac_try\") 1>&5; (eval $ac_try) 2>&5; }
+{ (eval echo configure:2777: \"$ac_try\") 1>&5; (eval $ac_try) 2>&5; }
ac_err=`grep -v '^ *+' conftest.out | grep -v "^conftest.${ac_ext}\$"`
if test -z "$ac_err"; then
rm -rf conftest*
@@ -2797,12 +2801,12 @@ done
echo $ac_n "checking for working const""... $ac_c" 1>&6
-echo "configure:2801: checking for working const" >&5
+echo "configure:2805: checking for working const" >&5
if eval "test \"`echo '$''{'ac_cv_c_const'+set}'`\" = set"; then
echo $ac_n "(cached) $ac_c" 1>&6
else
cat > conftest.$ac_ext <<EOF
-#line 2806 "configure"
+#line 2810 "configure"
#include "confdefs.h"
int main() {
@@ -2851,7 +2855,7 @@ ccp = (char const *const *) p;
; return 0; }
EOF
-if { (eval echo configure:2855: \"$ac_compile\") 1>&5; (eval $ac_compile) 2>&5; }; then
+if { (eval echo configure:2859: \"$ac_compile\") 1>&5; (eval $ac_compile) 2>&5; }; then
rm -rf conftest*
ac_cv_c_const=yes
else
@@ -2872,21 +2876,21 @@ EOF
fi
echo $ac_n "checking for inline""... $ac_c" 1>&6
-echo "configure:2876: checking for inline" >&5
+echo "configure:2880: checking for inline" >&5
if eval "test \"`echo '$''{'ac_cv_c_inline'+set}'`\" = set"; then
echo $ac_n "(cached) $ac_c" 1>&6
else
ac_cv_c_inline=no
for ac_kw in inline __inline__ __inline; do
cat > conftest.$ac_ext <<EOF
-#line 2883 "configure"
+#line 2887 "configure"
#include "confdefs.h"
int main() {
} $ac_kw foo() {
; return 0; }
EOF
-if { (eval echo configure:2890: \"$ac_compile\") 1>&5; (eval $ac_compile) 2>&5; }; then
+if { (eval echo configure:2894: \"$ac_compile\") 1>&5; (eval $ac_compile) 2>&5; }; then
rm -rf conftest*
ac_cv_c_inline=$ac_kw; break
else
@@ -2912,12 +2916,12 @@ EOF
esac
echo $ac_n "checking for pid_t""... $ac_c" 1>&6
-echo "configure:2916: checking for pid_t" >&5
+echo "configure:2920: checking for pid_t" >&5
if eval "test \"`echo '$''{'ac_cv_type_pid_t'+set}'`\" = set"; then
echo $ac_n "(cached) $ac_c" 1>&6
else
cat > conftest.$ac_ext <<EOF
-#line 2921 "configure"
+#line 2925 "configure"
#include "confdefs.h"
#include <sys/types.h>
#if STDC_HEADERS
@@ -2945,12 +2949,12 @@ EOF
fi
echo $ac_n "checking for size_t""... $ac_c" 1>&6
-echo "configure:2949: checking for size_t" >&5
+echo "configure:2953: checking for size_t" >&5
if eval "test \"`echo '$''{'ac_cv_type_size_t'+set}'`\" = set"; then
echo $ac_n "(cached) $ac_c" 1>&6
else
cat > conftest.$ac_ext <<EOF
-#line 2954 "configure"
+#line 2958 "configure"
#include "confdefs.h"
#include <sys/types.h>
#if STDC_HEADERS
@@ -2978,12 +2982,12 @@ EOF
fi
echo $ac_n "checking whether time.h and sys/time.h may both be included""... $ac_c" 1>&6
-echo "configure:2982: checking whether time.h and sys/time.h may both be included" >&5
+echo "configure:2986: checking whether time.h and sys/time.h may both be included" >&5
if eval "test \"`echo '$''{'ac_cv_header_time'+set}'`\" = set"; then
echo $ac_n "(cached) $ac_c" 1>&6
else
cat > conftest.$ac_ext <<EOF
-#line 2987 "configure"
+#line 2991 "configure"
#include "confdefs.h"
#include <sys/types.h>
#include <sys/time.h>
@@ -2992,7 +2996,7 @@ int main() {
struct tm *tp;
; return 0; }
EOF
-if { (eval echo configure:2996: \"$ac_compile\") 1>&5; (eval $ac_compile) 2>&5; }; then
+if { (eval echo configure:3000: \"$ac_compile\") 1>&5; (eval $ac_compile) 2>&5; }; then
rm -rf conftest*
ac_cv_header_time=yes
else
@@ -3013,12 +3017,12 @@ EOF
fi
echo $ac_n "checking whether struct tm is in sys/time.h or time.h""... $ac_c" 1>&6
-echo "configure:3017: checking whether struct tm is in sys/time.h or time.h" >&5
+echo "configure:3021: checking whether struct tm is in sys/time.h or time.h" >&5
if eval "test \"`echo '$''{'ac_cv_struct_tm'+set}'`\" = set"; then
echo $ac_n "(cached) $ac_c" 1>&6
else
cat > conftest.$ac_ext <<EOF
-#line 3022 "configure"
+#line 3026 "configure"
#include "confdefs.h"
#include <sys/types.h>
#include <time.h>
@@ -3026,7 +3030,7 @@ int main() {
struct tm *tp; tp->tm_sec;
; return 0; }
EOF
-if { (eval echo configure:3030: \"$ac_compile\") 1>&5; (eval $ac_compile) 2>&5; }; then
+if { (eval echo configure:3034: \"$ac_compile\") 1>&5; (eval $ac_compile) 2>&5; }; then
rm -rf conftest*
ac_cv_struct_tm=time.h
else
@@ -3047,12 +3051,12 @@ EOF
fi
echo $ac_n "checking for uid_t in sys/types.h""... $ac_c" 1>&6
-echo "configure:3051: checking for uid_t in sys/types.h" >&5
+echo "configure:3055: checking for uid_t in sys/types.h" >&5
if eval "test \"`echo '$''{'ac_cv_type_uid_t'+set}'`\" = set"; then
echo $ac_n "(cached) $ac_c" 1>&6
else
cat > conftest.$ac_ext <<EOF
-#line 3056 "configure"
+#line 3060 "configure"
#include "confdefs.h"
#include <sys/types.h>
EOF
@@ -3083,13 +3087,13 @@ fi
if test $ac_cv_prog_gcc = yes; then
echo $ac_n "checking whether ${CC-cc} needs -traditional""... $ac_c" 1>&6
-echo "configure:3087: checking whether ${CC-cc} needs -traditional" >&5
+echo "configure:3091: checking whether ${CC-cc} needs -traditional" >&5
if eval "test \"`echo '$''{'ac_cv_prog_gcc_traditional'+set}'`\" = set"; then
echo $ac_n "(cached) $ac_c" 1>&6
else
ac_pattern="Autoconf.*'x'"
cat > conftest.$ac_ext <<EOF
-#line 3093 "configure"
+#line 3097 "configure"
#include "confdefs.h"
#include <sgtty.h>
Autoconf TIOCGETP
@@ -3107,7 +3111,7 @@ rm -f conftest*
if test $ac_cv_prog_gcc_traditional = no; then
cat > conftest.$ac_ext <<EOF
-#line 3111 "configure"
+#line 3115 "configure"
#include "confdefs.h"
#include <termio.h>
Autoconf TCGETA
@@ -3129,7 +3133,7 @@ echo "$ac_t""$ac_cv_prog_gcc_traditional" 1>&6
fi
echo $ac_n "checking for 8-bit clean memcmp""... $ac_c" 1>&6
-echo "configure:3133: checking for 8-bit clean memcmp" >&5
+echo "configure:3137: checking for 8-bit clean memcmp" >&5
if eval "test \"`echo '$''{'ac_cv_func_memcmp_clean'+set}'`\" = set"; then
echo $ac_n "(cached) $ac_c" 1>&6
else
@@ -3137,7 +3141,7 @@ else
ac_cv_func_memcmp_clean=no
else
cat > conftest.$ac_ext <<EOF
-#line 3141 "configure"
+#line 3145 "configure"
#include "confdefs.h"
main()
@@ -3147,7 +3151,7 @@ main()
}
EOF
-if { (eval echo configure:3151: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext} && (./conftest; exit) 2>/dev/null
+if { (eval echo configure:3155: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext} && (./conftest; exit) 2>/dev/null
then
ac_cv_func_memcmp_clean=yes
else
@@ -3165,12 +3169,12 @@ echo "$ac_t""$ac_cv_func_memcmp_clean" 1>&6
test $ac_cv_func_memcmp_clean = no && LIBOBJS="$LIBOBJS memcmp.${ac_objext}"
echo $ac_n "checking return type of signal handlers""... $ac_c" 1>&6
-echo "configure:3169: checking return type of signal handlers" >&5
+echo "configure:3173: checking return type of signal handlers" >&5
if eval "test \"`echo '$''{'ac_cv_type_signal'+set}'`\" = set"; then
echo $ac_n "(cached) $ac_c" 1>&6
else
cat > conftest.$ac_ext <<EOF
-#line 3174 "configure"
+#line 3178 "configure"
#include "confdefs.h"
#include <sys/types.h>
#include <signal.h>
@@ -3187,7 +3191,7 @@ int main() {
int i;
; return 0; }
EOF
-if { (eval echo configure:3191: \"$ac_compile\") 1>&5; (eval $ac_compile) 2>&5; }; then
+if { (eval echo configure:3195: \"$ac_compile\") 1>&5; (eval $ac_compile) 2>&5; }; then
rm -rf conftest*
ac_cv_type_signal=void
else
@@ -3208,12 +3212,12 @@ EOF
for ac_func in gettimeofday putenv select socket strdup strerror strstr strtol uname
do
echo $ac_n "checking for $ac_func""... $ac_c" 1>&6
-echo "configure:3212: checking for $ac_func" >&5
+echo "configure:3216: checking for $ac_func" >&5
if eval "test \"`echo '$''{'ac_cv_func_$ac_func'+set}'`\" = set"; then
echo $ac_n "(cached) $ac_c" 1>&6
else
cat > conftest.$ac_ext <<EOF
-#line 3217 "configure"
+#line 3221 "configure"
#include "confdefs.h"
/* System header to define __stub macros and hopefully few prototypes,
which can conflict with char $ac_func(); below. */
@@ -3222,6 +3226,7 @@ else
/* We use char because int might match the return type of a gcc2
builtin and then its argument prototype would still apply. */
char $ac_func();
+char (*f)();
int main() {
@@ -3231,12 +3236,12 @@ int main() {
#if defined (__stub_$ac_func) || defined (__stub___$ac_func)
choke me
#else
-$ac_func();
+f = $ac_func;
#endif
; return 0; }
EOF
-if { (eval echo configure:3240: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext}; then
+if { (eval echo configure:3245: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext}; then
rm -rf conftest*
eval "ac_cv_func_$ac_func=yes"
else
@@ -3351,7 +3356,7 @@ do
echo "running \${CONFIG_SHELL-/bin/sh} $0 $ac_configure_args --no-create --no-recursion"
exec \${CONFIG_SHELL-/bin/sh} $0 $ac_configure_args --no-create --no-recursion ;;
-version | --version | --versio | --versi | --vers | --ver | --ve | --v)
- echo "$CONFIG_STATUS generated by autoconf version 2.13"
+ echo "$CONFIG_STATUS generated by autoconf version 2.14"
exit 0 ;;
-help | --help | --hel | --he | --h)
echo "\$ac_cs_usage"; exit 0 ;;
diff --git a/display.c b/display.c
index aaba3a5..1e56e99 100644
--- a/display.c
+++ b/display.c
@@ -1,4 +1,4 @@
-/* $Id: display.c,v 1.26 2001/03/12 12:39:36 reinelt Exp $
+/* $Id: display.c,v 1.27 2001/03/15 14:25:05 ltoetsch Exp $
*
* framework for device drivers
*
@@ -20,6 +20,9 @@
*
*
* $Log: display.c,v $
+ * Revision 1.27 2001/03/15 14:25:05 ltoetsch
+ * added unread/total news
+ *
* Revision 1.26 2001/03/12 12:39:36 reinelt
*
* reworked autoconf a lot: drivers may be excluded, #define's went to config.h
@@ -214,7 +217,7 @@ FAMILY Driver[] = {
#ifdef WITH_X11
{ "X Window System", XWindow },
#endif
-#ifdef WITH_Text
+#ifdef WITH_TEXT
{ "X Ncurses Text", Text },
#endif
{ NULL }
diff --git a/lcd4linux.conf.sample b/lcd4linux.conf.sample
index 5f14ec1..b083c91 100644
--- a/lcd4linux.conf.sample
+++ b/lcd4linux.conf.sample
@@ -101,31 +101,35 @@ Overload 2.0
# flash bp-Bar if below Battwarning
# I use Row6 "Bat%bp%bs%bd$r10bp+bp"
# which gives a nice flash effect
-# default 10
+# default is 10
Battwarning 10
SetiDir /etc/setiathome
# normal local mbox
-Mailbox1 /var/spool/mail/michi
+# Mailbox1 /var/spool/mail/michi
# POP3 mail @ machine
-Mailbox2 pop3:user:pass@machine
+# Mailbox2 pop3:user:pass@machine
# IMAP4 mail folder @ machine
-Mailbox3 imap4:user:pass@machine/folder
+# Mailbox3 imap4:user:pass@machine/folder
-# Full syntax of pop3/imap4 is:
+# News server on 'server' group at.linux
+# Mailbox4 nntp:server/at.linux
+
+# Full syntax of pop3/imap4/nntp is:
# [user[:pass]@]machine[:port][/dir]
#
-# display total/unseen mails of Mailbox3
+# display total/unseen mails/news of Mailbox3
# Row6 "Mails %e3/%u3"
# delay query of MailboxN in seconds (default = 5)
Delay_e1 5
Delay_e2 20
Delay_e3 20
+Delay_e4 120
Sensor1 /proc/sys/dev/sensors/as99127f-i2c-0-2d/temp1
Sensor1_min 30
diff --git a/mail.c b/mail.c
index 7621449..1815809 100644
--- a/mail.c
+++ b/mail.c
@@ -1,4 +1,4 @@
-/* $Id: mail.c,v 1.6 2001/03/14 13:19:29 ltoetsch Exp $
+/* $Id: mail.c,v 1.7 2001/03/15 14:25:05 ltoetsch Exp $
*
* email specific functions
*
@@ -20,6 +20,9 @@
*
*
* $Log: mail.c,v $
+ * Revision 1.7 2001/03/15 14:25:05 ltoetsch
+ * added unread/total news
+ *
* Revision 1.6 2001/03/14 13:19:29 ltoetsch
* Added pop3/imap4 mail support
*
@@ -121,9 +124,9 @@ int Mail (int index, int *num, int *unseen)
rc=stat(fnp1, &fst);
if ( rc != 0 ) {
/*
- is it pop3 or imap4?
+ is it pop3, imap4 or nntp?
*/
- rc = Mail_pop_imap(fnp1, num, unseen);
+ rc = Mail_pop_imap_news(fnp1, num, unseen);
if (rc == 0)
return 0;
else
diff --git a/mail.h b/mail.h
index 8341220..456a5ac 100644
--- a/mail.h
+++ b/mail.h
@@ -1,4 +1,4 @@
-/* $Id: mail.h,v 1.3 2001/03/14 13:19:29 ltoetsch Exp $
+/* $Id: mail.h,v 1.4 2001/03/15 14:25:05 ltoetsch Exp $
*
* email specific functions
*
@@ -20,6 +20,9 @@
*
*
* $Log: mail.h,v $
+ * Revision 1.4 2001/03/15 14:25:05 ltoetsch
+ * added unread/total news
+ *
* Revision 1.3 2001/03/14 13:19:29 ltoetsch
* Added pop3/imap4 mail support
*
@@ -38,5 +41,5 @@
#define MAILBOXES 9
int Mail (int index, int *num, int *unseen);
-int Mail_pop_imap(char *mbx, int *num, int *unseen); /* mail2.c */
+int Mail_pop_imap_news(char *mbx, int *num, int *unseen); /* mail2.c */
#endif
diff --git a/mail2.c b/mail2.c
index 4e974e5..af095fc 100644
--- a/mail2.c
+++ b/mail2.c
@@ -1,6 +1,6 @@
-/* $Id: mail2.c,v 1.2 2001/03/15 11:10:53 ltoetsch Exp $
+/* $Id: mail2.c,v 1.3 2001/03/15 14:25:05 ltoetsch Exp $
*
- * mail: pop3, imap functions
+ * mail: pop3, imap, news functions
*
* Copyright 2001 by Leopold Tötsch (lt@toetsch.at)
*
@@ -20,6 +20,9 @@
*
*
* $Log: mail2.c,v $
+ * Revision 1.3 2001/03/15 14:25:05 ltoetsch
+ * added unread/total news
+ *
* Revision 1.2 2001/03/15 11:10:53 ltoetsch
* added quit/logout to pop/imap
*
@@ -29,7 +32,7 @@
*
* Exported Functions:
*
- * int Mail_pop_imap(char *mbox, int *total_mails, int *unseen);
+ * int Mail_pop_imap_news(char *mbox, int *total_mails, int *unseen);
* returns -1 on error, 0 on success
*
*/
@@ -42,10 +45,12 @@
#include <errno.h>
#include "debug.h"
+#include "cfg.h"
#include "socket.h"
#define PROTO_UNKNOWN -1
#define PROTO_POP3 110
+#define PROTO_NNTP 119
#define PROTO_IMAP4 143
/*
@@ -71,6 +76,7 @@ static int parse_proto(char *s, int *proto, char **user, char **pass,
protos[] =
{
{ "pop3:", PROTO_POP3 },
+ { "nntp:", PROTO_NNTP },
{ "imap4:", PROTO_IMAP4 },
};
int i;
@@ -167,6 +173,115 @@ static int wr_rd(int fd, char *buf, char *match,
return n;
}
+static int check_nntp(char *user, char *pass, char *machine,
+ int port, char *dir, int *total, int *unseen)
+{
+ int fd;
+ int n;
+ char buf[BUFLEN];
+ char line[BUFLEN];
+ FILE *fp;
+ int groups;
+ int err;
+ int totg, unsg;
+ int first;
+
+ strcpy(buf, cfg_get("Newsrc") ?: ".newsrc");
+ if (*buf == 0 || ((fp = fopen(buf, "r")) == NULL)) {
+ error("Couldn't open .newsrc-file '%s'", buf);
+ return -1;
+ }
+
+ fd = open_socket(machine, port);
+ if (fd < 0)
+ {
+ error("Couldn't connect to %s:%d (%s)", machine, port, strerror(errno));
+ fclose(fp);
+ return -1;
+ }
+ n = read_socket_match(fd, buf, BUFLEN-1, "20"); /* server ready */
+ if (n <= 0) {
+ error("Server doesn't respond %s:%d (%s)", machine, port, strerror(errno));
+ close(fd);
+ return -1;
+ }
+ /* do auth if necessary, this is NOT TESTED */
+ if (*user) {
+ sprintf(buf, "AUTHINFO USER %s\r\n", user);
+ if (wr_rd(fd, buf, "381", "No AUTH required?", machine, port) <= 0)
+ return -1;
+ if (*pass)
+ {
+ sprintf(buf, "AUTHINFO PASS %s\r\n", pass);
+ if (wr_rd(fd, buf, "281", "Wrong PASS?", machine, port) <= 0)
+ return -1;
+ }
+ }
+ sleep(2); /* wait for newsserver to read groupinfo */
+ groups = 0;
+ err = 0;
+ totg = unsg = 0; /* total, unseen */
+ while (fgets(line, sizeof(line)-1, fp) && err < 5) {
+ char group[BUFLEN];
+ char *p;
+ int smin, smax, lmin, lmax;
+
+ if (sscanf(line, "%s:", group) != 1) {
+ error("Couldn't read group in '%s'", line);
+ err++;
+ continue;
+ }
+ if ((p=strchr(group,':')) != NULL)
+ *p='\0';
+
+ /* check dir if it matches group */
+ if (*dir && strcmp(dir, group))
+ continue;
+
+ sprintf(buf, "GROUP %s\r\n", group);
+ if (wr_rd(fd, buf, "211", "Wrong Group", machine, port) <= 0) {
+ err++;
+ continue;
+ }
+ /* answer 211 total smin smax group: */
+ sscanf(buf, "211 %*d %d %d", &smin, &smax);
+ debug("nntp: %s: smin=%d smax=%d", group, smin, smax);
+ totg += smax-smin-1;
+ p = strchr(line, ':');
+ p++;
+ first = 1;
+ while (1) {
+ lmin = strtol(p, &p, 10);
+ if (*p == '-')
+ lmax = strtol(++p, &p, 10);
+ else
+ lmax=lmin;
+ debug("nntp: %s: lmin=%d lmax=%d", group, lmin, lmax);
+ if (smax >= lmax) { /* server has more articles */
+ if (first)
+ unsg += smax - lmax;
+ else
+ unsg -= lmax-lmin+1;
+ first = 0;
+ }
+ else /* local has higher article ??? */
+ break;
+ if (*p == ',')
+ p++;
+ else
+ break;
+ }
+ } /* while fp */
+ fclose(fp);
+ strcpy(buf, "QUIT\r\n");
+ wr_rd(fd, buf, "2", "Quit", machine, port);
+ close(fd);
+ *unseen = unsg;
+ *total = totg;
+ return 0;
+}
+
+
static int check_imap4(char *user, char *pass, char *machine,
int port, char *dir, int *total, int *unseen)
{
@@ -259,7 +374,7 @@ static int check_pop3(char *user, char *pass, char *machine,
return 0;
}
-int Mail_pop_imap(char *s, int *total, int *unseen)
+int Mail_pop_imap_news(char *s, int *total, int *unseen)
{
int proto, port, ret;
char *user, *pass, *machine, *dir, *ds;
@@ -276,8 +391,10 @@ int Mail_pop_imap(char *s, int *total, int *unseen)
error("Not a pop3/imap4 mailbox");
else
ret = (proto == PROTO_POP3) ?
- check_pop3(user, pass, machine, port, total, unseen) :
- check_imap4(user, pass, machine, port, dir, total, unseen);
+ check_pop3(user, pass, machine, port, total, unseen) :
+ (proto == PROTO_NNTP) ?
+ check_nntp(user, pass, machine, port, dir, total, unseen) :
+ check_imap4(user, pass, machine, port, dir, total, unseen);
free(ds);
return ret;
}
diff --git a/socket.c b/socket.c
index fa57b53..cb00033 100644
--- a/socket.c
+++ b/socket.c
@@ -1,4 +1,4 @@
-/* $Id: socket.c,v 1.1 2001/03/14 13:19:29 ltoetsch Exp $
+/* $Id: socket.c,v 1.2 2001/03/15 14:25:05 ltoetsch Exp $
*
* simple socket functions
*
@@ -20,6 +20,9 @@
*
*
* $Log: socket.c,v $
+ * Revision 1.2 2001/03/15 14:25:05 ltoetsch
+ * added unread/total news
+ *
* Revision 1.1 2001/03/14 13:19:29 ltoetsch
* Added pop3/imap4 mail support
*
@@ -69,7 +72,7 @@
#include "debug.h"
-#define TIMEOUT 2 /* 2 seconds timeout */
+#define TIMEOUT 5 /* 5 seconds timeout */
int open_socket(char *machine, int port)
{