Commit e5c8de49 authored by Per Cederqvist's avatar Per Cederqvist
Browse files

(map_created_texts): New function.

parent 3e95a007
/*
* $Id: services.h,v 0.36 1998/08/05 16:12:49 ceder Exp $
* $Id: services.h,v 0.37 1998/08/22 17:40:19 ceder Exp $
* Copyright (C) 1991, 1992, 1993, 1994, 1995, 1996 Lysator Academic Computer Association.
*
* This file is part of the LysKOM server.
......@@ -173,6 +173,12 @@ KOM_( get_created_texts (Pers_no person,
unsigned long no_of_texts,
L2g_iterator_as_text_list *created_texts ));
extern Success
KOM_( map_created_texts (Pers_no person,
Local_text_no first,
unsigned long no_of_texts,
Text_mapping *created_texts ));
extern Success
KOM_( get_membership_old (Pers_no person,
unsigned short first,
......
/*
* $Id: person.c,v 0.40 1998/08/09 19:55:53 ceder Exp $
* $Id: person.c,v 0.41 1998/08/22 17:40:32 ceder Exp $
* Copyright (C) 1991, 1992, 1993, 1994, 1995, 1996 Lysator Academic Computer Association.
*
* This file is part of the LysKOM server.
......@@ -29,7 +29,7 @@
*/
static const char *
rcsid = "$Id: person.c,v 0.40 1998/08/09 19:55:53 ceder Exp $";
rcsid = "$Id: person.c,v 0.41 1998/08/22 17:40:32 ceder Exp $";
#include "rcs.h"
USE(rcsid);
......@@ -831,6 +831,62 @@ get_created_texts(Pers_no pers_no,
}
extern Success
map_created_texts(Pers_no pers_no,
Local_text_no first_local_no,
unsigned long no_of_texts,
Text_mapping *result)
{
Person *pers_p;
Access acc;
Local_text_no res_first;
if (first_local_no == 0)
{
err_stat = first_local_no;
kom_errno = KOM_LOCAL_TEXT_ZERO;
return FAILURE;
}
if (no_of_texts > 255)
{
err_stat = 255;
kom_errno = KOM_LONG_ARRAY;
return FAILURE;
}
CHK_LOGIN(FAILURE);
GET_P_STAT(pers_p, pers_no, FAILURE);
acc = access_perm(pers_no, NULL, ACTPERS, ACT_P);
if (acc == error)
return FAILURE;
if (acc == none)
{
err_stat = pers_no;
kom_errno = KOM_UNDEF_PERS;
return FAILURE;
}
if (first_local_no >= l2g_first_appendable_key(&pers_p->created_texts))
{
err_stat = first_local_no;
kom_errno = KOM_NO_SUCH_LOCAL_TEXT;
return FAILURE;
}
res_first = l2g_next_key(&pers_p->created_texts, 0);
result->first = max(res_first, first_local_no);
result->no_of_texts = no_of_texts;
result->l2g = &pers_p->created_texts;
return OK;
}
/*
* Set privilege bits of a person. You must have the wheel bit set
......
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