I saw somebody at work type the following commandline in Windows: start notepad blah.c He said "It's the easiest way to bring up a random file in Notepad." Well, of course Wine should be able to do that, I realized when I woke up this morning, and I vowed to make it happen before I went to work today. So here's a quickie implementation of the start command. Seems to work... comments welcome. - Dan -- Dan Kegel http://www.kegel.com http://counter.li.org/cgi-bin/runscript/display-person.cgi?user=78045
Index: configure.ac =================================================================== RCS file: /home/wine/wine/configure.ac,v retrieving revision 1.116 diff -d -u -r1.116 configure.ac --- configure.ac 4 Jan 2003 02:52:05 -0000 1.116 +++ configure.ac 16 Jan 2003 16:28:55 -0000 @@ -1497,6 +1497,7 @@ programs/regtest/Makefile programs/rpcss/Makefile programs/rundll32/Makefile +programs/start/Makefile programs/uninstaller/Makefile programs/view/Makefile programs/wcmd/Makefile Index: programs/Makefile.in =================================================================== RCS file: /home/wine/wine/programs/Makefile.in,v retrieving revision 1.33 diff -d -u -r1.33 Makefile.in --- programs/Makefile.in 4 Jan 2003 02:52:05 -0000 1.33 +++ programs/Makefile.in 16 Jan 2003 16:28:55 -0000 @@ -19,6 +19,7 @@ regtest \ rpcss \ rundll32 \ + start \ uninstaller \ view \ wcmd \ @@ -43,6 +44,7 @@ regsvr32 \ rpcss \ rundll32 \ + start \ uninstaller \ wcmd \ wineboot \ @@ -61,6 +63,7 @@ progman \ regedit \ regsvr32 \ + start \ uninstaller \ wcmd \ wineboot \ @@ -73,6 +76,7 @@ # Symlinks to apps that we want to run from inside the source tree SYMLINKS = \ + start.exe \ rpcss.exe \ wcmd.exe \ wineconsole.exe \ --- /dev/null 2002-08-30 16:31:37.000000000 -0700 +++ programs/start/Makefile.in 2003-01-16 08:20:35.000000000 -0800 @@ -0,0 +1,13 @@ +TOPSRCDIR = @top_srcdir@ +TOPOBJDIR = ../.. +SRCDIR = @srcdir@ +VPATH = @srcdir@ +MODULE = start.exe +APPMODE = cui +IMPORTS = shell32 + +C_SRCS = start.c + +@MAKE_PROG_RULES@ + +### Dependencies: --- /dev/null 2002-08-30 16:31:37.000000000 -0700 +++ programs/start/start.c 2003-01-16 08:23:33.000000000 -0800 @@ -0,0 +1,59 @@ +/* + * Start a program using ShellExecute + * + * Copyright 2003 Dan Kegel + * + * This library is free software; you can redistribute it and/or + * modify it under the terms of the GNU Lesser General Public + * License as published by the Free Software Foundation; either + * version 2.1 of the License, or (at your option) any later version. + * + * This library 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 + * Lesser General Public License for more details. + * + * You should have received a copy of the GNU Lesser General Public + * License along with this library; if not, write to the Free Software + * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA + */ + +#include "config.h" +#include "wine/debug.h" + +#include <windows.h> +#include <stdio.h> +#include <stdlib.h> + +WINE_DEFAULT_DEBUG_CHANNEL(start); + +/* Placeholder implementation for now. */ + +int main(int argc, char *argv[]) +{ + char *program; + char *arguments; + HINSTANCE hres; + + if (argc == 1) { + printf("Usage: start file-or-program ...\n"); + exit(0); + } + if (argc > 3) { + WINE_FIXME("More than one argument not implemented"); + exit(1); + } + + program = argv[1]; + arguments = NULL; + if (argc == 3) + arguments = argv[2]; + + hres = ShellExecute(NULL, "open", program, arguments, NULL, SW_SHOWNORMAL); + if (((int)hres) <= 32) { + printf("Cannot execute %s %s, error %d\n", program, arguments?arguments:"", (int)hres); + exit(1); + } + + exit(0); +}