home
***
CD-ROM
|
disk
|
FTP
|
other
***
search
/
Club Amiga de Montreal - CAM
/
CAM_CD_1.iso
/
files
/
443.lha
/
Pmode
/
pmode.c
< prev
next >
Wrap
C/C++ Source or Header
|
1990-12-06
|
4KB
|
144 lines
echo ; /* Note that this declares an int available externally
lc:lc -cwusf -v -y pmode.c
lc:blink lib:c.o pmode.o TO pmode LIB lib:amiga.lib,lib:lc.lib SD SC ND VERBOSE
quit
*/
/*
* Created on 88/07/27 by Dario de Judicibus
* via Canton 101, Rome I 00144, ITALY
*
* Module: pmode (Printer MODE)
*
* Purpose: select different printer modes
*
* Syntax: pmode { [op]flag }
*
* ParmList: flag one of the following characters:
* l : Near Letter Quality
* d : Double Strike
* s : Shadow
* e : Enlarged
* c : Condensed
* p : Proportional
* where [op] is
* + : to set style on
* - : to set style off
* x : to reset styles
*
* Syntax Guideline (BNF):
*
* arglist ::= "arg" | "arglist | arg"
* {arglist} argument is required
* [arglist] argument is optional
* arg | arg OR indicator: choose one
* arg ... repeat argument
*
* =========================================================================
* @Mod | on | by | reason
* -----+--------+-----+----------------------------------------------------
* @001 | 880727 | DdJ | Version 1 Release 0 Modification 0
*
*/
#include "exec/types.h"
#include "libraries/dos.h"
#include "libraries/dosextens.h"
#include "proto/exec.h"
#include "proto/dos.h"
#include "stdio.h"
#include "ctype.h"
#include "string.h"
#define A_BANNER "\x9B4;33mPrint Mode\x9B0;33m Version 1\x9B0m by Dario de Judicibus - Copyright © 1988\n"
#define H0_BANNER "\x9B33mSyntax:\x9B0m pmode { [op]flag }\n"
#define H1_BANNER "Operators are:\n \x9B33m+\x9B0m to switch on style\n \x9B33m-\x9B0m to switch off style\n \x9B33mx\x9B0m to reset all styles\n"
#define H2_BANNER "Flags are:\n \x9B33ml\x9B0metter quality \x9B33md\x9B0mouble strike \x9B33ms\x9B0mhadow\n \x9B33me\x9B0mnlarged \x9B33mc\x9B0mondensed \x9B33mp\x9B0mroportional\n"
#define B_T_N(c) ( (c == ' ') || (c == '\t') || (c == '\n') )
#define NLQ_ON "\x1B[2\x22z"
#define NLQ_OFF "\x1B[1\x22z"
#define DBS_ON "\x1B[4\x22z"
#define DBS_OFF "\x1B[3\x22z"
#define SHD_ON "\x1B[6\x22z"
#define SHD_OFF "\x1B[5\x22z"
#define ENL_ON "\x1B[6w"
#define ENL_OFF "\x1B[5w"
#define CMP_ON "\x1B[4w"
#define CMP_OFF "\x1B[3w"
#define PRO_ON "\x1B[2p"
#define PRO_OFF "\x1B[1p"
#define RESET_ALL "\x1B[1\x22z\x1B[3\x22z\x1B[5\x22z\x1B[0w\x1B[1p"
struct FileHandle *prt;
extern VOID PrintIt(int, char *);
VOID PrintIt(out,msg)
int out;
char *msg;
{
Write(out,msg,strlen(msg));
}
VOID _main(cmd)
char *cmd;
{
char style;
int toggle;
echo = Output();
if (!(cmd)) Exit(RETURN_WARN); /* Must be called from CLI */
while (*cmd != ' ') cmd++; /* Skip over command name */
while (B_T_N(*cmd)) cmd++; /* Skip over leading blanks */
if (*cmd == '\0')
{
PrintIt(echo,A_BANNER);
Exit(RETURN_OK);
}
if (*cmd == '+')
{
toggle = TRUE;
++cmd;
}
else if (*cmd == '-')
{
toggle = FALSE;
++cmd;
}
else if (*cmd == 'x')
;
else
{
PrintIt(echo,H0_BANNER);
PrintIt(echo,H1_BANNER);
PrintIt(echo,H2_BANNER);
Exit(RETURN_OK);
}
style = *cmd;
if((BOOL)(prt = Open("PRT:",MODE_NEWFILE)))
{
switch(style)
{
case 'l': PrintIt(prt,(toggle? NLQ_ON : NLQ_OFF)); break;
case 'd': PrintIt(prt,(toggle? DBS_ON : DBS_OFF)); break;
case 's': PrintIt(prt,(toggle? SHD_ON : SHD_OFF)); break;
case 'e': PrintIt(prt,(toggle? ENL_ON : ENL_OFF)); break;
case 'c': PrintIt(prt,(toggle? CMP_ON : CMP_OFF)); break;
case 'p': PrintIt(prt,(toggle? PRO_ON : PRO_OFF)); break;
case 'x': PrintIt(prt,RESET_ALL); break;
default : PrintIt(echo,H0_BANNER);
PrintIt(echo,H1_BANNER);
PrintIt(echo,H2_BANNER);
Close(prt);
Exit(RETURN_WARN);
}
Close(prt);
}
}