Re: [Dev-C++] My Operating System...
Open Source C & C++ IDE for Windows
Brought to you by:
claplace
|
From: Per W. <pw...@ia...> - 2004-04-20 12:35:50
|
Actually, depending on OS the array is _sometimes_ passed by the command
shell but for a lot of OS, the application just receives a text line and
must itself split it into arguments.
Also, processing of wildcard characters on the command line is performed
at different locations depending on OS.
/Per W
On Tue, 20 Apr 2004, Matthew Ozor wrote:
> I think programming an OS even for fun you should
> learn the basics of computer programming first.
> Passing arguemtns is very elementary. In your main you
> have two variables one that holds numbers of arguments
> and the other an pointer to and array. That array is
> actually passed to the program by the OS. Most people
> use:
>
> int main(int argc, char *argv[])
> argc =3D number of arguments
> argv =3D the array of arguments
>
> Try this:
>
> #include <stdio.h>
>
> int main(int argc, char *argv[])
> {
> int i;
> fprintf(stdout,
> "The number of command line arguments is
> %d\n",
> argc);
> fprintf(stdout,"The program name is
> %s\n",argv[0]);
>
> for (i =3D 1; i < argc; i++)
> {
> fprintf(stdout,"%s",argv[i]);
> }
> fprintf(stdout,"\n");
> return 0;
> }
>
>
> If you do a search on OS programming your going to
> find a ton of sites that will teach you the basics
> step by step.
>
> http://directory.google.com/Top/Computers/Programming/Operating_Systems/
>
> Good luck
> Matthew Ozor
> --- Per Westermark <pw...@ia...> wrote:
> > Note that if you make your completely own OS, you
> > might use any method you
> > like, since you have to implement it yourself.
> >
> > Alternative 2 - using msdos.sys + io.sys and just
> > replacing the command
> > line. One again, you might use any method you like,
> > since msdos will only
> > specially handle the first two arguments meaning
> > that the command.com
> > replacement must contain full commandl line parsing.
> >
> > Alternative 3 - you are still going to use
> > command.com. Then - I haven't
> > an old MSDOS available so I can't test - I assume
> > you have to run your
> > commands as dir.exe, md.exe etc, since command.com
> > will otherwise process
> > the built-in commands dir/echo/... as reserved words
> > and process by itself
> > without looking for any external program with the
> > same name in the
> > program path. Anyway, if you manage to start your
> > own external programs,
> > the command line parameters will be available
> > exactly as if you write a
> > normal dos or win32 command line program.
> >
> > /Per W
> >
> > On Tue, 20 Apr 2004, Rick Langschultz wrote:
> >
> > > I am writing an operating system called StarFire
> > it will be based off of
> > > dos, however the programs included with
> > command.com (dir, echo, etc. ) will
> > > be external commands in the C:\bin folder. What
> > functions can I use to
> > > detect arguments passed from the shell to a
> > program.
> > >
> > > Example: [dir.exe -a C:\bin] or [dir.exe
> > -hsx C:\bin]
> > >
> > > dir is the standard dos dir statement however i
> > want the arguments to be:
> > > -a all files
> > > -h hidden files
> > > -s system files
> > > -x compressed files
> > > -u user files
> > > -t text files
> > >
> > > or any combination of those with only one dash.
> > Is this possible?
> > >
> > >
> > >
> > >
> >
> -------------------------------------------------------
> > > This SF.Net email is sponsored by: IBM Linux
> > Tutorials
> > > Free Linux tutorial presented by Daniel Robbins,
> > President and CEO of
> > > GenToo technologies. Learn everything from
> > fundamentals to system
> > >
> >
> administration.http://ads.osdn.com/?ad_id=3D1470&alloc_id=3D3638&op=3Dcli=
ck
> > > _______________________________________________
> > > Dev-cpp-users mailing list
> > > Dev...@li...
> > > TO UNSUBSCRIBE:
> > http://www23.brinkster.com/noicys/devcpp/ub.htm
> > >
> >
> https://lists.sourceforge.net/lists/listinfo/dev-cpp-users
> > >
> >
> >
> >
> >
> -------------------------------------------------------
> > This SF.Net email is sponsored by: IBM Linux
> > Tutorials
> > Free Linux tutorial presented by Daniel Robbins,
> > President and CEO of
> > GenToo technologies. Learn everything from
> > fundamentals to system
> >
> administration.http://ads.osdn.com/?ad_id=3D1470&alloc_id=3D3638&op=3Dcli=
ck
> > _______________________________________________
> > Dev-cpp-users mailing list
> > Dev...@li...
> > TO UNSUBSCRIBE:
> > http://www23.brinkster.com/noicys/devcpp/ub.htm
> >
> https://lists.sourceforge.net/lists/listinfo/dev-cpp-users
>
>
>
>
>
> __________________________________
> Do you Yahoo!?
> Yahoo! Photos: High-quality 4x6 digital prints for 25=A2
> http://photos.yahoo.com/ph/print_splash
>
>
> -------------------------------------------------------
> This SF.Net email is sponsored by: IBM Linux Tutorials
> Free Linux tutorial presented by Daniel Robbins, President and CEO of
> GenToo technologies. Learn everything from fundamentals to system
> administration.http://ads.osdn.com/?ad_id=3D1470&alloc_id=3D3638&op=3Dcli=
ck
> _______________________________________________
> Dev-cpp-users mailing list
> Dev...@li...
> TO UNSUBSCRIBE: http://www23.brinkster.com/noicys/devcpp/ub.htm
> https://lists.sourceforge.net/lists/listinfo/dev-cpp-users
>
|