summaryrefslogtreecommitdiffstats
path: root/common/bbs/names.c
blob: 68dcf1019ac24d3b69381dd30cb6e7e88b6cb253 (plain) (blame)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
/* $Id$ */

#include "cmbbs.h"
#include <assert.h>
#include <string.h>
#include <ctype.h>
#include "pttstruct.h"


int 
is_validuserid(const char *id)
{
    int len, i;
    if(id==NULL)
    return 0;
    len = strlen(id);

    if (len < 2 || len>IDLEN)
    return 0;

    if (!isalpha(id[0]))
    return 0;
    for (i = 1; i < len; i++)
    if (!isalnum(id[i]))
        return 0;
    return 1;
}