Trust uboot's device list only if it does not look suspicious.
[AROS.git] / test / printer / printertxt.c
blob319744bc00fa97237b2524be3bf251b904544fba
1 /*
2 * Copyright (C) 2012, The AROS Development Team. All rights reserved.
3 * Author: Jason S. McMullan <jason.mcmullan@gmail.com>
5 * Licensed under the AROS PUBLIC LICENSE (APL) Version 1.1
6 */
8 #include <proto/dos.h>
9 #include <proto/exec.h>
10 #include <devices/prtbase.h>
12 #include <aros/shcommands.h>
14 TEXT const printertxt[] =
15 "aRIS\033c\n"
16 "aRIN\033#1\n"
17 "aIND\033DaIND\n"
18 "aNEL\033EaNEL\n"
19 "aRI\033MaRI\n"
20 "\n"
21 "aSGR: \033[3m italics\033[4m italic underline\033[1m italic underline bold\n"
22 " \033[23m underline bold\033[24m bold\033[22m normal\033[4m underline\n"
23 " \033[0m normal\n"
24 "aSFC \033[30mblack \033[31mred \033[32mgreen \033[33myellow \033[34mblue \033[35md. gray \033[36mcyan \033[37ml. gray\033[0m\n"
25 "aSBC \033[40m\033[39mblack \033[41m\033[30mred \033[42mgreen \033[43myellow \033[44mblue \033[45md. gray \033[46mcyan \033[47ml. gray\033[0m\n"
26 "aSHOR elite \033[2wis abcdefg on \033[1wthen off\n"
27 " cond. \033[4wis abcdefg on \033[3wthen off\n"
28 " enla \033[6wis abcdefg on \033[5wthen off\n"
29 "aDEN shadow \033[6\"zis on \033[5\"zthen off\n"
30 " double \033[4\"zis on \033[3\"zthen off\n"
31 " NLQ \033[2\"zis on \033[1\"zthen off\n"
32 "\n"
33 "aSUS super \033[2vis on \033[1vthen off\n"
34 " subs \033[4vis on \033[3vthen off\n\n"
35 " both \033[2vsuper \033[4vboth \033[0vneither\n"
36 "\n"
37 "aPL \033L partial line up, \033K partial line down\n"
38 "\n"
39 "aFNT (test needs to be written)\n"
40 "aPROP prop \033[2pis on \033[1pthen off \033[0pthen to default\n"
41 "aTSS prop \033[2p\033[5Eproportional offset of 5\033[0p\n"
42 "aJFY left \033[5F\nleft justify this text\033[0F\n"
43 " right \033[7F\nright justify this text\033[0F\n"
44 " full \033[6F\nfull justify this text\033[0F\n"
45 " letter \033[3F\nletter justify this text\033[0F\n"
46 " center \033[1F\ncenter justify this text\033[0F\n"
47 "aVER 1/8\" \033[0zOne\n Eighth\n Inch\n Spacing\n"
48 " 1/6\" \033[1zOne\n Sixth\n Inch\n Spacing\n"
49 "aSLPP (test needs to be written)\n"
50 "a?MS (test needs to be written)\n"
53 AROS_SH0(printertxt, 1.0)
55 AROS_SHCOMMAND_INIT
57 struct MsgPort *mp;
58 LONG err = RETURN_FAIL;
59 struct Library *DOSBase;
61 if (!(DOSBase = OpenLibrary("dos.library", 0))) {
62 return RETURN_FAIL;
65 if ((mp = CreateMsgPort())) {
66 struct IORequest *io;
67 if ((io = CreateIORequest(mp, sizeof(*io)))) {
68 if (0 == OpenDevice("printer.device", 0, io, 0)) {
69 Printf("Printing test page to printer.device unit 0...\n");
70 struct IOStdReq *sio = (struct IOStdReq *)io;
71 sio->io_Command = CMD_WRITE;
72 sio->io_Data = (APTR)printertxt;
73 sio->io_Length = -1;
74 err = DoIO(io);
75 if (err != 0) {
76 Printf("\tFAILED (%d)\n", err);
77 err = RETURN_FAIL;
78 } else {
79 Printf("\tPASSED (please compare with printertxt.pdf)\n");
80 err = RETURN_OK;
82 CloseDevice(io);
83 } else {
84 Printf("Can't open printer.device unit 0\n");
86 DeleteIORequest(io);
87 } else {
88 Printf("Can't create IO request\n");
90 DeleteMsgPort(mp);
91 } else {
92 Printf("Can't create MsgPort\n");
95 CloseLibrary(DOSBase);
97 return err;
99 AROS_SHCOMMAND_EXIT