banner.c (1b2fef9f1ef253fee2ebb5a7f1ff19fadc452920) | banner.c (eb257e6ec546a962b89bb2740a1760a7ec064040) |
---|---|
1/* 2 * Copyright (c) 1980, 1993, 1994 3 * The Regents of the University of California. All rights reserved. 4 * 5 * Redistribution and use in source and binary forms, with or without 6 * modification, are permitted provided that the following conditions 7 * are met: 8 * 1. Redistributions of source code must retain the above copyright --- 1013 unchanged lines hidden (view full) --- 1022}; 1023 1024char line[DWIDTH]; 1025char *message; 1026char print[DWIDTH]; 1027int debug, i, j, linen, max, nchars, pc, term, trace, x, y; 1028int width = DWIDTH; /* -w option: scrunch letters to 80 columns */ 1029 | 1/* 2 * Copyright (c) 1980, 1993, 1994 3 * The Regents of the University of California. All rights reserved. 4 * 5 * Redistribution and use in source and binary forms, with or without 6 * modification, are permitted provided that the following conditions 7 * are met: 8 * 1. Redistributions of source code must retain the above copyright --- 1013 unchanged lines hidden (view full) --- 1022}; 1023 1024char line[DWIDTH]; 1025char *message; 1026char print[DWIDTH]; 1027int debug, i, j, linen, max, nchars, pc, term, trace, x, y; 1028int width = DWIDTH; /* -w option: scrunch letters to 80 columns */ 1029 |
1030static void usage __P((void)); 1031 |
|
1030int 1031main(argc, argv) 1032 int argc; 1033 char *argv[]; 1034{ 1035 int ch; 1036 1037 while ((ch = getopt(argc, argv, "w:td")) != -1) --- 6 unchanged lines hidden (view full) --- 1044 break; 1045 case 'w': 1046 width = atoi(optarg); 1047 if (width <= 0) 1048 errx(1, "illegal argument for -w option"); 1049 break; 1050 case '?': 1051 default: | 1032int 1033main(argc, argv) 1034 int argc; 1035 char *argv[]; 1036{ 1037 int ch; 1038 1039 while ((ch = getopt(argc, argv, "w:td")) != -1) --- 6 unchanged lines hidden (view full) --- 1046 break; 1047 case 'w': 1048 width = atoi(optarg); 1049 if (width <= 0) 1050 errx(1, "illegal argument for -w option"); 1051 break; 1052 case '?': 1053 default: |
1052 (void)fprintf(stderr, "usage: banner [-w width]\n"); 1053 exit(1); | 1054 usage(); |
1054 } 1055 argc -= optind; 1056 argv += optind; 1057 1058 for (i = 0; i < width; i++) { 1059 j = i * 132 / width; 1060 print[j] = 1; 1061 } --- 42 unchanged lines hidden (view full) --- 1104 printf("};\n"); 1105 } 1106 1107 /* check message to make sure it's legal */ 1108 j = 0; 1109 for (i = 0; i < nchars; i++) 1110 if ((u_char) message[i] >= NCHARS || 1111 asc_ptr[(u_char) message[i]] == 0) { | 1055 } 1056 argc -= optind; 1057 argv += optind; 1058 1059 for (i = 0; i < width; i++) { 1060 j = i * 132 / width; 1061 print[j] = 1; 1062 } --- 42 unchanged lines hidden (view full) --- 1105 printf("};\n"); 1106 } 1107 1108 /* check message to make sure it's legal */ 1109 j = 0; 1110 for (i = 0; i < nchars; i++) 1111 if ((u_char) message[i] >= NCHARS || 1112 asc_ptr[(u_char) message[i]] == 0) { |
1112 warnx("The character '%c' is not in my character set", | 1113 warnx("the character '%c' is not in my character set", |
1113 message[i]); 1114 j++; 1115 } 1116 if (j) 1117 exit(1); 1118 1119 if (trace) 1120 printf("Message '%s' is OK\n",message); --- 43 unchanged lines hidden (view full) --- 1164 printf("x=%d, y=%d, max=%d\n",x,y,max); 1165 } 1166 } 1167 } 1168 1169 free(message); 1170 exit(0); 1171} | 1114 message[i]); 1115 j++; 1116 } 1117 if (j) 1118 exit(1); 1119 1120 if (trace) 1121 printf("Message '%s' is OK\n",message); --- 43 unchanged lines hidden (view full) --- 1165 printf("x=%d, y=%d, max=%d\n",x,y,max); 1166 } 1167 } 1168 } 1169 1170 free(message); 1171 exit(0); 1172} |
1173 1174static void 1175usage() 1176{ 1177 fprintf(stderr, "usage: banner [-d] [-t] [-w width] message ...\n"); 1178 exit(1); 1179} |
|