|
|
1.1 ! root 1: /* ! 2: * Copyright 1984, 1985 by the Regents of the University of ! 3: * California and by Gregory Glenn Minshall. ! 4: * ! 5: * Permission to use, copy, modify, and distribute these ! 6: * programs and their documentation for any purpose and ! 7: * without fee is hereby granted, provided that this ! 8: * copyright and permission appear on all copies and ! 9: * supporting documentation, the name of the Regents of ! 10: * the University of California not be used in advertising ! 11: * or publicity pertaining to distribution of the programs ! 12: * without specific prior permission, and notice be given in ! 13: * supporting documentation that copying and distribution is ! 14: * by permission of the Regents of the University of California ! 15: * and by Gregory Glenn Minshall. Neither the Regents of the ! 16: * University of California nor Gregory Glenn Minshall make ! 17: * representations about the suitability of this software ! 18: * for any purpose. It is provided "as is" without ! 19: * express or implied warranty. ! 20: */ ! 21: ! 22: /* this file contains the definitions, initialization, and processing of ! 23: commands to handle the various local options (APL ON, etc.) ! 24: */ ! 25: ! 26: #include "options.h" ! 27: ! 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.