2001-03-26 00:43:58 +04:00
|
|
|
/* $NetBSD: hack.u_init.c,v 1.6 2001/03/25 20:44:03 jsm Exp $ */
|
1997-10-19 20:56:41 +04:00
|
|
|
|
1993-08-02 21:18:41 +04:00
|
|
|
/*
|
|
|
|
* Copyright (c) Stichting Mathematisch Centrum, Amsterdam, 1985.
|
|
|
|
*/
|
|
|
|
|
1997-10-19 20:56:41 +04:00
|
|
|
#include <sys/cdefs.h>
|
1993-08-02 21:18:41 +04:00
|
|
|
#ifndef lint
|
2001-03-26 00:43:58 +04:00
|
|
|
__RCSID("$NetBSD: hack.u_init.c,v 1.6 2001/03/25 20:44:03 jsm Exp $");
|
1997-10-19 20:56:41 +04:00
|
|
|
#endif /* not lint */
|
1993-03-21 12:45:37 +03:00
|
|
|
|
1997-10-19 20:56:41 +04:00
|
|
|
#include <ctype.h>
|
1993-03-21 12:45:37 +03:00
|
|
|
#include <signal.h>
|
1997-10-19 20:56:41 +04:00
|
|
|
#include <stdlib.h>
|
|
|
|
#include "hack.h"
|
|
|
|
#include "extern.h"
|
|
|
|
|
1993-03-21 12:45:37 +03:00
|
|
|
#define Strcpy (void) strcpy
|
|
|
|
#define Strcat (void) strcat
|
|
|
|
#define UNDEF_TYP 0
|
|
|
|
#define UNDEF_SPE '\177'
|
|
|
|
|
1997-10-19 20:56:41 +04:00
|
|
|
struct you zerou;
|
|
|
|
char pl_character[PL_CSIZ];
|
2001-03-26 00:43:58 +04:00
|
|
|
const char *(roles[]) = { /* must all have distinct first letter */
|
1997-10-19 20:56:41 +04:00
|
|
|
/* roles[4] may be changed to -woman */
|
1993-03-21 12:45:37 +03:00
|
|
|
"Tourist", "Speleologist", "Fighter", "Knight",
|
|
|
|
"Cave-man", "Wizard"
|
|
|
|
};
|
|
|
|
#define NR_OF_ROLES SIZE(roles)
|
1997-10-19 20:56:41 +04:00
|
|
|
char rolesyms[NR_OF_ROLES + 1]; /* filled by u_init() */
|
1993-03-21 12:45:37 +03:00
|
|
|
|
|
|
|
struct trobj {
|
1997-10-19 20:56:41 +04:00
|
|
|
uchar trotyp;
|
|
|
|
schar trspe;
|
|
|
|
char trolet;
|
|
|
|
Bitfield(trquan, 6);
|
|
|
|
Bitfield(trknown, 1);
|
1993-03-21 12:45:37 +03:00
|
|
|
};
|
|
|
|
|
|
|
|
#ifdef WIZARD
|
1997-10-19 20:56:41 +04:00
|
|
|
struct trobj Extra_objs[] = {
|
|
|
|
{0, 0, 0, 0, 0},
|
|
|
|
{0, 0, 0, 0, 0}
|
1993-03-21 12:45:37 +03:00
|
|
|
};
|
1997-10-19 20:56:41 +04:00
|
|
|
#endif /* WIZARD */
|
1993-03-21 12:45:37 +03:00
|
|
|
|
1997-10-19 20:56:41 +04:00
|
|
|
struct trobj Cave_man[] = {
|
|
|
|
{MACE, 1, WEAPON_SYM, 1, 1},
|
|
|
|
{BOW, 1, WEAPON_SYM, 1, 1},
|
|
|
|
{ARROW, 0, WEAPON_SYM, 25, 1}, /* quan is variable */
|
|
|
|
{LEATHER_ARMOR, 0, ARMOR_SYM, 1, 1},
|
|
|
|
{0, 0, 0, 0, 0}
|
1993-03-21 12:45:37 +03:00
|
|
|
};
|
|
|
|
|
1997-10-19 20:56:41 +04:00
|
|
|
struct trobj Fighter[] = {
|
|
|
|
{TWO_HANDED_SWORD, 0, WEAPON_SYM, 1, 1},
|
|
|
|
{RING_MAIL, 0, ARMOR_SYM, 1, 1},
|
|
|
|
{0, 0, 0, 0, 0}
|
1993-03-21 12:45:37 +03:00
|
|
|
};
|
|
|
|
|
1997-10-19 20:56:41 +04:00
|
|
|
struct trobj Knight[] = {
|
|
|
|
{LONG_SWORD, 0, WEAPON_SYM, 1, 1},
|
|
|
|
{SPEAR, 2, WEAPON_SYM, 1, 1},
|
|
|
|
{RING_MAIL, 1, ARMOR_SYM, 1, 1},
|
|
|
|
{HELMET, 0, ARMOR_SYM, 1, 1},
|
|
|
|
{SHIELD, 0, ARMOR_SYM, 1, 1},
|
|
|
|
{PAIR_OF_GLOVES, 0, ARMOR_SYM, 1, 1},
|
|
|
|
{0, 0, 0, 0, 0}
|
1993-03-21 12:45:37 +03:00
|
|
|
};
|
|
|
|
|
1997-10-19 20:56:41 +04:00
|
|
|
struct trobj Speleologist[] = {
|
|
|
|
{STUDDED_LEATHER_ARMOR, 0, ARMOR_SYM, 1, 1},
|
|
|
|
{UNDEF_TYP, 0, POTION_SYM, 2, 0},
|
|
|
|
{FOOD_RATION, 0, FOOD_SYM, 3, 1},
|
|
|
|
{PICK_AXE, UNDEF_SPE, TOOL_SYM, 1, 0},
|
|
|
|
{ICE_BOX, 0, TOOL_SYM, 1, 0},
|
|
|
|
{0, 0, 0, 0, 0}
|
1993-03-21 12:45:37 +03:00
|
|
|
};
|
|
|
|
|
1997-10-19 20:56:41 +04:00
|
|
|
struct trobj Tinopener[] = {
|
|
|
|
{CAN_OPENER, 0, TOOL_SYM, 1, 1},
|
|
|
|
{0, 0, 0, 0, 0}
|
1993-03-21 12:45:37 +03:00
|
|
|
};
|
|
|
|
|
1997-10-19 20:56:41 +04:00
|
|
|
struct trobj Tourist[] = {
|
|
|
|
{UNDEF_TYP, 0, FOOD_SYM, 10, 1},
|
|
|
|
{POT_EXTRA_HEALING, 0, POTION_SYM, 2, 0},
|
|
|
|
{EXPENSIVE_CAMERA, 0, TOOL_SYM, 1, 1},
|
|
|
|
{DART, 2, WEAPON_SYM, 25, 1}, /* quan is variable */
|
|
|
|
{0, 0, 0, 0, 0}
|
1993-03-21 12:45:37 +03:00
|
|
|
};
|
|
|
|
|
1997-10-19 20:56:41 +04:00
|
|
|
struct trobj Wizard[] = {
|
|
|
|
{ELVEN_CLOAK, 0, ARMOR_SYM, 1, 1},
|
|
|
|
{UNDEF_TYP, UNDEF_SPE, WAND_SYM, 2, 0},
|
|
|
|
{UNDEF_TYP, UNDEF_SPE, RING_SYM, 2, 0},
|
|
|
|
{UNDEF_TYP, UNDEF_SPE, POTION_SYM, 2, 0},
|
|
|
|
{UNDEF_TYP, UNDEF_SPE, SCROLL_SYM, 3, 0},
|
|
|
|
{0, 0, 0, 0, 0}
|
1993-03-21 12:45:37 +03:00
|
|
|
};
|
|
|
|
|
1997-10-19 20:56:41 +04:00
|
|
|
void
|
|
|
|
u_init()
|
|
|
|
{
|
|
|
|
int i;
|
|
|
|
char exper = 'y', pc;
|
|
|
|
if (flags.female) /* should have been set in HACKOPTIONS */
|
1993-03-21 12:45:37 +03:00
|
|
|
roles[4] = "Cave-woman";
|
1997-10-19 20:56:41 +04:00
|
|
|
for (i = 0; i < NR_OF_ROLES; i++)
|
1993-03-21 12:45:37 +03:00
|
|
|
rolesyms[i] = roles[i][0];
|
|
|
|
rolesyms[i] = 0;
|
|
|
|
|
1997-10-19 20:56:41 +04:00
|
|
|
if ((pc = pl_character[0]) != '\0') {
|
|
|
|
if (islower(pc))
|
|
|
|
pc = toupper(pc);
|
|
|
|
if ((i = role_index(pc)) >= 0)
|
1993-03-21 12:45:37 +03:00
|
|
|
goto got_suffix; /* implies experienced */
|
|
|
|
printf("\nUnknown role: %c\n", pc);
|
|
|
|
pl_character[0] = pc = 0;
|
|
|
|
}
|
|
|
|
printf("\nAre you an experienced player? [ny] ");
|
|
|
|
|
1997-10-19 20:56:41 +04:00
|
|
|
while (!strchr("ynYN \n\004", (exper = readchar())))
|
1993-03-21 12:45:37 +03:00
|
|
|
bell();
|
1997-10-19 20:56:41 +04:00
|
|
|
if (exper == '\004') /* Give him an opportunity to get out */
|
1993-03-21 12:45:37 +03:00
|
|
|
end_of_input();
|
1997-10-19 20:56:41 +04:00
|
|
|
printf("%c\n", exper); /* echo */
|
|
|
|
if (strchr("Nn \n", exper)) {
|
1993-03-21 12:45:37 +03:00
|
|
|
exper = 0;
|
|
|
|
goto beginner;
|
|
|
|
}
|
|
|
|
printf("\nTell me what kind of character you are:\n");
|
|
|
|
printf("Are you");
|
1997-10-19 20:56:41 +04:00
|
|
|
for (i = 0; i < NR_OF_ROLES; i++) {
|
1993-03-21 12:45:37 +03:00
|
|
|
printf(" a %s", roles[i]);
|
1997-10-19 20:56:41 +04:00
|
|
|
if (i == 2) /* %% */
|
1993-03-21 12:45:37 +03:00
|
|
|
printf(",\n\t");
|
1997-10-19 20:56:41 +04:00
|
|
|
else if (i < NR_OF_ROLES - 2)
|
1993-03-21 12:45:37 +03:00
|
|
|
printf(",");
|
1997-10-19 20:56:41 +04:00
|
|
|
else if (i == NR_OF_ROLES - 2)
|
1993-03-21 12:45:37 +03:00
|
|
|
printf(" or");
|
|
|
|
}
|
|
|
|
printf("? [%s] ", rolesyms);
|
|
|
|
|
1997-10-19 20:56:41 +04:00
|
|
|
while ((pc = readchar()) != '\0') {
|
|
|
|
if (islower(pc))
|
|
|
|
pc = toupper(pc);
|
|
|
|
if ((i = role_index(pc)) >= 0) {
|
1993-03-21 12:45:37 +03:00
|
|
|
printf("%c\n", pc); /* echo */
|
|
|
|
(void) fflush(stdout); /* should be seen */
|
|
|
|
break;
|
|
|
|
}
|
1997-10-19 20:56:41 +04:00
|
|
|
if (pc == '\n')
|
1993-03-21 12:45:37 +03:00
|
|
|
break;
|
1997-10-19 20:56:41 +04:00
|
|
|
if (pc == '\004') /* Give him the opportunity to get
|
|
|
|
* out */
|
1993-03-21 12:45:37 +03:00
|
|
|
end_of_input();
|
|
|
|
bell();
|
|
|
|
}
|
1997-10-19 20:56:41 +04:00
|
|
|
if (pc == '\n')
|
1993-03-21 12:45:37 +03:00
|
|
|
pc = 0;
|
|
|
|
|
|
|
|
beginner:
|
1997-10-19 20:56:41 +04:00
|
|
|
if (!pc) {
|
1993-03-21 12:45:37 +03:00
|
|
|
printf("\nI'll choose a character for you.\n");
|
|
|
|
i = rn2(NR_OF_ROLES);
|
|
|
|
pc = rolesyms[i];
|
|
|
|
printf("This game you will be a%s %s.\n",
|
1997-10-19 20:56:41 +04:00
|
|
|
exper ? "n experienced" : "",
|
|
|
|
roles[i]);
|
1993-03-21 12:45:37 +03:00
|
|
|
getret();
|
|
|
|
/* give him some feedback in case mklev takes much time */
|
|
|
|
(void) putchar('\n');
|
|
|
|
(void) fflush(stdout);
|
|
|
|
}
|
1993-04-21 01:27:31 +04:00
|
|
|
#if 0
|
1997-10-19 20:56:41 +04:00
|
|
|
/*
|
|
|
|
* Given the above code, I can't see why this would ever change
|
|
|
|
* anything; it does core pretty well, though. - cmh 4/20/93
|
|
|
|
*/
|
|
|
|
if (exper) {
|
1993-03-21 12:45:37 +03:00
|
|
|
roles[i][0] = pc;
|
|
|
|
}
|
1993-04-21 01:27:31 +04:00
|
|
|
#endif
|
1993-03-21 12:45:37 +03:00
|
|
|
|
|
|
|
got_suffix:
|
|
|
|
|
1997-10-19 20:56:41 +04:00
|
|
|
(void) strncpy(pl_character, roles[i], PL_CSIZ - 1);
|
|
|
|
pl_character[PL_CSIZ - 1] = 0;
|
1993-03-21 12:45:37 +03:00
|
|
|
flags.beginner = 1;
|
|
|
|
u = zerou;
|
|
|
|
u.usym = '@';
|
|
|
|
u.ulevel = 1;
|
|
|
|
init_uhunger();
|
|
|
|
#ifdef QUEST
|
|
|
|
u.uhorizon = 6;
|
1997-10-19 20:56:41 +04:00
|
|
|
#endif /* QUEST */
|
1993-03-21 12:45:37 +03:00
|
|
|
uarm = uarm2 = uarmh = uarms = uarmg = uwep = uball = uchain =
|
1997-10-19 20:56:41 +04:00
|
|
|
uleft = uright = 0;
|
1993-03-21 12:45:37 +03:00
|
|
|
|
1997-10-19 20:56:41 +04:00
|
|
|
switch (pc) {
|
1993-03-21 12:45:37 +03:00
|
|
|
case 'c':
|
|
|
|
case 'C':
|
1997-10-19 20:56:41 +04:00
|
|
|
Cave_man[2].trquan = 12 + rnd(9) * rnd(9);
|
1993-03-21 12:45:37 +03:00
|
|
|
u.uhp = u.uhpmax = 16;
|
|
|
|
u.ustr = u.ustrmax = 18;
|
|
|
|
ini_inv(Cave_man);
|
|
|
|
break;
|
|
|
|
case 't':
|
|
|
|
case 'T':
|
|
|
|
Tourist[3].trquan = 20 + rnd(20);
|
|
|
|
u.ugold = u.ugold0 = rnd(1000);
|
|
|
|
u.uhp = u.uhpmax = 10;
|
|
|
|
u.ustr = u.ustrmax = 8;
|
|
|
|
ini_inv(Tourist);
|
1997-10-19 20:56:41 +04:00
|
|
|
if (!rn2(25))
|
|
|
|
ini_inv(Tinopener);
|
1993-03-21 12:45:37 +03:00
|
|
|
break;
|
|
|
|
case 'w':
|
|
|
|
case 'W':
|
1997-10-19 20:56:41 +04:00
|
|
|
for (i = 1; i <= 4; i++)
|
|
|
|
if (!rn2(5))
|
|
|
|
Wizard[i].trquan += rn2(3) - 1;
|
1993-03-21 12:45:37 +03:00
|
|
|
u.uhp = u.uhpmax = 15;
|
|
|
|
u.ustr = u.ustrmax = 16;
|
|
|
|
ini_inv(Wizard);
|
|
|
|
break;
|
|
|
|
case 's':
|
|
|
|
case 'S':
|
|
|
|
Fast = INTRINSIC;
|
|
|
|
Stealth = INTRINSIC;
|
|
|
|
u.uhp = u.uhpmax = 12;
|
|
|
|
u.ustr = u.ustrmax = 10;
|
|
|
|
ini_inv(Speleologist);
|
1997-10-19 20:56:41 +04:00
|
|
|
if (!rn2(10))
|
|
|
|
ini_inv(Tinopener);
|
1993-03-21 12:45:37 +03:00
|
|
|
break;
|
|
|
|
case 'k':
|
|
|
|
case 'K':
|
|
|
|
u.uhp = u.uhpmax = 12;
|
|
|
|
u.ustr = u.ustrmax = 10;
|
|
|
|
ini_inv(Knight);
|
|
|
|
break;
|
|
|
|
case 'f':
|
|
|
|
case 'F':
|
|
|
|
u.uhp = u.uhpmax = 14;
|
|
|
|
u.ustr = u.ustrmax = 17;
|
|
|
|
ini_inv(Fighter);
|
|
|
|
break;
|
1997-10-19 20:56:41 +04:00
|
|
|
default: /* impossible */
|
1993-03-21 12:45:37 +03:00
|
|
|
u.uhp = u.uhpmax = 12;
|
|
|
|
u.ustr = u.ustrmax = 16;
|
|
|
|
}
|
|
|
|
find_ac();
|
1997-10-19 20:56:41 +04:00
|
|
|
if (!rn2(20)) {
|
|
|
|
int d = rn2(7) - 2; /* biased variation */
|
1993-03-21 12:45:37 +03:00
|
|
|
u.ustr += d;
|
|
|
|
u.ustrmax += d;
|
|
|
|
}
|
|
|
|
#ifdef WIZARD
|
1997-10-19 20:56:41 +04:00
|
|
|
if (wizard)
|
|
|
|
wiz_inv();
|
|
|
|
#endif /* WIZARD */
|
1993-03-21 12:45:37 +03:00
|
|
|
|
|
|
|
/* make sure he can carry all he has - especially for T's */
|
1997-10-19 20:56:41 +04:00
|
|
|
while (inv_weight() > 0 && u.ustr < 118)
|
1993-03-21 12:45:37 +03:00
|
|
|
u.ustr++, u.ustrmax++;
|
|
|
|
}
|
|
|
|
|
1997-10-19 20:56:41 +04:00
|
|
|
void
|
|
|
|
ini_inv(trop)
|
|
|
|
struct trobj *trop;
|
|
|
|
{
|
|
|
|
struct obj *obj;
|
|
|
|
while (trop->trolet) {
|
1993-03-21 12:45:37 +03:00
|
|
|
obj = mkobj(trop->trolet);
|
|
|
|
obj->known = trop->trknown;
|
|
|
|
/* not obj->dknown = 1; - let him look at it at least once */
|
|
|
|
obj->cursed = 0;
|
1997-10-19 20:56:41 +04:00
|
|
|
if (obj->olet == WEAPON_SYM) {
|
1993-03-21 12:45:37 +03:00
|
|
|
obj->quan = trop->trquan;
|
|
|
|
trop->trquan = 1;
|
|
|
|
}
|
1997-10-19 20:56:41 +04:00
|
|
|
if (trop->trspe != UNDEF_SPE)
|
1993-03-21 12:45:37 +03:00
|
|
|
obj->spe = trop->trspe;
|
1997-10-19 20:56:41 +04:00
|
|
|
if (trop->trotyp != UNDEF_TYP)
|
1993-03-21 12:45:37 +03:00
|
|
|
obj->otyp = trop->trotyp;
|
1997-10-19 20:56:41 +04:00
|
|
|
else if (obj->otyp == WAN_WISHING) /* gitpyr!robert */
|
|
|
|
obj->otyp = WAN_DEATH;
|
1993-03-21 12:45:37 +03:00
|
|
|
obj->owt = weight(obj); /* defined after setting otyp+quan */
|
|
|
|
obj = addinv(obj);
|
1997-10-19 20:56:41 +04:00
|
|
|
if (obj->olet == ARMOR_SYM) {
|
|
|
|
switch (obj->otyp) {
|
1993-03-21 12:45:37 +03:00
|
|
|
case SHIELD:
|
1997-10-19 20:56:41 +04:00
|
|
|
if (!uarms)
|
|
|
|
setworn(obj, W_ARMS);
|
1993-03-21 12:45:37 +03:00
|
|
|
break;
|
|
|
|
case HELMET:
|
1997-10-19 20:56:41 +04:00
|
|
|
if (!uarmh)
|
|
|
|
setworn(obj, W_ARMH);
|
1993-03-21 12:45:37 +03:00
|
|
|
break;
|
|
|
|
case PAIR_OF_GLOVES:
|
1997-10-19 20:56:41 +04:00
|
|
|
if (!uarmg)
|
|
|
|
setworn(obj, W_ARMG);
|
1993-03-21 12:45:37 +03:00
|
|
|
break;
|
|
|
|
case ELVEN_CLOAK:
|
1997-10-19 20:56:41 +04:00
|
|
|
if (!uarm2)
|
1993-03-21 12:45:37 +03:00
|
|
|
setworn(obj, W_ARM);
|
|
|
|
break;
|
|
|
|
default:
|
1997-10-19 20:56:41 +04:00
|
|
|
if (!uarm)
|
|
|
|
setworn(obj, W_ARM);
|
1993-03-21 12:45:37 +03:00
|
|
|
}
|
|
|
|
}
|
1997-10-19 20:56:41 +04:00
|
|
|
if (obj->olet == WEAPON_SYM)
|
|
|
|
if (!uwep)
|
|
|
|
setuwep(obj);
|
1993-03-21 12:45:37 +03:00
|
|
|
#ifndef PYRAMID_BUG
|
1997-10-19 20:56:41 +04:00
|
|
|
if (--trop->trquan)
|
|
|
|
continue; /* make a similar object */
|
1993-03-21 12:45:37 +03:00
|
|
|
#else
|
1997-10-19 20:56:41 +04:00
|
|
|
if (trop->trquan) { /* check if zero first */
|
1993-03-21 12:45:37 +03:00
|
|
|
--trop->trquan;
|
1997-10-19 20:56:41 +04:00
|
|
|
if (trop->trquan)
|
1993-03-21 12:45:37 +03:00
|
|
|
continue; /* make a similar object */
|
|
|
|
}
|
1997-10-19 20:56:41 +04:00
|
|
|
#endif /* PYRAMID_BUG */
|
1993-03-21 12:45:37 +03:00
|
|
|
trop++;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
#ifdef WIZARD
|
1997-10-19 20:56:41 +04:00
|
|
|
void
|
|
|
|
wiz_inv()
|
|
|
|
{
|
|
|
|
struct trobj *trop = &Extra_objs[0];
|
|
|
|
char *ep = getenv("INVENT");
|
|
|
|
int type;
|
|
|
|
while (ep && *ep) {
|
1993-03-21 12:45:37 +03:00
|
|
|
type = atoi(ep);
|
1997-10-19 20:56:41 +04:00
|
|
|
ep = strchr(ep, ',');
|
|
|
|
if (ep)
|
|
|
|
while (*ep == ',' || *ep == ' ')
|
|
|
|
ep++;
|
|
|
|
if (type <= 0 || type > NROFOBJECTS)
|
|
|
|
continue;
|
1993-03-21 12:45:37 +03:00
|
|
|
trop->trotyp = type;
|
|
|
|
trop->trolet = objects[type].oc_olet;
|
|
|
|
trop->trspe = 4;
|
|
|
|
trop->trknown = 1;
|
|
|
|
trop->trquan = 1;
|
|
|
|
ini_inv(trop);
|
|
|
|
}
|
|
|
|
/* give him a wand of wishing by default */
|
|
|
|
trop->trotyp = WAN_WISHING;
|
|
|
|
trop->trolet = WAND_SYM;
|
|
|
|
trop->trspe = 20;
|
|
|
|
trop->trknown = 1;
|
|
|
|
trop->trquan = 1;
|
|
|
|
ini_inv(trop);
|
|
|
|
}
|
1997-10-19 20:56:41 +04:00
|
|
|
#endif /* WIZARD */
|
1993-03-21 12:45:37 +03:00
|
|
|
|
1997-10-19 20:56:41 +04:00
|
|
|
void
|
|
|
|
plnamesuffix()
|
|
|
|
{
|
|
|
|
char *p;
|
|
|
|
if ((p = strrchr(plname, '-')) != NULL) {
|
1993-03-21 12:45:37 +03:00
|
|
|
*p = 0;
|
|
|
|
pl_character[0] = p[1];
|
|
|
|
pl_character[1] = 0;
|
1997-10-19 20:56:41 +04:00
|
|
|
if (!plname[0]) {
|
1993-03-21 12:45:37 +03:00
|
|
|
askname();
|
|
|
|
plnamesuffix();
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
1997-10-19 20:56:41 +04:00
|
|
|
int
|
1993-03-21 12:45:37 +03:00
|
|
|
role_index(pc)
|
1997-10-19 20:56:41 +04:00
|
|
|
char pc;
|
|
|
|
{ /* must be called only from u_init() */
|
|
|
|
/* so that rolesyms[] is defined */
|
|
|
|
char *cp;
|
1993-03-21 12:45:37 +03:00
|
|
|
|
1997-10-19 20:56:41 +04:00
|
|
|
if ((cp = strchr(rolesyms, pc)) != NULL)
|
|
|
|
return (cp - rolesyms);
|
|
|
|
return (-1);
|
1993-03-21 12:45:37 +03:00
|
|
|
}
|