* ot, a programming question
@ Gregory Nowak
` Saqib Shaikh
` (2 more replies)
0 siblings, 3 replies; 12+ messages in thread
From: Gregory Nowak @ UTC (permalink / raw)
To: speakup
Hi all,
There is something that's been eating away at my cariousity for the last few days, and I just had to ask the below.
Say you run a program such as mpg123 or any other program which minipulates files, and you pass it *.*, or my?.mp3 to open. How does it parce that to get a list of files that match *.* or my?.mp3? I tried looking for mpg123 code that does that, but couldn't find it.
Could someone please enlighten me, I'm very much interested. Thanks.
Greg
^ permalink raw reply [flat|nested] 12+ messages in thread
* Re: ot, a programming question
ot, a programming question Gregory Nowak
@ ` Saqib Shaikh
` Gregory Nowak
` Charles Hallenbeck
` Geoff Shang
2 siblings, 1 reply; 12+ messages in thread
From: Saqib Shaikh @ UTC (permalink / raw)
To: speakup
Sorry, I've done this under DOS, Win32 and Java, but not under Linux but I'm
sure its the same.
There's bound to be a function that'll return a list of all files in the
current directory. Then it's simple programming to see which of them fits
the wildcard. Then once you have a list of files to play you just open the
file and do stuff etc.
If you're really lucky there may be functions under Linux to return a list
of files that match the wildcard but I'n not sure.
Oh, and I'm assuming you know how to program. In case you don't, every
C/C++ program has a function called main. Main has two parameters - the
number of command line parameters and an array of strings containing the
parameters - this is the operating system's doing.
Hope this satisfies your curiosity.
Saqib
----- Original Message -----
From: "Gregory Nowak" <gnowak1@uic.edu>
To: <speakup@braille.uwo.ca>
Sent: Friday, December 21, 2001 10:18 PM
Subject: ot, a programming question
> Hi all,
>
> There is something that's been eating away at my cariousity for the last
few days, and I just had to ask the below.
> Say you run a program such as mpg123 or any other program which
minipulates files, and you pass it *.*, or my?.mp3 to open. How does it
parce that to get a list of files that match *.* or my?.mp3? I tried looking
for mpg123 code that does that, but couldn't find it.
> Could someone please enlighten me, I'm very much interested. Thanks.
> Greg
>
>
> _______________________________________________
> Speakup mailing list
> Speakup@braille.uwo.ca
> http://speech.braille.uwo.ca/mailman/listinfo/speakup
^ permalink raw reply [flat|nested] 12+ messages in thread
* Re: ot, a programming question
` Saqib Shaikh
@ ` Gregory Nowak
0 siblings, 0 replies; 12+ messages in thread
From: Gregory Nowak @ UTC (permalink / raw)
To: speakup
Thanks for enlightening me (grin).
I've been programmming for almost 4 years now.
Anybody know which c++ header file contains this function?
Greg
On Fri, Dec 21, 2001 at 11:03:19PM -0000, Saqib Shaikh wrote:
> Sorry, I've done this under DOS, Win32 and Java, but not under Linux but I'm
> sure its the same.
>
> There's bound to be a function that'll return a list of all files in the
> current directory. Then it's simple programming to see which of them fits
> the wildcard. Then once you have a list of files to play you just open the
> file and do stuff etc.
>
> If you're really lucky there may be functions under Linux to return a list
> of files that match the wildcard but I'n not sure.
>
> Oh, and I'm assuming you know how to program. In case you don't, every
> C/C++ program has a function called main. Main has two parameters - the
> number of command line parameters and an array of strings containing the
> parameters - this is the operating system's doing.
>
> Hope this satisfies your curiosity.
>
> Saqib
> ----- Original Message -----
> From: "Gregory Nowak" <gnowak1@uic.edu>
> To: <speakup@braille.uwo.ca>
> Sent: Friday, December 21, 2001 10:18 PM
> Subject: ot, a programming question
>
>
> > Hi all,
> >
> > There is something that's been eating away at my cariousity for the last
> few days, and I just had to ask the below.
> > Say you run a program such as mpg123 or any other program which
> minipulates files, and you pass it *.*, or my?.mp3 to open. How does it
> parce that to get a list of files that match *.* or my?.mp3? I tried looking
> for mpg123 code that does that, but couldn't find it.
> > Could someone please enlighten me, I'm very much interested. Thanks.
> > Greg
> >
> >
> > _______________________________________________
> > Speakup mailing list
> > Speakup@braille.uwo.ca
> > http://speech.braille.uwo.ca/mailman/listinfo/speakup
>
>
> _______________________________________________
> Speakup mailing list
> Speakup@braille.uwo.ca
> http://speech.braille.uwo.ca/mailman/listinfo/speakup
^ permalink raw reply [flat|nested] 12+ messages in thread
* Re: ot, a programming question
ot, a programming question Gregory Nowak
` Saqib Shaikh
@ ` Charles Hallenbeck
` Geoff Shang
2 siblings, 0 replies; 12+ messages in thread
From: Charles Hallenbeck @ UTC (permalink / raw)
To: speakup
Greg -
You are looking in the wrong place. It is the shell that expands
the wildcards before the application is even invoked.
Chuck
On Fri, 21 Dec 2001, Gregory Nowak wrote:
> Hi all,
>
> There is something that's been eating away at my cariousity for the last few days, and I just had to ask the below.
> Say you run a program such as mpg123 or any other program which minipulates files, and you pass it *.*, or my?.mp3 to open. How does it parce that to get a list of files that match *.* or my?.mp3? I tried looking for mpg123 code that does that, but couldn't find it.
> Could someone please enlighten me, I'm very much interested. Thanks.
> Greg
>
>
> _______________________________________________
> Speakup mailing list
> Speakup@braille.uwo.ca
> http://speech.braille.uwo.ca/mailman/listinfo/speakup
>
Visit me at http://www.mhonline.net/~chuckh
The Moon is Waxing Crescent (42% of Full)
^ permalink raw reply [flat|nested] 12+ messages in thread
* Re: ot, a programming question
ot, a programming question Gregory Nowak
` Saqib Shaikh
` Charles Hallenbeck
@ ` Geoff Shang
` Charles Hallenbeck
2 siblings, 1 reply; 12+ messages in thread
From: Geoff Shang @ UTC (permalink / raw)
To: speakup
Hi:
The shell expands the wildcard, the wildcard itself never gets passed to
the application. This can be demonstrated by the following script:
#!/bin/sh
echo $1 $2 $3 $4 $5
Now, you can see here that it's important to read the correct number of
parameters. Running this script will only output the first 5 matching
files, so you need to be able to read in all the names. I don't know how
you'd do this in a shell script, but it'd be easy in say C.
Geoff.
^ permalink raw reply [flat|nested] 12+ messages in thread
* Re: ot, a programming question
` Geoff Shang
@ ` Charles Hallenbeck
` Gregory Nowak
` Geoff Shang
0 siblings, 2 replies; 12+ messages in thread
From: Charles Hallenbeck @ UTC (permalink / raw)
To: speakup
Another way to illustrate that it is the shell that expands the
wildcards is to use single quotes to prevent it from happening,
so that a wildcard is passed to the application instead of being
seen by the shell. Try this for instance:
mpg123 '*.mp3'
and the application will not be able to find the file whose name
contains the star!
In the bad old days (under DOS) the Borland C++ libraries had a
linkable module called "wildargs.obj" and if your program linked
with that module it would behave just like a Linux application
does with the shell expansion. Later versions of Borland
compilers abandoned this module and expected programmers to use
calls to "findfirst" and "findnext" to yield the names that
matched the wildcards. In Linux the expansion of wildcards is
_USUALLY the job of the shell.
HTH - Chuck
On Sat, 22 Dec 2001, Geoff Shang wrote:
> Hi:
>
> The shell expands the wildcard, the wildcard itself never gets passed to
> the application. This can be demonstrated by the following script:
>
> #!/bin/sh
> echo $1 $2 $3 $4 $5
>
> Now, you can see here that it's important to read the correct number of
> parameters. Running this script will only output the first 5 matching
> files, so you need to be able to read in all the names. I don't know how
> you'd do this in a shell script, but it'd be easy in say C.
>
> Geoff.
>
>
>
> _______________________________________________
> Speakup mailing list
> Speakup@braille.uwo.ca
> http://speech.braille.uwo.ca/mailman/listinfo/speakup
>
Visit me at http://www.mhonline.net/~chuckh
The Moon is Waxing Crescent (46% of Full)
^ permalink raw reply [flat|nested] 12+ messages in thread
* Re: ot, a programming question
` Charles Hallenbeck
@ ` Gregory Nowak
` Geoff Shang
1 sibling, 0 replies; 12+ messages in thread
From: Gregory Nowak @ UTC (permalink / raw)
To: speakup
Thanks, even though I haven't responded, I'm still following this thread.
Very interesting.
I have wondered too, why I saw this feature in Linux software, but not in DOS software. Now I guess I know why (grin).
Greg
On Sat, Dec 22, 2001 at 06:42:39AM -0500, Charles Hallenbeck wrote:
> Another way to illustrate that it is the shell that expands the
> wildcards is to use single quotes to prevent it from happening,
> so that a wildcard is passed to the application instead of being
> seen by the shell. Try this for instance:
>
> mpg123 '*.mp3'
>
> and the application will not be able to find the file whose name
> contains the star!
>
> In the bad old days (under DOS) the Borland C++ libraries had a
> linkable module called "wildargs.obj" and if your program linked
> with that module it would behave just like a Linux application
> does with the shell expansion. Later versions of Borland
> compilers abandoned this module and expected programmers to use
> calls to "findfirst" and "findnext" to yield the names that
> matched the wildcards. In Linux the expansion of wildcards is
> _USUALLY the job of the shell.
>
> HTH - Chuck
>
>
> On Sat, 22 Dec 2001, Geoff Shang wrote:
>
> > Hi:
> >
> > The shell expands the wildcard, the wildcard itself never gets passed to
> > the application. This can be demonstrated by the following script:
> >
> > #!/bin/sh
> > echo $1 $2 $3 $4 $5
> >
> > Now, you can see here that it's important to read the correct number of
> > parameters. Running this script will only output the first 5 matching
> > files, so you need to be able to read in all the names. I don't know how
> > you'd do this in a shell script, but it'd be easy in say C.
> >
> > Geoff.
> >
> >
> >
> > _______________________________________________
> > Speakup mailing list
> > Speakup@braille.uwo.ca
> > http://speech.braille.uwo.ca/mailman/listinfo/speakup
> >
>
> Visit me at http://www.mhonline.net/~chuckh
> The Moon is Waxing Crescent (46% of Full)
>
>
> _______________________________________________
> Speakup mailing list
> Speakup@braille.uwo.ca
> http://speech.braille.uwo.ca/mailman/listinfo/speakup
^ permalink raw reply [flat|nested] 12+ messages in thread
* Re: ot, a programming question
` Charles Hallenbeck
` Gregory Nowak
@ ` Geoff Shang
` Gregory Nowak
1 sibling, 1 reply; 12+ messages in thread
From: Geoff Shang @ UTC (permalink / raw)
To: speakup
Hi:
It's probably a good thing that the shell does it. Imagine the potential
problems if programs used different algorythms to get the list of files.
For example, what if ls and rm returned slightly different lists for a
given wildcard?
Geoff.
^ permalink raw reply [flat|nested] 12+ messages in thread
* Re: ot, a programming question
` Geoff Shang
@ ` Gregory Nowak
` modules.conf for es18xx Richard Wells
0 siblings, 1 reply; 12+ messages in thread
From: Gregory Nowak @ UTC (permalink / raw)
To: speakup
On Sun, Dec 23, 2001 at 09:26:12PM +1000, Geoff Shang wrote:
> Hi:
>
> It's probably a good thing that the shell does it. Imagine the potential
> problems if programs used different algorythms to get the list of files.
> For example, what if ls and rm returned slightly different lists for a
> given wildcard?
Owch!
Greg
>
> Geoff.
>
>
>
> _______________________________________________
> Speakup mailing list
> Speakup@braille.uwo.ca
> http://speech.braille.uwo.ca/mailman/listinfo/speakup
^ permalink raw reply [flat|nested] 12+ messages in thread
* modules.conf for es18xx
` Gregory Nowak
@ ` Richard Wells
` Geoff Shang
0 siblings, 1 reply; 12+ messages in thread
From: Richard Wells @ UTC (permalink / raw)
To: speakup
[-- Attachment #1: Type: text/plain, Size: 325 bytes --]
I hope this reaches Matt Campbell since you have gotten one of these
beasties to work. Jim Danley kindly attempted to get me the Email addres on
the Speak Freely reflector but my stupid Windows machine trunkated it.
Anyway, could Matt or someone look at this file and tell me what I have not
done to get it running?
Thanks
[-- Attachment #2: modules.conf --]
[-- Type: application/octet-stream, Size: 790 bytes --]
alias net-pf-4 off # we won't use PF IPX
alias net-pf-5 off # we won't use PF AppleTalk
# --- BEGIN: Generated by ALSACONF, do not edit. ---
# --- ALSACONF verion 0.4.3b ---
alias char-major-116 snd
alias snd-card-0 snd-card-audiodrive18xx
alias char-major-14 soundcore
alias sound-slot-0 snd-card-0
alias sound-service-0-0 snd-mixer-oss
alias sound-service-0-1 snd-seq-oss
alias sound-service-0-3 snd-pcm-oss
alias sound-service-0-8 snd-seq-oss
alias sound-service-0-12 snd-pcm-oss
options snd snd_major=116 snd_cards_limit=1 snd_device_mode=0666 snd_device_gid=0 snd_device_uid=0
options snd-card-audiodrive18xx snd_index=0 snd_id=CARD_0 snd_port=0x220 snd_mpu_port=0x330 snd_fm_port=-1 snd_irq=5 snd_dma1=0 snd_dma2=1
# --- END: Generated by ALSACONF, do not edit. ---
^ permalink raw reply [flat|nested] 12+ messages in thread
* Re: modules.conf for es18xx
` modules.conf for es18xx Richard Wells
@ ` Geoff Shang
` Richard Wells
0 siblings, 1 reply; 12+ messages in thread
From: Geoff Shang @ UTC (permalink / raw)
To: speakup
Hi:
Looks good to me. So what happens when you try to play a sound? What
error do you get? If you don't get any but no sound either, have you tried
unmuting your outputs? all channels are muted by default.
Geoff.
^ permalink raw reply [flat|nested] 12+ messages in thread
* Re: modules.conf for es18xx
` Geoff Shang
@ ` Richard Wells
0 siblings, 0 replies; 12+ messages in thread
From: Richard Wells @ UTC (permalink / raw)
To: speakup
The thing just doesn't start. When I do a modprobe -a snd-card-es18xx I am
told that the card is busy and something to the effect that the IO/IRQ/DMA
is probably not properly configured. I am completely stumped.
----- Original Message -----
From: "Geoff Shang" <gshang@uq.net.au>
To: <speakup@braille.uwo.ca>
Sent: Sunday, December 23, 2001 9:38 PM
Subject: Re: modules.conf for es18xx
Hi:
Looks good to me. So what happens when you try to play a sound? What
error do you get? If you don't get any but no sound either, have you tried
unmuting your outputs? all channels are muted by default.
Geoff.
_______________________________________________
Speakup mailing list
Speakup@braille.uwo.ca
http://speech.braille.uwo.ca/mailman/listinfo/speakup
_________________________________________________________
Do You Yahoo!?
Get your free @yahoo.com address at http://mail.yahoo.com
^ permalink raw reply [flat|nested] 12+ messages in thread
end of thread, other threads:[~ UTC | newest]
Thread overview: 12+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
ot, a programming question Gregory Nowak
` Saqib Shaikh
` Gregory Nowak
` Charles Hallenbeck
` Geoff Shang
` Charles Hallenbeck
` Gregory Nowak
` Geoff Shang
` Gregory Nowak
` modules.conf for es18xx Richard Wells
` Geoff Shang
` Richard Wells
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).