Results 1 to 6 of 6
#### test.c#####
#include <fcntl.h>
#include <string.h>
#include <sys/stat.h>
#include <sys/types.h>
#include <unistd.h>
#include <sys/types.h>
#include <sys/socket.h>
#include <sys/ioctl.h>
#include <netinet/in.h>
#include <net/if.h>
#include <stdio.h>
#include <stdlib.h>
#include <string.h>
#include <ctype.h>
...
- 08-23-2008 #1Just Joined!
- Join Date
- Jun 2007
- Posts
- 84
c programing with linux command!!
#### test.c#####
#include <fcntl.h>
#include <string.h>
#include <sys/stat.h>
#include <sys/types.h>
#include <unistd.h>
#include <sys/types.h>
#include <sys/socket.h>
#include <sys/ioctl.h>
#include <netinet/in.h>
#include <net/if.h>
#include <stdio.h>
#include <stdlib.h>
#include <string.h>
#include <ctype.h>
int main(int argc, char **argv )
{
if(strcmp(argv[1],"mac_arp")==0)
{
system("/usr/local/bin/naxclassv2 access arp -en | grep $1 | awk '{print $3}'");
}
}
i use c programing for call system command on linux fedora and how to call argv ($1) for filter mac address
test mac_arp 172.168.1.200
result it's show mac address of 172.168.1.200
i can try this it's not working. please help me
- 08-23-2008 #2Linux User
- Join Date
- Jan 2007
- Location
- cleveland
- Posts
- 452
are you calling your program "test"?
the problem is, /usr/bin/test will be run,
unless you say "./test" or else use another
namethe sun is new every day (heraclitus)
- 08-24-2008 #3Just Joined!
- Join Date
- Jun 2007
- Posts
- 84
- 08-24-2008 #4
in your if statement try:
if(!strcmp(argv[1],"mac_arp"))
I think this is what you want
- 08-25-2008 #5No, that won't change the behavior of his program.in your if statement try:
if(!strcmp(argv[1],"mac_arp"))
I think this is what you want--
Bill
Old age and treachery will overcome youth and skill.
- 08-25-2008 #6


Reply With Quote
