Platon Technologies
not logged in Login Registration
EnglishSlovak
open source software development celebrating 10 years of open source development! Thursday, October 15, 2026

Diff for ep/src/process.c between version 1.2 and 1.3

version 1.2, 2001/09/21 19:44:51 version 1.3, 2001/09/21 19:54:45
Line 1 
Line 1 
 /*  /*
  * $Log$   * $Log$
    * Revision 1.3  2001/09/21 19:54:45  host8
    * Cosmetics changes in *.c
    *
  * Revision 1.2  2001/09/21 19:44:51  host8   * Revision 1.2  2001/09/21 19:44:51  host8
  * Added $Log$ keyword substitution   * Added $Log$
    * Added Revision 1.3  2001/09/21 19:54:45  host8
    * Added Cosmetics changes in *.c
    * Added keyword substitution
  *   *
  */   */
 #ifdef HAVE_CONFIG_H  #ifdef HAVE_CONFIG_H
Line 28 
Line 34 
 #include "message.h"  #include "message.h"
   
 #ifndef __strdel  #ifndef __strdel
 #define __strdel  #define __strdel
 static char *strdel(char *s) {  static char *strdel(char *s) {
         register int k=-1;          register int k=-1;
         while (++k, s[k]!='\0')          while (++k, s[k]!='\0')
                 s[k]=s[k+1];                  s[k]=s[k+1];
         return s;          return s;
 }  }
Line 44  static char *strdel(char *s) {
Line 50  static char *strdel(char *s) {
   
   
 /*  /*
  * Analyze process optarg.   * Analyze process optarg.
  * Return 1, if there are items left, link->proc_id and link->fd are set.   * Return 1, if there are items left, link->proc_id and link->fd are set.
  * If it was last item return 0.   * If it was last item return 0.
  * On error return -1.   * On error return -1.
Line 72  analyze_proc_optarg(arg, link)
Line 78  analyze_proc_optarg(arg, link)
                 /* Check the konzistention. */                  /* Check the konzistention. */
                 if (strlen(arg) < 2)                  if (strlen(arg) < 2)
                         return -1;                          return -1;
                 if ((isdigit(arg[0]) && isalpha(arg[strlen(arg)-1])) ||                  if ((isdigit(arg[0]) && isalpha(arg[strlen(arg)-1])) ||
                                 (isalpha(arg[0]) && isdigit(arg[strlen(arg)-1])))                                  (isalpha(arg[0]) && isdigit(arg[strlen(arg)-1])))
                         ;                          ;
                 else                  else
Line 81  analyze_proc_optarg(arg, link)
Line 87  analyze_proc_optarg(arg, link)
                 curr_sub_arg = a_arg = arg;                  curr_sub_arg = a_arg = arg;
         }          }
   
         /*          /*
          * Set next_sub_arg to the next subarument.           * Set next_sub_arg to the next subarument.
          * Set curr_2nd_part to the 2nd part of current subargument.           * Set curr_2nd_part to the 2nd part of current subargument.
          */           */
         for (curr_2nd_part = next_sub_arg = curr_sub_arg; ; next_sub_arg++) {          for (curr_2nd_part = next_sub_arg = curr_sub_arg; ; next_sub_arg++) {
Line 107  analyze_proc_optarg(arg, link)
Line 113  analyze_proc_optarg(arg, link)
                         proc_id_start = curr_sub_arg;                          proc_id_start = curr_sub_arg;
                         fd_start = curr_2nd_part;                          fd_start = curr_2nd_part;
                         fd_end = next_sub_arg - 1;                          fd_end = next_sub_arg - 1;
                 }                  }
                 else {                  else {
                         proc_id_start = curr_2nd_part;                          proc_id_start = curr_2nd_part;
                         fd_start = curr_sub_arg;                          fd_start = curr_sub_arg;
Line 117  analyze_proc_optarg(arg, link)
Line 123  analyze_proc_optarg(arg, link)
                 /* Set link->proc_id. */                  /* Set link->proc_id. */
                 sscanf(proc_id_start, "%d", &link->proc_id);                  sscanf(proc_id_start, "%d", &link->proc_id);
   
                 /* Set link->fd. */                  /* Set link->fd. */
                 link->fd_id = INVALID_FD;                  link->fd_id = INVALID_FD;
                 for (i = 0; i < N_FD_STR * N_FD; i++) {                  for (i = 0; i < N_FD_STR * N_FD; i++) {
                         if (strlen(fd_str[i/N_FD][i%N_FD]) ==                          if (strlen(fd_str[i/N_FD][i%N_FD]) ==
Line 128  analyze_proc_optarg(arg, link)
Line 134  analyze_proc_optarg(arg, link)
                 }                  }
         }          }
   
         if (link->fd_id == INVALID_FD)          if (link->fd_id == INVALID_FD)
                 return -1;                  return -1;
   
         /* Move to the next subargument. */          /* Move to the next subargument. */
         curr_sub_arg = next_sub_arg;          curr_sub_arg = next_sub_arg;
   
         return curr_sub_arg[0] == '\0' ? 0 : 1;          return curr_sub_arg[0] == '\0' ? 0 : 1;
Line 152  process_init(proc)
Line 158  process_init(proc)
         proc->argv = NULL;          proc->argv = NULL;
 }  }
   
         int          int
 process_init_by_array(proc, size, array)  process_init_by_array(proc, size, array)
         struct process *proc;          struct process *proc;
         int size;          int size;
