mirror of
https://github.com/GnoConsortium/gno.git
synced 2025-02-23 00:29:10 +00:00
getvers version 2.0 test files.
This commit is contained in:
parent
3b6e40c95f
commit
d36d59e158
18
usr.bin/getvers/Makefile
Normal file
18
usr.bin/getvers/Makefile
Normal file
@ -0,0 +1,18 @@
|
||||
#
|
||||
# This makefile is intended for use with dmake(1) on Apple IIGS
|
||||
# $Id: Makefile,v 1.1 1998/04/29 00:41:45 tribby Exp $
|
||||
#
|
||||
# Created by Dave Tribby, April 1998
|
||||
|
||||
# Program name
|
||||
PROG= getvers
|
||||
|
||||
# Because this is an assembly program, need to avoid .c defaults
|
||||
SRCS *= $(PROG).asm
|
||||
MAIN *= $(PROG)
|
||||
MAINSRC *= $(MAIN).asm
|
||||
|
||||
# Delivery directory
|
||||
BINDIR = /usr/bin
|
||||
|
||||
.INCLUDE : /src/gno/prog.mk
|
@ -1,18 +1,48 @@
|
||||
=============
|
||||
GetVers v1.20
|
||||
=============
|
||||
============
|
||||
GetVers v2.0
|
||||
============
|
||||
$Id: README.getvers,v 1.2 1998/04/29 00:41:47 tribby Exp $
|
||||
|
||||
Another quality Two Meg Software shell utility by Ian Schmidt.
|
||||
Copyright (c) 1993 Two Meg Software.
|
||||
All Rights Reserved.
|
||||
This version of GetVers was created by Dave Tribby from a disassembly of
|
||||
v1.20: "Another quality Two Meg Software shell utility by Ian Schmidt.
|
||||
Copyright (c) 1993 Two Meg Software. All Rights Reserved."
|
||||
|
||||
Like most Two Meg shell utilities, this one's in 100% assembly for minimum size
|
||||
and maximum speed.
|
||||
In the spirit of Two Meg shell utilities, getvers is still in 100% assembly,
|
||||
"for minimum size and maximum speed."
|
||||
|
||||
GetVers is the companion for the 'SetVers' utility. Given a filename or
|
||||
list of filenames, it prints out the version information for each one.
|
||||
|
||||
*New and Improved!*
|
||||
== Improvements for each version ==
|
||||
|
||||
GetVers 2.0 changes:
|
||||
|
||||
* Packaged in standard GNO format, including Makefile, rez file,
|
||||
man page update, and desc entry. Also: test cases created.
|
||||
|
||||
* Two new options: -b for brief (no description or country) and
|
||||
-c to print rComment resource #1
|
||||
-q to skip printing of error information
|
||||
|
||||
* New countries: India, Pakistan, Lithuania, Poland, Hungary, Estonia,
|
||||
Latvia, Lapland, Faeroe Islands, Iran, and Russia.
|
||||
|
||||
* Continue processing multiple files even when one has an error.
|
||||
|
||||
* Stack/DP segment is 512 bytes, initialized to "?" characters so
|
||||
that.
|
||||
|
||||
* Strings that might contain non-printable characters are translated
|
||||
via StringToText.
|
||||
|
||||
* Meaningful error messages are printed when file errors are encountered,
|
||||
and remaining files are processed.
|
||||
|
||||
* Resources are locked after they are loaded.
|
||||
|
||||
* A resource file is closed before the next one is opened, removing any
|
||||
of the file's resources from memory.
|
||||
|
||||
|
||||
GetVers 1.20 now uses System 6.0's VersionString call so it can correctly
|
||||
report versions for all valid rVersion resources.
|
||||
@ -25,31 +55,30 @@ information for. This means GNO and TMSH users can use the * and other regexp
|
||||
operators to create version reports for a whole list of files (sorry, wildcards
|
||||
the Orca way is too much of a pain in the butt :)
|
||||
|
||||
|
||||
Usage
|
||||
-----
|
||||
|
||||
getvers file1 [file2 file3...filen]
|
||||
getvers [-b] [-c] [-q] file ...
|
||||
|
||||
GetVers will print a usage message if called with no arguments. Otherwise it
|
||||
processes all the arguments and generates a version printout for each one.
|
||||
|
||||
No flags are defined in GetVers 1.2.
|
||||
|
||||
Bugs
|
||||
----
|
||||
Console output under GNO 1.0 is screwed up. This is a GNO bug; GNO 1.1
|
||||
solves this.
|
||||
Console output under GNO 1.0 is screwed up. This is a GNO bug fixed in later
|
||||
versions.
|
||||
|
||||
Big Thanks To
|
||||
-------------
|
||||
|
||||
Big Thanks [from Ian Schmidt] To
|
||||
--------------------------------
|
||||
The Apple Brigade: Jim "Huh?" Murphy, Matt "Missed Manners" Deatherage, and
|
||||
David "Mr Tangent" Lyons. Also Jawaid `zaB' Bazyar and James `Abe' Brookes.
|
||||
|
||||
Author
|
||||
------
|
||||
|
||||
Original Author
|
||||
---------------
|
||||
Ian Schmidt, Two Meg Software
|
||||
|
||||
irsman@iastate.edu
|
||||
irsman@aol.com
|
||||
twbv4@isuvax.bitnet
|
||||
Updated by
|
||||
----------
|
||||
Dave Tribby, tribby@cup.hp.com
|
||||
|
@ -1,45 +0,0 @@
|
||||
========
|
||||
GV v1.00
|
||||
========
|
||||
|
||||
Another quality Two Meg Software shell utility by Ian Schmidt.
|
||||
Copyright (c) 1993 Two Meg Software.
|
||||
All Rights Reserved.
|
||||
|
||||
GV is written in Orca/C, which means the Byte Works gets this plug:
|
||||
"This software contains material from the Orca/C Run-Time Libraries, copyright
|
||||
1987-1989 by Byte Works, Inc. Used with permission."
|
||||
|
||||
GV is the micro companion for the 'SetVers' utility. Given a filename or
|
||||
list of filenames, it prints out just the version information for each one.
|
||||
This is especially handy for checking versions of your entire GNO /bin/
|
||||
directory.
|
||||
|
||||
Usage
|
||||
-----
|
||||
|
||||
gv file1 [file2 file3...filen]
|
||||
|
||||
GV will print a usage message if called with no arguments. Otherwise it
|
||||
processes all the arguments and generates a version printout for each one.
|
||||
|
||||
No flags are defined in GV 1.0.
|
||||
|
||||
Bugs
|
||||
----
|
||||
If a file's rVersion or resource fork is damaged, unpredictable results may
|
||||
occur.
|
||||
|
||||
Big Thanks To
|
||||
-------------
|
||||
The Apple Brigade: Jim "Huh?" Murphy, Matt "Missed Manners" Deatherage, and
|
||||
David "Mr Tangent" Lyons. Also Jawaid `zaB' Bazyar and James `Abe' Brookes.
|
||||
|
||||
Author
|
||||
------
|
||||
|
||||
Ian Schmidt, Two Meg Software
|
||||
|
||||
irsman@iastate.edu
|
||||
irsman@aol.com
|
||||
twbv4@isuvax.bitnet
|
312
usr.bin/getvers/c/getvers.c
Normal file
312
usr.bin/getvers/c/getvers.c
Normal file
@ -0,0 +1,312 @@
|
||||
/*
|
||||
* getvers version 2.0 for Apple IIGS
|
||||
*
|
||||
* Written by Dave Tribby for GNO/ME 2.0.6 * April 1998
|
||||
* Original getvers written by Ian Schmidt (Copyright 1993 Two Meg Software)
|
||||
*
|
||||
* NOTE: I started in recoding getvers in C, but shifted to assembly language
|
||||
* and completed the implementation. This version has a couple of
|
||||
* deficiencies (e.g. the resources should be locked after being
|
||||
* loaded). It's included just in case someone must translate getvers
|
||||
* to C and needs a resonable starting point.
|
||||
*
|
||||
* $Id
|
||||
*/
|
||||
|
||||
|
||||
#include <err.h>
|
||||
#include <errno.h>
|
||||
#include <stdio.h>
|
||||
#include <stdlib.h>
|
||||
#include <string.h>
|
||||
|
||||
#include <Types.h>
|
||||
#include <Resources.h>
|
||||
#include <GSOS.h>
|
||||
#include <orca.h>
|
||||
#include <misctool.h>
|
||||
|
||||
#include <gno/gno.h>
|
||||
|
||||
int rval=0; /* Returned status */
|
||||
int bflag=0; /* Command line -b option flag */
|
||||
int cflag=0; /* Command line -c option flag */
|
||||
|
||||
static void usage __P((void));
|
||||
static void ReadResources __P((char *));
|
||||
|
||||
|
||||
int
|
||||
main(int argc,
|
||||
char *argv[])
|
||||
{
|
||||
int ch;
|
||||
char *fn;
|
||||
|
||||
/* Report stack usage at end if compile option is set */
|
||||
__REPORT_STACK();
|
||||
|
||||
/* Parse the command-line options */
|
||||
while ((ch = getopt(argc, argv, "bc")) != -1)
|
||||
switch (ch) {
|
||||
case 'c':
|
||||
cflag = 1;
|
||||
break;
|
||||
case 'b':
|
||||
bflag = 1;
|
||||
break;
|
||||
case '?':
|
||||
default:
|
||||
usage();
|
||||
}
|
||||
argc -= optind;
|
||||
argv = argv + optind;
|
||||
|
||||
if (!*argv)
|
||||
usage();
|
||||
else {
|
||||
|
||||
/* Start up the resource manager */
|
||||
ResourceStartUp(userid());
|
||||
|
||||
/* Parse the command-line filenames */
|
||||
while (*argv) {
|
||||
fn = *argv++;
|
||||
ReadResources(fn);
|
||||
if (*argv && !bflag) (void)printf("\n");
|
||||
}
|
||||
|
||||
/* Shut down the resource manager */
|
||||
/* (which closes open resource files) */
|
||||
ResourceShutDown();
|
||||
}
|
||||
exit(rval);
|
||||
}
|
||||
|
||||
/*
|
||||
* Perform malloc memory allocation + error checking
|
||||
*/
|
||||
static void *
|
||||
malloc_c(size_t size)
|
||||
{
|
||||
void *rtn_value;
|
||||
if ((rtn_value = malloc(size)) == NULL) {
|
||||
(void)fprintf(stderr, "\nERROR: cannot allocate %ld bytes\n",
|
||||
size);
|
||||
exit(1);
|
||||
}
|
||||
return rtn_value;
|
||||
}
|
||||
|
||||
|
||||
typedef struct rVersType {
|
||||
Long version;
|
||||
unsigned short country;
|
||||
Str255 product;
|
||||
} rVersType, *rVersPtr;
|
||||
|
||||
/*
|
||||
* Translate 8-bit text and print on stdout
|
||||
*/
|
||||
void
|
||||
Print8bitText(ptr raw_text, Word raw_len)
|
||||
{
|
||||
Word Xlate_len;
|
||||
ResultBuf255Ptr Xlate_buf;
|
||||
LongWord Xresult;
|
||||
int Xprint_len;
|
||||
|
||||
/* Translated buffer could need up to 4 characters per input char. */
|
||||
/* It also needs two length words preceeding the characters. */
|
||||
Xlate_len = raw_len*4+4;
|
||||
|
||||
/* Allocate an extra byte so C-string can be terminated with null */
|
||||
Xlate_buf = (ResultBuf255Ptr)malloc_c(Xlate_len*4+1);
|
||||
Xlate_buf->bufSize = Xlate_len;
|
||||
|
||||
Xresult = StringToText(fAllowLongerSubs, raw_text,
|
||||
raw_len, (Ptr)Xlate_buf);
|
||||
|
||||
/* Add null character to terminate characters */
|
||||
Xprint_len = Xresult & 0xFFFF;
|
||||
Xlate_buf->bufString.text[Xprint_len] = 0;
|
||||
|
||||
/* Print the translated text */
|
||||
(void)fputs(Xlate_buf->bufString.text, stdout);
|
||||
|
||||
/* All done with the translation buffer */
|
||||
free(Xlate_buf);
|
||||
}
|
||||
|
||||
static void
|
||||
PrintPString(ptr ps)
|
||||
{
|
||||
int len;
|
||||
len = *ps++;
|
||||
while (len--) putchar(*ps++);
|
||||
}
|
||||
|
||||
/*
|
||||
* Translate 8-bit characters that might be embedded in
|
||||
* the p-string parameter and print on stdout
|
||||
*/
|
||||
static void
|
||||
Print8bitString(ptr ps)
|
||||
{
|
||||
/* Length of input string */
|
||||
Print8bitText((ptr)(ps+1), *ps);
|
||||
}
|
||||
|
||||
|
||||
|
||||
#define NUM_COUNTRY 55
|
||||
char *countryTbl[NUM_COUNTRY]={"United States", "France", "Britain",
|
||||
"Germany", "Italy", "Netherlands", "Belgium/Luxembourg",
|
||||
"Sweden", "Spain", "Denmark", "Portugal", "French Canadian",
|
||||
"Norway", "Israel", "Japan", "Australia", "Arabia", "Finland",
|
||||
"French Swiss", "German Swiss", "Greece", "Iceland", "Malta",
|
||||
"Cyprus", "Turkey", "Bosnia/Herzegovena/Yugoslavia/Croatia",
|
||||
NULL, NULL, NULL, NULL, NULL, NULL, NULL,
|
||||
"India", "Pakistan",
|
||||
NULL, NULL, NULL, NULL, NULL, NULL,
|
||||
"Lithuania", "Poland", "Hungary", "Estonia", "Latvia",
|
||||
"Lapland", "Faeroe Islands", "Iran", "Russia", "Ireland",
|
||||
"Korea", "China", "Taiwan", "Thailand"};
|
||||
|
||||
/*
|
||||
* Print information related to the rVersion resource
|
||||
* passed as a parameter.
|
||||
*/
|
||||
static void
|
||||
PrintVersionResource(ptr rezPtr)
|
||||
{
|
||||
rVersPtr rVers_addr;
|
||||
String(9) string_version;
|
||||
unsigned long moreInfo;
|
||||
int country_num;
|
||||
char *country;
|
||||
|
||||
/* Translate version from raw number to string */
|
||||
rVers_addr = (rVersPtr)rezPtr;
|
||||
VersionString(0, rVers_addr->version, (Ptr)&string_version);
|
||||
|
||||
/* Print product name and string version */
|
||||
Print8bitString((ptr) &(rVers_addr->product));
|
||||
putchar(' ');
|
||||
PrintPString((ptr) &string_version);
|
||||
putchar('\n');
|
||||
|
||||
/* All done if -b (brief) option was specified */
|
||||
if ( bflag ) return;
|
||||
|
||||
/* The "moreInfo" p-string follows the product p-string */
|
||||
moreInfo = (unsigned long)&(rVers_addr->product) +
|
||||
rVers_addr->product.textLength + 1;
|
||||
Print8bitString((Ptr)moreInfo);
|
||||
putchar('\n');
|
||||
|
||||
/* Print the country information */
|
||||
if ( (country_num=rVers_addr->country) < NUM_COUNTRY)
|
||||
country = countryTbl[country_num];
|
||||
if (country_num >= NUM_COUNTRY || country == NULL )
|
||||
(void)printf("Country: %d unknown to this version of getvers\n",
|
||||
country_num);
|
||||
else
|
||||
(void)printf("Country: %s\n", country);
|
||||
}
|
||||
|
||||
|
||||
/*
|
||||
* Print the rVersion comment passed as a parameter.
|
||||
*/
|
||||
static void
|
||||
PrintCommentResource(ptr rezPtr)
|
||||
{
|
||||
LongWord rez_len;
|
||||
rez_len = GetResourceSize(0x802A,1);
|
||||
Print8bitText(rezPtr, rez_len);
|
||||
putchar('\n');
|
||||
}
|
||||
|
||||
|
||||
/*
|
||||
* Read the version (and, optionally, comment) resources from the
|
||||
* indicated file
|
||||
*/
|
||||
static void
|
||||
ReadResources(char *path_str)
|
||||
{
|
||||
#define noPreload 0x8000
|
||||
Word new_file_id;
|
||||
Word old_file_id;
|
||||
Word old_depth;
|
||||
GSString255Ptr path_ptr;
|
||||
Handle rVer_handle, rCom_handle;
|
||||
int error;
|
||||
|
||||
/* Let user know what file we're working on */
|
||||
(void)printf("%s: ",path_str);
|
||||
|
||||
/* Convert C string into GSString */
|
||||
path_ptr = malloc_c(strlen(path_str)+2);
|
||||
path_ptr->length = strlen(path_str);
|
||||
strcpy(path_ptr->text, path_str);
|
||||
|
||||
/* Open the resource fork of the file */
|
||||
new_file_id = OpenResourceFile(noPreload+readEnable,
|
||||
NULL, (Pointer)path_ptr);
|
||||
if ((error = toolerror()) != noError) {
|
||||
if (error == 0x0046)
|
||||
(void)printf("File not found\n");
|
||||
else if (error == 0x0063)
|
||||
(void)printf("No resource fork\n");
|
||||
else
|
||||
(void)printf("Error $%04X opening resource fork\n",
|
||||
error);
|
||||
rval = 1;
|
||||
}
|
||||
else {
|
||||
/* Set up to search only this resource file, remembering */
|
||||
/* previous setting so it can be restored when closing file */
|
||||
old_file_id = GetCurResourceFile();
|
||||
SetCurResourceFile(new_file_id);
|
||||
old_depth = SetResourceFileDepth(1);
|
||||
|
||||
/* Read the version resource */
|
||||
rVer_handle = LoadResource(0x8029,1);
|
||||
if ((error = toolerror()) != noError) {
|
||||
if (error == 0x1E06)
|
||||
(void)printf("No version resource\n");
|
||||
else
|
||||
(void)printf(
|
||||
"Error $%04X getting version resource\n",
|
||||
error);
|
||||
rval = 1;
|
||||
}
|
||||
else {
|
||||
PrintVersionResource(*rVer_handle);
|
||||
}
|
||||
|
||||
/* Read the comment resource, if requested */
|
||||
if ( cflag ) {
|
||||
rCom_handle = LoadResource(0x802A,1);
|
||||
if ((error = toolerror()) == noError) {
|
||||
PrintCommentResource(*rCom_handle);
|
||||
}
|
||||
}
|
||||
|
||||
/* Close the resource file and restore original search values */
|
||||
CloseResourceFile(new_file_id);
|
||||
SetCurResourceFile(old_file_id);
|
||||
SetResourceFileDepth(old_depth);
|
||||
}
|
||||
/* Free the memory allocated for the path name */
|
||||
free(path_ptr);
|
||||
}
|
||||
|
||||
static void
|
||||
usage(void)
|
||||
{
|
||||
(void)fprintf(stderr, "usage: getvers [-b] [-c] file ...\n");
|
||||
exit(1);
|
||||
}
|
@ -1,40 +1,55 @@
|
||||
.TH VERSION 1
|
||||
.\"
|
||||
.\" $Id: getvers.1,v 1.2 1998/04/29 00:41:50 tribby Exp $
|
||||
.\"
|
||||
.TH GETVERS 1 "April 1998" "GNO" "Commands and Applications"
|
||||
.SH NAME
|
||||
.LP
|
||||
.B getvers
|
||||
\- get version number and information stored in rVersion format from
|
||||
specified executable file
|
||||
\- list information stored in rVersion and rComment resources
|
||||
.SH SYNOPSIS
|
||||
.LP
|
||||
.BR getvers " < file1 file2 ...filen >"
|
||||
.BR getvers " [" -b "] [" -c "]"
|
||||
.RB "[" -q "] file ..."
|
||||
.SH DESCRIPTION
|
||||
.LP
|
||||
.B getvers
|
||||
is a program which accepts as input the name(s) of file(s)
|
||||
and print the version information stored in the rVersion resource of
|
||||
the file(s). If no rVersion resource is present it will print with the error
|
||||
`This file has no version resource' and continue processing other filenames
|
||||
provided as input.
|
||||
.BR getvers
|
||||
print the version information stored in the rVersion resource of
|
||||
the specified files. If there is a problem handling a particular
|
||||
file (e.g., file does not exist, no resource fork,
|
||||
no rVersion resource)
|
||||
.BR getvers
|
||||
prints an error message and continues processing any remaining files.
|
||||
.LP
|
||||
To add information to the rVersion resource, you can use the companion
|
||||
shell utility
|
||||
.BR setvers "."
|
||||
.LP
|
||||
You can use the companion shell utility
|
||||
.BR gv " to list versions in a more compact form."
|
||||
.SH BUGS
|
||||
.LP
|
||||
Little crawly things, also known as insects.
|
||||
.BR setvers ,
|
||||
or use the
|
||||
.BR rez
|
||||
resource compiler.
|
||||
.PP
|
||||
.BR getvers
|
||||
returns 1 to its parent program if an error is encountered processing
|
||||
any of the files. Otherwise it returns 0.
|
||||
.SS OPTIONS
|
||||
.BR getvers
|
||||
recognizes these options:
|
||||
.IP \fB-b\fR
|
||||
print a brief listing for each file, leaving off the program
|
||||
description and country name.
|
||||
.IP \fB-c\fR
|
||||
print rComment resource number 1 (the one displayed by Finder in
|
||||
file information windows).
|
||||
.IP \fB-q\fR
|
||||
do not print error information.
|
||||
.SH SEE ALSO
|
||||
.LP
|
||||
.BR setvers "(1)"
|
||||
.BR gv "(1)"
|
||||
.SH VERSION
|
||||
This manual page documents
|
||||
.BR getvers
|
||||
version 2.0.
|
||||
.SH AUTHOR
|
||||
.LP
|
||||
.nf
|
||||
Ian Schmidt, Two Meg Software
|
||||
|
||||
internet irsman@iastate.edu
|
||||
BITNET twbv4@isuvax
|
||||
AOL IRSMan
|
||||
.fi
|
||||
Originally written by Ian Schmidt, Two Meg Software. Updated by Dave Tribby
|
||||
for GNO/ME 2.0.6.
|
||||
.SH HISTORY
|
||||
The previous version (1.20) of
|
||||
.BR getvers
|
||||
was released by Ian Schmidt in May 1993
|
||||
as an independent archive compatible with GNO and ORCA.
|
||||
|
702
usr.bin/getvers/getvers.asm
Normal file
702
usr.bin/getvers/getvers.asm
Normal file
@ -0,0 +1,702 @@
|
||||
*
|
||||
* getvers version 2.0 for Apple IIGS
|
||||
*
|
||||
* Original getvers written by Ian Schmidt (Copyright 1993 Two Meg Software)
|
||||
* Version 2.0 was created from a disassembly of getvers 1.2.
|
||||
* by Dave Tribby for GNO/ME 2.0.6 * April 1998
|
||||
* See README.getvers for additional implementation notes.
|
||||
*
|
||||
* $Id
|
||||
*
|
||||
|
||||
; Macro library
|
||||
MCOPY getvers.mac
|
||||
|
||||
; Predefined labels:
|
||||
GSOS gequ $E100A8
|
||||
|
||||
;
|
||||
; Locations used on direct page
|
||||
;
|
||||
CmdLn gequ $00 00-03 Command line address
|
||||
CmdIndx gequ $04 04-05 index into Command line
|
||||
RezHndl gequ $06 06-09 rVersion resource handle
|
||||
RezAddr gequ $0A 0A-0D rVersion resource address
|
||||
rezFieldAddr gequ $0E 0E-11 rVersion field address
|
||||
AdrPStr gequ $12 12-15 pString addr for WritePString
|
||||
RezRefNum gequ $16 16-17 ref num for resource file
|
||||
CntryPStrAdr gequ $18 18-1B addr of country pString
|
||||
; (Not used) UserID gequ $1C 1C-1D ID number of program
|
||||
|
||||
|
||||
* -----------------------------------------------------------------
|
||||
|
||||
;
|
||||
; Beginning of program
|
||||
;
|
||||
getvers start GETVERS
|
||||
longa on
|
||||
longi on
|
||||
|
||||
; Handle the GS/OS startup protocol for shell text programs
|
||||
phk Use program bank register
|
||||
plb to set data bank register.
|
||||
sty CmdLn Save address of
|
||||
stx CmdLn+2 command line.
|
||||
; (Not used) sta UserID Save the user ID number.
|
||||
|
||||
; Setup for using stdout
|
||||
jsr GetStdOutNum
|
||||
|
||||
; Start the Resource manager
|
||||
pha
|
||||
_ResourceStartUp
|
||||
|
||||
; Were parameters provided?
|
||||
ldy #8 Start beyond shell identifier.
|
||||
jsr GetNxtPrm 1st parameter is program name.
|
||||
ChkPrm lda [CmdLn],y Get next command line
|
||||
and #$FF character.
|
||||
bne GetParam If not end-of-string, continue.
|
||||
|
||||
; No filename parameter: print the usage message and exit from the program
|
||||
DoUsage PH4 #UsageMsg
|
||||
jsr WritePString
|
||||
|
||||
PH4 #PStrNewLn
|
||||
jsr WritePString
|
||||
|
||||
lda #1 Set return
|
||||
sta rval status to 1.
|
||||
;
|
||||
; Shutdown and exit the program
|
||||
;
|
||||
AllDone _ResourceShutDown Close the resource manager.
|
||||
jsr CloseStdout Close stdout.
|
||||
lda rval Set status and
|
||||
rtl exit from program.
|
||||
|
||||
|
||||
;
|
||||
; Process program's filename parameters
|
||||
;
|
||||
GetParam jsr GetNxtPrm Get filename
|
||||
stx BufLen Set dest length.
|
||||
sty CmdIndx Save cmd line pointer.
|
||||
|
||||
; Was it a valid option?
|
||||
lda EndOptFlg If end-of-options flag is set,
|
||||
bne Fname process parameter as pathname.
|
||||
|
||||
SHORT M Use short mode to access chars.
|
||||
lda Buffer Get parameter.
|
||||
cmp #'-' If 1st character isn't '-',
|
||||
bne FrstName it must be a filename.
|
||||
|
||||
ldx #1
|
||||
GetPCh lda Buffer,x Get option character.
|
||||
cmp #'b' If it's 'b',
|
||||
bne ChkPc
|
||||
sta bflag set bflag.
|
||||
bra BumpIt
|
||||
ChkPc cmp #'c' If it's 'c',
|
||||
bne ChkPq
|
||||
sta cflag set cflag.
|
||||
bra BumpIt
|
||||
ChkPq cmp #'q' If it's 'q',
|
||||
bne BadParam
|
||||
sta qflag set qflag.
|
||||
BumpIt inx Increment index.
|
||||
cpx BufLen If not at end of buffer,
|
||||
bcc GetPCh get the next parameter character.
|
||||
LONG M Otherwise, restore long mode
|
||||
ldy CmdIndx Restore cmd line pointer
|
||||
bra ChkPrm and check if params are provided.
|
||||
|
||||
; First filename encountered
|
||||
Frstname LONG M Restore long mode.
|
||||
inc EndOptFlg Set end-of-options flag.
|
||||
|
||||
; Check for "quiet" mode
|
||||
Fname lda qflag If -q option was specified,
|
||||
bne PRF go process the rez file.
|
||||
|
||||
|
||||
; Write the pathname
|
||||
PH2 BufLen
|
||||
PH4 #Buffer
|
||||
jsr WriteBuf
|
||||
|
||||
; Write a colon and a space
|
||||
PH4 #PstrColSp
|
||||
jsr WritePString
|
||||
|
||||
|
||||
; Try to open the file and print rVersion information
|
||||
PRF jsr ProcessRezFile
|
||||
|
||||
ldy CmdIndx Restore cmd line pointer.
|
||||
|
||||
lda [CmdLn],y Get next command line
|
||||
and #$FF character.
|
||||
beq AllDone If end-of-string, all done.
|
||||
lda bflag If "brief" option
|
||||
ora qflag and "quiet" options aren't set,
|
||||
bne GetParam
|
||||
PH4 #PStrNewLn print newline separator.
|
||||
jsr WritePString
|
||||
bra GetParam Get next filename.
|
||||
|
||||
|
||||
; A parameter was offered, but it's not "b", "c" or "q".
|
||||
BadParam sta BadOpChr Save character in error message.
|
||||
LONG M Restore long mode.
|
||||
PH4 #BadOption Print "Illegal option"
|
||||
jsr WritePString
|
||||
|
||||
PH4 #PStrNewLn
|
||||
jsr WritePString
|
||||
|
||||
brl DoUsage Print usage and exit program.
|
||||
|
||||
|
||||
;
|
||||
; Subroutine to open and process the rez fork of the file named in Buffer
|
||||
;
|
||||
ProcessRezFile pha Word for result.
|
||||
PH2 #1 Access mode = read.
|
||||
PH4 #0 Ptr to map in mem (0: load from disk).
|
||||
PH4 #BufLen Filename (GS/OS string format).
|
||||
_OpenResourceFile Open the resource fork.
|
||||
bcc OpenedOK If no error, go print the information.
|
||||
|
||||
ply Discard return value.
|
||||
|
||||
PrintErr ldy qflag If -q option was specified,
|
||||
bne ErRtn don't print error message.
|
||||
|
||||
sta ErrGS_error Save error value.
|
||||
|
||||
; Check for two specific error cases
|
||||
cmp #$0046 If error = $0046,
|
||||
bne chkerr2
|
||||
|
||||
PH4 #E0046Msg print "File not found"
|
||||
bra MsgRtn and exit the subroutine.
|
||||
|
||||
chkerr2 cmp #$0063 If error = $0063,
|
||||
bne Generr
|
||||
|
||||
PH4 #E0063Msg print "No resource fork"
|
||||
MsgRtn jsr WritePString
|
||||
PH4 #PStrNewLn
|
||||
jsr WritePString
|
||||
|
||||
; Return with error status
|
||||
ErRtn lda #1 Set error status
|
||||
sta rval
|
||||
rts and return from ProcessRezFile.
|
||||
|
||||
; Print a generic error message
|
||||
Generr jsl >GSOS Shell:ErrorGS
|
||||
dc i2'$0145'
|
||||
dc a4'ErrorGSbuf'
|
||||
|
||||
bra ErRtn
|
||||
|
||||
;
|
||||
; Resource file was opened without error
|
||||
;
|
||||
OpenedOK PL2 RezRefNum Save rtn value (file ref num).
|
||||
|
||||
; Get file ID of resource file containing rVersion resource ID # 1
|
||||
|
||||
pha Space for result.
|
||||
PH2 #$8029 Resource type: rVersion
|
||||
PH4 #1 ID: 1
|
||||
_HomeResourceFile
|
||||
|
||||
pla If return value
|
||||
cmp RezRefNum != loaded rez file number,
|
||||
beq LoadVRez
|
||||
|
||||
ldy qflag and -q option wasn't specified,
|
||||
bne ErRtn
|
||||
|
||||
PH4 #NoRezMsg print error message,
|
||||
jsr WritePString
|
||||
PH4 #PStrNewLn
|
||||
jsr WritePString
|
||||
|
||||
bra ErRtn Set err stat & rtn from ProcessRezFile.
|
||||
|
||||
;
|
||||
; The resource exists in the target file. Load it.
|
||||
;
|
||||
LoadVRez pha Reserve space for
|
||||
pha return value.
|
||||
PH2 #$8029 Resource type: rVersion
|
||||
PH4 #1 ID: 1
|
||||
_LoadResource
|
||||
bcc GotRez If error getting resource,
|
||||
|
||||
plx Remove the
|
||||
plx returned value,
|
||||
brl PrintErr Print error msg and exit.
|
||||
|
||||
;
|
||||
; The rVersion resource was successfully loaded. Print its information.
|
||||
;
|
||||
GotRez PL4 RezHndl Rtn value = resource handle.
|
||||
|
||||
ldy #4 Make sure resource
|
||||
lda [RezHndl],y doesn't move by
|
||||
ora #$8000 setting AttrLocked bit
|
||||
sta [RezHndl],y in handle.
|
||||
|
||||
lda [RezHndl] De-reference
|
||||
sta RezAddr handle
|
||||
ldy #2 and
|
||||
lda [RezHndl],y save
|
||||
sta RezAddr+2 address.
|
||||
|
||||
; Convert version field to pString using _VersionString
|
||||
pea 0 Flags (= 0).
|
||||
lda [RezAddr],y Version (long).
|
||||
pha
|
||||
lda [RezAddr]
|
||||
pha
|
||||
PH4 #VersPStr Address of result.
|
||||
_VersionString
|
||||
|
||||
ldy #4
|
||||
lda [RezAddr],y Get country code.
|
||||
cmp #55 If >= 55,
|
||||
bcc shift
|
||||
lda #30 use 30 (an unknown country).
|
||||
shift asl a Multiply country code
|
||||
asl a by 4
|
||||
tax and use as index.
|
||||
lda CntryAddrTbl,x Get address of pString
|
||||
sta CntryPStrAdr of country name and
|
||||
lda CntryAddrTbl+2,x store in CntryPStrAdr.
|
||||
sta CntryPStrAdr+2
|
||||
|
||||
clc
|
||||
lda RezAddr Get rVersion address,
|
||||
adc #6 add 6
|
||||
sta rezFieldAddr and store pointer
|
||||
lda RezAddr+2 to name of
|
||||
adc #0 product.
|
||||
sta rezFieldAddr+2
|
||||
|
||||
; Print product name
|
||||
PH4 rezFieldAddr
|
||||
jsr Wrt8bitPStr
|
||||
|
||||
; Print a single space
|
||||
PH4 #PstrSpace
|
||||
jsr WritePString
|
||||
|
||||
; Print version number
|
||||
PH4 #VersPStr
|
||||
jsr WritePString
|
||||
|
||||
; Print newline
|
||||
PH4 #PStrNewLn
|
||||
jsr WritePString
|
||||
|
||||
; If "brief" option is set, skip moreInfo and Country.
|
||||
lda bflag
|
||||
bne ChkCflag
|
||||
|
||||
; Calculate address of moreInfo field
|
||||
lda [rezFieldAddr] Get product name's
|
||||
and #$FF length byte.
|
||||
inc a Add one for length byte itself.
|
||||
clc
|
||||
adc rezFieldAddr Add to addr of product name.
|
||||
sta rezFieldAddr Store addr of moreInfo field.
|
||||
bcc PrintMI
|
||||
inc rezFieldAddr+2
|
||||
|
||||
; Print moreInfo field
|
||||
PrintMI PH4 rezFieldAddr
|
||||
jsr Wrt8bitPStr
|
||||
|
||||
; Print newline
|
||||
PH4 #PStrNewLn
|
||||
jsr WritePString
|
||||
|
||||
|
||||
; Print "Country: "
|
||||
PH4 #CountryPStrK
|
||||
jsr WritePString
|
||||
|
||||
; Print country name
|
||||
PH4 CntryPStrAdr
|
||||
jsr WritePString
|
||||
|
||||
; Print newline
|
||||
PH4 #PStrNewLn
|
||||
jsr WritePString
|
||||
|
||||
; If "comment" option is set, load and print Comment resource.
|
||||
ChkCflag lda cflag
|
||||
beq CloseRez
|
||||
|
||||
; Get file ID of resource file containing rComment resource ID # 1
|
||||
|
||||
pha Space for result.
|
||||
PH2 #$802A Resource type: rVersion
|
||||
PH4 #1 ID: 1
|
||||
_HomeResourceFile
|
||||
|
||||
pla If return value
|
||||
cmp RezRefNum != loaded rez file number,
|
||||
bne CloseRez skip it.
|
||||
|
||||
pha Reserve space for
|
||||
pha return value.
|
||||
PH2 #$802A Resource type: rVersion
|
||||
PH4 #1 ID: 1
|
||||
_LoadResource
|
||||
bcs CloseRez If error, skip it.
|
||||
|
||||
;
|
||||
; The rComment resource was successfully loaded. Print its information.
|
||||
;
|
||||
PL4 RezHndl Rtn value = resource handle.
|
||||
|
||||
ldy #4 Make sure resource
|
||||
lda [RezHndl],y doesn't move by
|
||||
ora #$8000 setting AttrLocked bit
|
||||
sta [RezHndl],y in handle.
|
||||
|
||||
lda [RezHndl] De-reference
|
||||
sta GSWriteAdr handle
|
||||
ldy #2 and
|
||||
lda [RezHndl],y save
|
||||
sta GSWriteAdr+2 address.
|
||||
|
||||
pha Reserve space for
|
||||
pha result.
|
||||
PH4 RezHndl Get size of
|
||||
_GetHandleSize rComment resource.
|
||||
PL4 GSWriteLen Save length.
|
||||
|
||||
jsr Wrt8bitStr Convert and write comment string.
|
||||
|
||||
; Print newline
|
||||
PH4 #PStrNewLn
|
||||
jsr WritePString
|
||||
|
||||
|
||||
; Done with the resource file; close it
|
||||
CloseRez PH2 RezRefNum fileID
|
||||
_CloseResourceFile
|
||||
|
||||
Rtn rts Return from ProcessRezFile.
|
||||
|
||||
|
||||
;
|
||||
; Subroutine to copy next word of input line into Buffer
|
||||
; Upon entry: Y-reg = index into CmdLn (beginning of parameter)
|
||||
; Upon exit: Y-reg = index into CmdLn (beyond end of parameter)
|
||||
; A-reg = char beyond end: [CmdLn],y (0 or ' ')
|
||||
; X-reg = length of parameter
|
||||
;
|
||||
GetNxtPrm ldx #0 Destination index and len = 0.
|
||||
SHORT M Use short mode to access chars.
|
||||
|
||||
; Skip leading blanks.
|
||||
SkipSp lda [CmdLn],y Get next character.
|
||||
beq EndParam If null character, at end of string.
|
||||
cmp #' ' If not blank,
|
||||
bne SaveCh found start of parameter.
|
||||
iny If blank, skip it
|
||||
bra SkipSp and get the next character.
|
||||
|
||||
SaveCh sta Buffer,x Save char in Buffer.
|
||||
iny Increment source and
|
||||
inx destination pointers.
|
||||
lda [CmdLn],y Get next character.
|
||||
beq EndParam If null character, found end.
|
||||
cmp #' ' If not a blank,
|
||||
bne SaveCh keep getting characters.
|
||||
|
||||
; Found the end of parameter (or end of string)
|
||||
EndParam LONG M Restore long mode.
|
||||
rts Return from GetNxtPrm.
|
||||
|
||||
|
||||
;
|
||||
; Subroutine to ensure that stdout is open
|
||||
;
|
||||
GetStdOutNum jsl >GSOS GetStdRefNum
|
||||
dc i2'$2037'
|
||||
dc a4'GetSRefBlk'
|
||||
lda GSRrefNum Use current refnum, unless
|
||||
bcc SvRefNum stdout isn't already open.
|
||||
jsl >GSOS GSOpen "Console"
|
||||
dc i2'$2010'
|
||||
dc a4'OpenBlock'
|
||||
lda OpenRefNum and use that refnum.
|
||||
inc OpenFlag Set "open" flag.
|
||||
SvRefNum sta StdOutRefNum Save stdout refnum.
|
||||
rts Return from GetStdOutNum.
|
||||
|
||||
|
||||
;
|
||||
; Subroutine to close stdout
|
||||
;
|
||||
CloseStdout lda OpenFlag If this program opened .CONSOLE
|
||||
beq GoBack for use as stdout,
|
||||
lda OpenRefNum
|
||||
sta GSClose_ref
|
||||
jsl >GSOS Close the file.
|
||||
dc i2'$2014'
|
||||
dc a4'GSClosePB'
|
||||
GoBack rts Return from CloseStdout.
|
||||
|
||||
|
||||
;
|
||||
; Subroutine to write the Pascal string whose address is on the stack
|
||||
;
|
||||
WritePString plx Hold the return address.
|
||||
PL4 AdrPStr Get pString address.
|
||||
phx Restore return address.
|
||||
|
||||
clc Text starts at one
|
||||
lda AdrPStr byte beyond the
|
||||
adc #1 beginning of the
|
||||
sta GSWriteAdr pString. Store
|
||||
lda AdrPStr+2 addr in GSWrite
|
||||
adc #0 Param Block.
|
||||
sta GSWriteAdr+2
|
||||
|
||||
lda [AdrPStr] Get pString length
|
||||
and #$FF (byte).
|
||||
sta GSWriteLen Store in Param Block
|
||||
stz GSWriteLen+2 (long).
|
||||
|
||||
jsl >GSOS GSWrite
|
||||
dc i2'$2013'
|
||||
dc a4'GSWritePB'
|
||||
rts Return from WritePString.
|
||||
|
||||
;
|
||||
; Subroutine to write the Pascal string whose address is on the stack
|
||||
; and whose contents may contain 8-bit characters.
|
||||
;
|
||||
Wrt8bitPStr plx Hold the return address.
|
||||
PL4 AdrPStr Get pString address.
|
||||
phx Restore return address.
|
||||
|
||||
clc Text starts at one
|
||||
lda AdrPStr byte beyond the
|
||||
adc #1 beginning of the
|
||||
sta GSWriteAdr pString. Store
|
||||
lda AdrPStr+2 addr in GSWrite
|
||||
adc #0 Param Block.
|
||||
sta GSWriteAdr+2
|
||||
|
||||
lda [AdrPStr] Store pString length
|
||||
and #$FF in GSWrite Param Block.
|
||||
sta GSWriteLen
|
||||
;
|
||||
; Alternate entry point to write 8-bit characters, with address
|
||||
; and length already stored at GSWriteAdr and GSEriteLen.
|
||||
;
|
||||
Wrt8bitStr anop
|
||||
|
||||
; Convert 8-bit characters to printable
|
||||
pha Reserve space for
|
||||
pha return values.
|
||||
PH2 #$4000 Flags: allow longer subs.
|
||||
PH4 GSWriteAdr Pointer to source text.
|
||||
PH2 GSWriteLen Source text length.
|
||||
PH4 #BufSize Pointer to destination.
|
||||
_StringToText
|
||||
PL2 GSWriteLen Save length.
|
||||
pla Ignore resultFlags.
|
||||
|
||||
PH4 #Buffer Set GSWrite address
|
||||
PL4 GSWriteAdr to the result buffer.
|
||||
|
||||
jsl >GSOS GSWrite
|
||||
dc i2'$2013'
|
||||
dc a4'GSWritePB'
|
||||
rts Return from Wrt8bitPStr/Wrt8bitStr.
|
||||
|
||||
;
|
||||
; Subroutine to write text; Addr and Len passed on stack
|
||||
;
|
||||
WriteBuf plx Hold return address.
|
||||
PL4 GSWriteAdr Move parameters into
|
||||
PL2 GSWriteLen GS Write
|
||||
stz GSWriteLen+2 Param Block.
|
||||
phx Restore return address.
|
||||
jsl >GSOS GSWrite
|
||||
dc i2'$2013'
|
||||
dc a4'GSWritePB'
|
||||
rts Return from WriteBuf.
|
||||
|
||||
|
||||
; -------------------------------------------------------------------
|
||||
; Miscellaneous program constants and storage
|
||||
; -------------------------------------------------------------------
|
||||
|
||||
; Usage message
|
||||
UsageMsg dw 'usage: getvers [-b] [-c] [-q] file ...'
|
||||
|
||||
; Bad option error message (pString)
|
||||
BadOption dc i1'BadOpChr-BadOption'
|
||||
dc c'illegal option -- '
|
||||
BadOpChr dc c' '
|
||||
|
||||
; File open error pStrings
|
||||
E0046Msg dw 'File not found'
|
||||
E0063Msg dw 'No resource fork'
|
||||
NoRezMsg dw 'No version resource'
|
||||
|
||||
; Indicates whether this program opened stdout
|
||||
OpenFlag dc i2'0'
|
||||
|
||||
; Status value returned to shell
|
||||
rval dc i2'0'
|
||||
|
||||
; Parameter flags
|
||||
EndOptFlg dc i2'0' Has end-of-options been reached?
|
||||
bflag dc i2'0' Has -b option been specified?
|
||||
cflag dc i2'0' Has -c option been specified?
|
||||
qflag dc i2'0' Has -q option been specified?
|
||||
|
||||
; Miscellaneous pString constants:
|
||||
PstrColSp dw ': ' Colon and space
|
||||
PstrSpace dw ' ' Space
|
||||
PStrNewLn dc h'010D' Newline
|
||||
|
||||
; pString Version (filled in by call to SetVersion)
|
||||
VersPStr dw ' '
|
||||
|
||||
; Constants used for printing country information
|
||||
|
||||
CountryPStrK dw 'Country: ' Label
|
||||
|
||||
; Table of addresses for country pStrings
|
||||
CntryAddrTbl dc a4'US,France,Britain,Germany,Italy,Netherlands,BelgiumLux'
|
||||
dc a4'Sweden,Spain,Denmark,Portugal,FrCanada,Norway,Israel'
|
||||
dc a4'Japan,Australia,Arabia,Finland,FrSwiss,GrSwiss,Greece'
|
||||
dc a4'Iceland,Malta,Cyprus,Turkey,Yugoslavia'
|
||||
dc a4'Unknown,Unknown,Unknown,Unknown,Unknown,Unknown,Unknown'
|
||||
dc a4'India,Pakistan'
|
||||
dc a4'Unknown,Unknown,Unknown,Unknown,Unknown,Unknown'
|
||||
dc a4'Lithuania,Poland,Hungary,Estonia,Latvia,Lapland'
|
||||
dc a4'FaeroeIsl,Iran,Russia,Ireland,Korea,China,Taiwan'
|
||||
dc a4'Thailand'
|
||||
; Message printed when country is not valid
|
||||
Unknown dw 'unknown to this version of getvers'
|
||||
|
||||
; pStrings for the various countries
|
||||
US dw 'United States'
|
||||
France dw 'France'
|
||||
Britain dw 'Britain'
|
||||
Germany dw 'Germany'
|
||||
Italy dw 'Italy'
|
||||
Netherlands dw 'Netherlands'
|
||||
BelgiumLux dw 'Belgium/Luxembourg'
|
||||
Sweden dw 'Sweden'
|
||||
Spain dw 'Spain'
|
||||
Denmark dw 'Denmark'
|
||||
Portugal dw 'Portugal'
|
||||
FrCanada dw 'French Canadian'
|
||||
Norway dw 'Norway'
|
||||
Israel dw 'Israel'
|
||||
Japan dw 'Japan'
|
||||
Australia dw 'Australia'
|
||||
Arabia dw 'Arabia'
|
||||
Finland dw 'Finland'
|
||||
FrSwiss dw 'French Swiss'
|
||||
GrSwiss dw 'German Swiss'
|
||||
Greece dw 'Greece'
|
||||
Iceland dw 'Iceland'
|
||||
Malta dw 'Malta'
|
||||
Cyprus dw 'Cyprus'
|
||||
Turkey dw 'Turkey'
|
||||
Yugoslavia dw 'Bosnia/Herzegovena/Yugoslavia/Croatia'
|
||||
India dw 'India'
|
||||
Pakistan dw 'Pakistan'
|
||||
Lithuania dw 'Lithuania'
|
||||
Poland dw 'Poland'
|
||||
Hungary dw 'Hungary'
|
||||
Estonia dw 'Estonia'
|
||||
Latvia dw 'Latvia'
|
||||
Lapland dw 'Lapland'
|
||||
FaeroeIsl dw 'Faeroe Islands'
|
||||
Iran dw 'Iran'
|
||||
Russia dw 'Russia'
|
||||
Ireland dw 'Ireland'
|
||||
Korea dw 'Korea'
|
||||
China dw 'China'
|
||||
Taiwan dw 'Taiwan'
|
||||
Thailand dw 'Thailand'
|
||||
|
||||
|
||||
; GS/OS input/result string: two length words followed by 256 bytes
|
||||
BufSize dc i2'260' Total size (when used as result buf)
|
||||
BufLen dc i2'0' Num chars used in buffer
|
||||
Buffer ds 256 Storage area (256 bytes)
|
||||
|
||||
|
||||
|
||||
; Parameter Block used for ErrorGS
|
||||
ErrorGSbuf dc i2'1' Number of parameters
|
||||
ErrGS_error dc i2'0' Error code
|
||||
|
||||
; Parameter block for GSOpen of .CONSOLE
|
||||
OpenBlock dc i2'4' pCount
|
||||
OpenRefNum dc i2'0' refNum
|
||||
OpenPath dc i4'ConName' pathname
|
||||
OpenAccess dc i2'2' requestAccess (write)
|
||||
OpenRNum dc i2'0' resourceNumber (open data fork)
|
||||
|
||||
; ".CONSOLE" as a GS/OS input string
|
||||
ConName dc i2'8'
|
||||
dc c'.CONSOLE'
|
||||
|
||||
; GetStdRefNum parameter block
|
||||
GetSRefBlk dc i2'2' pCount
|
||||
GSRpfixNum dc i2'11' prefixNum
|
||||
GSRrefNum dc i2'0' refNum (returned)
|
||||
|
||||
; Parameter block for GSClose
|
||||
GSClosePB dc i2'1' pCount
|
||||
GSClose_ref dc i2'0' refNum
|
||||
|
||||
; Parameter block used for GSWrite in WriteBuf and WritePString
|
||||
GSWritePB dc i2'4' pCount
|
||||
StdOutRefNum dc i2'0' device number
|
||||
GSWriteAdr dc a4'0' buffer
|
||||
GSWriteLen dc i4'0' request count
|
||||
dc i4'0' starting block
|
||||
|
||||
end
|
||||
|
||||
; -----------------------------------------------------------------
|
||||
|
||||
; Segment for direct-page and stack
|
||||
|
||||
stack data STACK
|
||||
kind $12
|
||||
|
||||
; Fill the direct-page/stack pages with question marks,
|
||||
; so they can be examined for use during execution.
|
||||
|
||||
dc 128c'?'
|
||||
dc 128c'?'
|
||||
|
||||
dc 128c'?'
|
||||
dc 128c'?'
|
||||
|
||||
end
|
9
usr.bin/getvers/getvers.desc
Normal file
9
usr.bin/getvers/getvers.desc
Normal file
@ -0,0 +1,9 @@
|
||||
Name: getvers
|
||||
Version: 2.0 (April 1998)
|
||||
Shell: GNO or ORCA
|
||||
Author: Dave Tribby (original by Ian Schmidt)
|
||||
Contact: tribby@cup.hp.com
|
||||
Where: /usr/bin
|
||||
FTP: ground.isca.uiowa.edu apple2.caltech.edu trenco.myrias.com
|
||||
|
||||
Print information from rVersion and rComment resources
|
246
usr.bin/getvers/getvers.mac
Normal file
246
usr.bin/getvers/getvers.mac
Normal file
@ -0,0 +1,246 @@
|
||||
MACRO
|
||||
&lab _HomeResourceFile
|
||||
&lab ldx #$151E
|
||||
jsl $E10000
|
||||
MEND
|
||||
MACRO
|
||||
&lab _LoadResource
|
||||
&lab ldx #$0E1E
|
||||
jsl $E10000
|
||||
MEND
|
||||
MACRO
|
||||
&lab _OpenResourceFile
|
||||
&lab ldx #$0A1E
|
||||
jsl $E10000
|
||||
MEND
|
||||
MACRO
|
||||
&lab _ResourceShutDown
|
||||
&lab ldx #$031E
|
||||
jsl $E10000
|
||||
MEND
|
||||
MACRO
|
||||
&lab _ResourceStartUp
|
||||
&lab ldx #$021E
|
||||
jsl $E10000
|
||||
MEND
|
||||
MACRO
|
||||
&lab _VersionString
|
||||
&lab ldx #$3903
|
||||
jsl $E10000
|
||||
MEND
|
||||
macro
|
||||
&l long &a,&b
|
||||
lclb &i
|
||||
lclb &m
|
||||
&a amid &a,1,1
|
||||
&m setb ("&a"="M").or.("&a"="m")
|
||||
&i setb ("&a"="I").or.("&a"="i")
|
||||
aif c:&b=0,.a
|
||||
&b amid &b,1,1
|
||||
&m setb ("&b"="M").or.("&b"="m").or.&m
|
||||
&i setb ("&b"="I").or.("&b"="i").or.&i
|
||||
.a
|
||||
&l rep #&m*32+&i*16
|
||||
aif .not.&m,.b
|
||||
longa on
|
||||
.b
|
||||
aif .not.&i,.c
|
||||
longi on
|
||||
.c
|
||||
mend
|
||||
macro
|
||||
&l short &a,&b
|
||||
lclb &i
|
||||
lclb &m
|
||||
&a amid &a,1,1
|
||||
&m setb ("&a"="M").or.("&a"="m")
|
||||
&i setb ("&a"="I").or.("&a"="i")
|
||||
aif c:&b=0,.a
|
||||
&b amid &b,1,1
|
||||
&m setb ("&b"="M").or.("&b"="m").or.&m
|
||||
&i setb ("&b"="I").or.("&b"="i").or.&i
|
||||
.a
|
||||
&l sep #&m*32+&i*16
|
||||
aif .not.&m,.b
|
||||
longa off
|
||||
.b
|
||||
aif .not.&i,.c
|
||||
longi off
|
||||
.c
|
||||
mend
|
||||
macro
|
||||
&l dw &adr
|
||||
&l dc i1"l:~&SYSNAME&SYSCNT"
|
||||
~&SYSNAME&SYSCNT dc c"&adr"
|
||||
mend
|
||||
macro
|
||||
&l ph4 &n1
|
||||
&l anop
|
||||
aif "&n1"="*",.f
|
||||
lclc &c
|
||||
&c amid &n1,1,1
|
||||
aif "&c"="#",.d
|
||||
aif s:longa=1,.a
|
||||
rep #%00100000
|
||||
.a
|
||||
aif "&c"<>"{",.b
|
||||
&c amid &n1,l:&n1,1
|
||||
aif "&c"<>"}",.g
|
||||
&n1 amid &n1,2,l:&n1-2
|
||||
ldy #2
|
||||
lda (&n1),y
|
||||
pha
|
||||
lda (&n1)
|
||||
pha
|
||||
ago .e
|
||||
.b
|
||||
aif "&c"<>"[",.c
|
||||
ldy #2
|
||||
lda &n1,y
|
||||
pha
|
||||
lda &n1
|
||||
pha
|
||||
ago .e
|
||||
.c
|
||||
aif "&c"<>"<",.c1
|
||||
&n1 amid &n1,2,l:&n1-1
|
||||
pei &n1+2
|
||||
pei &n1
|
||||
ago .e
|
||||
.c1
|
||||
lda &n1+2
|
||||
pha
|
||||
lda &n1
|
||||
pha
|
||||
ago .e
|
||||
.d
|
||||
&n1 amid &n1,2,l:&n1-1
|
||||
pea +(&n1)|-16
|
||||
pea &n1
|
||||
ago .f
|
||||
.e
|
||||
aif s:longa=1,.f
|
||||
sep #%00100000
|
||||
.f
|
||||
mexit
|
||||
.g
|
||||
mnote "Missing closing '}'",16
|
||||
mend
|
||||
macro
|
||||
&l pl4 &n1
|
||||
lclc &c
|
||||
&l anop
|
||||
aif s:longa=1,.a
|
||||
rep #%00100000
|
||||
.a
|
||||
&c amid &n1,1,1
|
||||
aif "&c"<>"{",.b
|
||||
&c amid &n1,l:&n1,1
|
||||
aif "&c"<>"}",.f
|
||||
&n1 amid &n1,2,l:&n1-2
|
||||
pla
|
||||
sta (&n1)
|
||||
ldy #2
|
||||
pla
|
||||
sta (&n1),y
|
||||
ago .d
|
||||
.b
|
||||
aif "&c"<>"[",.c
|
||||
pla
|
||||
sta &n1
|
||||
ldy #2
|
||||
pla
|
||||
sta &n1,y
|
||||
ago .d
|
||||
.c
|
||||
pla
|
||||
sta &n1
|
||||
pla
|
||||
sta &n1+2
|
||||
.d
|
||||
aif s:longa=1,.e
|
||||
sep #%00100000
|
||||
.e
|
||||
mexit
|
||||
.f
|
||||
mnote "Missing closing '}'",16
|
||||
mend
|
||||
macro
|
||||
&l ph2 &n1
|
||||
&l anop
|
||||
aif "&n1"="*",.f
|
||||
lclc &c
|
||||
&c amid &n1,1,1
|
||||
aif "&c"="#",.d
|
||||
aif s:longa=1,.a
|
||||
rep #%00100000
|
||||
.a
|
||||
aif "&c"<>"{",.b
|
||||
&c amid &n1,l:&n1,1
|
||||
aif "&c"<>"}",.g
|
||||
&n1 amid &n1,2,l:&n1-2
|
||||
lda (&n1)
|
||||
pha
|
||||
ago .e
|
||||
.b
|
||||
aif "&c"="<",.c
|
||||
lda &n1
|
||||
pha
|
||||
ago .e
|
||||
.c
|
||||
&n1 amid &n1,2,l:&n1-1
|
||||
pei &n1
|
||||
ago .e
|
||||
.d
|
||||
&n1 amid &n1,2,l:&n1-1
|
||||
pea &n1
|
||||
ago .f
|
||||
.e
|
||||
aif s:longa=1,.f
|
||||
sep #%00100000
|
||||
.f
|
||||
mexit
|
||||
.g
|
||||
mnote "Missing closing '}'",16
|
||||
mend
|
||||
macro
|
||||
&l pl2 &n1
|
||||
lclc &c
|
||||
&l anop
|
||||
aif s:longa=1,.a
|
||||
rep #%00100000
|
||||
.a
|
||||
&c amid &n1,1,1
|
||||
aif "&c"<>"{",.b
|
||||
&c amid &n1,l:&n1,1
|
||||
aif "&c"<>"}",.f
|
||||
&n1 amid &n1,2,l:&n1-2
|
||||
pla
|
||||
sta (&n1)
|
||||
ago .d
|
||||
.b
|
||||
pla
|
||||
sta &n1
|
||||
.d
|
||||
aif s:longa=1,.e
|
||||
sep #%00100000
|
||||
.e
|
||||
mexit
|
||||
.f
|
||||
mnote "Missing closing '}'",16
|
||||
mend
|
||||
MACRO
|
||||
&lab _CloseResourceFile
|
||||
&lab ldx #$0B1E
|
||||
jsl $E10000
|
||||
MEND
|
||||
MACRO
|
||||
&lab _StringToText
|
||||
&lab ldx #$3B03
|
||||
jsl $E10000
|
||||
MEND
|
||||
MACRO
|
||||
&lab _GetHandleSize
|
||||
&lab ldx #$1802
|
||||
jsl $E10000
|
||||
MEND
|
29
usr.bin/getvers/getvers.rez
Normal file
29
usr.bin/getvers/getvers.rez
Normal file
@ -0,0 +1,29 @@
|
||||
/*
|
||||
* Resources for getvers version and comment
|
||||
*/
|
||||
#define PROG "getvers"
|
||||
#define DESC "Print contents of resource version."
|
||||
|
||||
#include "Types.rez"
|
||||
|
||||
/*
|
||||
* Version
|
||||
*/
|
||||
resource rVersion (1, purgeable3) {
|
||||
{ 2, 0, 0, /* Version 2.0.0 */
|
||||
release, /* development|alpha|beta|final|release */
|
||||
0 }, /* non-final release number */
|
||||
verUS, /* Country */
|
||||
PROG, /* Program name */
|
||||
DESC " Released with GNO/ME."
|
||||
};
|
||||
|
||||
|
||||
/*
|
||||
* Comment
|
||||
*/
|
||||
resource rComment (1, purgeable3) {
|
||||
PROG " v2.0 (April 1998)\n"
|
||||
"GNO utility: " DESC "\n"
|
||||
"Originally by Ian Schmidt; updated by Dave Tribby."
|
||||
};
|
107
usr.bin/getvers/tests/Makefile
Normal file
107
usr.bin/getvers/tests/Makefile
Normal file
@ -0,0 +1,107 @@
|
||||
#
|
||||
# Makefile for use with dmake on Apple IIGS to create getvers test files
|
||||
# $Id: Makefile,v 1.1 1998/04/29 00:42:01 tribby Exp $
|
||||
#
|
||||
# Written by Dave Tribby * April 1998
|
||||
|
||||
# Default values for parameters
|
||||
PROD = product
|
||||
VERSION = 1,0,0,release,0
|
||||
DESC = Program description
|
||||
COMMENT = Program comment
|
||||
|
||||
# Longer values for parameters
|
||||
LPROD = Super Graphics Destroyer
|
||||
LVERSION = 2,0,0,release,0
|
||||
LDESC = \\\\0xA9 1991 Pretty as a Picture, Inc.
|
||||
LCOMMENT = This is the comment displayed by the Finder\\\\0xAA when file \\\\0x11Information is requested.
|
||||
|
||||
# Default rule for creating country rez file
|
||||
%.rez : rezskel ; modskel $* ver$* $(VERSION) '$(PROD)' '$(DESC)' '$(COMMENT)'
|
||||
|
||||
# Resource files to be created:
|
||||
GOODOBJ = US.r Russia.r Yugo.r Ireland.r Thai.r
|
||||
BADVER = Arabia.r Britain.r Cyprus.r Denmark.r Latvia.r France.r
|
||||
LONGER = Portugal.r
|
||||
BADCTRY = Bad26.r Bad55.r Bad80.r
|
||||
DEFAUL1 = Germany.r Italy.r Netherlands.r BelgiumLux.r Sweden.r Spain.r
|
||||
DEFAUL2 = Australia.r Finland.r FrSwiss.r GrSwiss.r Greece.r Iceland.r Malta.r
|
||||
DEFAUL3 = India.r Pakistan.r Lithuania.r Poland.r Hungary.r Estonia.r Lapland.r
|
||||
DEFAUL4 = Iran.r Korea.r China.r Taiwan.r FaeroeIsl.r Turkey.r FrCanada.r
|
||||
OBJS = $(GOODOBJ) $(BADVER) $(LONGER) $(BADCTRY) $(DEFAUL1) $(DEFAUL2) $(DEFAUL3) $(DEFAUL4)
|
||||
|
||||
|
||||
# Groups of characters
|
||||
CHR0 = 00-0F:\\\\0x00\\\\0x01\\\\0x02\\\\0x03\\\\0x04\\\\0x05\\\\0x06\\\\0x07\\\\0x08\\\\0x09\\\\0x0A\\\\0x0B\\\\0x0C\\\\0x0D\\\\0x0E\\\\0x0F
|
||||
CHR1 = 10-1F:\\\\0x10\\\\0x11\\\\0x12\\\\0x13\\\\0x14\\\\0x15\\\\0x16\\\\0x17\\\\0x18\\\\0x19\\\\0x1A\\\\0x1B\\\\0x1C\\\\0x1D\\\\0x1E\\\\0x1F
|
||||
CHR2 = 20-2F:\\\\0x20\\\\0x21\\\\0x22\\\\0x23\\\\0x24\\\\0x25\\\\0x26\\\\0x27\\\\0x28\\\\0x29\\\\0x2A\\\\0x2B\\\\0x2C\\\\0x2D\\\\0x2E\\\\0x2F
|
||||
CHR3 = 30-3F:\\\\0x30\\\\0x31\\\\0x32\\\\0x33\\\\0x34\\\\0x35\\\\0x36\\\\0x37\\\\0x38\\\\0x39\\\\0x3A\\\\0x3B\\\\0x3C\\\\0x3D\\\\0x3E\\\\0x3F
|
||||
CHR4 = 40-4F:\\\\0x40\\\\0x41\\\\0x42\\\\0x43\\\\0x44\\\\0x45\\\\0x46\\\\0x47\\\\0x48\\\\0x49\\\\0x4A\\\\0x4B\\\\0x4C\\\\0x4D\\\\0x4E\\\\0x4F
|
||||
CHR5 = 50-5F:\\\\0x50\\\\0x51\\\\0x52\\\\0x53\\\\0x54\\\\0x55\\\\0x56\\\\0x57\\\\0x58\\\\0x59\\\\0x5A\\\\0x5B\\\\0x5C\\\\0x5D\\\\0x5E\\\\0x5F
|
||||
CHR6 = 60-6F:\\\\0x60\\\\0x61\\\\0x62\\\\0x63\\\\0x64\\\\0x65\\\\0x66\\\\0x67\\\\0x68\\\\0x69\\\\0x6A\\\\0x6B\\\\0x6C\\\\0x6D\\\\0x6E\\\\0x6F
|
||||
CHR7 = 70-7F:\\\\0x70\\\\0x71\\\\0x72\\\\0x73\\\\0x74\\\\0x75\\\\0x76\\\\0x77\\\\0x78\\\\0x79\\\\0x7A\\\\0x7B\\\\0x7C\\\\0x7D\\\\0x7E\\\\0x7F
|
||||
CHR8 = 80-8F:\\\\0x80\\\\0x81\\\\0x82\\\\0x83\\\\0x84\\\\0x85\\\\0x86\\\\0x87\\\\0x88\\\\0x89\\\\0x8A\\\\0x8B\\\\0x8C\\\\0x8D\\\\0x8E\\\\0x8F
|
||||
CHR9 = 90-9F:\\\\0x90\\\\0x91\\\\0x92\\\\0x93\\\\0x94\\\\0x95\\\\0x96\\\\0x97\\\\0x98\\\\0x99\\\\0x9A\\\\0x9B\\\\0x9C\\\\0x9D\\\\0x9E\\\\0x9F
|
||||
CHRA = A0-AF:\\\\0xA0\\\\0xA1\\\\0xA2\\\\0xA3\\\\0xA4\\\\0xA5\\\\0xA6\\\\0xA7\\\\0xA8\\\\0xA9\\\\0xAA\\\\0xAB\\\\0xAC\\\\0xAD\\\\0xAE\\\\0xAF
|
||||
CHRB = B0-BF:\\\\0xB0\\\\0xB1\\\\0xB2\\\\0xB3\\\\0xB4\\\\0xB5\\\\0xB6\\\\0xB7\\\\0xB8\\\\0xB9\\\\0xBA\\\\0xBB\\\\0xBC\\\\0xBD\\\\0xBE\\\\0xBF
|
||||
CHRC = C0-CF:\\\\0xC0\\\\0xC1\\\\0xC2\\\\0xC3\\\\0xC4\\\\0xC5\\\\0xC6\\\\0xC7\\\\0xC8\\\\0xC9\\\\0xCA\\\\0xCB\\\\0xCC\\\\0xCD\\\\0xCE\\\\0xCF
|
||||
CHRD = D0-DF:\\\\0xD0\\\\0xD1\\\\0xD2\\\\0xD3\\\\0xD4\\\\0xD5\\\\0xD6\\\\0xD7\\\\0xD8\\\\0xD9\\\\0xDA\\\\0xDB\\\\0xDC\\\\0xDD\\\\0xDE\\\\0xDF
|
||||
CHRE = E0-EF:\\\\0xE0\\\\0xE1\\\\0xE2\\\\0xE3\\\\0xE4\\\\0xE5\\\\0xE6\\\\0xE7\\\\0xE8\\\\0xE9\\\\0xEA\\\\0xEB\\\\0xEC\\\\0xED\\\\0xEE\\\\0xEF
|
||||
CHRF = F0-FF:\\\\0xF0\\\\0xF1\\\\0xF2\\\\0xF3\\\\0xF4\\\\0xF5\\\\0xF6\\\\0xF7\\\\0xF8\\\\0xF9\\\\0xFA\\\\0xFB\\\\0xFC\\\\0xFD\\\\0xFE\\\\0xFF
|
||||
|
||||
# Default rule: create all the resource files, including special case
|
||||
all: $(OBJS) norver.r
|
||||
|
||||
|
||||
US.rez: rezskel
|
||||
modskel $* verUS 2,0,0,release,0 '$(PROD)' '$(CHR0)' '$(CHR1)'
|
||||
|
||||
Russia.rez: rezskel
|
||||
modskel $* verRussia 0x99,9,9,alpha,0x99 '$(PROD)' '$(CHR2)' '$(CHR3)'
|
||||
|
||||
Yugo.rez: rezskel
|
||||
modskel $* verYugoCroatian 0,0,0,final,0 getvers '$(CHR4)' '$(CHR5)'
|
||||
|
||||
Ireland.rez: rezskel
|
||||
modskel $* verIreland 3,2,1,release,0 getvers '$(CHR6)' '$(CHR7)'
|
||||
|
||||
Thai.rez: rezskel
|
||||
modskel $* verThailand 1,2,3,development,4 getvers '$(CHR8)' '$(CHR9)'
|
||||
|
||||
# The following use hex number to generate invalid version numbers
|
||||
|
||||
Arabia.rez: rezskel
|
||||
modskel $* verArabia 0xAA,0xA,0xA,alpha,0xAA '$(PROD)' '$(CHRA)' '$(CHRB)'
|
||||
|
||||
Britain.rez: rezskel
|
||||
modskel $* verBritain 0xBB,0xB,0xB,beta,0xBB '$(PROD)' '$(CHRC)' '$(CHRD)'
|
||||
|
||||
Cyprus.rez: rezskel
|
||||
modskel $* verCyprus 0xCC,0xC,0xC,final,0xCC '$(PROD)' '$(CHRE)' '$(CHRF)'
|
||||
|
||||
Denmark.rez: rezskel
|
||||
modskel $* verDenmark 0xDD,0xD,0xD,development,0xDD '$(PROD)' '$(DESC)' '$(COMMENT)'
|
||||
|
||||
Latvia.rez: rezskel
|
||||
modskel $* verLatvia 0xEE,0xE,0xE,release,0xEE '$(PROD)' '$(DESC)' '$(COMMENT)'
|
||||
|
||||
France.rez: rezskel
|
||||
modskel $* verFrance 0xFF,0xF,0xF,beta,0xFF '$(PROD)' '$(DESC)' '$(COMMENT)'
|
||||
|
||||
# Generate at least one decent-sized rVersion resource
|
||||
Portugal.rez: rezskel
|
||||
modskel $* ver$* $(LVERSION) '$(LPROD)' '$(LDESC)' '$(LCOMMENT)'
|
||||
|
||||
# Generate a couple of examples with out-of-range country numbers
|
||||
Bad26.rez: rezskel
|
||||
modskel $* 26 $(VERSION) '$(PROD)' '$(DESC)' '$(COMMENT)'
|
||||
|
||||
Bad55.rez: rezskel
|
||||
modskel $* 55 $(VERSION) '$(PROD)' '$(DESC)' '$(COMMENT)'
|
||||
|
||||
Bad80.rez: rezskel
|
||||
modskel $* 80 $(VERSION) '$(PROD)' '$(DESC)' '$(COMMENT)'
|
||||
|
||||
clean:
|
||||
-$(RM) -f $(OBJS) norver.r
|
||||
-$(RM) -f $(OBJS:s/.r/.rez/:f)
|
214
usr.bin/getvers/tests/dotests
Normal file
214
usr.bin/getvers/tests/dotests
Normal file
@ -0,0 +1,214 @@
|
||||
# -------------------------------------------------------------------
|
||||
#
|
||||
# Tests for getvers command; invoked by command file "fulltests"
|
||||
# Written by Dave Tribby (April 1998)
|
||||
# $Id: dotests,v 1.1 1998/04/29 00:42:03 tribby Exp $
|
||||
#
|
||||
# -------------------------------------------------------------------
|
||||
|
||||
# If test resource files aren't present, create them before running
|
||||
# this script.
|
||||
# NOTE: should be able to simply call dmake, but that hasn't worked
|
||||
# on my GS. Your results may vary...but the following method
|
||||
# has worked: create command file via dmake, then execute it.
|
||||
## rm -f /tmp/makerez
|
||||
## dmake -n > /tmp/makerez
|
||||
## chtyp -l exec /tmp/makerez
|
||||
## /tmp/makerez
|
||||
|
||||
|
||||
# Location of the cut command to be tested
|
||||
set testcmd="/obj/gno/usr.bin/getvers/getvers"
|
||||
|
||||
# GNO's rm command is implemented under the cp command
|
||||
set RM="cp -p rm"
|
||||
|
||||
# Use either cmp or diff for comparing files
|
||||
set compare=diff
|
||||
|
||||
# Create directory under /tmp to hold results
|
||||
$RM -rf /tmp/out > /tmp/err.list
|
||||
mkdir /tmp/out
|
||||
|
||||
# Record starting time
|
||||
echo -n "Testing command $testcmd beginning at"
|
||||
date
|
||||
|
||||
set src="US.r Russia.r Yugo.r Ireland.r Thai.r Portugal.r"
|
||||
set cmp="out/default.out"
|
||||
set dest="/tmp/$cmp"
|
||||
echo "Default output"
|
||||
$testcmd $src > $dest
|
||||
echo " Completion status = $status"
|
||||
echo "Checking results against control file $cmp (no differences expected)"
|
||||
$compare $cmp $dest
|
||||
echo " comparison status = $status"
|
||||
echo ""
|
||||
|
||||
set cmp="out/comment.out"
|
||||
set dest="/tmp/$cmp"
|
||||
echo "Complete output"
|
||||
$testcmd -c $src > $dest
|
||||
echo " Completion status = $status"
|
||||
echo "Checking results against control file $cmp (no differences expected)"
|
||||
$compare $cmp $dest
|
||||
echo " comparison status = $status"
|
||||
echo ""
|
||||
|
||||
set cmp="out/brief.out"
|
||||
set dest="/tmp/$cmp"
|
||||
echo "Brief output"
|
||||
$testcmd -b $src > $dest
|
||||
echo " Completion status = $status"
|
||||
echo "Checking results against control file $cmp (no differences expected)"
|
||||
$compare $cmp $dest
|
||||
echo " comparison status = $status"
|
||||
echo ""
|
||||
|
||||
set cmp="out/quiet.out"
|
||||
set dest="/tmp/$cmp"
|
||||
echo "Quiet output"
|
||||
$testcmd -q $src > $dest
|
||||
echo " Completion status = $status"
|
||||
echo "Checking results against control file $cmp (no differences expected)"
|
||||
$compare $cmp $dest
|
||||
echo " comparison status = $status"
|
||||
echo ""
|
||||
|
||||
set src="Arabia.r Britain.r Cyprus.r Denmark.r Latvia.r France.r"
|
||||
set cmp="out/badver.out"
|
||||
set dest="/tmp/$cmp"
|
||||
echo "Illegal versions"
|
||||
$testcmd -c $src > $dest
|
||||
echo " Completion status = $status"
|
||||
echo "Checking results against control file $cmp (no differences expected)"
|
||||
$compare $cmp $dest
|
||||
echo " comparison status = $status"
|
||||
echo ""
|
||||
|
||||
set src="Germany.r Italy.r Netherlands.r BelgiumLux.r Sweden.r Spain.r"
|
||||
set src="$src Australia.r Finland.r FrSwiss.r GrSwiss.r Greece.r Iceland.r Malta.r"
|
||||
set cmp="out/remain1.out"
|
||||
set dest="/tmp/$cmp"
|
||||
echo "Remaining countries (part 1)"
|
||||
$testcmd $src > $dest
|
||||
echo " Completion status = $status"
|
||||
echo "Checking results against control file $cmp (no differences expected)"
|
||||
$compare $cmp $dest
|
||||
echo " comparison status = $status"
|
||||
echo ""
|
||||
|
||||
set src="India.r Pakistan.r Lithuania.r Poland.r Hungary.r Estonia.r Lapland.r"
|
||||
set src="$src Iran.r Korea.r China.r Taiwan.r FaeroeIsl.r Turkey.r FrCanada.r"
|
||||
set cmp="out/remain2.out"
|
||||
set dest="/tmp/$cmp"
|
||||
echo "Remaining countries (part 2)"
|
||||
$testcmd $src > $dest
|
||||
echo " Completion status = $status"
|
||||
echo "Checking results against control file $cmp (no differences expected)"
|
||||
$compare $cmp $dest
|
||||
echo " comparison status = $status"
|
||||
echo ""
|
||||
|
||||
set src="Bad26.r Bad55.r Bad80.r"
|
||||
set cmp="out/unknown.out"
|
||||
set dest="/tmp/$cmp"
|
||||
echo "Unknown country"
|
||||
$testcmd -c $src > $dest
|
||||
echo " Completion status = $status"
|
||||
echo "Checking results against control file $cmp (no differences expected)"
|
||||
$compare $cmp $dest
|
||||
echo " comparison status = $status"
|
||||
echo ""
|
||||
|
||||
|
||||
echo "***** Error Messages *****"
|
||||
echo ""
|
||||
|
||||
set src="badname"
|
||||
set cmp="out/nofile.out"
|
||||
set dest="/tmp/$cmp"
|
||||
echo "Expected error: $src: File not found"
|
||||
$testcmd $src > $dest
|
||||
echo " Error completion status = $status (expected: 1)"
|
||||
echo "Checking results against control file $cmp (no differences expected)"
|
||||
$compare $cmp $dest
|
||||
echo " comparison status = $status"
|
||||
echo ""
|
||||
|
||||
set src="/tmp/newfile"
|
||||
$RM -f $src > /tmp/err.list
|
||||
echo "This is a file without a resource fork" > $src
|
||||
set cmp="out/norez.out"
|
||||
set dest="/tmp/$cmp"
|
||||
echo "Expected error: $src: No resource fork"
|
||||
$testcmd $src > $dest
|
||||
echo " Error completion status = $status (expected: 1)"
|
||||
echo "Checking results against control file $cmp (no differences expected)"
|
||||
$compare $cmp $dest
|
||||
echo " comparison status = $status"
|
||||
echo ""
|
||||
|
||||
set src="norver.r"
|
||||
set cmp="out/norver.out"
|
||||
set dest="/tmp/$cmp"
|
||||
echo "Expected error: $src: No version resource"
|
||||
$testcmd $src > $dest
|
||||
echo " Error completion status = $status (expected: 1)"
|
||||
echo "Checking results against control file $cmp (no differences expected)"
|
||||
$compare $cmp $dest
|
||||
echo " comparison status = $status"
|
||||
echo ""
|
||||
|
||||
|
||||
set src="badname /tmp/newfile norver.r Portugal.r US.r"
|
||||
set cmp="out/mixerr.out"
|
||||
set dest="/tmp/$cmp"
|
||||
echo "Expected mix of errors and non-errors with no option"
|
||||
$testcmd $src > $dest
|
||||
echo " Error completion status = $status (expected: 1)"
|
||||
echo "Checking results against control file $cmp (no differences expected)"
|
||||
$compare $cmp $dest
|
||||
echo " comparison status = $status"
|
||||
echo ""
|
||||
|
||||
set cmp="out/mixerrb.out"
|
||||
set dest="/tmp/$cmp"
|
||||
echo "Expected mix of errors and non-errors with -b option"
|
||||
$testcmd -b $src > $dest
|
||||
echo " Error completion status = $status (expected: 1)"
|
||||
echo "Checking results against control file $cmp (no differences expected)"
|
||||
$compare $cmp $dest
|
||||
echo " comparison status = $status"
|
||||
echo ""
|
||||
|
||||
set cmp="out/mixerrq.out"
|
||||
set dest="/tmp/$cmp"
|
||||
echo "Expected mix of errors and non-errors with -q option"
|
||||
$testcmd -q $src > $dest
|
||||
echo " Error completion status = $status (expected: 1)"
|
||||
echo "Checking results against control file $cmp (no differences expected)"
|
||||
$compare $cmp $dest
|
||||
echo " comparison status = $status"
|
||||
echo ""
|
||||
|
||||
set cmp="out/mixerrbq.out"
|
||||
set dest="/tmp/$cmp"
|
||||
echo "Expected mix of errors and non-errors with -bq option"
|
||||
$testcmd -bq $src > $dest
|
||||
echo " Error completion status = $status (expected: 1)"
|
||||
echo "Checking results against control file $cmp (no differences expected)"
|
||||
$compare $cmp $dest
|
||||
echo " comparison status = $status"
|
||||
echo ""
|
||||
|
||||
|
||||
set cmp="out/illop.cond"
|
||||
set dest="/tmp/$cmp"
|
||||
echo "Expected error: illegal option"
|
||||
$testcmd -x $src > $dest
|
||||
echo " Error completion status = $status (expected: 1)"
|
||||
echo "Checking results against control file $cmp (no differences expected)"
|
||||
$compare $cmp $dest
|
||||
echo " comparison status = $status"
|
||||
echo ""
|
13
usr.bin/getvers/tests/modskel
Normal file
13
usr.bin/getvers/tests/modskel
Normal file
@ -0,0 +1,13 @@
|
||||
# Generate rez file $1.rez with indicated parameters
|
||||
# Written by Dave Tribby to test getvers * April 1998
|
||||
|
||||
echo "Creating $1.rez"
|
||||
echo "" > $1.rez
|
||||
echo "#define COUNTRY $2" >> $1.rez
|
||||
echo "#define VERSION $3" >> $1.rez
|
||||
echo "#define PROG \"$4\"" >> $1.rez
|
||||
echo '#define DESC "'$5'"' >> $1.rez
|
||||
echo '#define COMMENT "'$6'"' >> $1.rez
|
||||
cat rezskel >> $1.rez
|
||||
|
||||
chtyp -l rez $1.rez
|
66
usr.bin/getvers/tests/mytypes.rez
Normal file
66
usr.bin/getvers/tests/mytypes.rez
Normal file
@ -0,0 +1,66 @@
|
||||
/*
|
||||
* Subset of resource types needed for testing getvers. Taken from:
|
||||
* Types.Rez - 3/4/92
|
||||
* Rez Resource templates for standard IIGS system types
|
||||
*
|
||||
* Copyright Apple Computer, Inc. 1988-1992
|
||||
* All Rights Reserved.
|
||||
*
|
||||
*/
|
||||
|
||||
/* Resource Types */
|
||||
#define rVersion $8029
|
||||
#define rComment $802A
|
||||
|
||||
/* Definitions and Std Ref Descriptors */
|
||||
|
||||
#Define NIL 0
|
||||
#Define RefIsPtr $0000
|
||||
#Define RefIsPointer $0000 /* spelling variant */
|
||||
#Define RefIsHandle $0001
|
||||
#Define RefIsResource $0002
|
||||
|
||||
|
||||
// Equates for the country code of an rVersion resource
|
||||
|
||||
#define Region verUS, verFrance, verBritain, verGermany, \
|
||||
verItaly, verNetherlands, verBelgiumLux, \
|
||||
verFrBelgiumLux = 6, verSweden, verSpain, \
|
||||
verDenmark, verPortugal, verFrCanada, verNorway, \
|
||||
verIsrael, verJapan, verAustralia, verArabia, \
|
||||
verArabic=16, verFinland, verFrSwiss, verGrSwiss, \
|
||||
verGreece, verIceland, verMalta, verCyprus, \
|
||||
verTurkey, verYugoslavia, verYugoCroatian = 25, \
|
||||
verIndia = 33, verIndiaHindi = 33, verPakistan, \
|
||||
verLithuania = 41, verPoland, verHungary, \
|
||||
verEstonia, verLatvia, verLapland, verFaeroeIsl, \
|
||||
verIran, verRussia, verIreland = 50, verKorea, \
|
||||
verChina, verTaiwan, verThailand \
|
||||
|
||||
|
||||
/*********************************************************/
|
||||
/* The Resource Definitions.
|
||||
/*********************************************************/
|
||||
|
||||
|
||||
/*------------------- rVersion ------------------*/
|
||||
type rVersion {
|
||||
ReverseBytes {
|
||||
hex byte; // Major revision in BCD
|
||||
hex bitstring[4]; // Minor vevision in BCD
|
||||
hex bitstring[4]; // Bug version
|
||||
hex byte development = 0x20, // Release stage
|
||||
alpha = 0x40,
|
||||
beta = 0x60,
|
||||
final = 0x80, /* or */ release = 0xA0;
|
||||
hex byte; // Non-final release #
|
||||
};
|
||||
integer Region; // Region code
|
||||
pstring; // Short version number
|
||||
pstring; // Long version number
|
||||
};
|
||||
|
||||
/*------------------- rComment ------------------*/
|
||||
type rComment {
|
||||
string;
|
||||
};
|
6
usr.bin/getvers/tests/norver.rez
Normal file
6
usr.bin/getvers/tests/norver.rez
Normal file
@ -0,0 +1,6 @@
|
||||
|
||||
// Special test case for getvers: no rVersion resource (only a comment)
|
||||
|
||||
#include "mytypes.rez"
|
||||
|
||||
resource rComment (1, purgeable3) {"This resource fork has no rVersion"};
|
29
usr.bin/getvers/tests/out/badver.out
Normal file
29
usr.bin/getvers/tests/out/badver.out
Normal file
@ -0,0 +1,29 @@
|
||||
Arabia.r: product ??.?.?a??
|
||||
A0-AF:c*ss(R)(C)(TM)'<>AE0
|
||||
Country: Arabia
|
||||
B0-BF:+-<=>=YuaoOae0
|
||||
|
||||
Britain.r: product ??.?.?b??
|
||||
C0-CF:?!f<<>>... AAOOEoe
|
||||
Country: Britain
|
||||
D0-DF:---""''yY/o<>fifl
|
||||
|
||||
Cyprus.r: product ??.?.?f??
|
||||
E0-EF:.,,,AEAEEIIIIOO
|
||||
Country: Cyprus
|
||||
F0-FF:OUUUi
|
||||
|
||||
Denmark.r: product ??.?.?d??
|
||||
Program description
|
||||
Country: Denmark
|
||||
Program comment
|
||||
|
||||
Latvia.r: product ??.?.????
|
||||
Program description
|
||||
Country: Latvia
|
||||
Program comment
|
||||
|
||||
France.r: product ??.?.?b??
|
||||
Program description
|
||||
Country: France
|
||||
Program comment
|
6
usr.bin/getvers/tests/out/brief.out
Normal file
6
usr.bin/getvers/tests/out/brief.out
Normal file
@ -0,0 +1,6 @@
|
||||
US.r: product 2.0
|
||||
Russia.r: product 99.9.9a99
|
||||
Yugo.r: getvers 0.0f0
|
||||
Ireland.r: getvers 3.2.1
|
||||
Thai.r: getvers 1.2.3d4
|
||||
Portugal.r: Super Graphics Destroyer 2.0
|
29
usr.bin/getvers/tests/out/comment.out
Normal file
29
usr.bin/getvers/tests/out/comment.out
Normal file
@ -0,0 +1,29 @@
|
||||
US.r: product 2.0
|
||||
00-0F:
|
||||
Country: United States
|
||||
10-1F:
|
||||
|
||||
Russia.r: product 99.9.9a99
|
||||
20-2F: !"#$%&'()*+,-./
|
||||
Country: Russia
|
||||
30-3F:0123456789:;<=>?
|
||||
|
||||
Yugo.r: getvers 0.0f0
|
||||
40-4F:@ABCDEFGHIJKLMNO
|
||||
Country: Bosnia/Herzegovena/Yugoslavia/Croatia
|
||||
50-5F:PQRSTUVWXYZ[\]^_
|
||||
|
||||
Ireland.r: getvers 3.2.1
|
||||
60-6F:`abcdefghijklmno
|
||||
Country: Ireland
|
||||
70-7F:pqrstuvwxyz{|}~
|
||||
|
||||
Thai.r: getvers 1.2.3d4
|
||||
80-8F:AACENOUaaaaaacee
|
||||
Country: Thailand
|
||||
90-9F:eeiiiinooooouuuu
|
||||
|
||||
Portugal.r: Super Graphics Destroyer 2.0
|
||||
(C) 1991 Pretty as a Picture, Inc.
|
||||
Country: Portugal
|
||||
This is the comment displayed by the Finder(TM) when file Information is requested.
|
23
usr.bin/getvers/tests/out/default.out
Normal file
23
usr.bin/getvers/tests/out/default.out
Normal file
@ -0,0 +1,23 @@
|
||||
US.r: product 2.0
|
||||
00-0F:
|
||||
Country: United States
|
||||
|
||||
Russia.r: product 99.9.9a99
|
||||
20-2F: !"#$%&'()*+,-./
|
||||
Country: Russia
|
||||
|
||||
Yugo.r: getvers 0.0f0
|
||||
40-4F:@ABCDEFGHIJKLMNO
|
||||
Country: Bosnia/Herzegovena/Yugoslavia/Croatia
|
||||
|
||||
Ireland.r: getvers 3.2.1
|
||||
60-6F:`abcdefghijklmno
|
||||
Country: Ireland
|
||||
|
||||
Thai.r: getvers 1.2.3d4
|
||||
80-8F:AACENOUaaaaaacee
|
||||
Country: Thailand
|
||||
|
||||
Portugal.r: Super Graphics Destroyer 2.0
|
||||
(C) 1991 Pretty as a Picture, Inc.
|
||||
Country: Portugal
|
2
usr.bin/getvers/tests/out/illop.cond
Normal file
2
usr.bin/getvers/tests/out/illop.cond
Normal file
@ -0,0 +1,2 @@
|
||||
illegal option -- x
|
||||
usage: getvers [-b] [-c] [-q] file ...
|
13
usr.bin/getvers/tests/out/mixerr.out
Normal file
13
usr.bin/getvers/tests/out/mixerr.out
Normal file
@ -0,0 +1,13 @@
|
||||
badname: File not found
|
||||
|
||||
/tmp/newfile: No resource fork
|
||||
|
||||
norver.r: No version resource
|
||||
|
||||
Portugal.r: Super Graphics Destroyer 2.0
|
||||
(C) 1991 Pretty as a Picture, Inc.
|
||||
Country: Portugal
|
||||
|
||||
US.r: product 2.0
|
||||
00-0F:
|
||||
Country: United States
|
5
usr.bin/getvers/tests/out/mixerrb.out
Normal file
5
usr.bin/getvers/tests/out/mixerrb.out
Normal file
@ -0,0 +1,5 @@
|
||||
badname: File not found
|
||||
/tmp/newfile: No resource fork
|
||||
norver.r: No version resource
|
||||
Portugal.r: Super Graphics Destroyer 2.0
|
||||
US.r: product 2.0
|
2
usr.bin/getvers/tests/out/mixerrbq.out
Normal file
2
usr.bin/getvers/tests/out/mixerrbq.out
Normal file
@ -0,0 +1,2 @@
|
||||
Super Graphics Destroyer 2.0
|
||||
product 2.0
|
6
usr.bin/getvers/tests/out/mixerrq.out
Normal file
6
usr.bin/getvers/tests/out/mixerrq.out
Normal file
@ -0,0 +1,6 @@
|
||||
Super Graphics Destroyer 2.0
|
||||
(C) 1991 Pretty as a Picture, Inc.
|
||||
Country: Portugal
|
||||
product 2.0
|
||||
00-0F:
|
||||
Country: United States
|
1
usr.bin/getvers/tests/out/nofile.out
Normal file
1
usr.bin/getvers/tests/out/nofile.out
Normal file
@ -0,0 +1 @@
|
||||
badname: File not found
|
1
usr.bin/getvers/tests/out/norez.out
Normal file
1
usr.bin/getvers/tests/out/norez.out
Normal file
@ -0,0 +1 @@
|
||||
/tmp/newfile: No resource fork
|
1
usr.bin/getvers/tests/out/norver.out
Normal file
1
usr.bin/getvers/tests/out/norver.out
Normal file
@ -0,0 +1 @@
|
||||
norver.r: No version resource
|
18
usr.bin/getvers/tests/out/quiet.out
Normal file
18
usr.bin/getvers/tests/out/quiet.out
Normal file
@ -0,0 +1,18 @@
|
||||
product 2.0
|
||||
00-0F:
|
||||
Country: United States
|
||||
product 99.9.9a99
|
||||
20-2F: !"#$%&'()*+,-./
|
||||
Country: Russia
|
||||
getvers 0.0f0
|
||||
40-4F:@ABCDEFGHIJKLMNO
|
||||
Country: Bosnia/Herzegovena/Yugoslavia/Croatia
|
||||
getvers 3.2.1
|
||||
60-6F:`abcdefghijklmno
|
||||
Country: Ireland
|
||||
getvers 1.2.3d4
|
||||
80-8F:AACENOUaaaaaacee
|
||||
Country: Thailand
|
||||
Super Graphics Destroyer 2.0
|
||||
(C) 1991 Pretty as a Picture, Inc.
|
||||
Country: Portugal
|
51
usr.bin/getvers/tests/out/remain1.out
Normal file
51
usr.bin/getvers/tests/out/remain1.out
Normal file
@ -0,0 +1,51 @@
|
||||
Germany.r: product 1.0
|
||||
Program description
|
||||
Country: Germany
|
||||
|
||||
Italy.r: product 1.0
|
||||
Program description
|
||||
Country: Italy
|
||||
|
||||
Netherlands.r: product 1.0
|
||||
Program description
|
||||
Country: Netherlands
|
||||
|
||||
BelgiumLux.r: product 1.0
|
||||
Program description
|
||||
Country: Belgium/Luxembourg
|
||||
|
||||
Sweden.r: product 1.0
|
||||
Program description
|
||||
Country: Sweden
|
||||
|
||||
Spain.r: product 1.0
|
||||
Program description
|
||||
Country: Spain
|
||||
|
||||
Australia.r: product 1.0
|
||||
Program description
|
||||
Country: Australia
|
||||
|
||||
Finland.r: product 1.0
|
||||
Program description
|
||||
Country: Finland
|
||||
|
||||
FrSwiss.r: product 1.0
|
||||
Program description
|
||||
Country: French Swiss
|
||||
|
||||
GrSwiss.r: product 1.0
|
||||
Program description
|
||||
Country: German Swiss
|
||||
|
||||
Greece.r: product 1.0
|
||||
Program description
|
||||
Country: Greece
|
||||
|
||||
Iceland.r: product 1.0
|
||||
Program description
|
||||
Country: Iceland
|
||||
|
||||
Malta.r: product 1.0
|
||||
Program description
|
||||
Country: Malta
|
55
usr.bin/getvers/tests/out/remain2.out
Normal file
55
usr.bin/getvers/tests/out/remain2.out
Normal file
@ -0,0 +1,55 @@
|
||||
India.r: product 1.0
|
||||
Program description
|
||||
Country: India
|
||||
|
||||
Pakistan.r: product 1.0
|
||||
Program description
|
||||
Country: Pakistan
|
||||
|
||||
Lithuania.r: product 1.0
|
||||
Program description
|
||||
Country: Lithuania
|
||||
|
||||
Poland.r: product 1.0
|
||||
Program description
|
||||
Country: Poland
|
||||
|
||||
Hungary.r: product 1.0
|
||||
Program description
|
||||
Country: Hungary
|
||||
|
||||
Estonia.r: product 1.0
|
||||
Program description
|
||||
Country: Estonia
|
||||
|
||||
Lapland.r: product 1.0
|
||||
Program description
|
||||
Country: Lapland
|
||||
|
||||
Iran.r: product 1.0
|
||||
Program description
|
||||
Country: Iran
|
||||
|
||||
Korea.r: product 1.0
|
||||
Program description
|
||||
Country: Korea
|
||||
|
||||
China.r: product 1.0
|
||||
Program description
|
||||
Country: China
|
||||
|
||||
Taiwan.r: product 1.0
|
||||
Program description
|
||||
Country: Taiwan
|
||||
|
||||
FaeroeIsl.r: product 1.0
|
||||
Program description
|
||||
Country: Faeroe Islands
|
||||
|
||||
Turkey.r: product 1.0
|
||||
Program description
|
||||
Country: Turkey
|
||||
|
||||
FrCanada.r: product 1.0
|
||||
Program description
|
||||
Country: French Canadian
|
14
usr.bin/getvers/tests/out/unknown.out
Normal file
14
usr.bin/getvers/tests/out/unknown.out
Normal file
@ -0,0 +1,14 @@
|
||||
Bad26.r: product 1.0
|
||||
Program description
|
||||
Country: unknown to this version of getvers
|
||||
Program comment
|
||||
|
||||
Bad55.r: product 1.0
|
||||
Program description
|
||||
Country: unknown to this version of getvers
|
||||
Program comment
|
||||
|
||||
Bad80.r: product 1.0
|
||||
Program description
|
||||
Country: unknown to this version of getvers
|
||||
Program comment
|
16
usr.bin/getvers/tests/rezskel
Normal file
16
usr.bin/getvers/tests/rezskel
Normal file
@ -0,0 +1,16 @@
|
||||
|
||||
#include "mytypes.rez"
|
||||
|
||||
/* Version */
|
||||
resource rVersion (1, purgeable3) {
|
||||
{ VERSION }, /* x.y.z development|alpha|beta|final|release
|
||||
non-final release number */
|
||||
COUNTRY,
|
||||
PROG,
|
||||
DESC
|
||||
};
|
||||
|
||||
/* Comment */
|
||||
resource rComment (1, purgeable3) {
|
||||
COMMENT
|
||||
};
|
Loading…
x
Reference in New Issue
Block a user