home *** CD-ROM | disk | FTP | other *** search
/ Gold Fish 2 / goldfish_vol2_cd1.bin / files / comm / mail / smail / src / rcs / convert.c,v < prev    next >
Text File  |  1993-12-21  |  2KB  |  99 lines

  1. head    1.2;
  2. access;
  3. symbols
  4.     C_1:1.2;
  5. locks; strict;
  6. comment    @ * @;
  7.  
  8.  
  9. 1.2
  10. date    93.09.18.16.47.47;    author Aussem;    state Exp;
  11. branches;
  12. next    1.1;
  13.  
  14. 1.1
  15. date    93.09.08.16.27.13;    author Aussem;    state Exp;
  16. branches;
  17. next    ;
  18.  
  19.  
  20. desc
  21. @converts pathalias output to smail format
  22. @
  23.  
  24.  
  25. 1.2
  26. log
  27. @insert GNU license text in the header
  28. @
  29. text
  30. @/*
  31.  * convert.c
  32.  *
  33.  * This program is free software; you can redistribute it and/or
  34.  * modify it under the terms of the GNU General Public License as
  35.  * published by the Free Software Foundation; either version 2 of
  36.  * the License, or (at your option) any later version.
  37.  *
  38.  * This program is distributed in the hope that it will be useful,
  39.  * but WITHOUT ANY WARRANTY; without even the implied warranty of
  40.  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
  41.  * General Public License for more details.
  42.  *
  43.  * You should have received a copy of the GNU General Public License
  44.  * along with this program; if not, write to the Free Software
  45.  * Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
  46.  *
  47.  * $Log$
  48.  */
  49.  
  50.  
  51. #include <stdio.h>
  52. #include <string.h>
  53.  
  54. static char *version="$VER: convert V1.0 compiled "__DATE__;
  55.  
  56. main(argc, argv)
  57. int argc;
  58. char *argv[];
  59. {
  60.     FILE *ifp, *ofp;
  61.     char buf[1024];
  62.     register char *p,*s;
  63.    char *cost,*host,*route;
  64.  
  65.  
  66.     ifp = stdin;
  67.     ofp = stdout;
  68.  
  69.     while(fgets(buf, sizeof(buf), ifp) != NULL) {
  70.       for(s=p=buf;*p!='\t' && *p!='\0';p++);
  71.       if(p=='\0')break;
  72.       *p='\0';
  73.       cost=strdup(s);
  74.  
  75.       for(s=++p;*p!='\t' && *p!='\0';p++);
  76.       if(p=='\0')break;
  77.       *p='\0';
  78.       host=strdup(s);
  79.  
  80.       for(s=++p;*p!='\n' && *p!='\0';p++);
  81.       *p='\0';
  82.       route=strdup(s);
  83.       fprintf(ofp,"%s\t%s\t%s\n",host,route,cost);
  84.         }
  85.     return(0);
  86. }
  87. @
  88.  
  89.  
  90. 1.1
  91. log
  92. @Initial revision
  93. @
  94. text
  95. @d2 1
  96. d4 15
  97. d20 1
  98. @
  99.