home *** CD-ROM | disk | FTP | other *** search
/ The C Users' Group Library 1994 August / wc-cdrom-cusersgrouplibrary-1994-08.iso / listings / v_09_10 / 9n10020a < prev    next >
Text File  |  1991-08-14  |  985b  |  37 lines

  1.  
  2. /* --------------------------------------------------------------
  3.  
  4. FUNCTION DISPLAY_NODE: The steps to display a selected node are:
  5.  
  6. A.  Complain if list empty.
  7.  
  8. B.  Get a string from the user.
  9.  
  10. C.  If no such node, complain else display its count and string.
  11.  
  12. -------------------------------------------------------------- */
  13.  
  14. void display_node(void)
  15. {
  16.         Node *ploc_node;        /* ptr to located node */
  17.         char string[21];        /* tmp holder for node's string */
  18.  
  19. /*A*/   if (proot_node == NULL) {
  20.                 printf("\n   List contains no nodes\n");
  21.                 return;
  22.         }
  23.  
  24. /*B*/   printf("\n   Enter string: ");
  25.         scanf("%20s", string);
  26.  
  27. /*C*/   ploc_node = locate_node(string, EXACT); 
  28.         if (ploc_node == NULL) {
  29.                 printf("No such node exists\n");
  30.         }
  31.         else {
  32.                 printf("\t%2u >%s<\n", ploc_node->count,
  33.                         ploc_node->pstring);
  34.         }
  35. }
  36.  
  37.