Main Page | Alphabetical List | Data Structures | File List | Data Fields | Globals

newboard.c File Reference

#include <sys/types.h>
#include <ctype.h>
#include <stdio.h>
#include <stdlib.h>
#include <string.h>
#include <time.h>
#include "merc.h"

Include dependency graph for newboard.c:

Go to the source code of this file.

Functions

void builder_note (CHAR_DATA *ch, char *argument)
void code_note (CHAR_DATA *ch, char *argument)


Function Documentation

void builder_note CHAR_DATA ch,
char *  argument
 

Definition at line 252 of file newboard.c.

References BUILDER_FILE, MAX_STRING_LENGTH, one_argument(), send_to_char(), str_cmp(), and unlink().

00253 {
00254     char arg1[MAX_STRING_LENGTH];
00255     char arg2[MAX_STRING_LENGTH];
00256     char buf[MAX_STRING_LENGTH];
00257     argument = one_argument(argument, arg1);
00258     argument = one_argument(argument, arg2);
00259     FILE *fp;
00260     
00261     if ((!str_cmp(arg1, "post")) && arg2[0] == '\0')
00262     {
00263         send_to_char("Syntax - bnote post <who> <message>\n\r",ch);
00264         return;
00265     }
00266     if (!str_cmp(arg1, "read"))
00267     {
00268         //send_to_char("Working on it!!\n\r",ch);
00269         //return;
00270         if ((fp = fopen (BUILDER_FILE, "r")) == NULL)
00271         {
00272             send_to_char("Unable to open Builder-file.\n\rIf you get this error, then that probably means its empty.\n\r",ch);
00273             return;
00274         }
00275         for ( ; ; )
00276         {
00277             if ( feof (fp))
00278             {
00279                 fclose(fp);
00280                 send_to_char("\n\rEnd of file.\n\r",ch);
00281                 return;
00282             }
00283             while(fgets(buf, 10, fp)!=NULL)
00284                 send_to_char(buf,ch);
00285         }
00286             
00287     }
00288     if (!str_cmp(arg1, "post"))
00289     {
00290         if (arg2[0] == '\0')
00291         {
00292             send_to_char("You need a receipient.\n\r",ch);
00293             return;
00294         }
00295         if (argument[0] == '\0')
00296         {
00297             send_to_char("You need a message\n\r",ch);
00298             return;
00299         }
00300         
00301         sprintf (buf, "From: %s\n\rTo: %s\n\rmessage:\n\r%s\n\r", ch->name, arg2, argument);
00302 //  append_file2(ch, BUILDER_FILE, buf);
00303         send_to_char (buf, ch);
00304         send_to_char("logged.\n\r",ch);
00305         return;
00306     }
00307     if (!str_cmp(arg1, "purge"))
00308     {
00309         if (!str_cmp(ch->name, "Rhaeven") || !str_cmp(ch->name,"Tribul"))
00310         {
00311             send_to_char ("{R{!{*Deleting{x the build-note file.\n\r",ch);
00312             unlink (BUILDER_FILE);
00313             return;
00314         }
00315         send_to_char ("Syntax - bnote post <who> <message>\n\rSyntax - bnote read\n\r",ch);
00316         return;
00317     }
00318     
00319     send_to_char("Syntax - bnote post <who> <message>\n\rSyntax - bnote read\n\r",ch);
00320     return;
00321 }

Here is the call graph for this function:

void code_note CHAR_DATA ch,
char *  argument
 

Definition at line 323 of file newboard.c.

References CODE_FILE, MAX_STRING_LENGTH, one_argument(), send_to_char(), str_cmp(), and unlink().

00324 {
00325     char buf[MAX_STRING_LENGTH];
00326     char arg1[MAX_STRING_LENGTH];
00327     char arg2[MAX_STRING_LENGTH];
00328     char tempp[MAX_STRING_LENGTH];
00329     FILE *fp;
00330     argument = one_argument (argument, arg1);
00331     argument = one_argument (argument, arg2);
00332     
00333     if (!str_cmp(arg1, "post"))
00334     {
00335         if (arg2[0] == '\0')
00336         {
00337             send_to_char("You must have something to post!\n\r",ch);
00338             return;
00339         }
00340         strcat(arg2, argument);
00341         sprintf(buf, "From: %s\n\rMessage: \n\r%s\n\r", ch->name, arg2);
00342 //      append_file2(ch, CODE_FILE, buf);
00343         send_to_char(buf, ch);
00344         send_to_char("\n\rLogged.\n\r",ch);
00345         return;
00346     }
00347 
00348     if (!str_cmp(ch->name, "Tribul") && arg1[0] == '\0' && argument[0] == '\0' && arg2[0] == '\0')
00349     {
00350         if ((fp = fopen (CODE_FILE, "r")) == NULL)
00351         {
00352                send_to_char("Unable to open Code-file.\n\rIf you get this error, then that probably means its empty.\n\r",ch);
00353                return;
00354         }
00355         for ( ; ; )
00356         {
00357                if ( feof (fp))
00358                {
00359                       fclose(fp);
00360                       send_to_char("\n\rEnd of file.\n\r",ch);
00361                       return;
00362                }
00363             while(fgets(buf, 10, fp)!=NULL)
00364                        send_to_char(buf,ch);
00365              }
00366         
00367     
00368     }
00369      if (!str_cmp(arg1, "purge"))
00370      {
00371          if (!str_cmp(ch->name,"Tribul"))
00372          {
00373              send_to_char ("{R{!{*Deleting{x the Code-note file.\n\r",ch);
00374          unlink (CODE_FILE);
00375              return;
00376           }
00377           send_to_char ("Syntax - cnote post <message>\n\r",ch);
00378           return;
00379           }
00380          send_to_char("Syntax - cnote post <message>\n\r",ch);
00381          return;
00382 }

Here is the call graph for this function:


Generated on Thu Jan 13 22:11:54 2005 for Beyond the Shadows by  doxygen 1.4.0