Linux-Development-Apps Digest #340, Volume #7    Tue, 17 Apr 01 18:13:14 EDT

Contents:
  Re: Pipes vs. FIFO's vs ???? ("Bill Feero")
  Re: linux c++ problem (Erik Max Francis)
  Re: Public Domain CODEC (Chris M. Moore)
  "movl %ax,%ds " ?? what does "l"  means ??? ("hushui")
  Re: where am i? ("Peter T. Breuer")
  Re: where am i? ([EMAIL PROTECTED])
  socket() problem ("Ryan Pfenninger")
  Re: Passing Parameters to a (library) function (Nate Eldredge)
  Re: Accessing PCI device from user space ("Kent B. Larsen")
  Re: java VM ("Bbitzer")
  Re: where am i?
  what should I do to get my first hello.c run? ("Pengcheng Dai")
  Re: what should I do to get my first hello.c run? (Lew Pitcher)
  Re: what should I do to get my first hello.c run? ("Pengcheng Dai")
  Where to edit the $PATH ("Pengcheng Dai")
  Re: Where to edit the $PATH (Juergen Heinzl)
  Re: what should I do to get my first hello.c run? (Stefan Heimers)
  Re: what should I do to get my first hello.c run? ([EMAIL PROTECTED])
  Re: CodeWarrior Linux and ld error messages (Peter Mantell)
  Re: where am i? (Juha Laiho)
  Re: where am i? ("Philip Van Hoof")

----------------------------------------------------------------------------

From: "Bill Feero" <[EMAIL PROTECTED]>
Subject: Re: Pipes vs. FIFO's vs ????
Date: Tue, 17 Apr 2001 11:07:48 -0400

Thanks for the info. I will check it out, and get a copy of the book.

Bill


"Paul D. Boyle" <[EMAIL PROTECTED]> wrote in message
news:9b2t86$p2k$[EMAIL PROTECTED]...
> Bill Feero ([EMAIL PROTECTED]) wrote:
> : I need some ideas on how to implement the following:
>
> : I need to monitor and buffer the data coming from a serial port(s). The
>
> I had to do something like this.  Someone on comp.unix.programmer
suggested
> I use pseudoterminals to do this.  This can be done completely in
> user space.  Here is what I ended up doing:
>
> I wrote two programs.  One program was the serial port "sniffer".
> This program opened and read the data from the serial port.  It took
> the contents of what was read (or written) and did two things with it.
> First,  it copied it to a SYSV shared memory segment.  The second thing it
> did was to write the data it had just read to a pseudoterminal device.
> The second program was a "logger".  It would read the contents of
> whatever was in the shared memory segment set up by the first process.
> The second program could spew the buffer contents to the screen or write
> it to a logging file.  I could watch the log file using 'tail -f'. Because
> I used shared memory, the logger could attach and detach from the shared
> memory whenever I wanted it to.  The synchronization between the sniffer
> and the logger was done with SYSV semaphore and signals.
>
> Using a pseudoterminal allowed the program which normally read and
> wrote data to the serial port to open, read and write data to the
> pseudoterminal in the same way.  In a sense, the sniffer program
> intercepted the data, copied it to shared memory, and sent it "on it's
> way" via the pseudoterminal.
>
> I have the code available via ftp, see:
> ftp://laue.chem.ncsu.edu/pub/linux/cad4/cd4port.tar.gz
>
> The code is sort of a hack, and is probably confusing, but it may help
> you get started nevertheless.
>
> Also, reading Stevens' "Advanced Programming in the UNIX Environment"
> will give you valuable information.
>
> Good Luck,
>
> Paul
>
> --
> Paul D. Boyle
> [EMAIL PROTECTED]
> North Carolina State University
> http://laue.chem.ncsu.edu/web/xray.welcome.html



------------------------------

From: Erik Max Francis <[EMAIL PROTECTED]>
Subject: Re: linux c++ problem
Date: Tue, 17 Apr 2001 08:04:57 -0700

