[Home] [Downloads] [Search] [Help/forum]


Register forum user name Search FAQ

Gammon Forum

[Folder]  Entire forum
-> [Folder]  SMAUG
. -> [Folder]  Running the server
. . -> [Subject]  Backup and minor bugs

Backup and minor bugs

It is now over 60 days since the last post. This thread is closed.     [Refresh] Refresh page


Posted by Shadoan   Canada  (21 posts)  [Biography] bio
Date Sun 15 Apr 2001 06:26 PM (UTC)

Amended on Sun 15 Apr 2001 10:15 PM (UTC) by Nick Gammon

Message
Heya, ok I added a backup code to my mud but I'm getting errors on compiling. Heres the errors:



$ make
make swreality
make[1]: Entering directory `/home/unknown/swr/dist/src'
gcc -c -g3 -Wall  -DNOCRYPT  backup.c
rm -f swreality
gcc  -o swreality act_comm.o act_info.o act_move.o act_obj.o act_wiz.o boards.o
build.o clans.o comm.o comments.o const.o db.o fight.o handler.o hashstr.o id.o
interp.o magic.o makeobjs.o misc.o mud_comm.o mud_prog.o player.o requests.o res
et.o save.o shops.o skills.o special.o tables.o track.o update.o space.o bounty.
o swskills.o hail.o whisper.o backup.o -lm  -lcrypt
backup.o(.text+0x58a): undefined reference to `exists_file'
backup.o(.text+0x66d): undefined reference to `exists_file'
backup.o(.text+0x6ee): undefined reference to `exists_file'
backup.o(.text+0x7d1): undefined reference to `exists_file'
backup.o(.text+0x852): undefined reference to `exists_file'
backup.o(.text+0x935): more undefined references to `exists_file' follow
collect2: ld returned 1 exit status
make[1]: *** [swreality] Error 1
make[1]: Leaving directory `/home/unknown/swr/dist/src'
make: *** [all] Error 2



And here is the backup.c file:




#include <sys/types.h>
#include <sys/stat.h>
#include <sys/socket.h>
#include <sys/time.h>
#include <unistd.h>
#include <stdio.h>
#include "mud.h"

#define PFILE_BACKUP	"pfileb.tgz"
#define BUILD_BACKUP	"buildb.tgz"
#define AREAS_BACKUP	"areasb.tgz"
#define SYSTM_BACKUP	"systmb.tgz"
#define LOGS_BACKUP	"logsb.tgz"
#define LOG_DIR		"../log"

