Main Page   Class Hierarchy   Alphabetical List   Compound List   File List   Compound Members   File Members   Related Pages  

cmd_collab.C

Go to the documentation of this file.
00001 /***************************************************************************
00002  *cr
00003  *cr            (C) Copyright 1995-2008 The Board of Trustees of the
00004  *cr                        University of Illinois
00005  *cr                         All Rights Reserved
00006  *cr
00007  ***************************************************************************/
00008 
00009 /***************************************************************************
00010  * RCS INFORMATION:
00011  *
00012  *      $RCSfile: cmd_collab.C,v $
00013  *      $Author: johns $        $Locker:  $             $State: Exp $
00014  *      $Revision: 1.4 $      $Date: 2008/03/27 19:36:50 $
00015  *
00016  ***************************************************************************/
00017 
00018 #include "CommandQueue.h"
00019 #include "VMDApp.h"
00020 #include "MoleculeList.h"
00021 #include "utilities.h"
00022 #include "config.h"    // for CMDLEN
00023 #include <stdlib.h>
00024 #include <tcl.h>
00025 
00026 #include "VMDCollab.h"
00027 
00028 int text_cmd_collab(ClientData cd, Tcl_Interp *interp, int argc,
00029                      const char *argv[]) {
00030   VMDApp *app = (VMDApp *)cd;
00031 
00032   if (argc == 4 && !strupncmp(argv[1], "connect", CMDLEN)) {
00033     const char *host = argv[2];
00034     int port;
00035     if (Tcl_GetInt(interp, argv[3], &port) != TCL_OK) return TCL_ERROR;
00036     if (!strcmp(host, Tcl_GetHostName())) {
00037       if (!app->vmdcollab->startserver(port)) {
00038         Tcl_AppendResult(interp, "Failed to start server on port ", argv[3], NULL);
00039         return TCL_ERROR;
00040       }
00041     }
00042     if (!app->vmdcollab->connect(host, port)) {
00043       Tcl_AppendResult(interp, "Failed to connect to vmdcollab at ", host,
00044           "port: ", argv[3], NULL);
00045       return TCL_ERROR;
00046     }
00047     return TCL_OK;
00048   }
00049   if (argc == 2 && !strupncmp(argv[1], "disconnect", CMDLEN)) {
00050     app->vmdcollab->disconnect();
00051     return TCL_OK;
00052   }
00053 
00054   Tcl_SetResult(interp, "Usage: vmdcollab [connect <host> <port> | disconnect",
00055       TCL_STATIC);
00056   return TCL_ERROR;
00057 }
00058 
00059 

Generated on Sun Jul 6 01:27:21 2008 for VMD (current) by doxygen1.2.14 written by Dimitri van Heesch, © 1997-2002