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

Diff for ep/src/fd.c between version 1.3 and 1.4

version 1.3, 2001/09/21 19:54:45 version 1.4, 2001/12/02 23:30:06
Line 1 
Line 1 
 /*  /*
  * $Log$   * $Log$
    * Revision 1.4  2001/12/02 23:30:06  jombik9
    * A lot of new functions added.
    * Various improvements.
    *
  * Revision 1.3  2001/09/21 19:54:45  host8   * Revision 1.3  2001/09/21 19:54:45  host8
  * Cosmetics changes in *.c   * 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$   * Added $Log$
    * Added Revision 1.4  2001/12/02 23:30:06  jombik9
    * Added A lot of new functions added.
    * Added Various improvements.
    * Added
  * Added Revision 1.3  2001/09/21 19:54:45  host8   * Added Revision 1.3  2001/09/21 19:54:45  host8
  * Added Cosmetics changes in *.c   * Added Cosmetics changes in *.c
  * Added keyword substitution   * Added keyword substitution
Line 15 
Line 23 
 #endif  #endif
   
 #include <stdio.h>  #include <stdio.h>
   #include <string.h>
   
 #if HAVE_UNISTD_H  #if HAVE_UNISTD_H
 #  include <sys/types.h>  #  include <sys/types.h>
Line 28 
Line 37 
 #include "fd.h"  #include "fd.h"
 #include "message.h"  #include "message.h"
   
   /*
    * TODO
    * - make this static a cut the same parameters,
    * because the comparion will be case insensitive
    */
 char *fd_str[N_FD_STR][N_FD] = {  char *fd_str[N_FD_STR][N_FD] = {
         {"input ", "output", "errput"},          {"input ", "output", "errput"},
         {"input", "output", "errput"},          {"input", "output", "errput"},
Line 39  char *fd_str[N_FD_STR][N_FD] = {
Line 53  char *fd_str[N_FD_STR][N_FD] = {
         {"STDIN", "STDOUT", "STDERR"},          {"STDIN", "STDOUT", "STDERR"},
         {"IN", "OUT", "ERR"},          {"IN", "OUT", "ERR"},
         {"IN", "OU", "ER"},          {"IN", "OU", "ER"},
         {"I", "O", "E"},          {"I", "O", "E"}
 };  };
   
   int fd_str_to_fd_id(char *str)
   {
           register int i, j;
   
           for (i = 0; i < N_FD_STR; i++)
                   for (j = 0; j < N_FD; j++) {
                           if (! strcasecmp(fd_str[i][j], str))
                                   return j;
                   }
   
           return -1;
   }
   
   
         int          int
 fd_add_proclink(fd, link)  fd_add_proclink(fd, link)
Line 50  fd_add_proclink(fd, link)
Line 77  fd_add_proclink(fd, link)
 {  {
 #if DEBUG  #if DEBUG
         msg_debug_print("fd_add_proclink(): link = (%d.%d)\n",          msg_debug_print("fd_add_proclink(): link = (%d.%d)\n",
                         link->proc_id, link->fd_id);                                                          link->proc_id, link->fd_id);
 #endif  #endif
   
         fd->link = (struct proclink *) realloc(fd->link,          fd->link = (struct proclink *) realloc(fd->link,
                         (fd->n_link + 1) * sizeof(struct proclink));                                                          (fd->n_link + 1) * sizeof(struct proclink));
   
         if (fd->link == NULL) {          if (fd->link == NULL) {
                 msg_error_print("fd_add_proclink(): realloc() failure\n");                  msg_error_print("fd_add_proclink(): realloc() failure\n");
Line 78  fd_remove_proclink(fd, link)
Line 105  fd_remove_proclink(fd, link)
   
 #if DEBUG  #if DEBUG
         msg_debug_print("fd_remove_proclink(): link = (%d.%d)\n",          msg_debug_print("fd_remove_proclink(): link = (%d.%d)\n",
                         link->proc_id, link->fd_id);                                                          link->proc_id, link->fd_id);
 #endif  #endif
   
         while ((index = fd_is_proclink(fd, link)) != 0)          while ((index = fd_is_proclink(fd, link)) != 0)
Line 107  fd_remove_proclink_by_index(fd, index)
Line 134  fd_remove_proclink_by_index(fd, index)
   
                 /* Reallocating array. */                  /* Reallocating array. */
                 fd->link = (struct proclink *)realloc(fd->link,                  fd->link = (struct proclink *)realloc(fd->link,
                                 (fd->n_link - 1) * sizeof(struct proclink));                                                                  (fd->n_link - 1) * sizeof(struct proclink));
   
                 if (fd->link == NULL) {                  if (fd->link == NULL) {
                         msg_error_print("fd_remove_proclink_by_index(): "                          msg_error_print("fd_remove_proclink_by_index(): "
                                         "realloc() failure\n");                                                                          "realloc() failure\n");
                         return 0;                          return 0;
                 }                  }
   
Line 139  fd_is_proclink(fd, link)
Line 166  fd_is_proclink(fd, link)
                  * Does somebody know it?!?                   * Does somebody know it?!?
                  */                   */
                 if (fd->link[i].proc_id == link->proc_id &&                  if (fd->link[i].proc_id == link->proc_id &&
                                 fd->link[i].fd_id == link->fd_id)                                                                  fd->link[i].fd_id == link->fd_id)
                         return i + 1;                          return i + 1;
   
         return 0;          return 0;

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

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