BBS program design 3 - Common functions (on)

xiaoxiao2021-03-06  42

Sender: loveyou (Dreamman), letter area: DAS_ROOM Title: BBS program design 3 - Common functions (on) Sending station: Jincheng Station (Tue Apr 25 20:32:51 2000), transfer

When you come to the src directory, your head must be doubled. Oh, don't be afraid, there are many unused stuff. The first is * .o file, it is the input file generated when compiling BBS (* Note, When compiling BBS is not a executable file *), such as FB7.0 is an executable that generates BBSD, it is a BBS driver program. Not much to say. Annections * .o Dongdong leave it.

Don't say that it is useless, let's talk about it, tell you * .c files are the source program of BBS. They are useful, so say it directly.: PP

I only started learning, you just want to watch the * .c file.

Below, I started to talk one by one. (* The project is really very big, hey, come slowly, I try to speak with easy-to-understand methods *)

The user is on the ground. First, the system call is the bbsd.c program, which is generally not to change unless you are very familiar with the operating system, it is very familiar with the BBS program. It can be seen by the user only in front of the station screen:

Current system load ..... (I can't remember: PP)

It's too much in one by one. I usually use it, those who are not intended, I have time to say.

============================================================================================================================================================================================================= ====================

Before you say this, I first tell you some of the functions that are often used in BBS programming.

============================================================================================================================================================================================================= ====================

Currentuser

This is a global constant. It is a useer structure. You can use it at any time in your programming without need to define. It's a variety of properties. You can check it in the Struct.h file of the include directory. I am here Everyone is posted out:

Struct useer {

Char userid [idlen 2]; // user code // char fill [30];

Time_t firstLogin; // User's first time char LastHost [16]; // User last time the address UNSIGNED INT NUMLOGINS; // last time

Unsigned int number; // Posts the number of articles Char flags [2]; // seems to define the identity (I don't know) Char passwd [passlen]; // User's password char username [namelen]; // user NAS CHAR IDENT [Namelen]; // Set in main.c. Don't take it. CHAR TERMTYPE [Strlen]; // User's Terminal Type Char TermType [strlen]; // User Terminal Type Unsigned Userlevel; / / User's permissions Time_t lastlogin; // User last time on the station time Time_t stay; // User's stay at station Char RealName [Namelen]; // Real Name CHAR Address [strlen]; // Real Address Char email [Strlen]; // Real E-mail int signature; // currently used the signature file unsigned int useerdefine; // user parameter setting Time_t notedate; // User last time Inteline; // Row number of messages

INT Notemode; // Users to see the scheme of the message board (all look, only did not read, no watch)

// int unuse1; / * no use * / / set to fill more attributes later, useless // int unuse3; / * no use * /

}

I have said before these attributes, I said again:

If you want to get the current number of users, it is currentuser.numlogins its return value. You don't have to remember, check it again, slowly you will remember. ========= ============================================================================================================================================================================================================= ============================================================================================================================================================================================================= ============================================================================ Has_Perm () This function is also common, Is it judge whether or not the current user has a certain permission.

If a user presses D in the article, the system must judge whether the user has the privilege of the owner. If not, it will return immediately:

IF (! HAS_PERM (Perm_Boarder) Return;

Perm_boarder is set in the permissions settings, and you can find it in the permissions.h file in the include directory. Below I have explained it out:

"Basic Power", / * perm_basic * / "Enter Chat Room", / * perm_chat * /

"Call others chat", / * perm_page * / "publish article", / * perm_post * / "user data correct", / * perm_loginok * / "prohibited publishing article", / * perm_denypost * / "stealth", / * Perm_cloak * / "Wearing the Swipe", / * perm_seecloak * / "Account Permanent Reserved", / * Perm_xempt * / "Edit Inbred Screen", / * Perm_welcome * / "Board", / * perm_boards * / "account Administrator, / * perm_accounts * / "This site think tank", / * perm_chatcloak * / "voting administrator", / * perm_ovote * / "system maintenance administrator", / * perm_sysop * / "read / post / post limit" , / * Perm_postmask * / "Essence Area", / * perm_announce * / "Discussion Forum", / * perm_oboards * / "Activity View Edition", / * perm_acboard * / "No ZAP (discussion area)", / * Perm_nozap * / "Forced Call", / * Perm_ForcePage * /

"Extending Denancy", / * perm_ext_idle * / "Special Permissions 1", / * perm_special1 * / .....

There are still several special permissions below.

============================================================================================================================================================================================================= =================== Define () This function is to determine if the user is set to YES, if the user wants to determine if the user receives information. Sound: if (def_soundmsg)) Beep (1); these parameters are defined in Permissions.h, I have as follows:

"When the call is closed, you can make friends calls", / * def_friendcall * / "accept everyone's message", / * def_allmsg * / "Accept your friends", / * def_friendmsg * / "Receive message to sound", / * DEF_SOUNDMSG * / "Receive Message Sound", / * Def_SoundMsg * / "Use Color", / * DEF_COLOR * / "Display Activity View", / * DEF_ACBOARD * / "Show menu message bar", / * DEF_ENDLINE * / "Edit Show Status Bar", / * Def_editmsg * / "Message Bar is used in general / streamlined mode", / * DEF_NOTMSGFRIEND * /

"Menu uses a general / streamline mode", / * def_normalscr * / "Classification discussion area", / * DEF_NEWPOST * / "Read the article Whether to use Wind Roll Selection, / * DEF_CIRCLE * /

"Read article Clap in the first unread", / * def_firstnew * / "Show friend list", / * DEF_LOGFRIEND * / "Show memo", / * def_innote * / "display time display Memo ", / * Def_outnote * /" When I leave the station, I will send it to all messages ", / * def_mailmsg * /" Use your own off-site picture ", / * Def_logout * /" I am a member of this organization ", / * Def_seewelc1 * / "Friends Listening Notice", / * DEF_LOGINFROM * / "Watch the message version", / * Def_notepad * / "Do not send out the station notification to friends", / * Def_nologinsend * / "Sociode", / * DEF_THESIS * / "Receive Message Waiting Response or Clearance", / * DEF_MSGGETKEY * /

"Chinese characters", / * def_deldblchar * / "use GB code reading" / * DEF_USEGB * / "using GB code reading" / * DEF_USEGB * /

============================================================================================================================================================================================================= =================== move (x, y) move the current cursor to the screen (x, y) point.

============================================================================================================================================================================================================= ================== car () and CLRTOEOL ()

The two functions are clear. There is a difference, clear () means all the current screen, that is, all clear. CLRTOEOL () is to clear the current line, this function you only need to always use Move (). If you want to display a line of information in the first line of the user screen: Move (1, 1); CLRTOEOL (); Prints ("See this line?"); This clrtoeol () function is to put users The previous character is clear, and then "see this ..." is displayed. So, when you want to clear the screen, use clear (), when you want to clear the current line, use CLRToEOL ( )

============================================================================================================================================================================================================= ================== Prints ()

A string is displayed at the current cursor. Such as: Prints ("Hi, Hello!"); Can also bring variables: Prints ("Hi% s, Welcome!", Currentuser.userid; if the current user is me, show me: hi loveyou, Welcome! If the current user is me, it will show me: hi loveyou, Welcome! According to this, you can use it flexible!

============================================================================================================================================================================================================= ================== Printf () saves some strings to a string variable. To save the current user's BBSE-mail to the Usermail string: char usermail [30]; printf (& usermail, "% s.bbs@%s", currentuser.userid, my_bbs_domain); then if the current user is me, The usermail string variable is: loveYou.bbs@bbs.swjtu.edu.cn The mY_bbs_domain is the global constant defined in the Config.h file in the include directory, and you can go see.

============================================================================================================================================================================================================= =================== - ※ Source: · Meilong Inn BBS.ECust.edu.cn · [from: 211.144.72.160]

转载请注明原文地址:https://www.9cbs.com/read-54648.html

New Post(0)