Files
2025-03-05 08:37:43 +01:00

95 lines
2.2 KiB
C

/*
* PVVMUD a 3D MUD
* Copyright (C) 1998-1999 Programvareverkstedet (pvv@pvv.org)
*
* This program 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 of the License, or
* (at your option) any later version.
*
* This program 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 this program; if not, write to the Free Software
* Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
*
*/
#include "pvvmud.H"
#include <signal.h>
#include <iostream.h>
#include <stdlib.h>
#include <unistd.h>
#include "getgos.H"
#include "msggos.H"
CGetGOS * getgos;
void signalhandler(int signum){
switch(signum){
case SIGINT:
getgos->quit();
break;
}
}
void printUsage(){
printf("Usage [-h|--host <gos host>] [-p|--port <gos port>] <-g|-m|-t ID>\n");
}
int main(int argc, char * argv[]){
int id;
// Install signal handlers
signal(SIGINT, signalhandler);
signal(SIGPIPE, SIG_IGN);
int ch;
COption option;
option.setValue("host",'h',"localhost");
option.setValue("port",'p',GOS_CLIENT_PORT);
option.setValue("material",'m',-1);
option.setValue("geometry",'g',-1);
option.setValue("texture",'t',-1);
option.setValue("help",'h',0);
option.parseArguments(argc,argv);
if (argc < 3){
printUsage();
exit (0);
}
if (option.getInt("help")){
printUsage();
exit (0);
}
if (option.getInt("geometry") != -1){
getgos = new CGetGOS(&option,GOSREQUEST_GEOMETRY,option.getInt("geometry"));
getgos->run();
delete getgos;
}
if (option.getInt("material") != -1){
getgos = new CGetGOS(&option,GOSREQUEST_MATERIAL,option.getInt("material"));
getgos->run();
delete getgos;
}
if (option.getInt("texture") != -1){
getgos = new CGetGOS(&option,GOSREQUEST_TEXTURE,option.getInt("texture"));
getgos->run();
delete getgos;
}
exit(0);
}