Annotation of researchv10no/cmd/lcc/ph/sdutil.h, revision 1.1.1.1

1.1       root        1: /* As per your license agreement, your distribution is not to be moved or copied outside the Designated Site
                      2:  * without specific permission from Plum Hall Inc.
                      3:  */
                      4: 
                      5: /*
                      6:  * SDUTIL - system-dependent utility routines for freestanding implementations
                      7:  *
                      8:  * These functions are used by UTIL.C.  They provide facilities that cannot
                      9:  * be implemented portably and must be rewritten for each freestanding imple-
                     10:  * mentation.  This sample implementation uses standard library functions
                     11:  * (provided by a hosted implementation).
                     12:  */
                     13: 
                     14: #ifndef FREESTANDING
                     15: #include <errno.h>
                     16: #include <stdio.h>
                     17: #endif /* FREESTANDING */
                     18: 
                     19: #include "defs.h"
                     20: 
                     21: extern char last_char_printed;
                     22: 
                     23: /*
                     24:  * PR_OK - printf a text line in ok situation (no error, just text)
                     25:  */
                     26: void pr_ok FN_DEF1(s,
                     27:        const char *s)
                     28:        {
                     29:        char c;
                     30:        fputs(s, stdout);
                     31:        while (*s != '\0')
                     32:                c = *s++;
                     33:        last_char_printed = c;
                     34:        fflush(stdout);
                     35:        }
                     36: 
                     37: /*
                     38:  * SETZERO - appear, to a compiler, as though Zero is unpredictably set
                     39:  */
                     40: void setzero()
                     41:        {
                     42:        FILE *fp;
                     43:        int save;
                     44: 
                     45:        save = errno;
                     46:        if ((fp = fopen("nonexistent", "r")) != 0)
                     47:                {
                     48:                fscanf(fp, "ignore format", &Zero);
                     49:                fclose(fp);
                     50:                }
                     51:        errno = save;
                     52:        }

unix.superglobalmegacorp.com

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