Robert Pond wrote:

> Does anybody know why this snippet only creates one child process?

Because it's only calling fork once.  (main returns int, by the way.)

-- 
 Erik Max Francis / [EMAIL PROTECTED] / http://www.alcyone.com/max/
 __ San Jose, CA, US / 37 20 N 121 53 W / ICQ16063900 / &tSftDotIotE
/  \ Can you take my breath away / Can you give him life today
\__/ Sweetbox
    blackgirl international / http://www.blackgirl.org/
 The Internet resource for black women.

------------------------------

From: [EMAIL PROTECTED] (Chris M. Moore)
Subject: Re: Public Domain CODEC
Date: Tue, 17 Apr 2001 15:38:24 GMT

On Thu, 12 Apr 2001 14:50:43 GMT, hac <[EMAIL PROTECTED]> wrote:

>"Chris M. Moore" wrote:
>>
>> Err, so what's wrong with MPEG1 then?
>> 
>Patents.

I am aware that there are patent problems with MPEG2.  MPEG1 seems to
be well supported by the GNU media players I've used.  Care to expand
your comment?

--
Chris M. Moore
Software engineer
speaking for myself

------------------------------

From: "hushui" <[EMAIL PROTECTED]>
Subject: "movl %ax,%ds " ?? what does "l"  means ???
Date: Tue, 17 Apr 2001 23:22:29 +0800


 "movl %ax,%ds " ?? what does "l"  means ???


In At&t 's asm , there are many instructions end with "l"
,such as movl,pushl??
what does "l" means ??
long????






------------------------------

From: "Peter T. Breuer" <[EMAIL PROTECTED]>
Subject: Re: where am i?
Date: Tue, 17 Apr 2001 16:19:53 GMT

Wong Ka Chun <[EMAIL PROTECTED]> wrote:
>   I tried, but if I run the program say "./abc", argv[0] just gives me
> ./abc, rather than full path of the program location.

This is a unix and C faq. Please see them.

Peter

------------------------------

From: [EMAIL PROTECTED]
Subject: Re: where am i?
Date: Tue, 17 Apr 2001 17:49:23 GMT

Wong Ka Chun <[EMAIL PROTECTED]> wrote:
:   I have a C program that wants to know where itself is located in the file
: system. Is there any system call can do it?

getcwd(3)


-- 
    Jeff Gentry  [EMAIL PROTECTED]  [EMAIL PROTECTED]
           SEX           DRUGS           UNIX

------------------------------

From: "Ryan Pfenninger" <[EMAIL PROTECTED]>
Subject: socket() problem
Date: Tue, 17 Apr 2001 13:01:40 -0500

I am having a problem reading from a server.  I can write this using
fsockopen() in PHP and it works perfectly, but when I write it in C the last
bit of data that should be returned and printed to the screen gets cut off
prematurely.  I've been messing with the recv() and while() loop functions
with no luck. The code im using is below:  Any suggestions would be highly
appreciated.


#include<sys/socket.h>
#include<sys/types.h>
#include<netinet/in.h>
#include<unistd.h>
#include<stdlib.h>
#include<stdio.h>

