Annotation of 43BSDReno/usr.bin/tn3270/ctlr/options.c, revision 1.1

1.1     ! root        1: /*
        !             2:  * Copyright (c) 1988 Regents of the University of California.
        !             3:  * All rights reserved.
        !             4:  *
        !             5:  * Redistribution and use in source and binary forms are permitted
        !             6:  * provided that the above copyright notice and this paragraph are
        !             7:  * duplicated in all such forms and that any documentation,
        !             8:  * advertising materials, and other materials related to such
        !             9:  * distribution and use acknowledge that the software was developed
        !            10:  * by the University of California, Berkeley.  The name of the
        !            11:  * University may not be used to endorse or promote products derived
        !            12:  * from this software without specific prior written permission.
        !            13:  * THIS SOFTWARE IS PROVIDED ``AS IS'' AND WITHOUT ANY EXPRESS OR
        !            14:  * IMPLIED WARRANTIES, INCLUDING, WITHOUT LIMITATION, THE IMPLIED
        !            15:  * WARRANTIES OF MERCHANTIBILITY AND FITNESS FOR A PARTICULAR PURPOSE.
        !            16:  */
        !            17: 
        !            18: #ifndef lint
        !            19: static char sccsid[] = "@(#)options.c  4.1 (Berkeley) 12/4/88";
        !            20: #endif /* not lint */
        !            21: 
        !            22: /*
        !            23:  * this file contains the definitions, initialization, and processing of
        !            24:  *     commands to handle the various local options (APL ON, etc.)
        !            25:  */
        !            26: 
        !            27: #include "options.h"
        !            28: 
        !            29: #include "../general/globals.h"
        !            30: #include "declare.h"
        !            31: 
        !            32: void
        !            33: OptInit()
        !            34: {
        !            35:     register int i;
        !            36: 
        !            37:     OptAPLmode = 0;
        !            38:     OptNullProcessing = 1;             /* improved null processing */
        !            39:     OptZonesMode = 0;          /* zones mode off */
        !            40:     OptEnterNL = 0;            /* regular enter/new line keys */
        !            41:     OptColFieldTab = 0;                /* regular column/field tab keys */
        !            42:     OptPacing = 1;                     /* do pacing */
        !            43:     OptAlphaInNumeric = 0;             /* allow alpha in numeric fields */
        !            44:     for (i = 0; i < sizeof OptColTabs; i++) {
        !            45:        OptColTabs[i] = ((i%8) == 0);   /* every 8 columns */
        !            46:     }
        !            47:     OptHome = 0;
        !            48:     OptLeftMargin = 0;
        !            49:     OptWordWrap = 0;
        !            50: }
        !            51: 
        !            52: OptOrder(pointer, count, control)
        !            53: unsigned char *pointer;
        !            54: int count;
        !            55: int control;
        !            56: {
        !            57:     int i, j, character, origCount;
        !            58: 
        !            59:     origCount = count;
        !            60: 
        !            61:     if (count == 0) {
        !            62:        return(0);
        !            63:     }
        !            64:     character = *pointer&0xff;
        !            65:     pointer++;
        !            66:     count--;
        !            67:     switch (character) {
        !            68:     case 0xa0:
        !            69:        OptAPLmode = 1;
        !            70:        break;
        !            71:     case 0x61:
        !            72:        OptAPLmode = 0;
        !            73:        break;
        !            74:     case 0x95:
        !            75:        OptNullProcessing = 0;
        !            76:        break;
        !            77:     case 0xd5:
        !            78:        OptNullProcessing = 1;
        !            79:        break;
        !            80:     case 0xa9:
        !            81:        OptZonesMode = 1;
        !            82:        break;
        !            83:     case 0xe9:
        !            84:        OptZonesMode = 0;
        !            85:        break;
        !            86:     case 0x85:
        !            87:        OptEnterNL = 1;
        !            88:        break;
        !            89:     case 0xc5:
        !            90:        OptEnterNL = 0;
        !            91:        break;
        !            92:     case 0x83:
        !            93:        OptColFieldTab = 1;
        !            94:        break;
        !            95:     case 0xc3:
        !            96:        OptColFieldTab = 0;
        !            97:        break;
        !            98:     case 0x97:
        !            99:        OptPacing = 0;
        !           100:        break;
        !           101:     case 0xd7:
        !           102:        OptPacing = 1;
        !           103:        break;
        !           104:     case 0xa5:
        !           105:        OptAlphaInNumeric = 1;
        !           106:        break;
        !           107:     case 0xe5:
        !           108:        OptAlphaInNumeric = 0;
        !           109:        break;
        !           110:     case 0xe3:
        !           111:        if (!control && count < 30) {
        !           112:            return(0);          /* want more! */
        !           113:        }
        !           114:        for (i = 0; i < sizeof OptColTabs; i++) {
        !           115:            OptColTabs[i] = 0;
        !           116:        }
        !           117:        if (!count) {
        !           118:            break;
        !           119:        }
        !           120:        j = (*pointer&0xff)-0x40;
        !           121:        count--;
        !           122:        pointer++;
        !           123:        if (j < 0 || j >= 24) {
        !           124:            break;
        !           125:        }
        !           126:        OptHome = j;
        !           127:        if (!count) {
        !           128:            break;
        !           129:        }
        !           130:        j = (*pointer&0xff)-0x40;
        !           131:        count--;
        !           132:        pointer++;
        !           133:        if (j < 0 || j >= 80) {
        !           134:            break;
        !           135:        }
        !           136:        OptLeftMargin = j;
        !           137:        if (!count) {
        !           138:            break;
        !           139:        }
        !           140:        i = count;
        !           141:        if (i > 28) {
        !           142:            i = 28;
        !           143:        }
        !           144:        while (i) {
        !           145:            j = (*pointer&0xff)-0x40;
        !           146:            if (j < 0 || j >= sizeof OptColTabs) {
        !           147:                break;
        !           148:            }
        !           149:            OptColTabs[j] = 1;
        !           150:            i --;
        !           151:            pointer++;
        !           152:            count--;
        !           153:        }
        !           154:        break;
        !           155:     case 0xa6:
        !           156:        OptWordWrap = 1;
        !           157:        break;
        !           158:     case 0xe6:
        !           159:        OptWordWrap = 0;
        !           160:        break;
        !           161:     default:
        !           162:        break;
        !           163:     }
        !           164:     return(origCount - count);
        !           165: }

unix.superglobalmegacorp.com

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