summaryrefslogtreecommitdiffstats
path: root/common/bbs/names.c
blob: d96b3b3ea69d44eb13ab6bad0054131a216416b7 (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
29
/* $Id$ */

// #include "bbs.h"
#include "cmbbs.h"
#include <assert.h>
// #include <stdio.h>
// #include <stdlib.h>
#include <string.h>
#include <ctype.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;
}