main(int argc,char *argv[]) {
   int create_socket;
   int bufsize = 1024;
   char *buffer = malloc(bufsize);
   struct sockaddr_in address;

   printf("\x1B[2J");

   if ((create_socket = socket(AF_INET,SOCK_STREAM,0)) > 0) printf("The
Socket was created\n");

   address.sin_family = AF_INET;
   address.sin_port = htons(6199);
   inet_pton(AF_INET,argv[1],&address.sin_addr);

   if (connect(create_socket,(struct sockaddr *)&address,sizeof(address)) ==
0)
     printf("The connection was accepted with the server
%s...\n",inet_ntoa(address.sin_addr));

   printf("Message to send: ");
   fgets(buffer,256,stdin);
   send(create_socket, buffer, bufsize, 0);

   while (recv(create_socket, buffer, bufsize, 0) > 0) {
      printf("Message recieved: %s\n",buffer);
   }

   close(create_socket);
}



------------------------------

From: Nate Eldredge <[EMAIL PROTECTED]>
Subject: Re: Passing Parameters to a (library) function
Date: 17 Apr 2001 11:18:36 -0700

Markus Hoffmann <[EMAIL PROTECTED]> writes:

> Hi, I want to pass an unknown number of Parameters to a function.
> (using the gcc c compiler)
> The Problem is, the Number of Parameters is not known at compile time.
> I am only interested in the function call. The subroutine is a
> shared-Library function.
> 
> This is how I can execute a Function without parameters.
> 
> void *a();       Adress of Function

I think you mean

void (*a)();

> a=dl_sym("NAME");
> 
> a();
> 
> -----------------
> 
> But how can I give Arguments?

void (*a)(sometype firstarg, ...);
a = dlsym("foo");
a(firstarg, 1, 2, 3);

Note that at least one argument whose type is known is required.

-- 

Nate Eldredge
[EMAIL PROTECTED]

------------------------------

Crossposted-To: comp.os.linux.development.system
From: "Kent B. Larsen" <[EMAIL PROTECTED]>
Subject: Re: Accessing PCI device from user space
Date: Tue, 17 Apr 2001 18:41:07 GMT

see Bill Alexander's:
        A Linux IEEE 1394 Configuration ROM Decoder at:
<http://www.geocities.com/SiliconValley/Haven/4824/ieee1394.html>

Slawek Grajewski wrote:
> 
> Hello,
> 
> I'm looking for hints on how to map memory of a PCI card into a user process
> address space. I just want to have direct access to this memory without
> kernel/user mode copying. Anyone has an idea?
> 
> TIA,
> Slawek

------------------------------

From: "Bbitzer" <[EMAIL PROTECTED]>
Subject: Re: java VM
Date: Tue, 17 Apr 2001 15:18:36 -0400


Thank you for your advice. I downloaded it and JBF4 and it installed on the
desktop fine. However, when I try to copy the tat.gz file to my laptop and
try to install, I get some error about it must install to a local disk. Do
you know what this means?

"Jan Schaumann" <[EMAIL PROTECTED]> wrote in message
news:[EMAIL PROTECTED]...
> * Bbitzer wrote:
> [quoting re-arranged to make sense]
>
> > "Jan Schaumann" <[EMAIL PROTECTED]> wrote in message
> > news:[EMAIL PROTECTED]...
> > > * Bbitzer wrote:
> > > > does MDK 7.1 hava a java VM or do I have to download it?
> > >
> > > Either you have Mandrake installed or not.  If you have it installed,
> > > you can find out easily.  If you don't, what do you care?
> > >
> > > I /believe/ Mandrake comes with Kaffe.
>
> > I have Borland Foundation JBuilder 3.5 that I want to install on my
Mandrake
> > 7.1. When attempting this, it states that I have no virtual machine
> > installed.
>
> Where does it look?  Most likely you just have to tell it where the
> root-directory for your JRE is.
>
> > I tried downloading the file from sun but did not know how to
> > install it.
>
> I believe the Sun SDK comes with rather simple and complete instructions
> on how to install it.  IIRC, it installs to /usr/local/java/jdkx.x (or
> was it /usr/share/java?)
>
> > (I'm not that handy with Linux yet). in my attempt to install
> > it, my GUI failed and the sound.
>
> That's amazing! ;-)
> What did you do?
>
> > Most likely my fault :) anyway, what is the
> > simplest way to download and install a VM without a dummy like me
screwing
> > it up?
>
> The absolutely simplest way is to download it from wherever you get it
> (sun, ibm, blackdown, whatever) and *read the isntructions*.  Read the
> README and INSTALL files carefully.  Don't operate as root unless you
> absolutely have to (ie if it asks you to do something like "./configure
> && make && make install", you can do the first two steps as a mortal and
> only su to make install).
>
> -Jan
>
> --
> Jan Schaumann <http://www.netmeister.org>
>
> A programming language is low level when its programs require attention
> to the irrelevant.



------------------------------

From: [EMAIL PROTECTED] ()
Subject: Re: where am i?
Date: Tue, 17 Apr 2001 19:27:59 GMT

On Tue, 17 Apr 2001 13:05:54 GMT, Lew Pitcher <[EMAIL PROTECTED]> wrote:
>On Tue, 17 Apr 2001 20:13:36 +0800, "Wong Ka Chun"
><[EMAIL PROTECTED]> wrote:
>
>>Hello,
>>
>>  I tried, but if I run the program say "./abc", argv[0] just gives me
>>./abc, rather than full path of the program location.
>
>To get the full path to the program, you have to read the /proc entry
>for your program (specifically, resolve the symbolic link
>/proc/self/exe). There is no other 'generic' way to get the path to
>the executable from within the running executable. BTW: this is not
>portable outside of Linux; it's not a Unix-generic method.
>

Bad idea.  There are no standards for the /proc directory.  It might
be better to use a system call like getcwd and concatenate the relative
filename to it.

Or something like that.

------------------------------

From: "Pengcheng Dai" <[EMAIL PROTECTED]>
Subject: what should I do to get my first hello.c run?
Date: Tue, 17 Apr 2001 19:36:30 GMT

Sorry to ask this simple question.
I did the following steps.
1. vi test.c
#include <stdio.h>
main(){
    printf("hello");
}
2. cc -o test test.c
3. test

nothing come out. Is there any problem with env?




------------------------------

From: [EMAIL PROTECTED] (Lew Pitcher)
Subject: Re: what should I do to get my first hello.c run?
Reply-To: [EMAIL PROTECTED]
Date: Tue, 17 Apr 2001 19:42:23 GMT

On Tue, 17 Apr 2001 19:36:30 GMT, "Pengcheng Dai" <[EMAIL PROTECTED]>
wrote:

>Sorry to ask this simple question.
>I did the following steps.
>1. vi test.c
>#include <stdio.h>
>main(){
>    printf("hello");
>}
>2. cc -o test test.c
>3. test
>
>nothing come out. Is there any problem with env?

'test' is often a reserved name in shell, and also exists as a program
in /usr/bin.

If you must call your program 'test', execute it as ./test

However, it's better to call your program something other than 'test'
(or any of the other common commands/builtins)



Lew Pitcher, Information Technology Consultant, Toronto Dominion Bank Financial Group
([EMAIL PROTECTED])

(Opinions expressed are my own, not my employer's.)

------------------------------

From: "Pengcheng Dai" <[EMAIL PROTECTED]>
Subject: Re: what should I do to get my first hello.c run?
Date: Tue, 17 Apr 2001 20:00:30 GMT

Thanks.
But when I tried using another name and try to execute the program, it said
'command not found'
my steps are
1. vi myprog.c
2. cc -o myprog myprog.c
3. myprog

I guess there is some env variable I should set?

"Lew Pitcher" <[EMAIL PROTECTED]> wrote in message
news:[EMAIL PROTECTED]...
> On Tue, 17 Apr 2001 19:36:30 GMT, "Pengcheng Dai" <[EMAIL PROTECTED]>
> wrote:
>
> >Sorry to ask this simple question.
> >I did the following steps.
> >1. vi test.c
> >#include <stdio.h>
> >main(){
> >    printf("hello");
> >}
> >2. cc -o test test.c
> >3. test
> >
> >nothing come out. Is there any problem with env?
>
> 'test' is often a reserved name in shell, and also exists as a program
> in /usr/bin.
>
> If you must call your program 'test', execute it as ./test
>
> However, it's better to call your program something other than 'test'
> (or any of the other common commands/builtins)
>
>
>
> Lew Pitcher, Information Technology Consultant, Toronto Dominion Bank
Financial Group
> ([EMAIL PROTECTED])
>
> (Opinions expressed are my own, not my employer's.)



------------------------------

From: "Pengcheng Dai" <[EMAIL PROTECTED]>
Subject: Where to edit the $PATH
Date: Tue, 17 Apr 2001 20:14:44 GMT

It's a problem of the $PATH.
I know I can change it by export PATH=.:$PATH
Should I modify /root/.profile and add .: to the PATH?
But after I logout/login again, the PATH did not change.

"Pengcheng Dai" <[EMAIL PROTECTED]> wrote in message
news:yh1D6.684575$[EMAIL PROTECTED]...
> Thanks.
> But when I tried using another name and try to execute the program, it
said
> 'command not found'
> my steps are
> 1. vi myprog.c
> 2. cc -o myprog myprog.c
> 3. myprog
>
> I guess there is some env variable I should set?
>
> "Lew Pitcher" <[EMAIL PROTECTED]> wrote in message
> news:[EMAIL PROTECTED]...
> > On Tue, 17 Apr 2001 19:36:30 GMT, "Pengcheng Dai" <[EMAIL PROTECTED]>
> > wrote:
> >
> > >Sorry to ask this simple question.
> > >I did the following steps.
> > >1. vi test.c
> > >#include <stdio.h>
> > >main(){
> > >    printf("hello");
> > >}
> > >2. cc -o test test.c
> > >3. test
> > >
> > >nothing come out. Is there any problem with env?
> >
> > 'test' is often a reserved name in shell, and also exists as a program
> > in /usr/bin.
> >
> > If you must call your program 'test', execute it as ./test
> >
> > However, it's better to call your program something other than 'test'
> > (or any of the other common commands/builtins)
> >
> >
> >
> > Lew Pitcher, Information Technology Consultant, Toronto Dominion Bank
> Financial Group
> > ([EMAIL PROTECTED])
> >
> > (Opinions expressed are my own, not my employer's.)
>
>



------------------------------

From: [EMAIL PROTECTED] (Juergen Heinzl)
Subject: Re: Where to edit the $PATH
Date: Tue, 17 Apr 2001 20:54:22 GMT

In article <Uu1D6.684624$[EMAIL PROTECTED]>, Pengcheng Dai wrote:
>It's a problem of the $PATH.
>I know I can change it by export PATH=.:$PATH
>Should I modify /root/.profile and add .: to the PATH?
>But after I logout/login again, the PATH did not change.
[-]
No. If you want to have . in your path, which is fine with
me for all but root, then edit your $HOME/.profile or .bash_profile
or whatever your shell uses. For the ksh and bash it'd be ...

export PATH=$PATH:.

... and you can add more than one directories to your path,
so this ...

export PATH=$PATH:/opt/j2ee/bin:.

... is fine too. Since the Bourne shell does not allow
exporting and setting variables in one line you may
find it put this way though ...

PATH=$PATH:/opt/j2ee/bin:.
export PATH

...

Ta',
Juergen

-- 
\ Real name     : Juergen Heinzl                \       no flames      /
 \ EMail Private : [EMAIL PROTECTED] \ send money instead /

------------------------------

From: Stefan Heimers <[EMAIL PROTECTED]>
Subject: Re: what should I do to get my first hello.c run?
Reply-To: [EMAIL PROTECTED]
Date: Tue, 17 Apr 2001 23:07:10 +0200

Pengcheng Dai wrote:

> Thanks.
> But when I tried using another name and try to execute the program, it
> said 'command not found'
> my steps are
> 1. vi myprog.c
> 2. cc -o myprog myprog.c
> 3. myprog

Your working directory is not in the $PATH.

Just do a

./myprog


The dot and the slash are important. They tell the system to search the 
program in your working directory instead of the paths included in $PATH.

Stefan

------------------------------

From: [EMAIL PROTECTED]
Subject: Re: what should I do to get my first hello.c run?
Date: Tue, 17 Apr 2001 21:33:15 GMT

Stefan Heimers <[EMAIL PROTECTED]> writes:
> Pengcheng Dai wrote:
> 
> > Thanks.
> > But when I tried using another name and try to execute the program, it
> > said 'command not found'
> > my steps are
> > 1. vi myprog.c
> > 2. cc -o myprog myprog.c
> > 3. myprog
> 
> Your working directory is not in the $PATH.
> 
> Just do a
> 
> ../myprog
> 
> 
> The dot and the slash are important. They tell the system to search the 
> program in your working directory instead of the paths included in $PATH.

That might work better as:
  ./myprog

That looks for the program in the current directory, whilst
"../myprog" looks for the program un directory up...

-- 
(concatenate 'string "cbbrowne" "@acm.org")
http://vip.hyperusa.com/~cbbrowne/resume.html
Rule of Scarcity
"If it's not allocated by a market, then it's more expensive than
money."
-- Mark Miller

------------------------------

From: Peter Mantell <[EMAIL PROTECTED]>
Subject: Re: CodeWarrior Linux and ld error messages
Date: Tue, 17 Apr 2001 22:46:44 +0100

Guy Rouillier wrote:
> 
> The sentinals are defined only for a single compilation unit.  So if
> you compile a.c that #include "model.h" and then compile b.c that does
> the same, model.h will get included in both because the sentinal only
> becomes defined for the duration of a single compilation unit. a.c and
> b.c are different compilation units.
> 


That fits with what I'm seeing, but then leads me to another question.
I've seen people put these sentinels in code before: what purpose do
they serve?

------------------------------

From: Juha Laiho <[EMAIL PROTECTED]>
Subject: Re: where am i?
Date: 17 Apr 2001 15:06:33 GMT

[EMAIL PROTECTED] said:
>On Tue, 17 Apr 2001 20:13:36 +0800, "Wong Ka Chun"
><[EMAIL PROTECTED]> wrote:
>>  I tried, but if I run the program say "./abc", argv[0] just gives me
>>./abc, rather than full path of the program location.
...
>What happens if I start a program outside of the PATH?
>What happens if I start a program from the PATH?

And what happens, if the calling program puts plain bogus information in
argv[0]?
-- 
Wolf  a.k.a.  Juha Laiho     Espoo, Finland
(GC 3.0) GIT d- s+: a C++ UH++++$ UL++++ P++@ L+++ E(-) W+$@ N++ !K w !O
         !M V PS(+) PE Y+ PGP(+) t- 5 !X R tv--- b+ !DI D G e+ h--- r+++ y+++
"...cancel my subscription to the resurrection!" (Jim Morrison)

------------------------------

From: "Philip Van Hoof" <[EMAIL PROTECTED]>
Subject: Re: where am i?
Reply-To: [EMAIL PROTECTED]
Date: Tue, 17 Apr 2001 22:07:17 GMT

Checkout the GNU whereis made by Carlo Wood which uses the same
algoritm that bash uses to determine which binary to execute
when calling it at a bash

# whereis ls
ls: /bin/ls /usr/bin/ls
# 


-- 
Philip van Hoof aka freax (http://www.freax.eu.org)
irc: irc.openprojects.net mailto:freax @ pandora.be

------------------------------


** FOR YOUR REFERENCE **

The service address, to which questions about the list itself and requests
to be added to or deleted from it should be directed, is:

    Internet: [EMAIL PROTECTED]

You can send mail to the entire list by posting to the
comp.os.linux.development.apps newsgroup.

Linux may be obtained via one of these FTP sites:
    ftp.funet.fi                                pub/Linux
    tsx-11.mit.edu                              pub/linux
    sunsite.unc.edu                             pub/Linux

End of Linux-Development-Apps Digest
******************************

Reply via email to