Commit 9de146e9 authored by Per Cederqvist's avatar Per Cederqvist
Browse files

Added find_next_text_no and find_previous_text_no.

parent a5cf5fe0
/* /*
* $Id: services.h,v 0.6 1991/12/16 23:58:14 ceder Exp $ * $Id: services.h,v 0.7 1991/12/17 23:07:32 ceder Exp $
* Copyright (C) 1991 Lysator Academic Computer Association. * Copyright (C) 1991 Lysator Academic Computer Association.
* *
* This file is part of the LysKOM server. * This file is part of the LysKOM server.
...@@ -401,6 +401,17 @@ extern Success ...@@ -401,6 +401,17 @@ extern Success
KOM_( get_last_text (struct tm *clock, Text_no *result)); KOM_( get_last_text (struct tm *clock, Text_no *result));
#endif #endif
/*
* Return next/previous existing text-no.
*/
extern Success
KOM_( find_next_text_no (Text_no start, Text_no *result));
extern Success
KOM_( find_previous_text_no (Text_no start, Text_no *result));
/* /*
* Who is logged on now? * Who is logged on now?
*/ */
......
Wed Dec 18 00:05:43 1991 Per Cederqvist (ceder at lysator)
* fncdef.txt, prot-a.c, text.c (find_next_text_no,
find_previous_text_no): New functions.
Tue Dec 17 00:52:11 1991 Per Cederqvist (ceder at lysator) Tue Dec 17 00:52:11 1991 Per Cederqvist (ceder at lysator)
* prot-a-parse-arg-c.awk: Fixed bogus parsing of argument to * prot-a-parse-arg-c.awk: Fixed bogus parsing of argument to
......
# #
# $Id: fncdef.txt,v 0.7 1991/11/11 00:27:41 ceder Exp $ # $Id: fncdef.txt,v 0.8 1991/12/17 23:07:42 ceder Exp $
# Copyright (C) 1991 Lysator Academic Computer Association. # Copyright (C) 1991 Lysator Academic Computer Association.
# #
# This file is part of the LysKOM server. # This file is part of the LysKOM server.
...@@ -22,7 +22,7 @@ ...@@ -22,7 +22,7 @@
# #
# Please mail bug reports to bug-lyskom@lysator.liu.se. # Please mail bug reports to bug-lyskom@lysator.liu.se.
# #
# $Id: fncdef.txt,v 0.7 1991/11/11 00:27:41 ceder Exp $ # $Id: fncdef.txt,v 0.8 1991/12/17 23:07:42 ceder Exp $
# #
# This file is used to describe the functions in services.c. All # This file is used to describe the functions in services.c. All
# functions that are reachable from the clients are listed here, together # functions that are reachable from the clients are listed here, together
...@@ -95,3 +95,5 @@ success who_am_i : session_no ...@@ -95,3 +95,5 @@ success who_am_i : session_no
success set_user_area num num success set_user_area num num
success get_last_text time_date : text_no success get_last_text time_date : text_no
number create_anonymous_text c_string (TEXT_LEN) num c_misc_info_p number create_anonymous_text c_string (TEXT_LEN) num c_misc_info_p
success find_next_text_no num : text_no
success find_previous_text_no num : text_no
/* /*
* $Id: prot-a.c,v 0.11 1991/11/16 03:30:05 ceder Exp $ * $Id: prot-a.c,v 0.12 1991/12/17 23:07:40 ceder Exp $
* Copyright (C) 1991 Lysator Academic Computer Association. * Copyright (C) 1991 Lysator Academic Computer Association.
* *
* This file is part of the LysKOM server. * This file is part of the LysKOM server.
...@@ -26,7 +26,7 @@ ...@@ -26,7 +26,7 @@
* Protocol A. * Protocol A.
*/ */
static char *rcsid = "$Id: prot-a.c,v 0.11 1991/11/16 03:30:05 ceder Exp $"; static char *rcsid = "$Id: prot-a.c,v 0.12 1991/12/17 23:07:40 ceder Exp $";
#include <stdio.h> #include <stdio.h>
...@@ -297,6 +297,8 @@ prot_a_is_legal_fnc(Call_header fnc) ...@@ -297,6 +297,8 @@ prot_a_is_legal_fnc(Call_header fnc)
case call_fnc_set_user_area: case call_fnc_set_user_area:
case call_fnc_get_last_text: case call_fnc_get_last_text:
case call_fnc_create_anonymous_text: case call_fnc_create_anonymous_text:
case call_fnc_find_next_text_no:
case call_fnc_find_previous_text_no:
return TRUE; return TRUE;
default: default:
......
/* /*
* $Id: text.c,v 0.14 1991/12/17 22:20:53 ceder Exp $ * $Id: text.c,v 0.15 1991/12/17 23:07:38 ceder Exp $
* Copyright (C) 1991 Lysator Academic Computer Association. * Copyright (C) 1991 Lysator Academic Computer Association.
* *
* This file is part of the LysKOM server. * This file is part of the LysKOM server.
...@@ -28,7 +28,7 @@ ...@@ -28,7 +28,7 @@
* All atomic calls that deals with texts. * All atomic calls that deals with texts.
*/ */
static char *rcsid = "$Id: text.c,v 0.14 1991/12/17 22:20:53 ceder Exp $"; static char *rcsid = "$Id: text.c,v 0.15 1991/12/17 23:07:38 ceder Exp $";
#include <time.h> #include <time.h>
#include <stdlib.h> #include <stdlib.h>
...@@ -1950,6 +1950,56 @@ get_last_text(time_t time, ...@@ -1950,6 +1950,56 @@ get_last_text(time_t time,
} }
/*
* Return next existing text-no.
*/
extern Success
find_next_text_no (Text_no start,
Text_no *result)
{
Text_no highest = query_next_text_num();
Text_stat *text_s;
while (++start < highest)
{
text_s = cached_get_text_stat(start);
if (text_s != NULL && text_read_access(start, text_s) == TRUE)
{
*result = start;
return OK;
}
}
kom_errno = KOM_NO_SUCH_TEXT;
return FAILURE;
}
/*
* Return next/previous existing text-no.
*/
extern Success
find_previous_text_no (Text_no start,
Text_no *result)
{
Text_stat *text_s;
while (start-- > 0)
{
text_s = cached_get_text_stat(start);
if (text_s != NULL && text_read_access(start, text_s) == TRUE)
{
*result = start;
return OK;
}
}
kom_errno = KOM_NO_SUCH_TEXT;
return FAILURE;
}
/* /*
* Add a recipient to a text. * Add a recipient to a text.
*/ */
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment