# 2.11BSD#431 - /usr/src/usr.bin/learn/learn.c

##### Functions

    hangup            X
    intrpt            X
    main              X

##### Variables

    again             X
    ask               X
    comfile           X
    didok             X
    dir               X
    direct            X
    level             X
    logging           X
    more              X
    pwline            X
    sequence          X
    skip              X
    sname             X
    speed             X
    status            X
    teed              X
    todo              X
    total             X
    wrong             X

       1: #if !defined(lint) && defined(DOSCCS)
       2: static char sccsid[] = "@(#)learn.c	4.4.2	(2.11BSD)	1997/10/2";
       3: #endif
       4:
       5: #include "stdio.h"
       6: #include "lrnref.h"
       7: #include "signal.h"
       8: #include <unistd.h>
       9:
      10: char    *direct = "/usr/share/learn";   /* CHANGE THIS ON YOUR SYSTEM */
      11: int more;
      12: char    *level;
      13: int speed;
      14: char    *sname;
      15: char    *todo;
      16: FILE    *incopy = NULL;
      17: int didok;
      18: int sequence    = 1;
      19: int comfile = -1;
      20: int status;
      21: int wrong;
      22: char    *pwline;
      23: char    *dir;
      24: FILE    *scrin;
      25: int logging = 1;    /* set to 0 to turn off logging */
      26: int ask;
      27: int again;
      28: int skip;
      29: int teed;
      30: int total;
      31:
      32: main(argc,argv)
      33: int argc;
      34: char *argv[];
      35: {
      36:     extern hangup(), intrpt();
      37:
      38:     speed = 0;
      39:     more = 1;
      40:     pwline = getlogin();
      41: #ifndef BSD4_2
      42:     setbuf(stdout, malloc(BUFSIZ));
      43:     setbuf(stderr, malloc(BUFSIZ));
      44: #endif
      45:     selsub(argc, argv);
      46:     chgenv();
      47:     signal(SIGHUP, hangup);
      48:     signal(SIGINT, intrpt);
      49:     while (more) {
      50:         selunit();
      51:         dounit();
      52:         whatnow();
      53:     }
      54:     wrapup(0);
      55: }
      56:
      57: hangup()
      58: {
      59:     wrapup(1);
      60: }
      61:
      62: intrpt()
      63: {
      64:     char response[20], *p;
      65:
      66:     signal(SIGINT, hangup);
      67:     write(2, "\nInterrupt.\nWant to go on?  ", 28);
      68:     p = response;
      69:     *p = 'n';
      70:     while (read(0, p, 1) == 1 && *p != '\n')
      71:         p++;
      72:     if (response[0] != 'y')
      73:         wrapup(0);
      74:     ungetc('\n', stdin);
      75:     signal(SIGINT, intrpt);
      76: }

#### Defined functions

hangup defined in line 57; used 3 times

- in line 36, 47, 66

intrpt defined in line 62; used 7 times

- in line 36, 48, 75
- in /usr/src/usr.bin/learn/copy.c line 25, 69
- in /usr/src/usr.bin/learn/list.c line 14, 28

main defined in line 32; never used

#### Defined variables

again defined in line 27; used 6 times

- in /usr/src/usr.bin/learn/selsub.c line 41, 59, 101
- in /usr/src/usr.bin/learn/selunit.c line 21-22(2)
- in /usr/src/usr.bin/learn/whatnow.c line 13

ask defined in line 26; used 3 times

- in /usr/src/usr.bin/learn/selsub.c line 37
- in /usr/src/usr.bin/learn/selunit.c line 30
- in /usr/src/usr.bin/learn/start.c line 49

comfile defined in line 19; never used
didok defined in line 17; used 2 times

- in /usr/src/usr.bin/learn/whatnow.c line 32, 46

dir defined in line 23; used 6 times

- in /usr/src/usr.bin/learn/selsub.c line 112-116(4)
- in /usr/src/usr.bin/learn/wrapup.c line 28-29(2)

direct defined in line 10; used 8 times

- in /usr/src/usr.bin/learn/maktee.c line 17
- in /usr/src/usr.bin/learn/selsub.c line 24-29(3), 122-123(2)
- in /usr/src/usr.bin/learn/selunit.c line 44
- in /usr/src/usr.bin/learn/start.c line 51

level defined in line 12; used 19 times

- in /usr/src/usr.bin/learn/selsub.c line 35-44(5), 57-61(2), 88, 102, 123
- in /usr/src/usr.bin/learn/selunit.c line 36, 44-48(2), 83, 97
- in /usr/src/usr.bin/learn/whatnow.c line 17, 24, 33, 47

logging defined in line 25; never used
more defined in line 11; used 4 times

- in line 39, 49
- in /usr/src/usr.bin/learn/whatnow.c line 29, 46

pwline defined in line 22; used 1 times

- in line 40

sccsid defined in line 2; never used
sequence defined in line 18; used 4 times

- in /usr/src/usr.bin/learn/mem.c line 68-73(3), 82

skip defined in line 28; used 2 times

- in /usr/src/usr.bin/learn/whatnow.c line 20-25(2)

sname defined in line 14; used 22 times

- in /usr/src/usr.bin/learn/selsub.c line 33, 54-68(5), 76-87(6), 122-123(2), 142-143(2), 151-152(2), 164
- in /usr/src/usr.bin/learn/selunit.c line 44
- in /usr/src/usr.bin/learn/start.c line 51
- in /usr/src/usr.bin/learn/wrapup.c line 39

speed defined in line 13; used 14 times

- in line 38
- in /usr/src/usr.bin/learn/selsub.c line 46, 58
- in /usr/src/usr.bin/learn/selunit.c line 78(2)
- in /usr/src/usr.bin/learn/whatnow.c line 34-44(8)
- in /usr/src/usr.bin/learn/wrapup.c line 39

status defined in line 20; never used
teed defined in line 29; never used
todo defined in line 15; used 13 times

- in /usr/src/usr.bin/learn/selunit.c line 23-25(2), 37, 60, 91, 99
- in /usr/src/usr.bin/learn/whatnow.c line 15, 21-33(4)
- in /usr/src/usr.bin/learn/wrapup.c line 36-39(2)

total defined in line 30; used 1 times

- in /usr/src/usr.bin/learn/selsub.c line 87

wrong defined in line 21; used 1 times

- in /usr/src/usr.bin/learn/whatnow.c line 42

Last modified: 1997-10-03 Generated: 2016-12-26 | Generated by src2html V0.67 page hit count: 1415 |