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

Subversion Repositories or1k

[/] [or1k/] [tags/] [start/] [insight/] [libgui/] [src/] [tclshellexe.c] - Blame information for rev 1765

Details | Compare with Previous | View Log

Line No. Rev Author Line
1 578 markom
/* tclshellexe.c - Interface to Windows ShellExecute function.
2
   Copyright (C) 1997 Cygnus Solutions.
3
   Written by Tom Tromey <tromey@cygnus.com>;
4
   Code mostly taken from S-N.  */
5
 
6
#ifdef _WIN32
7
 
8
#include <string.h>
9
 
10
#include <windows.h>
11
 
12
#include <tcl.h>
13
#include <tk.h>
14
 
15
#include "guitcl.h"
16
 
17
static int
18
shell_execute_command (ClientData clientData, Tcl_Interp *interp,
19
                       int argc, char *argv[])
20
{
21
  char  *operation;
22
  char  *file;
23
  char  *param;
24
  char  *dir;
25
  int   ret;
26
 
27
  if (argc < 3 || argc > 5)
28
    {
29
      Tcl_AppendResult(interp, "wrong # args:  should be \"",
30
                       argv[0], " operation file ?parameters? ?directory?\"", NULL);
31
 
32
      return TCL_ERROR;
33
    }
34
  operation = argv[1];  /* Mandatory */
35
  if (!*operation)
36
    operation = NULL;
37
 
38
  file = argv[2];               /* Mandatory */
39
 
40
  if (argc > 3)
41
    {
42
      param = argv[3];
43
      if (!*param)
44
        param = NULL;
45
    }
46
  else
47
    param = NULL;
48
 
49
  if (argc > 4)
50
    {
51
      dir = argv[4];
52
      if (!*dir)
53
        dir = NULL;
54
    }
55
  else
56
    dir = NULL;
57
 
58
  ret = (int)ShellExecute(NULL, operation, file, param, dir, SW_SHOWNORMAL);
59
  if (ret <= 32)
60
    {
61
      Tcl_AppendResult(interp, strerror(ret), NULL);
62
      return TCL_ERROR;
63
    }
64
  return TCL_OK;
65
}
66
 
67
int
68
ide_create_shell_execute_command (Tcl_Interp *interp)
69
{
70
  if (Tcl_CreateCommand (interp, "ide_shell_execute", shell_execute_command,
71
                         NULL, NULL) == NULL)
72
    return TCL_ERROR;
73
  return TCL_OK;
74
}
75
 
76
#endif /* _WIN32 */

powered by: WebSVN 2.1.0

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