Line 176  process_init_by_array(proc, size, array)
Line 182  process_init_by_array(proc, size, array)
         optind = 0;          optind = 0;
   
         while (1) {          while (1) {
                 c = getopt_long(size + 1, array - 1, "+i:o:e:",                  c = getopt_long(size + 1, array - 1, "+i:o:e:",
                                 long_options, &option_index);                                  long_options, &option_index);
   
 #if DEBUG  #if DEBUG
Line 186  process_init_by_array(proc, size, array)
Line 192  process_init_by_array(proc, size, array)
   
                 if (c == -1) {                  if (c == -1) {
                         return process_argv_init_by_array(                          return process_argv_init_by_array(
                                         proc,                                          proc,
                                         size + 1 - optind,                                          size + 1 - optind,
                                         array - 1 + optind);                                          array - 1 + optind);
                 }                  }
   
                 switch (c) {                  switch (c) {
                         case 'i':                          case 'i':
Line 250  process_destroy(proc)
Line 256  process_destroy(proc)
 }  }
   
   
         int          int
 process_argv_init_by_array(proc, size, array)  process_argv_init_by_array(proc, size, array)
         struct process *proc;          struct process *proc;
         int size;          int size;
Line 284  process_argv_init_by_array(proc, size, a
Line 290  process_argv_init_by_array(proc, size, a
 }  }
   
   
         void          void
 process_argv_destroy(proc)  process_argv_destroy(proc)
         struct process *proc;          struct process *proc;
 {  {
Line 308  process_print_cmdline(proc)
Line 314  process_print_cmdline(proc)
         if (proc == NULL) {          if (proc == NULL) {
                 msg_warn_print("\nNULL struct process pointer in "                  msg_warn_print("\nNULL struct process pointer in "
                                 "process_print_cmdline()\n");                                  "process_print_cmdline()\n");
         }          }
         else {          else {
                 register int j = 0;                  register int j = 0;
   
                 while (proc->argv != NULL && proc->argv[j] != NULL) {                  while (proc->argv != NULL && proc->argv[j] != NULL) {
Line 329  process_print_struct(proc)
Line 335  process_print_struct(proc)
         if (proc == NULL) {          if (proc == NULL) {
                 msg_warn_print("\nNULL struct process pointer in "                  msg_warn_print("\nNULL struct process pointer in "
                                 "process_print_struct()\n");                                  "process_print_struct()\n");
         }          }
         else {          else {
                 register int i;                  register int i;
                 struct stat buf;                  struct stat buf;
Line 356  process_print_struct(proc)
Line 362  process_print_struct(proc)
         }          }
 }  }
   
         void          void
 process_close_2nd_sides_of_pipes(proc)  process_close_2nd_sides_of_pipes(proc)
         struct process *proc;          struct process *proc;
 {  {

Legend:
Removed from v.1.2  
changed lines
  Added in v.1.3

Platon Group <platon@platon.org> http://platon.org/
Copyright © 2002-2006 Platon Group
Site powered by Metafox CMS
Go to Top