# 2.11BSD#431 - /usr/src/usr.lib/libI77/util.c

##### Functions

    b_char            X
    g_char            X
    last_char         X
    now_acc           X
    nowreading        X
    nowwriting        X

       1: /*
       2:  * Copyright (c) 1980 Regents of the University of California.
       3:  * All rights reserved.  The Berkeley software License Agreement
       4:  * specifies the terms and conditions for redistribution.
       5:  *
       6:  *	@(#)util.c	5.1	6/7/85
       7:  */
       8:
       9: /*
      10:  * utility routines
      11:  */
      12:
      13: #include "fio.h"
      14:
      15: extern short    ccntrl_, blzero_;
      16:
      17: nowreading(x) unit *x;
      18: {
      19:     return(now_acc(x,"r"));
      20: }
      21:
      22: nowwriting(x) unit *x;
      23: {
      24:     return(now_acc(x,"a"));
      25: }
      26:
      27: LOCAL now_acc(x,mode)
      28: unit *x; char *mode;
      29: {
      30:     long loc;
      31:
      32:     if (!x->ufnm)
      33:     {
      34:         errno = EBADF;
      35:         return(NO);
      36:     }
      37:     if (x->useek)
      38:         loc=ftell(x->ufd);
      39:     if (freopen(x->ufnm,mode,x->ufd))
      40:     {
      41:         if (x->useek)
      42:             fseek(x->ufd,loc,0);
      43:         x->uwrt = (*mode=='a');
      44:         return(YES);
      45:     }
      46:     if (x->ufd = fopen(x->ufnm, (*mode=='a')? "r":"a"))
      47:         if (x->useek)
      48:             fseek(x->ufd,loc,0);
      49:     return(NO);
      50: }
      51:
      52: g_char(a,alen,b) char *a,*b; ftnlen alen;
      53: {   char *x=a+alen-1, *y=b+alen-1;
      54:     while (x >= a  &&  *x == ' ') {x--; y--;}
      55:     *(y+1) = '\0';
      56:     while (x >= a) *y-- = *x--;
      57: }
      58:
      59: b_char(from, to, tolen) char *from, *to; ftnlen tolen;
      60: {   int i=0;
      61:     while (*from && i < tolen) {
      62:         *to++ = *from++;
      63:         i++;
      64:     }
      65:     while (i++ < tolen)
      66:         *to++ = ' ';
      67: }
      68:
      69: char
      70: last_char(f) FILE *f;
      71: {
      72:     fseek(f,-2L,1);
      73:     if(ftell(f)) return(getc(f));
      74:     else return('\n');
      75: }

#### Defined functions

b_char defined in line 59; used 19 times

- in /usr/src/usr.lib/libI77/inquire.c line 66, 73, 79, 85, 97, 103, 109, 124
- in /usr/src/usr.lib/libI77/lread.c line 166
- in /usr/src/usr.lib/libI77/rsnmle.c line 395
- in /usr/src/usr.lib/libU77/ctime_.c line 27
- in /usr/src/usr.lib/libU77/fdate_.c line 30
- in /usr/src/usr.lib/libU77/gerror_.c line 37
- in /usr/src/usr.lib/libU77/getcwd_.c line 37
- in /usr/src/usr.lib/libU77/getenv_.c line 36, 44
- in /usr/src/usr.lib/libU77/getlog_.c line 29
- in /usr/src/usr.lib/libU77/hostnm_.c line 34
- in /usr/src/usr.lib/libU77/ttynam_.c line 34

g_char defined in line 52; used 17 times

- in /usr/src/usr.lib/libI77/inquire.c line 30
- in /usr/src/usr.lib/libI77/open.c line 54
- in /usr/src/usr.lib/libU77/access_.c line 37
- in /usr/src/usr.lib/libU77/chdir_.c line 34
- in /usr/src/usr.lib/libU77/chmod_.c line 33-34(2)
- in /usr/src/usr.lib/libU77/link_.c line 35-36(2)
- in /usr/src/usr.lib/libU77/lstat_.c line 35
- in /usr/src/usr.lib/libU77/rename_.c line 38-39(2)
- in /usr/src/usr.lib/libU77/stat_.c line 34
- in /usr/src/usr.lib/libU77/symlnk_.c line 36-37(2)
- in /usr/src/usr.lib/libU77/system_.c line 38
- in /usr/src/usr.lib/libU77/tapeio.c line 90
- in /usr/src/usr.lib/libU77/unlink_.c line 35

last_char defined in line 69; used 3 times

- in /usr/src/usr.lib/libI77/backspace.c line 16, 61
- in /usr/src/usr.lib/libI77/err.c line 106

now_acc defined in line 27; used 2 times

- in line 19-24(2)

nowreading defined in line 17; used 9 times

- in /usr/src/usr.lib/libI77/close.c line 85
- in /usr/src/usr.lib/libI77/due.c line 23
- in /usr/src/usr.lib/libI77/lread.c line 64
- in /usr/src/usr.lib/libI77/rdfe.c line 25
- in /usr/src/usr.lib/libI77/rsfe.c line 26
- in /usr/src/usr.lib/libI77/rsnmle.c line 75
- in /usr/src/usr.lib/libI77/sue.c line 25
- in /usr/src/usr.lib/libU77/fgetc_.c line 36
- in /usr/src/usr.lib/libU77/getc_.c line 34

nowwriting defined in line 22; used 9 times

- in /usr/src/usr.lib/libI77/due.c line 33
- in /usr/src/usr.lib/libI77/lwrite.c line 31
- in /usr/src/usr.lib/libI77/sue.c line 41
- in /usr/src/usr.lib/libI77/wdfe.c line 26
- in /usr/src/usr.lib/libI77/wsfe.c line 27
- in /usr/src/usr.lib/libI77/wsnmle.c line 38
- in /usr/src/usr.lib/libU77/fputc_.c line 36
- in /usr/src/usr.lib/libU77/perror_.c line 41
- in /usr/src/usr.lib/libU77/putc_.c line 34

Last modified: 1987-02-18 Generated: 2016-12-26 | Generated by src2html V0.67 page hit count: 653 |