The UNIX and Linux Forums  

Go Back   The UNIX and Linux Forums > Top Forums > High Level Programming
Google UNIX.COM


High Level Programming Post questions about C, C++, Java, SQL, and other programming languages here.

More UNIX and Linux Forum Topics You Might Find Helpful
Thread Thread Starter Forum Replies Last Post
Cron - Not working properly risshanth HP-UX 23 10-31-2007 03:34 AM
Telnet is not working properly deepak_pathania UNIX for Dummies Questions & Answers 1 10-05-2007 02:59 PM
Rlogin not working properly from Linux frankkahle UNIX for Advanced & Expert Users 1 10-19-2006 07:02 PM
Keyboard not working properly... timresh UNIX for Dummies Questions & Answers 2 02-25-2005 04:28 AM
pf not working properly even with only "pass in all" and "pass out all" rules xyyz UNIX for Advanced & Expert Users 4 12-30-2003 02:33 AM

Reply
 
Submit Tools LinkBack Thread Tools Display Modes
  #1  
Old 05-18-2005
Registered User
 

Join Date: Apr 2005
Location: Australia
Posts: 30
y is this not working properly?

#include <stdio.h>
#include <sys/types.h>
#include <string.h>
#include <sys/stat.h>
#include <unistd.h>

struct stat s;

main() {
char c[100];
if (fork()==0) {
system("clear");
do {
printf("myAI\\>§ ");
scanf("%s",c);

if(stat(c,&s)>-1) {
system("att");

}
else if (strcmp("machine",c)<0) {
system("echo $USER@`hostname`");
system("echo kernel : `uname -r`");
system("kde-config --version | grep KDE");
}
} while (strcmp("exit",c));
exit(1);
}
wait(NULL);
}
Attached Images
File Type: png snapshot3.png (95.7 KB, 11 views)
Reply With Quote
Forum Sponsor
  #2  
Old 05-18-2005
Moderator
 

Join Date: Sep 2002
Location: Hong Kong, China
Posts: 1,469
What are you trying to do with

Code:
strcmp("machine",c)<0
?
Reply With Quote
  #3  
Old 05-18-2005
Registered User
 

Join Date: Apr 2005
Location: Australia
Posts: 30
it didnt change big deal
Reply With Quote
  #4  
Old 05-18-2005
Registered User
 

Join Date: Apr 2005
Location: Australia
Posts: 30
Talking

there's the answer

(strcmp("machine",c)==0)

im trying to make my own shell, i thk its the best way for me to grasp C and Bash at the same time
Reply With Quote
Google The UNIX and Linux Forums
Reply

Thread Tools
Display Modes




All times are GMT -7. The time now is 02:44 AM.


Powered by: vBulletin, Copyright ©2000 - 2006, Jelsoft Enterprises Limited.
The UNIX and Linux Forums Content Copyright ©1993-2008. All Rights Reserved.Ad Management by RedTyger Visit The Complex Event Processing Blog

Content Relevant URLs by vBSEO 3.2.0