Git Product home page Git Product logo

Comments (4)

GoogleCodeExporter avatar GoogleCodeExporter commented on August 24, 2024
so here what happen

when you bundle an *.abc file with a shell.exe you are basically creating a 
projector
when the shell execute it tries to discover if it is in "projector mode" or 
"shell mode"
and here without the ".exe" extension the shell fail to see it is in "projector 
mode"
so it runs the regular shell command (and end up showing the usage informations)

the problem is situated here
http://code.google.com/p/redtamarin/source/browse/trunk/shell/avmshell.cpp#695

apparently running an executable without the ".exe" extension does not fill the 
argv[0] value,
and because argv[0] is NULLL, then the redshell fail to reckonize it is a 
projector

I ll make some tests with something like
{{{
char *Path;
GetModuleFileName(NULL, Path,MAX_PATH); 
printf("%s\n", Path);
}}}

see if it gives better result under Windows

also as an alternative if you run under cygwin there is no issues (eg. argv[0] 
is found)
see the attached screenshot.


Original comment by zwetan on 18 Jul 2011 at 12:51

  • Added labels: Priority-Low
  • Removed labels: Priority-Medium

Attachments:

from redtamarin.

GoogleCodeExporter avatar GoogleCodeExporter commented on August 24, 2024

Original comment by zwetan on 28 Oct 2011 at 1:31

from redtamarin.

GoogleCodeExporter avatar GoogleCodeExporter commented on August 24, 2024
just gave redtamarin a spin - very nice work.

i've noticed this issue, but i'm not exactly sure why it happens, as the 
windows default shell should always populate argv[0] with the call (being 
"a.exe" or simply "a"); also to my knowledge the value of argc should be >=1 on 
DOS/CMD/NTVDM. on the other hand cygwi/msys with bash/sh should populate it 
with a full path.

> apparently running an executable without the ".exe" extension does not fill 
the
> argv[0] value, and because argv[0] is NULLL, then the redshell fail to 
reckonize
> it is a projector

as mentioned above i cannot confirm this, but mind that the c entry point 
arguments are shell specific and if you decide to port your code to a not so 
common OS, its shell might not even allow arguments (argc = 0, *argv = NULL). 
if you are mainly targeting popular OS, arguments should work on such (thus a 
puzzle for this specific issue).

i haven't compiled your code since there are a bit too much dependencies for 
me: ant, python, jre etc., but here is a simple test with argv[0] / 
GetModuleFileName() for windows:

// -------------------------------------------------------------------
#include <windows.h>
#include <stdio.h>
#include <string.h>
#include <ctype.h>

#define STRIP_PATH(buffer, filename) \
    (filename) = strrchr((buffer), '\\'); \
  if ((filename)) \
    (filename)++; \
  else \
    (filename) = (buffer)

int main(int argc, char *argv[])
{
  const char ext_exe[] = ".exe\0";
  char buffer[MAX_PATH] = {0};
  char *filename;
  short i;

  if (!(*argv))
  {
    GetModuleFileName(NULL, buffer, MAX_PATH);
    STRIP_PATH(buffer, filename);

    printf("no arguments, %d, %s\n", argc, filename);
  }
  else
  {
    strcpy((char *)buffer, argv[0]);

    i = -1;
    while (buffer[++i])
      buffer[i] = tolower(buffer[i]);

    if (!strstr((char *)buffer, ext_exe))
      strcat(buffer, ext_exe);

    STRIP_PATH(buffer, filename);

    printf("has argumens, %d, %s\n", argc, filename);
  }

  return 0;
}
// -------------------------------------------------------------------

lubomir
--

Original comment by neolit123 on 13 Jun 2012 at 12:53

from redtamarin.

GoogleCodeExporter avatar GoogleCodeExporter commented on August 24, 2024
I will investigate that further with the basic command prompt and cygwin under 
Windows

Original comment by zwetan on 20 Nov 2013 at 5:16

  • Added labels: Milestone-Release0.4

from redtamarin.

Related Issues (20)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.