delorie.com/archives/browse.cgi   search  
Mail Archives: cygwin/2003/07/02/09:20:22

Mailing-List: contact cygwin-help AT cygwin DOT com; run by ezmlm
List-Subscribe: <mailto:cygwin-subscribe AT cygwin DOT com>
List-Archive: <http://sources.redhat.com/ml/cygwin/>
List-Post: <mailto:cygwin AT cygwin DOT com>
List-Help: <mailto:cygwin-help AT cygwin DOT com>, <http://sources.redhat.com/ml/#faqs>
Sender: cygwin-owner AT cygwin DOT com
Mail-Followup-To: cygwin AT cygwin DOT com
Delivered-To: mailing list cygwin AT cygwin DOT com
X-Originating-IP: [65.96.48.135]
X-Originating-Email: [mgainty AT hotmail DOT com]
From: "Martin Gainty" <mgainty AT hotmail DOT com>
To: "Brian Dessent" <brian AT dessent DOT net>, <cygwin AT cygwin DOT com>,
"Elfyn McBratney" <emcb_exposure AT hotmail DOT com>
References: <3EFE120B DOT 58A0C79E AT dessent DOT net> <Pine DOT GSO DOT 4 DOT 44 DOT 0306282234360 DOT 22307-100000 AT slinky DOT cs DOT nyu DOT edu> <20030701040434 DOT GE7604 AT ny-kenton2a-710 DOT buf DOT adelphia DOT net> <3F018740 DOT B28F53DC AT dessent DOT net> <3F018D6C DOT EA1226CA AT dessent DOT net> <Xns93ABB16F2D760soren1Gmane AT 80 DOT 91 DOT 224 DOT 249> <3F021C46 DOT C8F4CE31 AT dessent DOT net> <Xns93AC469331861soren1Gmane AT 80 DOT 91 DOT 224 DOT 249> <Xns93AC47EC6AA77soren1Gmane AT 80 DOT 91 DOT 224 DOT 249> <3F02DA32 DOT EAD1FC18 AT dessent DOT net>
Subject: More on GCC
Date: Wed, 2 Jul 2003 09:20:10 -0400
MIME-Version: 1.0
X-Priority: 3
X-MSMail-Priority: Normal
X-MimeOLE: Produced By Microsoft MimeOLE V6.00.2800.1106
Message-ID: <Law10-OE589juGXoDAb0001da35@hotmail.com>
X-OriginalArrivalTime: 02 Jul 2003 13:20:08.0496 (UTC) FILETIME=[A8A4E300:01C3409C]

Hello All

I managed to get 2 modules to compile. SLPReg.o has a main libslp_handle
does not have a main . But I get this always get this error
$ GCC
SLPReg.c -nostartfiles -L/cygdrive/f/slp/openslp-1.1.3/common/.libs/test
libslp_handle.o SLPReg.o
SLPReg.o(.text+0xc8):SLPReg.c: multiple definition of `_main'

Where is the extra definition of _main coming from?

Sorry for the bother,

Martin

----- Original Message -----
From: "Brian Dessent" <brian AT dessent DOT net>
To: <cygwin AT cygwin DOT com>
Sent: Wednesday, July 02, 2003 9:12 AM
Subject: Re: example needed pls: `cygpath -c <HANDLE>'


