src/next.c

/* [<][>]
[^][v][top][bottom][index][help] */

DEFINITIONS

This source file includes following functions.
  1. do_next_last
  2. CMDnext
  3. CMDlast

/* $Id: next.c,v 1.1.1.1 1998/08/02 20:35:01 proff Exp $
 * $Copyright$
 */

#include "nglobal.h"
#include "next.h"

static bool do_next_last(bool last)
/* [<][>][^][v][top][bottom][index][help] */
{
        char buf[MAX_LINE];
        if (!*CurrentGroup)
        {
                emitrn (NNTP_NOTINGROUP);
                return FALSE;
        }
        if (CurrentScfg->artno != CurrentGroupArtNum)
        {
                int cc;
                Cemitf("stat %d\r\n", CurrentGroupArtNum);
                Cflush();
                if (!(cc=Cget(buf, sizeof buf)))
                {
                        emitrn (NNTP_SERVERDOWN);
                        return FALSE;
                }
        }
        Cemitrn(last? "last": "next");
        Cflush();
        if (!Cget(buf, sizeof buf))
        {
                emitrn (NNTP_SERVERDOWN);
                return FALSE;
        }
        emit (buf);
        if (strToi(buf)!=NNTP_NOTHING_FOLLOWS_VAL)
            {
                return FALSE;
            }
        sscanf (buf, "%*d %d", &CurrentGroupArtNum);
        CurrentScfg->artno = CurrentGroupArtNum;
        return TRUE;
}

EXPORT bool CMDnext(char *args)
/* [<][>][^][v][top][bottom][index][help] */
{
        return do_next_last(FALSE);
}

EXPORT bool CMDlast(char *args)
/* [<][>][^][v][top][bottom][index][help] */
{
        return do_next_last(TRUE);
}

/* [<][>][^][v][top][bottom][index][help] */