Codebase list ascii / a1079bd
Imported Upstream version 3.11 Florian Ernst 13 years ago
6 changed file(s) with 39 addition(s) and 27 deletion(s). Raw diff Collapse all Expand all
4747 dist: ascii-$(VERS).tar.gz
4848
4949 release: ascii-$(VERS).tar.gz ascii.html
50 shipper -t -m; make clean
50 shipper -u -m -t; make clean
11 .\" Title: ascii
22 .\" Author: [see the "AUTHOR" section]
33 .\" Generator: DocBook XSL Stylesheets v1.75.2 <http://docbook.sf.net/>
4 .\" Date: 10/19/2010
5 .\" Manual: Open Source
6 .\" Source: Open Source
4 .\" Date: 03/16/2011
5 .\" Manual: Development Tools
6 .\" Source: ascii
77 .\" Language: English
88 .\"
9 .TH "ASCII" "1" "10/19/2010" "Open Source" "Open Source"
9 .TH "ASCII" "1" "03/16/2011" "ascii" "Development Tools"
1010 .\" -----------------------------------------------------------------
1111 .\" * Define some portability stuff
1212 .\" -----------------------------------------------------------------
210210 /* interpret single characters as themselves */
211211 if (len == 1) {
212212 speak((unsigned int)str[0]);
213 return;
213 /* also interpret single digits as numeric */
214 if(!line && strchr("0123456789ABCDEFabcdef",str[0])) {
215 int hval;
216 (void) sscanf(str, "%x", &hval);
217 speak(hval);
218 } return;
214219 }
215220
216221 /* process multiple letters */
223228
224229 /* interpret ^-escapes as control-character notation */
225230 if (strcmp(str, "^?") == 0)
226 { speak((unsigned int)0x7F); return; }
231 { speak((unsigned int)0x7F); return; }
227232 else if (str[0] == '^' && len == 2)
228233 { speak((unsigned int)(str[1] & 0x1f)); return; }
229234
232237 for (ch = 7; ch < 14; ch++)
233238 for (ptr = &cnames[ch][1]; *ptr; ptr++)
234239 if (**ptr == '\\' && strcmp(str, *ptr) == 0)
235 { speak((unsigned int)ch); return; }
240 { speak((unsigned int)ch); return; }
236241
237242 /* interpret 2 and 3-character ASCII control mnemonics */
238243 if (len == 2 || len == 3)
239244 {
240245 /* first check for standard mnemonics */
241246 if (stricmp(str, "DEL") == 0)
242 { speak(0x7f); return; }
247 { speak(0x7f); return; }
243248 if (stricmp(str, "BL") == 0)
244 { speak(' '); return; }
249 { speak(' '); return; }
245250 else if (isalpha(str[0]))
246251 for (ch = 0; ch <= 32; ch++)
247252 if (!stricmp(str,cnames[ch][0]) || !strcmp(str,cnames[ch][1]))
248 { speak(ch); return; }
253 { speak(ch); return; }
249254 }
250255
251256 /* OK, now try to interpret the string as a numeric */
272277 else if (tolower(str[0]) == 'x')
273278 (void) sscanf(str + 1, "%x", &hval);
274279 else if ((len >= 2) && (len <= 3) &&
275 (strspn(str,"0123456789ABCDEFabcdef") == (len-1)) &&
276 (tolower(str[len - 1]) == 'h'))
280 (strspn(str,"0123456789ABCDEFabcdef") == (len-1)) &&
281 (tolower(str[len - 1]) == 'h'))
277282 (void) sscanf(str, "%x", &hval);
278283
279284 /* accept 0onn, \onnn, onnn and \nnn forms for octal */
318323 }
319324
320325 if (sscanf(str, "%d/%d", &hi, &lo) == 2) /* code table reference? */
321 { speak(hi*16 + lo); return; }
326 { speak(hi*16 + lo); return; }
322327 else if (len > 1 && isalpha(str[0])) /* try to match long names */
323328 {
324329 char canbuf[BUFSIZ], *ep;
00 Name: ascii
1 Version: 3.10
1 Version: 3.11
22 Release: 1
33 URL: http://www.catb.org/~esr/ascii/
44 Source0: %{name}-%{version}.tar.gz
88 Packager: Eric S. Raymond <esr@thyrsus.com>
99 BuildRoot: %{_tmppath}/%{name}-root
1010 #Keywords: ASCII
11 #Destinations: mailto:vanonim@bluewin.ch
11 #Destinations: freshmeat, mailto:vanonim@bluewin.ch
1212
1313 %description
1414 The ascii utility provides easy conversion between various byte
4242 %doc README COPYING
4343
4444 %changelog
45 * Mon Mar 15 2011 Eric S. Raymond <esr@snark.thyrsus.com> - 3.11-1
46 - Recognize single decimal or hex digits.
47 - Minor bug fixes and additional character names from Debian.
48
4549 * Mon Oct 19 2010 Eric S. Raymond <esr@snark.thyrsus.com> - 3.10-1
4650 - License change to BSD. Polish code to modern fully-ANSI C.
4751
55 <refmeta>
66 <refentrytitle>ascii</refentrytitle>
77 <manvolnum>1</manvolnum>
8 <refmiscinfo class='source'>Open Source</refmiscinfo>
8 <refmiscinfo class='date'>Aug 24 1994</refmiscinfo>
9 <refmiscinfo class='productname'>ascii</refmiscinfo>
10 <refmiscinfo class='source'>ascii</refmiscinfo>
11 <refmiscinfo class='manual'>Development Tools</refmiscinfo>
912 </refmeta>
1013 <refnamediv id='name'>
1114 <refname>ascii</refname>
2323 %%
2424 Mnemonics: "BEL",
2525 ISO names: "Bell",
26 C escape: "\a"
26 C escape: "\\a",
2727 Synonyms: "Alert",
2828 %%
2929 Mnemonics: "BS",
3030 ISO names: "Backspace",
3131 C escape: "\\b",
3232 %%
33 Mnemonics: "HT" "TAB",
34 ISO names: "Character Tabulation", "Horizontal Tab"
33 Mnemonics: "HT", "TAB",
34 ISO names: "Character Tabulation", "Horizontal Tab",
3535 C escape: "\\t",
3636 %%
37 Mnemonics: "LF" "NL",
37 Mnemonics: "LF", "NL",
3838 ISO name: "Line Feed", "Newline",
3939 C escape: "\\n",
4040 %%
233233 %%
234234 Mnemonics: ">",
235235 ISO names: "Greater-than sign",
236 Synonyms: "Right Angle", "Write To", "Into", "Toward",
236 Synonyms: "Right Angle Bracket", "Write To", "Into", "Toward",
237237 "Out", "To", "Gozinta", "Right Funnel",
238238 "Right Broket", "Zap", "Blow",
239239 XML name: "&gt;",
326326 Mnemonics: "Z",
327327 ISO names: "Majuscule Z", "Capital Z", "Uppercase Z",
328328 %%
329 Mnemonics: "["
329 Mnemonics: "[",
330330 ISO names: "Left Square Bracket",
331331 Synonyms: "Bracket", "Bra", "Square",
332332 Comments: "# See ] for matching names.",
438438 Mnemonics: "z",
439439 ISO names: "Miniscule z", "Small z", "Lowercase z",
440440 %%
441 Mnemonics: "{"
442 ISO names: "Left Curly Bracket",
441 Mnemonics: "{",
442 ISO names: "Left Curly Bracket",
443443 Synonyms: "Left Brace", "Brace", "Open Brace", "Curly", "Leftit", "Embrace",
444444 Comments: "# See } for matching names.",
445445 %%
446 Mnemonics: "|"
446 Mnemonics: "|",
447447 ISO names: "Vertical Line",
448448 Synonyms: "Pipe", "Bar", "Or", "V-Bar", "Spike", "Gozinta", "Thru",
449449 %%
450 Mnemonics: "}"
450 Mnemonics: "}",
451451 ISO names: "Right Curly Bracket",
452452 Synonyms: "Right Brace", "Unbrace", "Close Brace",
453453 "Uncurly", "Rytit", "Bracelet",