> Soren A wrote:
>
> > OK, "what's UP with this bizarre thing?" It is a REG_EXPAND_SZ -type
> > REGEDIT .reg file instead of using easy REG_SZ -type entries. The
> > expansion encoded is of a variable %CYGROOT% which must be present
> > in the Windows "master" environment, so that the Registry
> > _always_ has access to it. I set it in my Windows9x autoexec.bat
> > file of course, and under NT/2K/XP you can use the ControlPanel|System.
>
> I was wondering why I didn't have any CYGROOT set.  I agree that
> REG_EXPAND_SZ is "nicer" in terms of not hard-coding paths, but since
> $CYGROOT is non-standard I don't see that it matters too much.
>
> There's a couple of problems with it still, in the backspaces/quotes
> department.  Your .reg file installs the command:
>
> "%CYGROOT%\\bin\\bash -c \"echo -n `/bin/cygpath -u
> '%l'`>/dev/clipboard\"" + NewLine
>
> When I run the command I get an error.  The proper quoting is
>
> "%CYGROOT%\bin\bash" -c "echo -n `/bin/cygpath -u '%l'`>/dev/clipboard"
>
> You don't want to escape the double-quotes because they are there to
> tell the windows shell to make all that stuff a single arg, after -c.
> You need double quotes around the exe image in the off chance there's a
> space in $CYGROOT.  And there's the issue of the raw binary newline at
> the end.  The hexified version of that is
>
hex(2):22,25,43,59,47,52,4f,4f,54,25,5c,62,69,6e,5c,62,61,73,68,22,20,2d,63,
20,22,65,63,68,6f,20,2d,6e,20,60,2f,62,69,6e,2f,63,79,67,70,61,74,68,20,2d,7
5,20,27,25,6c,27,60,3e,2f,64,65,76,2f,63,6c,69,70,62,6f,61,72,64,22,00
>
>
> ----
>
> Anyway, the Right Way (IMHO) to do this would be something like the
> following:
>
> ----- copy_cygpath.c -----
> #include <sys/cygwin.h>
> #include <windows.h>
>
> int main(int argc, char **argv)
> {
>     HGLOBAL hglbBuffer;
>     LPTSTR  lptstrBuffer;
>
>
>     if(argc != 2) {
>
>         // usage: copy_cygpath [win32 path]
>         return 1;
>     }
>
>     hglbBuffer = GlobalAlloc(GMEM_MOVEABLE, (MAX_PATH +
> 1)*sizeof(TCHAR));
>     if (hglbBuffer == NULL) {
>         return 1;
>     }
>
>     lptstrBuffer = GlobalLock(hglbBuffer);
>     cygwin_conv_to_full_posix_path(argv[1], lptstrBuffer);
>     GlobalUnlock(hglbBuffer);
>
>     if(OpenClipboard(NULL) == 0) {
>         // failure!
>
>         GlobalFree(hglbBuffer);
>         return 1;
>     }
>
>     EmptyClipboard();
>     SetClipboardData(CF_TEXT, hglbBuffer);
>     CloseClipboard();
>
>     return 0;
> }
> ------
>
> $ gcc copy_cygpath.c -o copy_cygpath.exe -mwindows -luser32
> $ mv copy_cygpath.exe /bin
>
> Now your registry entry is just:
>
> "%CYGROOT%\bin\copy_cygpath.exe" "%1"
>
> or
>
> ------
> REGEDIT4
>
> [HKEY_CLASSES_ROOT\Directory\shell\CygPath]
> @="&Copy LFN Cygwin Path"
>
> [HKEY_CLASSES_ROOT\Directory\shell\CygPathLFN\Command]
>
@=hex(2):22,25,43,59,47,52,4f,4f,54,25,5c,62,69,6e,5c,63,6f,70,79,5f,63,79,6
7,70,61,74,68,2e,65,78,65,22,20,22,25,31,22,00
> ------
>
>
>
> This has the advantage of loading a single process, rather than bash,
> echo, and cygpath.  You also eliminate the silly console window that
> flashes open and then closes.
>
> One might also want to change the C code to backslash escape spaces and
> other non-[\w\d] characters.  That way you could still work with the
> long filenames at the command prompt.  Alternatively you could have it
> paste the path as '/path/with a/space' (with the quotes.)
>
> Brian
>
> --
> Unsubscribe info:      http://cygwin.com/ml/#unsubscribe-simple
> Problem reports:       http://cygwin.com/problems.html
> Documentation:         http://cygwin.com/docs.html
> FAQ:                   http://cygwin.com/faq/
>
>

--
Unsubscribe info:      http://cygwin.com/ml/#unsubscribe-simple
Problem reports:       http://cygwin.com/problems.html
Documentation:         http://cygwin.com/docs.html
FAQ:                   http://cygwin.com/faq/

- Raw text -


  webmaster     delorie software   privacy  
  Copyright © 2019   by DJ Delorie     Updated Jul 2019