Annotation of 43BSDReno/contrib/jove/teachjove.c, revision 1.1.1.1

1.1       root        1: /***************************************************************************
                      2:  * This program is Copyright (C) 1986, 1987, 1988 by Jonathan Payne.  JOVE *
                      3:  * is 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 <stdio.h>
                      9: #include <sys/types.h>
                     10: #include <sys/file.h>
                     11: 
                     12: #ifndef TEACHJOVE
                     13: #    define TEACHJOVE  "/usr/lib/jove/teach-jove"
                     14: #endif
                     15: 
                     16: #ifndef W_OK
                     17: #   define W_OK        2
                     18: #   define F_OK        0
                     19: #endif
                     20: 
                     21: extern char    *getenv();
                     22: 
                     23: int
                     24: main()
                     25: {
                     26:        char    cmd[256],
                     27:                fname[256],
                     28:                *home;
                     29: 
                     30:        if ((home = getenv("HOME")) == 0) {
                     31:                printf("teachjove: cannot find your home!\n");
                     32:                exit(-1);
                     33:        }
                     34:        (void) sprintf(fname, "%s/teach-jove", home);
                     35:        if (access(fname, F_OK) != 0) {
                     36:                (void) sprintf(cmd, "cp %s %s; chmod 644 %s", TEACHJOVE, fname, fname);
                     37:                system(cmd);
                     38:        }
                     39:        (void) execlp("jove", "teachjove", fname, (char *) 0);
                     40:        printf("teachjove: cannot execl jove!\n");
                     41:        return 1;
                     42: }
                     43: 

unix.superglobalmegacorp.com

This archive runs on limited infrastructure. Preserving old code on modern bandwidth. Automated agents are requested to crawl responsibly.