OpenCores
URL https://opencores.org/ocsvn/or1k/or1k/trunk

Subversion Repositories or1k

[/] [or1k/] [tags/] [start/] [insight/] [libgui/] [src/] [tclshellexe.c] - Diff between revs 579 and 1765

Only display areas with differences | Details | Blame | View Log

Rev 579 Rev 1765
/* tclshellexe.c - Interface to Windows ShellExecute function.
/* tclshellexe.c - Interface to Windows ShellExecute function.
   Copyright (C) 1997 Cygnus Solutions.
   Copyright (C) 1997 Cygnus Solutions.
   Written by Tom Tromey <tromey@cygnus.com>;
   Written by Tom Tromey <tromey@cygnus.com>;
   Code mostly taken from S-N.  */
   Code mostly taken from S-N.  */
 
 
#ifdef _WIN32
#ifdef _WIN32
 
 
#include <string.h>
#include <string.h>
 
 
#include <windows.h>
#include <windows.h>
 
 
#include <tcl.h>
#include <tcl.h>
#include <tk.h>
#include <tk.h>
 
 
#include "guitcl.h"
#include "guitcl.h"
 
 
static int
static int
shell_execute_command (ClientData clientData, Tcl_Interp *interp,
shell_execute_command (ClientData clientData, Tcl_Interp *interp,
                       int argc, char *argv[])
                       int argc, char *argv[])
{
{
  char  *operation;
  char  *operation;
  char  *file;
  char  *file;
  char  *param;
  char  *param;
  char  *dir;
  char  *dir;
  int   ret;
  int   ret;
 
 
  if (argc < 3 || argc > 5)
  if (argc < 3 || argc > 5)
    {
    {
      Tcl_AppendResult(interp, "wrong # args:  should be \"",
      Tcl_AppendResult(interp, "wrong # args:  should be \"",
                       argv[0], " operation file ?parameters? ?directory?\"", NULL);
                       argv[0], " operation file ?parameters? ?directory?\"", NULL);
 
 
      return TCL_ERROR;
      return TCL_ERROR;
    }
    }
  operation = argv[1];  /* Mandatory */
  operation = argv[1];  /* Mandatory */
  if (!*operation)
  if (!*operation)
    operation = NULL;
    operation = NULL;
 
 
  file = argv[2];               /* Mandatory */
  file = argv[2];               /* Mandatory */
 
 
  if (argc > 3)
  if (argc > 3)
    {
    {
      param = argv[3];
      param = argv[3];
      if (!*param)
      if (!*param)
        param = NULL;
        param = NULL;
    }
    }
  else
  else
    param = NULL;
    param = NULL;
 
 
  if (argc > 4)
  if (argc > 4)
    {
    {
      dir = argv[4];
      dir = argv[4];
      if (!*dir)
      if (!*dir)
        dir = NULL;
        dir = NULL;
    }
    }
  else
  else
    dir = NULL;
    dir = NULL;
 
 
  ret = (int)ShellExecute(NULL, operation, file, param, dir, SW_SHOWNORMAL);
  ret = (int)ShellExecute(NULL, operation, file, param, dir, SW_SHOWNORMAL);
  if (ret <= 32)
  if (ret <= 32)
    {
    {
      Tcl_AppendResult(interp, strerror(ret), NULL);
      Tcl_AppendResult(interp, strerror(ret), NULL);
      return TCL_ERROR;
      return TCL_ERROR;
    }
    }
  return TCL_OK;
  return TCL_OK;
}
}
 
 
int
int
ide_create_shell_execute_command (Tcl_Interp *interp)
ide_create_shell_execute_command (Tcl_Interp *interp)
{
{
  if (Tcl_CreateCommand (interp, "ide_shell_execute", shell_execute_command,
  if (Tcl_CreateCommand (interp, "ide_shell_execute", shell_execute_command,
                         NULL, NULL) == NULL)
                         NULL, NULL) == NULL)
    return TCL_ERROR;
    return TCL_ERROR;
  return TCL_OK;
  return TCL_OK;
}
}
 
 
#endif /* _WIN32 */
#endif /* _WIN32 */
 
 

powered by: WebSVN 2.1.0

© copyright 1999-2024 OpenCores.org, equivalent to Oliscience, all rights reserved. OpenCores®, registered trademark.