Made bbs menus machine endian indepentant
This commit is contained in:
parent
8def403243
commit
e4c4477ad3
@ -1,6 +1,7 @@
|
||||
$Id$
|
||||
|
||||
WARNING, users of Sparc and HP-PA systems should not edit bbs menus now!
|
||||
WARNING, users of Sparc and HP-PA systems should be carefull, some
|
||||
menus might not work.
|
||||
All other users on Intel machines (99,9% I think) can use this version.
|
||||
|
||||
|
||||
@ -106,6 +107,7 @@ v0.37.01 14-Jan-2003.
|
||||
Fixed whoson list to display user real names and handles again.
|
||||
Fixed send online message to send to user real names, handles
|
||||
and unix names again.
|
||||
The menus are machine endian independant.
|
||||
|
||||
examples:
|
||||
The English and Dutch templates are updated to show the new
|
||||
|
@ -3,13 +3,9 @@
|
||||
|
||||
include ../Makefile.global
|
||||
|
||||
SRCS = endian.c
|
||||
HDRS = endian.h
|
||||
OBJS = endian.o
|
||||
OTHER = Makefile header.txt footer.txt menus-le.tar menus-be.tar \
|
||||
txtfiles-en.tar templates-en.tar \
|
||||
OTHER = Makefile header.txt footer.txt \
|
||||
menus-en.tar txtfiles-en.tar templates-en.tar \
|
||||
menus-es.tar txtfiles-es.tar templates-es.tar \
|
||||
menus-en.tar \
|
||||
templates-de.tar \
|
||||
templates-nl.tar
|
||||
|
||||
@ -18,13 +14,10 @@ OTHER = Makefile header.txt footer.txt menus-le.tar menus-be.tar \
|
||||
.c.o:
|
||||
${CC} ${CFLAGS} ${INCLUDES} ${DEFINES} -c $<
|
||||
|
||||
all: endian
|
||||
all:
|
||||
|
||||
endian: ${OBJS} ${LIBS}
|
||||
${CC} -o endian ${OBJS} ${LIBS}
|
||||
strip endian
|
||||
|
||||
install: all
|
||||
install:
|
||||
@if [ ! -f ${ETCDIR}/header.txt ]; then \
|
||||
${INSTALL} -c -o ${OWNER} -g ${GROUP} -m 0644 header.txt ${ETCDIR} ; \
|
||||
echo "${INSTALL} -c -o ${OWNER} -g ${GROUP} -m 0644 header.txt ${ETCDIR}" ; \
|
||||
@ -34,8 +27,8 @@ install: all
|
||||
echo "${INSTALL} -c -o ${OWNER} -g ${GROUP} -m 0644 footer.txt ${ETCDIR}" ; \
|
||||
fi
|
||||
@if [ ! -f ${PREFIX}/english/menus/main.mnu ]; then \
|
||||
tar xfC menus-`./endian`.tar ${PREFIX}/english/menus ; \
|
||||
echo "tar xfC menus-`./endian`.tar ${PREFIX}/english/menus" ; \
|
||||
tar xfC menus-en.tar ${PREFIX}/english/menus ; \
|
||||
echo "tar xfC menus-en.tar ${PREFIX}/english/menus" ; \
|
||||
echo "Installed default English menus" ; \
|
||||
fi
|
||||
@if [ ! -f ${PREFIX}/english/txtfiles/main.ans ]; then \
|
||||
@ -69,7 +62,7 @@ install: all
|
||||
fi
|
||||
|
||||
clean:
|
||||
rm -f endian *.o *.h~ *.c~ core filelist Makefile.bak
|
||||
rm -f *.h~ *.c~ core filelist Makefile.bak
|
||||
|
||||
filelist: Makefile
|
||||
BASE=`pwd`; \
|
||||
@ -100,5 +93,4 @@ depend:
|
||||
|
||||
# DO NOT DELETE THIS LINE - MAKE DEPEND RELIES ON IT
|
||||
# Dependencies generated by make depend
|
||||
endian.o: endian.h
|
||||
# End of generated dependencies
|
||||
|
@ -1,64 +0,0 @@
|
||||
/*****************************************************************************
|
||||
*
|
||||
* $Id$
|
||||
* Purpose ...............: Check little/big-endian for install of the menus.
|
||||
*
|
||||
*****************************************************************************
|
||||
* Copyright (C) 1997-2002
|
||||
*
|
||||
* Michiel Broek FIDO: 2:280/2802
|
||||
* Beekmansbos 10
|
||||
* 1971 BV IJmuiden
|
||||
* the Netherlands
|
||||
*
|
||||
* This file is part of MBSE BBS.
|
||||
*
|
||||
* This BBS is free software; you can redistribute it and/or modify it
|
||||
* under the terms of the GNU General Public License as published by the
|
||||
* Free Software Foundation; either version 2, or (at your option) any
|
||||
* later version.
|
||||
*
|
||||
* MB BBS is distributed in the hope that it will be useful, but
|
||||
* WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
|
||||
* General Public License for more details.
|
||||
*
|
||||
* You should have received a copy of the GNU General Public License
|
||||
* along with MB BBS; see the file COPYING. If not, write to the Free
|
||||
* Software Foundation, 675 Mass Ave, Cambridge, MA 02139, USA.
|
||||
*****************************************************************************/
|
||||
|
||||
|
||||
#include <stdio.h>
|
||||
#include <ctype.h>
|
||||
#include "endian.h"
|
||||
|
||||
int main(void)
|
||||
{
|
||||
|
||||
/*
|
||||
* First test BYTE_ORDER
|
||||
*/
|
||||
#ifdef BYTE_ORDER
|
||||
if (BYTE_ORDER == 1234) {
|
||||
printf("le");
|
||||
} else if (BYTE_ORDER == 4321) {
|
||||
printf("be");
|
||||
} else {
|
||||
/*
|
||||
* If it failed do a simple CPU test
|
||||
*/
|
||||
#endif
|
||||
#ifdef __i386__
|
||||
printf("le");
|
||||
#else
|
||||
printf("be");
|
||||
#endif
|
||||
#ifdef BYTE_ORDER
|
||||
}
|
||||
#endif
|
||||
|
||||
|
||||
return 0;
|
||||
}
|
||||
|
@ -1,4 +0,0 @@
|
||||
/* $Id$ */
|
||||
|
||||
int main(void);
|
||||
|
Binary file not shown.
Binary file not shown.
Binary file not shown.
@ -501,7 +501,7 @@ void name_mangle(char *); /* Mangle name or make uppercase */
|
||||
* sectest.c
|
||||
*/
|
||||
int Access(securityrec, securityrec); /* Check security access */
|
||||
|
||||
int Le_Access(securityrec, securityrec); /* Endian independant */
|
||||
|
||||
#endif
|
||||
|
||||
|
@ -4,7 +4,7 @@
|
||||
* Purpose ...............: Security flags access test
|
||||
*
|
||||
*****************************************************************************
|
||||
* Copyright (C) 1997-2002
|
||||
* Copyright (C) 1997-2003
|
||||
*
|
||||
* Michiel Broek FIDO: 2:280/2802
|
||||
* Beekmansbos 10
|
||||
@ -55,3 +55,27 @@ int Access(securityrec us, securityrec ref)
|
||||
return TRUE;
|
||||
}
|
||||
|
||||
|
||||
|
||||
/*
|
||||
* The same test, for menus which are written in machine endian independant way.
|
||||
* The second parameter MUST be the menu parameter.
|
||||
*/
|
||||
int Le_Access(securityrec us, securityrec ref)
|
||||
{
|
||||
Syslog('B', "User %5d %08lx %08lx", us.level, us.flags, ~us.flags);
|
||||
Syslog('B', "Ref. %5d %08lx %08lx", le_int(ref.level), ref.flags, ref.notflags);
|
||||
|
||||
if (us.level < le_int(ref.level))
|
||||
return FALSE;
|
||||
|
||||
if ((ref.notflags & ~us.flags) != ref.notflags)
|
||||
return FALSE;
|
||||
|
||||
if ((ref.flags & us.flags) != ref.flags)
|
||||
return FALSE;
|
||||
|
||||
return TRUE;
|
||||
}
|
||||
|
||||
|
||||
|
@ -4,7 +4,7 @@
|
||||
* Purpose ...............: MBSE BBS Global structure
|
||||
*
|
||||
*****************************************************************************
|
||||
* Copyright (C) 1997-2002
|
||||
* Copyright (C) 1997-2003
|
||||
*
|
||||
* Michiel Broek FIDO: 2:280/2802
|
||||
* Beekmansbos 10
|
||||
@ -839,16 +839,16 @@ struct menufile {
|
||||
char Display[81]; /* Menu display line */
|
||||
securityrec MenuSecurity; /* Menu Security Level */
|
||||
int Age; /* Minimum Age to use menu */
|
||||
unsigned int MaxSecurity; /* Maximum security level */
|
||||
unsigned int xMaxSecurity;
|
||||
char Password[15]; /* Menu Password */
|
||||
char TypeDesc[30]; /* Menu Type Description */
|
||||
unsigned AutoExec : 1; /* Auto Exec Menu Type */
|
||||
unsigned NoDoorsys : 1; /* Suppress door.sys */
|
||||
unsigned Y2Kdoorsys : 1; /* Write Y2K style door.sys */
|
||||
unsigned Comport : 1; /* Vmodem compart mode */
|
||||
unsigned Comport : 1; /* Vmodem comport mode */
|
||||
unsigned NoSuid : 1; /* Execute door nosuid */
|
||||
unsigned NoPrompt : 1; /* No prompt after door */
|
||||
long Credit; /* Credit needed */
|
||||
long xCredit;
|
||||
int HiForeGnd; /* High ForeGround color */
|
||||
int HiBackGnd; /* High ForeGround color */
|
||||
int ForeGnd; /* Normal ForeGround color */
|
||||
|
@ -147,8 +147,8 @@ void menu()
|
||||
*/
|
||||
IsANSI = FALSE;
|
||||
while (fread(&menus, sizeof(menus), 1, pMenuFile) == 1) {
|
||||
if ( Access(exitinfo.Security, menus.MenuSecurity) && (UserAge >= menus.Age)){
|
||||
if ((menus.MenuType == 5) || (menus.MenuType == 19) || (menus.MenuType == 20))
|
||||
if ( Le_Access(exitinfo.Security, menus.MenuSecurity) && (UserAge >= le_int(menus.Age))){
|
||||
if ((le_int(menus.MenuType) == 5) || (le_int(menus.MenuType) == 19) || (le_int(menus.MenuType) == 20))
|
||||
IsANSI = TRUE;
|
||||
}
|
||||
}
|
||||
@ -157,9 +157,9 @@ void menu()
|
||||
clear();
|
||||
|
||||
while (fread(&menus, sizeof(menus), 1, pMenuFile) == 1) {
|
||||
if ( Access(exitinfo.Security, menus.MenuSecurity) && (UserAge >= menus.Age)){
|
||||
if ( Le_Access(exitinfo.Security, menus.MenuSecurity) && (UserAge >= le_int(menus.Age))){
|
||||
if ( menus.AutoExec ) {
|
||||
DoMenu( menus.MenuType );
|
||||
DoMenu( le_int(menus.MenuType) );
|
||||
}
|
||||
DisplayMenu( );
|
||||
}
|
||||
@ -224,10 +224,10 @@ void menu()
|
||||
while (fread(&menus, sizeof(menus), 1, pMenuFile) == 1) {
|
||||
|
||||
if ((strcmp(tu(Input), menus.MenuKey)) == 0) {
|
||||
if ((Access(exitinfo.Security, menus.MenuSecurity)) && (UserAge >= menus.Age)) {
|
||||
Syslog('b', "Menu[%d] %d=(%s), Opt: '%s'", MenuLevel, menus.MenuType,
|
||||
if ((Le_Access(exitinfo.Security, menus.MenuSecurity)) && (UserAge >= le_int(menus.Age))) {
|
||||
Syslog('b', "Menu[%d] %d=(%s), Opt: '%s'", MenuLevel, le_int(menus.MenuType),
|
||||
menus.TypeDesc, menus.OptionalData);
|
||||
if (menus.MenuType == 13) {
|
||||
if (le_int(menus.MenuType) == 13) {
|
||||
/*
|
||||
* Terminate call, cleanup here
|
||||
*/
|
||||
@ -235,7 +235,7 @@ void menu()
|
||||
free(sMenuPathFileName);
|
||||
fclose(pMenuFile);
|
||||
}
|
||||
DoMenu(menus.MenuType);
|
||||
DoMenu(le_int(menus.MenuType));
|
||||
iFoundKey = TRUE;
|
||||
break;
|
||||
}
|
||||
@ -321,8 +321,8 @@ void DoMenu(int Type)
|
||||
strcat(sPrompt, temp);
|
||||
}
|
||||
}
|
||||
if (menus.ForeGnd || menus.BackGnd)
|
||||
pout(menus.ForeGnd, menus.BackGnd, sPrompt);
|
||||
if (le_int(menus.ForeGnd) || le_int(menus.BackGnd))
|
||||
pout(le_int(menus.ForeGnd), le_int(menus.BackGnd), sPrompt);
|
||||
else
|
||||
pout(WHITE, BLACK, sPrompt);
|
||||
break;
|
||||
@ -372,7 +372,7 @@ void DoMenu(int Type)
|
||||
|
||||
case 15:
|
||||
/* print text to screen */
|
||||
if (exitinfo.Security.level >= menus.MenuSecurity.level) {
|
||||
if (exitinfo.Security.level >= le_int(menus.MenuSecurity.level)) {
|
||||
for (i = 0; i < strlen(menus.OptionalData); i++)
|
||||
if (*(menus.OptionalData + i) == '@')
|
||||
*(menus.OptionalData + i) = '\n';
|
||||
@ -713,7 +713,7 @@ void DisplayMenu(void)
|
||||
int maxdpos, dpos, escaped, skipCRLF, highlight;
|
||||
|
||||
/* Anything to process, if not; save CPU time, return */
|
||||
if (( strlen( menus.Display ) == 0 ) && (menus.MenuType != 21)) {
|
||||
if (( strlen( menus.Display ) == 0 ) && (le_int(menus.MenuType) != 21)) {
|
||||
return;
|
||||
}
|
||||
|
||||
@ -724,7 +724,7 @@ void DisplayMenu(void)
|
||||
skipCRLF = 0;
|
||||
highlight = 0;
|
||||
|
||||
colour( menus.ForeGnd, menus.BackGnd );
|
||||
colour( le_int(menus.ForeGnd), le_int(menus.BackGnd) );
|
||||
|
||||
for ( dpos = 0; dpos < maxdpos ; dpos++ ){
|
||||
switch ( menus.Display[ dpos ] ) {
|
||||
@ -749,10 +749,10 @@ void DisplayMenu(void)
|
||||
if ( !escaped ) {
|
||||
if ( highlight == 0 ) {
|
||||
highlight = 1;
|
||||
colour( menus.HiForeGnd, menus.HiBackGnd);
|
||||
colour( le_int(menus.HiForeGnd), le_int(menus.HiBackGnd));
|
||||
} else {
|
||||
highlight = 0 ;
|
||||
colour( menus.ForeGnd, menus.BackGnd );
|
||||
colour( le_int(menus.ForeGnd), le_int(menus.BackGnd) );
|
||||
}
|
||||
} else {
|
||||
escaped=0;
|
||||
|
Reference in New Issue
Block a user