home *** CD-ROM | disk | FTP | other *** search
/ OS/2 Shareware BBS: 5 Edit / 05-Edit.zip / ftes46b5.zip / ftes46b5 / src / e_unix.cpp < prev    next >
C/C++ Source or Header  |  1997-05-30  |  1KB  |  45 lines

  1. /*    e_unix.cpp
  2.  *
  3.  *    Copyright (c) 1997, Marko Macek
  4.  *
  5.  *    You may distribute under the terms of either the GNU General Public
  6.  *    License or the Artistic License, as specified in the README file.
  7.  *
  8.  */
  9.  
  10. // UNIX specific routines
  11.  
  12. #include "fte.h"
  13.  
  14. int EView::SysShowHelp(ExState &State, const char *word) {
  15.     char options[128] = "";
  16.     char command[1024];
  17.     char file[MAXPATH];
  18.  
  19.     if (State.GetStrParam(this, options, sizeof(options) - 1) == 0)
  20.         options[0] = 0;
  21.  
  22.     char wordAsk[64] = "";
  23.     if (word == 0) {
  24.         if (State.GetStrParam(this, wordAsk, sizeof(wordAsk) - 1) == 0)
  25.             if (MView->Win->GetStr("Keyword",
  26.                                    sizeof(wordAsk) - 1, wordAsk, HIST_DEFAULT) == 0)
  27.                 return 0;
  28.         word = wordAsk;
  29.     }
  30.  
  31.     sprintf(file, "/tmp/fte%d-man-%s", getpid(), word);
  32.     sprintf(command, "%s %s %s >'%s' 2>&1", HelpCommand, options, word, file);
  33.  
  34.     int rc = system(command);
  35.         
  36.     if (FileLoad(0, file, "CATBS", this) == 0) {
  37.         unlink(file);
  38.         return 0;
  39.     }
  40.     unlink(file);
  41.     if (rc != 0)
  42.         Msg(ERROR, "Error code %d retrieving manpage for %s", rc, word);
  43.     return 1;
  44. }
  45.