Annotation of researchv9/jerq/sgs/compress/sdp.c, revision 1.1.1.1

1.1       root        1: /*
                      2:  *     static char ID_sdp[] = "@(#) sdp.c: 1.1 1/8/82";
                      3:  */
                      4: 
                      5: #include <stdio.h>
                      6: #include <fatal.h>
                      7: #include <signal.h>
                      8: 
                      9: /*  define dummy variables used by ld (may be useful later) */
                     10: long   SDP_read = 0;
                     11: long   SDP_write= 0;
                     12: long   LD_lock  = 0;
                     13: long   LD_unlock= 0;
                     14: int    dflag    = 0;
                     15: 
                     16: extern char    *sname();
                     17: #include "syms.h"
                     18: #include "tagitem.h"
                     19: #include "sdpsrc/hd/define2.h"
                     20: #include "sdpsrc/hd/define3.h"
                     21: #include "sdpsrc/hd/define4.h"
                     22: #include "sdpsrc/hd/struct.h"
                     23: #include "sdpsrc/hd/globals.h"
                     24: 
                     25: #include "sdpsrc/lo/delist.c"
                     26: #include "sdpsrc/lo/enlist.c"
                     27: #include "sdpsrc/lo/fatal.c"
                     28: #include "sdpsrc/lo/getnxtpage.c"
                     29: #include "sdpsrc/lo/readpage.c"
                     30: #include "sdpsrc/lo/sojourn.c"
                     31: #include "sdpsrc/lo/repartition.c"
                     32: #include "sdpsrc/lo/writeframe.c"
                     33: 
                     34: #include "sdpsrc/hi/allocate.c"
                     35: #include "sdpsrc/hi/flush.c"
                     36: #include "sdpsrc/hi/init.c"
                     37: #include "sdpsrc/hi/lock.c"
                     38: #include "sdpsrc/hi/unlock.c"
                     39: lderror(lvl, ln,fln,strng, a1,a2,a3,a4,a5,a6,a7,a8,a9,aa)
                     40: int lvl;               /* error severity level */
                     41: int ln;                        /* line in ifile containing the error */
                     42: char *fln;             /* name of the ifile containing the error */
                     43: char *strng;           /* error message format */
                     44: int a1,a2,a3,a4,a5,    /* error message format arguments */
                     45:     a6,a7,a8,a9,aa;
                     46: {
                     47: 
                     48: /*
                     49:  *  Prepend a filename and a line number to an error message.
                     50:  *  used for printing all parsing-related errors.
                     51:  */
                     52: 
                     53: 
                     54:        if (lvl != 2)
                     55:                return;
                     56: 
                     57:        if (fln != NULL)
                     58:                fprintf(stderr, " %s", sname(fln));
                     59:        if ( ln > 0 )
                     60:                fprintf(stderr, " %d", ln) ;
                     61: 
                     62:        switch(lvl) {
                     63:        case 0:
                     64:                fprintf(stderr, " warning: ");
                     65:                break;
                     66:        case 2:
                     67:                fprintf(stderr, " fatal: ");
                     68:                break;
                     69:        default:
                     70:                fprintf(stderr, ": ");
                     71:                break;
                     72:        }
                     73: 
                     74:        fprintf(stderr, strng, a1, a2, a3, a4, a5, a6, a7, a8, a9, aa);
                     75:        fprintf(stderr, "\n");
                     76:        fflush(stderr);
                     77: 
                     78:        if(lvl > 1)
                     79:                exit();
                     80: }
                     81: char *
                     82: sname(s)
                     83: char *s;
                     84: {
                     85: 
                     86: /*
                     87:  * Returns pointer to "simple" name of path name; that is,
                     88:  * pointer to first character after last '/'.  If no slashes,
                     89:  * returns pointer to first char of arg.
                     90:  *
                     91:  * If the string ends in a slash:
                     92:  *     1. replace the terminating slash with '\0'
                     93:  *     2. return a pointer to the first character after the last
                     94:  *             '/', or the first character in the string
                     95:  */
                     96: 
                     97:        register char *p;
                     98: 
                     99:        p = s;
                    100:        while( *p )
                    101:                if(*p++ == '/')
                    102:                        if( *p == '\0' ) {
                    103:                                *(p-1) = '\0';
                    104:                                break;
                    105:                                }
                    106:                        else
                    107:                                s = p;
                    108: 
                    109:        return(s);
                    110: }

unix.superglobalmegacorp.com

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