|
|
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 this notice is preserved and that due credit is given ! 7: * to the University of California at Berkeley. The name of the University ! 8: * may not be used to endorse or promote products derived from this ! 9: * software without specific prior written permission. This software ! 10: * is provided ``as is'' without express or implied warranty. ! 11: */ ! 12: ! 13: #ifndef lint ! 14: static char sccsid[] = "@(#)options.c 3.2 (Berkeley) 3/28/88"; ! 15: #endif /* not lint */ ! 16: ! 17: /* ! 18: * this file contains the definitions, initialization, and processing of ! 19: * commands to handle the various local options (APL ON, etc.) ! 20: */ ! 21: ! 22: #include "options.h" ! 23: ! 24: #include "../general/globals.h" ! 25: #include "options.ext" ! 26: ! 27: void ! 28: OptInit() ! 29: { ! 30: register int i; ! 31: ! 32: OptAPLmode = 0; ! 33: OptNullProcessing = 1; /* improved null processing */ ! 34: OptZonesMode = 0; /* zones mode off */ ! 35: OptEnterNL = 0; /* regular enter/new line keys */ ! 36: OptColFieldTab = 0; /* regular column/field tab keys */ ! 37: OptPacing = 1; /* do pacing */ ! 38: OptAlphaInNumeric = 0; /* allow alpha in numeric fields */ ! 39: for (i = 0; i < sizeof OptColTabs; i++) { ! 40: OptColTabs[i] = ((i%8) == 0); /* every 8 columns */ ! 41: } ! 42: OptHome = 0; ! 43: OptLeftMargin = 0; ! 44: OptWordWrap = 0; ! 45: } ! 46: ! 47: OptOrder(pointer, count, control) ! 48: char *pointer; ! 49: int count; ! 50: int control; ! 51: { ! 52: int i, j, character, origCount; ! 53: ! 54: origCount = count; ! 55: ! 56: if (count == 0) { ! 57: return(0); ! 58: } ! 59: character = *pointer&0xff; ! 60: pointer++; ! 61: count--; ! 62: switch (character) { ! 63: case 0xa0: ! 64: OptAPLmode = 1; ! 65: break; ! 66: case 0x61: ! 67: OptAPLmode = 0; ! 68: break; ! 69: case 0x95: ! 70: OptNullProcessing = 0; ! 71: break; ! 72: case 0xd5: ! 73: OptNullProcessing = 1; ! 74: break; ! 75: case 0xa9: ! 76: OptZonesMode = 1; ! 77: break; ! 78: case 0xe9: ! 79: OptZonesMode = 0; ! 80: break; ! 81: case 0x85: ! 82: OptEnterNL = 1; ! 83: break; ! 84: case 0xc5: ! 85: OptEnterNL = 0; ! 86: break; ! 87: case 0x83: ! 88: OptColFieldTab = 1; ! 89: break; ! 90: case 0xc3: ! 91: OptColFieldTab = 0; ! 92: break; ! 93: case 0x97: ! 94: OptPacing = 0; ! 95: break; ! 96: case 0xd7: ! 97: OptPacing = 1; ! 98: break; ! 99: case 0xa5: ! 100: OptAlphaInNumeric = 1; ! 101: break; ! 102: case 0xe5: ! 103: OptAlphaInNumeric = 0; ! 104: break; ! 105: case 0xe3: ! 106: if (!control && count < 30) { ! 107: return(0); /* want more! */ ! 108: } ! 109: for (i = 0; i < sizeof OptColTabs; i++) { ! 110: OptColTabs[i] = 0; ! 111: } ! 112: if (!count) { ! 113: break; ! 114: } ! 115: j = (*pointer&0xff)-0x40; ! 116: count--; ! 117: pointer++; ! 118: if (j < 0 || j >= 24) { ! 119: break; ! 120: } ! 121: OptHome = j; ! 122: if (!count) { ! 123: break; ! 124: } ! 125: j = (*pointer&0xff)-0x40; ! 126: count--; ! 127: pointer++; ! 128: if (j < 0 || j >= 80) { ! 129: break; ! 130: } ! 131: OptLeftMargin = j; ! 132: if (!count) { ! 133: break; ! 134: } ! 135: i = count; ! 136: if (i > 28) { ! 137: i = 28; ! 138: } ! 139: while (i) { ! 140: j = (*pointer&0xff)-0x40; ! 141: if (j < 0 || j >= sizeof OptColTabs) { ! 142: break; ! 143: } ! 144: OptColTabs[j] = 1; ! 145: i --; ! 146: pointer++; ! 147: count--; ! 148: } ! 149: break; ! 150: case 0xa6: ! 151: OptWordWrap = 1; ! 152: break; ! 153: case 0xe6: ! 154: OptWordWrap = 0; ! 155: break; ! 156: default: ! 157: break; ! 158: } ! 159: return(origCount - count); ! 160: }
This archive runs on limited infrastructure. Preserving old code on modern bandwidth. Automated agents are requested to crawl responsibly.