Is it possible to disable the file name globbing in a console apps ? I want to start my program with a command such as PROG *.c and end up with "*.c" in argv[1] instead of a long list of all the .c files in the current directory.
Thanks,
Frederic
If you would like to refer to this comment somewhere else in this project, copy and paste the following link:
this has nothing to do with the IDE, compiler or linker; it is simply the system who processes the command line and expands the wildcards
so there is nothing you can do, except changing the way you run the program
Adrian
If you would like to refer to this comment somewhere else in this project, copy and paste the following link:
DOS does not expand the wildcards. It has to be some "globbing emulator" in the startup code of the program to emulate the unix shell. It is included at link time hence my hope to have an option to disable it or use an alternate startup code. I am afraid I will have to rewrite the startup code to disable that emulation but I would like to be sure there is no other way before undertaking such a task...
Frederic
If you would like to refer to this comment somewhere else in this project, copy and paste the following link:
I don't know if DOS does or doesn't expand wildcards, but none of us is using DOS.
Anyway, I made a small test and it appears that the system indeed doesn't expand the wildcards.. I guess it comes from the C runtime library.
If you think you are able to write startup code, then you are invited to join us at http://sourceforge.net/projects/smart-library - we are writing an alternate runtime library.
Currently there is no other library available for mingw; you can try rewriting the startup code but I don't know how you can link the rest of the library without getting redefined symbols. Perhaps if you get the mingw runtime source files and modify them and replace the library, it could work.
Adrian
If you would like to refer to this comment somewhere else in this project, copy and paste the following link:
I didn't knew about that project. I may try to contribute to some of the functions because I have from time to time the need for such functions. I already have a few low level functions I wrote for compatibility between the Win API and the standard C API. Just tell me how I can help and what you are expecting from me.
Another point, to find the answer to my problem, I had to dig into an old source code of MingW and I saw that everything is/was included to use an alternate CRT instead of MSCRT with a simple define.. I didn't spent much time to look into this, but have you looked into that source code to be sure you are not reinventing the wheel ?
Frederic
If you would like to refer to this comment somewhere else in this project, copy and paste the following link:
I found out that you can also link CRT_noglob.o for the same purpose
about the mingw code: you probably saw that it was designed to work with MSVCRT or CRTDLL; they're both dll's for C runtime from Microsoft; I understand that MSVCRT is newer and better
Adrian
If you would like to refer to this comment somewhere else in this project, copy and paste the following link:
Hello,
Is it possible to disable the file name globbing in a console apps ? I want to start my program with a command such as PROG *.c and end up with "*.c" in argv[1] instead of a long list of all the .c files in the current directory.
Thanks,
Frederic
try PROG "*.c"
(including quotes)
Adrian
Thanks Adrian,
By chance is there any way to disable it during the compilation to avoid the use of the quotes ?
Frederic
this has nothing to do with the IDE, compiler or linker; it is simply the system who processes the command line and expands the wildcards
so there is nothing you can do, except changing the way you run the program
Adrian
DOS does not expand the wildcards. It has to be some "globbing emulator" in the startup code of the program to emulate the unix shell. It is included at link time hence my hope to have an option to disable it or use an alternate startup code. I am afraid I will have to rewrite the startup code to disable that emulation but I would like to be sure there is no other way before undertaking such a task...
Frederic
I don't know if DOS does or doesn't expand wildcards, but none of us is using DOS.
Anyway, I made a small test and it appears that the system indeed doesn't expand the wildcards.. I guess it comes from the C runtime library.
If you think you are able to write startup code, then you are invited to join us at http://sourceforge.net/projects/smart-library - we are writing an alternate runtime library.
Currently there is no other library available for mingw; you can try rewriting the startup code but I don't know how you can link the rest of the library without getting redefined symbols. Perhaps if you get the mingw runtime source files and modify them and replace the library, it could work.
Adrian
Adrian,
I didn't knew about that project. I may try to contribute to some of the functions because I have from time to time the need for such functions. I already have a few low level functions I wrote for compatibility between the Win API and the standard C API. Just tell me how I can help and what you are expecting from me.
Another point, to find the answer to my problem, I had to dig into an old source code of MingW and I saw that everything is/was included to use an alternate CRT instead of MSCRT with a simple define.. I didn't spent much time to look into this, but have you looked into that source code to be sure you are not reinventing the wheel ?
Frederic
I found it. It is sufficient to declare
int _CRT_glob=0;
in one of the source file of the program to disable any file name globbing.
Frederic
you're good! ;)
I found out that you can also link CRT_noglob.o for the same purpose
about the mingw code: you probably saw that it was designed to work with MSVCRT or CRTDLL; they're both dll's for C runtime from Microsoft; I understand that MSVCRT is newer and better
Adrian