1 /* 2 * CDDL HEADER START 3 * 4 * The contents of this file are subject to the terms of the 5 * Common Development and Distribution License (the "License"). 6 * You may not use this file except in compliance with the License. 7 * 8 * You can obtain a copy of the license at src/OPENSOLARIS.LICENSE 9 * or http://www.opensolaris.org/os/licensing. 10 * See the License for the specific language governing permissions 11 * and limitations under the License. 12 * 13 * When distributing Covered Code, include this CDDL HEADER in each 14 * file and include the License file at src/OPENSOLARIS.LICENSE. 15 * If applicable, add the following below this CDDL HEADER, with the 16 * fields enclosed by brackets "[]" replaced with your own identifying 17 * information: Portions Copyright [yyyy] [name of copyright owner] 18 * 19 * CDDL HEADER END 20 */ 21 /* 22 * Copyright (c) 1999 by Sun Microsystems, Inc. 23 * All rights reserved. 24 * 25 * This program generates reverse Modified Base 64 values. 26 */ 27 28 29 #include <stdio.h> 30 31 main() { 32 unsigned int c; 33 int i; 34 int j; 35 36 for (c = 0, i = j = 0; c < 0x100; c++) { 37 if (j % 16 == 0) 38 printf("\n/*%02x*/\t", j); 39 j++; 40 if (c >= 'A' && c <= 'Z') { 41 printf("%2d, ", c - 'A'); 42 } else if (c >= 'a' && c <= 'z') { 43 printf("%2d, ", c - 'a' + 26); 44 } else if (c >= '0' && c <= '9') { 45 printf("%2d, ", c - '0' + 52); 46 } else if (c == '+') { 47 printf("%2d, ", 62); 48 } else if (c == '/') { 49 printf("%2d, ", 63); 50 } else if (c > 127) 51 printf("%d, ", -2); 52 else 53 printf("%d, ", -1); 54 } 55 printf("\n"); 56 } 57