void do_backup( CHAR_DATA *ch, char *argument )
{
	char cmd[MAX_INPUT_LENGTH];
	char buf[MAX_STRING_LENGTH];
	bool overrideit;
	bool exists_file( char *filen );
		
	argument = one_argument( argument, cmd );
	overrideit = !str_cmp( argument, "yes" );
	
	if( cmd[0] == '\0' )
	  {
		set_char_color( AT_NOTE, ch );
		send_to_char( "Syntax: backup <pfiles/build/sysdata/logs> <yes>\n\r", ch );
		return;
	  }

	if(!str_cmp( cmd, "pfiles" ) )
	  {
		if( exists_file( PFILE_BACKUP ) )
		  {
			send_to_char( "Syntax: backup pfiles yes\n\r", ch );
			send_to_char( "-- There is a previous backup of PFILES, please\n\r", ch );
			send_to_char( "follow the Syntax above to make a NEW backup.\n\r", ch );
			
			if( !overrideit )
			  {
 				send_to_char( "Syntax: backup pfiles yes\n\r", ch );
				return;
			  }
			  else
			  {
			  	send_to_char( "Deleting Previous Backup...\n\r", ch );
				unlink( PFILE_BACKUP );
			  }
			}

		send_to_char( "Creating Player Base Backup...\n\r", ch );
		sprintf( buf, "tar -zcf %s %s*", PFILE_BACKUP, PLAYER_DIR );
		system( buf );
		if( !exists_file( PFILE_BACKUP ) )
		  {
			send_to_char( "Cannot Create Backup, ERROR! Please try again\n\r", ch );
			return;
		  }

		echo_to_all( AT_YELLOW, "PFILE BACKUP CREATED!", ECHOTAR_IMM );
		
		send_to_char( "Pfiles backed-up.", ch );
		return;
	}

	if(!str_cmp( cmd, "build" ) )
	  {
		if( exists_file( BUILD_BACKUP ) )
		  {
			send_to_char( "Syntax: backup build yes\n\r", ch );
			send_to_char( "-- There is a previous backup of BUILD, please\n\r", ch );
			send_to_char( "follow the Syntax above to make a NEW backup.\n\r", ch );
			
			if( !overrideit )
			  {
 				send_to_char( "Syntax: backup build yes\n\r", ch );
				return;
			  }
			  else
			  {
			  	send_to_char( "Deleting Previuos Backup...\n\r", ch );
				unlink( BUILD_BACKUP );
			  }
			}
		send_to_char( "Creating Player Base Backup...\n\r", ch );
		sprintf( buf, "tar -zcf %s %s*", PFILE_BACKUP, PLAYER_DIR );
		system( buf );
		if( !exists_file( PFILE_BACKUP ) )
		  {
			send_to_char( "Cannot Create Backup, ERROR! Please try again\n\r", ch );
			return;
		  }

		echo_to_all( AT_YELLOW, "PFILE BACKUP CREATED!", ECHOTAR_IMM );
		
		send_to_char( "Pfiles backed-up.", ch );
		return;
	}

	if(!str_cmp( cmd, "build" ) )
	  {
		if( exists_file( BUILD_BACKUP ) )
		  {
			send_to_char( "Syntax: backup build yes\n\r", ch );
			send_to_char( "-- There is a previous backup of BUILD, please\n\r", ch );
			send_to_char( "follow the Syntax above to make a NEW backup.\n\r", ch );
			
			if( !overrideit )
			  {
 				send_to_char( "Syntax: backup build yes\n\r", ch );
				return;
			  }
			  else
			  {
			  	send_to_char( "Deleting Previuos Backup...\n\r", ch );
				unlink( BUILD_BACKUP );
			  }
			}

		send_to_char( "Creating Building Direcotry Backup...\n\r", ch );
		sprintf( buf, "tar -zcf %s %s*", BUILD_BACKUP, BUILD_DIR );
		system( buf );
		if( !exists_file( BUILD_BACKUP ) )
		  {
			send_to_char( "Cannot Create Backup, ERROR! Please try again\n\r", ch );
			return;
		  }

		echo_to_all( AT_YELLOW, "BUILD DIR BACKUP CREATED!", ECHOTAR_IMM );
		
		send_to_char( "Build-Areas backed-up.", ch );
		return;
     	}
	if(!str_cmp( cmd, "logs" ) )
	  {
		if( exists_file( LOGS_BACKUP ) )
		  {
			send_to_char( "Syntax: backup logs yes\n\r", ch );
			send_to_char( "-- There is a previous backup of LOGS, please\n\r", ch );
			send_to_char( "follow the Syntax above to make a NEW backup.\n\r", ch );
			
			if( !overrideit )
			  {
 				send_to_char( "Syntax: backup logs yes\n\r", ch );
				return;
			  }
			  else
			  {
			  	send_to_char( "Deleting Previous Backup...\n\r", ch );
				unlink( PFILE_BACKUP );
			  }
			}

		send_to_char( "Creating Log Backup...\n\r", ch );
		sprintf( buf, "tar -zcf %s %s*", LOGS_BACKUP, LOG_DIR );
		system( buf );
		/* Make sure to check, dun want just spitting out send_to_chars */
		if( !exists_file( LOGS_BACKUP ) )
		  {
			send_to_char( "Cannot Create Backup, ERROR! Please try again\n\r", ch );
			return;
		  }

		echo_to_all( AT_YELLOW, "LOG BACKUP CREATED!", ECHOTAR_IMM );
		
		send_to_char( "Logs have been backed up.", ch );
		return;
	}
		
	if(!str_cmp( cmd, "sysdata" ) )
	  {
		if( exists_file( SYSTM_BACKUP ) )
		  {
			send_to_char( "Syntax: backup sysdata yes\n\r", ch );
			send_to_char( "-- There is a previous backup of SYSDATA, please\n\r", ch );
			send_to_char( "follow the Syntax above to make a NEW backup.\n\r", ch );
			
			if( !overrideit )
			  {
 				send_to_char( "Syntax: backup sysdata yes\n\r", ch );
				return;
			  }
			  else
			  {
			  	send_to_char( "Deleting Previous Backup...\n\r", ch );
				unlink( SYSTM_BACKUP );
			  }
			}

		send_to_char( "Creating Sysdata Direcotry Backup...\n\r", ch );
		sprintf( buf, "tar -zcf %s %s*", SYSTM_BACKUP, SYSTEM_DIR );
		system( buf );
		/* Make sure to check, dun want just spitting out send_to_chars */
		if( !exists_file( SYSTM_BACKUP ) )
		  {
			send_to_char( "ERROR: Something happened in the process, try again.\n\r", ch );
			return;
		  }

		echo_to_all( AT_YELLOW, "System-Data has been successfully backed-up.", ECHOTAR_IMM );
		
		send_to_char( "System-Data backed-up.", ch );
		return;
	}
}


Ok and here's my minor bug:
Whenever I try doing makewizlist it adds another wizlist not replaces it, like this:
Before makewizlist:
Masters of MUD
NAME NAME NAME
After makewizlist:
Masters of MUD
NAME NAME NAME
Masters of MUD
NAME NAME NAME
And every makewizlist after that it adds one more, but a reboot resets it and it goes back to only 1 wizlist.
Thx in advance.

Edge of Darkness MUD and Hosting Service,
Head Administrator(Retired)
All your SWR needs, right here, right now.
[Go to top] top

Posted by Nick Gammon   Australia  (23,000 posts)  [Biography] bio   Forum Administrator
Date Reply #1 on Sun 15 Apr 2001 10:17 PM (UTC)
Message
You are calling a function "exists_file" that you have not implemented.

- Nick Gammon

www.gammon.com.au, www.mushclient.com
[Go to top] top

The dates and times for posts above are shown in Universal Co-ordinated Time (UTC).

To show them in your local time you can join the forum, and then set the 'time correction' field in your profile to the number of hours difference between your location and UTC time.


9,153 views.

It is now over 60 days since the last post. This thread is closed.     [Refresh] Refresh page

Go to topic:           Search the forum


[Go to top] top

Quick links: MUSHclient. MUSHclient help. Forum shortcuts. Posting templates. Lua modules. Lua documentation.

Information and images on this site are licensed under the Creative Commons Attribution 3.0 Australia License unless stated otherwise.

[Home]


Written by Nick Gammon - 5K   profile for Nick Gammon on Stack Exchange, a network of free, community-driven Q&A sites   Marriage equality

Comments to: Gammon Software support
[RH click to get RSS URL] Forum RSS feed ( https://gammon.com.au/rss/forum.xml )

[Best viewed with any browser - 2K]    [Hosted at HostDash]