home *** CD-ROM | disk | FTP | other *** search
/ Beijing Paradise BBS Backup / PARADISE.ISO / software / BBSDOORW / NETCLB35.ZIP / NETCLB35.EXE / EXAMPLES / TOSERVER.C < prev    next >
C/C++ Source or Header  |  1996-01-03  |  2KB  |  53 lines

  1. /***************************************************************************/
  2. /* File:             TOSERVER.C                                            */
  3. /*                                                                         */
  4. /* Function:         Send message to the default server                    */
  5. /*                                                                         */
  6. /* Usage:            toserver "message"                                    */
  7. /*                                                                         */
  8. /* Functions Called: BroadcastToConsole                                    */
  9. /*                   GetPreferredConnectionID                              */
  10. /*                   GetDefaultConnectionID                                */
  11. /*                   GetPrimaryConnectionID                                */
  12. /*                   SetPreferredConnectionID                              */
  13. /*                   ISShellLoaded                                         */
  14. /*                                                                         */
  15. /***************************************************************************/
  16. #include "netware.h"
  17.  
  18. #include <stdio.h>
  19.  
  20. int main (int argc,char *argv[])
  21. {
  22. int thisserver,prefserver;
  23.  
  24.    if (argc !=2)
  25.    {
  26.       printf("Usage is 'toserver message'\n");
  27.       return(-1);
  28.    }
  29.    else
  30.    if (IsShellLoaded() != SUCCESS)
  31.    {
  32.       printf("*** No netware shell loaded ***\n");
  33.       return(255);
  34.    }
  35.  
  36.    if ((prefserver = GetPreferredConnectionID()) == 0)
  37.    {
  38.       if ((thisserver = GetDefaultConnectionID()) == 0)
  39.          thisserver = GetPrimaryConnectionID();
  40.       SetPreferredConnectionID( thisserver );
  41.    }
  42.    else
  43.       thisserver = prefserver;
  44.  
  45.    BroadcastToConsole(argv[1]);
  46.  
  47.    if (thisserver != prefserver)   /* reset preferred server */
  48.       SetPreferredConnectionID( prefserver );
  49.  
  50.    return 0;
  51. }
  52.  
  53.