home *** CD-ROM | disk | FTP | other *** search
/ Usenet 1994 January / usenetsourcesnewsgroupsinfomagicjanuary1994.iso / sources / unix / volume8 / jove / part07 / teachjove.c < prev    next >
Encoding:
C/C++ Source or Header  |  1987-02-03  |  1.0 KB  |  41 lines

  1. /************************************************************************
  2.  * This program is Copyright (C) 1986 by Jonathan Payne.  JOVE is       *
  3.  * provided to you without charge, and with no warranty.  You may give  *
  4.  * away copies of JOVE, including sources, provided that this notice is *
  5.  * included in all the files.                                           *
  6.  ************************************************************************/
  7.  
  8. #include <sys/types.h>
  9. #include <sys/file.h>
  10.  
  11. #ifndef TEACHJOVE
  12. #    define TEACHJOVE    "/usr/lib/jove/teach-jove"
  13. #endif
  14.  
  15. #ifndef W_OK
  16. #   define W_OK    2
  17. #   define F_OK    0
  18. #endif
  19.  
  20. extern char    *getenv();
  21.  
  22. main()
  23. {
  24.     char    cmd[256],
  25.         fname[256],
  26.         *home;
  27.  
  28.     if ((home = getenv("HOME")) == 0) {
  29.         printf("teachjove: cannot find your home!\n");
  30.         exit(-1);
  31.     }
  32.     (void) sprintf(fname, "%s/teach-jove", home);
  33.     if (access(fname, F_OK) != 0) {
  34.         (void) sprintf(cmd, "cp %s %s", TEACHJOVE, fname);
  35.         system(cmd);
  36.     }
  37.     (void) execlp("jove", "teachjove", fname, (char *) 0);
  38.     printf("teachjove: cannot execl jove!\n");
  39. }
  40.  
  41.