home *** CD-ROM | disk | FTP | other *** search
/ Super Net 1 / SUPERNET_1.iso / PC / OTROS / EXTRAS / UUCODE / UUPC / TEST / UPC12ES1.ZIP / LIB / importng.c < prev    next >
Encoding:
C/C++ Source or Header  |  1993-10-11  |  3.9 KB  |  92 lines

  1. /*--------------------------------------------------------------------*/
  2. /*    i m p o r t n g . c                                             */
  3. /*                                                                    */
  4. /*    Create the fully-qualified path name for a news group           */
  5. /*    under UUPC/extended.                                            */
  6. /*                                                                    */
  7. /*    Copyright (c) 1992, by Andrew H. Derbyshire; all rights         */
  8. /*    reserved except as specified in UUPC/extended end-user          */
  9. /*    documentation.                                                  */
  10. /*--------------------------------------------------------------------*/
  11.  
  12. /*
  13.  *    $Id: importng.c 1.3 1993/10/12 00:45:27 ahd Exp $
  14.  *
  15.  *    $Log: importng.c $
  16.  *     Revision 1.3  1993/10/12  00:45:27  ahd
  17.  *     Normalize comments
  18.  *
  19.  * Revision 1.2  1992/11/20  12:39:57  ahd
  20.  * Drop boring message reporting mapping of name
  21.  *
  22.  */
  23.  
  24. /*--------------------------------------------------------------------*/
  25. /*                        System include files                        */
  26. /*--------------------------------------------------------------------*/
  27.  
  28. #include <stdio.h>
  29. #include <time.h>
  30. #include <string.h>
  31.  
  32. /*--------------------------------------------------------------------*/
  33. /*                    UUPC/extended include files                     */
  34. /*--------------------------------------------------------------------*/
  35.  
  36. #include "lib.h"
  37. #include "import.h"
  38. #include "hlib.h"
  39. #include "importng.h"
  40.  
  41. /*--------------------------------------------------------------------*/
  42. /*    I m p o r t N e w s G r o u p                                   */
  43. /*                                                                    */
  44. /*    Takes a news group and returns a directory path for it          */
  45. /*--------------------------------------------------------------------*/
  46.  
  47. char *ImportNewsGroup( char *local,
  48.                        const char *group,
  49.                        const long article )
  50. {
  51.    char fullpath[FILENAME_MAX];
  52.    char partial[FILENAME_MAX];
  53.    char *s;
  54.  
  55. /*--------------------------------------------------------------------*/
  56. /*    Combine the group with the name of the file of in the           */
  57. /*    newgroup, if needed.  Otherwise, copy the simple news group     */
  58. /*    name to our work buffer                                         */
  59. /*--------------------------------------------------------------------*/
  60.  
  61.    strcpy( partial, group);
  62.  
  63.    if ( article != 0 )
  64.       sprintf(partial + strlen( partial ),"/%ld", article );
  65.  
  66. /*--------------------------------------------------------------------*/
  67. /*    Transform all periods in the news group to slashes, which       */
  68. /*    allows for longer group names than allowed by the simple DOS    */
  69. /*    8 + 3 directory structure.                                      */
  70. /*--------------------------------------------------------------------*/
  71.  
  72.    while ((s = strchr(partial, '.')) != NULL)
  73.       *s = '/';
  74.  
  75.    while ((s = strchr(E_newsdir, '\\')) != NULL)
  76.       *s = '/';                                 /* Normalize slashes  */
  77.  
  78. /*--------------------------------------------------------------------*/
  79. /*    Now combine the name with the root news directory; we do        */
  80. /*    this before importing the file name to insure we have a         */
  81. /*    path, which affects how ImportPath processes the file           */
  82. /*--------------------------------------------------------------------*/
  83.  
  84.    mkfilename( fullpath , E_newsdir, partial ); /* Build the name     */
  85.  
  86.    importpath( local, fullpath, NULL );        /* Truncate name and
  87.                                                    zap bad chars as
  88.                                                    needed             */
  89.    return local;
  90.  
  91. } /* ImportNewsGroup */
  92.