/[cvs]/joko/Uni/BSArch/03/win32/min_shell.c
ViewVC logotype

Diff of /joko/Uni/BSArch/03/win32/min_shell.c

Parent Directory Parent Directory | Revision Log Revision Log | View Patch Patch

revision 1.5 by joko, Thu Jun 15 22:15:10 2006 UTC revision 1.6 by joko, Thu Jun 15 22:34:55 2006 UTC
# Line 33  int main(int argc, char * argv[]) { Line 33  int main(int argc, char * argv[]) {
33  void read_commands(FILE * fp) {  void read_commands(FILE * fp) {
34        
35    char command[MAX_COMMAND_LENGTH];    char command[MAX_COMMAND_LENGTH];
   int command_length;  
36        
37    fgets(command, MAX_COMMAND_LENGTH, fp);    fgets(command, MAX_COMMAND_LENGTH, fp);
38    command_length = strlen(command);    chomp(command);
     
   /* if last char is newline, strip it */  
   if (command[command_length-1] == '\n') {  
     command[command_length-1] = '\0';  
   }  
39        
40    process_command(command);    process_command(command);
41  }  }
42    
43    /* if last char is newline, "strip" it */
44    void chomp(char * string) {
45      int string_length = strlen(string);
46      if (string[string_length-1] == '\n') {
47        string[string_length-1] = '\0';
48      }
49    }
50    
51  void process_command(char * command) {  void process_command(char * command) {
52    printf("process_command: %s\n", command);    printf("process_command: %s\n", command);
53    start_process(command, 0);    start_process(command, 0);

Legend:
Removed from v.1.5  
changed lines
  Added in v.1.6

MailToCvsAdmin">MailToCvsAdmin
ViewVC Help
Powered by ViewVC 1.1.26 RSS 2.0 feed