home *** CD-ROM | disk | FTP | other *** search
/ OS/2 Shareware BBS: 3 Comm / 03-Comm.zip / DMP_FON.ZIP / DMP_FON.C next >
Text File  |  1990-10-09  |  2KB  |  76 lines

  1. /* 
  2.  *    This program dumps out the dialing directory for PMCOMM 1.06.  It isn't
  3.  * very smart, but it met my poor needs of a quick printout.  Feel free to
  4.  * modify it as you please.  It prints to stdout, so you can redirect the
  5.  * output to a file, or the printer.
  6.  *
  7.  * Note:  This is not an officially supported product by anyone.  I wrote it
  8.  * without input or assistance from Multi-Net so don't be upset if it doesn't
  9.  * work with any version of PMCOMM other than 1.06.  On the other hand, it 
  10.  * won't hurt to try it.
  11.  *
  12.  * Kevin Nickerson
  13.  *
  14.  */
  15.  
  16. #include <stdio.h>
  17. #include <stdlib.h>
  18.  
  19. #define  PHONE_FILE          "pmcomm.fon"
  20.  
  21. /* This structure was determined by looking at the dialing directory in hex.
  22.    The filler area was stuff that I wasn't concerned about. */
  23. struct   t_entry
  24. {
  25.    char                      name [21];
  26.    char                      number [21];
  27.    char                      baud [7];
  28.    char                      parity [5];
  29.    char                      data_bits [2];
  30.    char                      stop_bits [2];
  31.    char                      script [12];
  32.    char                      filler [52];
  33. };
  34.  
  35. void  print_entry ( struct t_entry * );
  36.  
  37. void main ( void )
  38.  
  39. {
  40.    struct t_entry            entry;
  41.    FILE                      *fp;
  42.  
  43.    if ( NULL == (fp = fopen ( PHONE_FILE, "rb" )) )
  44.    {
  45.       perror ( PHONE_FILE );
  46.       exit ( 1 );
  47.    }
  48.  
  49.    do
  50.    {
  51.       if ( 1 == fread ( &entry, sizeof ( entry ), 1, fp ) )
  52.          print_entry ( &entry );
  53.    }
  54.    while ( ! feof ( fp ) );
  55.  
  56.    fclose ( fp );
  57.    exit ( 0 );
  58. }
  59.  
  60. void  print_entry 
  61.    struct t_entry            *entry
  62. )
  63. {
  64.    printf ( "%-20s %-20s %7s %s-%c-%s %-12s\n",
  65.                entry -> name,
  66.                entry -> number,
  67.                entry -> baud,
  68.                entry -> data_bits,
  69.                entry -> parity [0],
  70.                entry -> stop_bits,
  71.                entry -> script );
  72. }
  73.  
  74.  
  75.