mirror of https://github.com/GnoConsortium/gno.git
Describe (and related utils), version 1.0.1. Like v1.0, this checkin
does not include resource forks. See the README for changes. This update by Devin Reade.
This commit is contained in:
parent
effd236a58
commit
3a79f5a3a6
|
@ -0,0 +1,125 @@
|
|||
$Id: README,v 1.1 1996/01/22 01:37:59 gdr Exp $
|
||||
|
||||
This is the README file for the describe package. This package is
|
||||
designated as version 1.0.1, and consists of the following utilities:
|
||||
|
||||
describe v1.0.1 - show database entries describing the current
|
||||
status of programs
|
||||
|
||||
descc v1.0.1 - the describe source compiler
|
||||
|
||||
descu v1.0 - the describe source updater
|
||||
|
||||
ABOUT DESCRIBE AND DESCC
|
||||
========================
|
||||
|
||||
This is yet another project I've been sitting on for a while, but have
|
||||
finally decided to release. The basic idea of the 'describe' package
|
||||
(the descc "compiler" and describe itself) is to provide a quick, easy
|
||||
way of accessing information related to the utilities which so many
|
||||
different people are releasing these days. The reason it sat around on
|
||||
my harddrive so long is I was having qualms about its designated role in
|
||||
life. I wasn't sure exactly what I wanted it to do. Well, I've decided
|
||||
to KISS for now: descc simply compiles the utility list, which I maintain,
|
||||
into a (very) simple "database" located in /usr/local/lib/. The companion
|
||||
utility 'describe' is used to fetch information about a particular utility
|
||||
from this "database".
|
||||
|
||||
descc is fairly limited, as is the "database" format itself. Part of the
|
||||
KISS (or it wouldn't be out now) design philosophy ;). Usage is simple:
|
||||
when you get a new listing (I'll provide monthly updates), simply "descc
|
||||
<filename>" where <filename> is the name of the newly released update.
|
||||
descc will simply write over the old database and replace it with the
|
||||
new. (Note: No appendages are allowed by descc. See descu.)
|
||||
|
||||
As always, coments are appreciated. And, moreso than on other projects,
|
||||
I'd appreciate some comments about the direction I'm going in, suggestions
|
||||
as to where to take this, etc. I have a feeling that some fields in the
|
||||
format (eg, FTP:) are rather useless, and I'd like to know what you guys
|
||||
out there think.
|
||||
|
||||
James Brookes
|
||||
jamesb@ecst.csuchico.edu
|
||||
|
||||
ABOUT DESCU
|
||||
===========
|
||||
|
||||
I think describe and descc were really good ideas; they sure beat the
|
||||
text file list of Gno utilities that James used to keep. The one major
|
||||
shortfall I found was having to manually update the describe database
|
||||
source every time I wanted to include a new entry.
|
||||
|
||||
I therefore wrote descu, the describe updater, which is also rather
|
||||
limited due to following the KISS principle.
|
||||
|
||||
For completeness, I have also added the man pages describe.1, descc.8,
|
||||
and descu.8. I briefly pondered having a describe.5, but alas I was too
|
||||
lazy; you can find the file formats as part of descc.8.
|
||||
|
||||
Devin Reade
|
||||
gdr@myrias.ab.ca
|
||||
|
||||
INSTALLATION
|
||||
============
|
||||
|
||||
You can either type "dmake install", or do the following:
|
||||
|
||||
mkdir -p /usr/local/lib
|
||||
cp ./describe /usr/local/bin
|
||||
cp ./descc /usr/sbin
|
||||
cp ./descu /usr/sbin
|
||||
rm /usr/local/bin/descc
|
||||
|
||||
You will also want to do the following, which is NOT done by dmake's
|
||||
install target:
|
||||
|
||||
rehash
|
||||
descc ./describe.source
|
||||
|
||||
CHANGES
|
||||
=======
|
||||
|
||||
This details changes to the entire distribution.
|
||||
|
||||
v1.1 May 1995
|
||||
Initial release for descu.
|
||||
Added -h and -v flags to describe and descc.
|
||||
Common defines and typedefs were extracted to desc.h.
|
||||
Descc now exits -1 on failure (vice 0).
|
||||
In descc, some more error checking and flushing were added. Also,
|
||||
mygets wasn't dereferencing one of its arguments properly.
|
||||
Allocated stack size was increased from 512 to 768 bytes.
|
||||
Describe and descc were modified not to be dependant on the size
|
||||
of integers.
|
||||
Ran source files through indent(1).
|
||||
|
||||
v1.0 Feb 1994
|
||||
Initial release for describe and descc.
|
||||
|
||||
AUTHORS
|
||||
=======
|
||||
|
||||
The original describe and descc utilities and the describe format were
|
||||
written by James Brookes <jamesb@ecst.csuchico.edu>.
|
||||
|
||||
The descu utility and v1.1 modifications to describe and descc were by
|
||||
Devin Reade <gdr@myrias.ab.ca>.
|
||||
|
||||
LEGALESE
|
||||
========
|
||||
|
||||
The describe and descc utilities are copyright (c) 1994-1995 by James
|
||||
Brookes. The descu utility is copyright (c) 1995 by Devin Reade.
|
||||
|
||||
These programs may be freely copied provided that the archive, including
|
||||
source files and this README, remain intact. Modified versions of these
|
||||
programs may not be distributed without the permission of the respective
|
||||
authors.
|
||||
|
||||
Contact the respective authors for permission to include these programs on
|
||||
any commercial software collections. Permission is granted to Usenet sites
|
||||
and GEnie Information Services for inclusion in software archives.
|
||||
|
||||
The Apple IIGS executable files distributed with this archive contain
|
||||
material from the ORCA/C Run-Time Libraries, copyright 1987-1995 by
|
||||
Byte Works, Inc. Used with permission.
|
|
@ -1,20 +0,0 @@
|
|||
About Me
|
||||
~~~~~~~~~
|
||||
Um. Not much to say right now. I'll get back to this part later.
|
||||
|
||||
About My Source
|
||||
~~~~~~~~~~~~~~~
|
||||
I guess I used to feel a bit propriatary about it, but a couple of things
|
||||
have caused me to change my mind:
|
||||
|
||||
1) Losing over half of the eps source, may it rest in peace.
|
||||
2) Yes, people can profit by and sometimes even improve (gasp!) my
|
||||
source. And I'd be a grumpy old coot if I didn't let them.
|
||||
|
||||
So what this means is that most (not all) of my stuff will be released
|
||||
with full source from now henceforth. I only ask of you, the humble masses
|
||||
yearning to be free, please don't distribute modified versions of my programs
|
||||
without first contacting me. I think this is only fair.
|
||||
|
||||
James Brookes
|
||||
jamesb@ecst.csuchico.edu
|
|
@ -0,0 +1,30 @@
|
|||
#pragma optimize -1
|
||||
|
||||
#include <string.h>
|
||||
#include <stdio.h>
|
||||
#include <unistd.h>
|
||||
|
||||
char *basename (char *name) {
|
||||
char *p, brk;
|
||||
|
||||
/* checking for ':' is GS-specific */
|
||||
brk = (strchr(name,':')) ? ':' : '/';
|
||||
p = strrchr(name,brk);
|
||||
|
||||
return ((p) ? p+1 : name);
|
||||
}
|
||||
|
||||
|
||||
#ifdef SHELLCOMD
|
||||
|
||||
int main (int argc, char **argv) {
|
||||
|
||||
if (argc != 2) {
|
||||
fprintf(stderr,"Usage: basename file_name\nVersion 1.0\n");
|
||||
return -1;
|
||||
}
|
||||
printf("%s\n",basename(argv[1]));
|
||||
return 0;
|
||||
}
|
||||
|
||||
#endif /* SHELLCOMD */
|
|
@ -0,0 +1,52 @@
|
|||
/*
|
||||
* Header file for the describe package. This file is
|
||||
* used by describe(1), descc(8), and descu(8).
|
||||
*/
|
||||
|
||||
#define QUOTE_CHAR '#'
|
||||
#define DATABASE "/usr/local/lib/describe"
|
||||
|
||||
#define FIELD_LEN 9
|
||||
#define NAME_LEN 34
|
||||
#define MAX_LINE_LENGTH 81
|
||||
#define FIELD_COUNT 6 /* number of fields below, not including comments */
|
||||
|
||||
#define NAME "Name: "
|
||||
#define VERSION "Version: "
|
||||
#define AUTHOR "Author: "
|
||||
#define CONTACT "Contact: "
|
||||
#define WHERE "Where: "
|
||||
#define FTP "FTP: "
|
||||
|
||||
#define NAME_SHORT "Name:"
|
||||
#define VERSION_SHORT "Version:"
|
||||
#define AUTHOR_SHORT "Author:"
|
||||
#define CONTACT_SHORT "Contact:"
|
||||
#define WHERE_SHORT "Where:"
|
||||
#define FTP_SHORT "FTP:"
|
||||
|
||||
#ifndef FALSE
|
||||
# define FALSE 0
|
||||
# define TRUE 1
|
||||
#endif
|
||||
|
||||
typedef short int2;
|
||||
typedef long int4;
|
||||
|
||||
typedef struct nameEntry_tag {
|
||||
char name[NAME_LEN];
|
||||
long int offset;
|
||||
} nameEntry;
|
||||
|
||||
typedef struct descEntryTag {
|
||||
char *name;
|
||||
char *data;
|
||||
} descEntry;
|
||||
|
||||
extern int optind;
|
||||
extern char *optarg;
|
||||
|
||||
/* extern int getopt_restart(void); */
|
||||
extern void begin_stack_check(void);
|
||||
extern int end_stack_check(void);
|
||||
extern char *basename(char *);
|
|
@ -0,0 +1,86 @@
|
|||
.TH DESCC 8 "System Administration" "7 May 1995" "Version 1.0.1"
|
||||
.SH NAME
|
||||
descc \- the describe(1) source compiler
|
||||
.SH SYNOPSIS
|
||||
.BR descc " [" -hV ]
|
||||
.I sourcefile
|
||||
.SH DESCRIPTION
|
||||
.BR descc
|
||||
compiles the describe source file
|
||||
.I sourcefile
|
||||
and saves the result to the system describe database.
|
||||
.SH OPTIONS
|
||||
.nf
|
||||
\fB-h\fR Show usage information.
|
||||
|
||||
\fB-V\fR Show version information.
|
||||
.fi
|
||||
.SH "FILE FORMATS"
|
||||
The describe source file consists of comments and records. A comment
|
||||
is any line starting with the
|
||||
.BR #
|
||||
character. Each record consists of seven fields. The first
|
||||
six consist of one line of text and begin with the following identifiers:
|
||||
.nf
|
||||
|
||||
Name: (The name of the program.)
|
||||
Version: (The current version number.)
|
||||
Author: (The author or maintainer of the program.)
|
||||
Contact: (How to contact the Author, typically an
|
||||
email address.)
|
||||
Where: (Where the program should be installed.)
|
||||
FTP: (An ftp site from which the program may be
|
||||
obtained.)
|
||||
|
||||
.fi
|
||||
The last field consists of multiple lines of text. It should be
|
||||
a brief description of the program. The following is an example of
|
||||
a complete record:
|
||||
.nf
|
||||
|
||||
Name: descc
|
||||
Version: 1.0.1
|
||||
Author: James Brookes
|
||||
Contact: jamesb@ecst.csuchico.edu
|
||||
Where: /usr/local/bin
|
||||
FTP: ftp.cco.caltech.edu
|
||||
|
||||
Print a multi-line description obtained from the compiled
|
||||
'describe' database; giving utility name, version, author,
|
||||
author's contact, where the utility is, as well as where the
|
||||
utility can be FTPd from on the InterNet.
|
||||
|
||||
.fi
|
||||
.LP
|
||||
The describe database file consists of a
|
||||
.BR Header ,
|
||||
a set of
|
||||
.BR "Name Entries" ,
|
||||
and a set of
|
||||
.BR Records ,
|
||||
in the following format:
|
||||
.nf
|
||||
|
||||
Header
|
||||
2 bytes: Short Int, number of \fBName Entries\fR
|
||||
|
||||
Name Entries
|
||||
34 bytes: NULL-terminated string; name of the utility.
|
||||
4 bytes: Long Int, offset of the \fBrecord\fR in file.
|
||||
|
||||
Records
|
||||
7 variable-length NULL-terminated strings.
|
||||
|
||||
.fi
|
||||
.SH FILES
|
||||
/usr/local/lib/describe \- the system
|
||||
.B describe
|
||||
database.
|
||||
.SH AUTHOR
|
||||
James Brookes <jamesb@ecst.csuchico.edu>.
|
||||
.SH "SEE ALSO"
|
||||
.BR apropos (1),
|
||||
.BR describe (1),
|
||||
.BR man (1),
|
||||
.BR whatis (1),
|
||||
.BR descu (8).
|
|
@ -1,15 +1,11 @@
|
|||
#ifndef _ORCAC_
|
||||
#define _ORCAC_
|
||||
#endif
|
||||
|
||||
#ifdef _ORCAC_
|
||||
#pragma optimize -1
|
||||
#pragma stacksize 512
|
||||
#endif /* _ORCAC_ */
|
||||
|
||||
/* */
|
||||
/* descc - compile info file into describe database file */
|
||||
/* */
|
||||
/* v1.0.1 - Added -h and -V flags [Sat May 06 1995] */
|
||||
/* Extracted certain #defines to "desc.h" */
|
||||
/* Now uses getopt for command line parsing. */
|
||||
/* Fixed some potential bugs. */
|
||||
/* */
|
||||
/* v1.0.0 - James Brookes [Sat Oct 23 1993] */
|
||||
/* released [Thu Mar 31 1994] [!!!!!!!!!!!] */
|
||||
/* */
|
||||
|
@ -33,199 +29,213 @@
|
|||
/* 7 variable-length Null-terminated strings. */
|
||||
/* */
|
||||
|
||||
#pragma optimize 15
|
||||
|
||||
#include <stdio.h>
|
||||
#include <stdlib.h>
|
||||
#include <string.h>
|
||||
#include <getopt.h>
|
||||
#include <assert.h>
|
||||
#include "desc.h"
|
||||
|
||||
#pragma lint -1
|
||||
#define _VERSION_ "v1.0.1"
|
||||
|
||||
/* prototypes */
|
||||
|
||||
void usage(char *callname);
|
||||
void version(char *callname);
|
||||
void puke(int error,int lines);
|
||||
int mygets(char *buffer, int *lines, FILE *FInPtr);
|
||||
int mygets(char *buffer, int2 *lines, FILE *FInPtr);
|
||||
|
||||
/* defines */
|
||||
int Vflag;
|
||||
|
||||
typedef struct nameEntry_tag
|
||||
/* version - print it out */
|
||||
|
||||
{
|
||||
char name[34];
|
||||
long int offset;
|
||||
}nameEntry;
|
||||
|
||||
#define _VERSION_ "v1.0.0"
|
||||
#define QUOTE_CHAR '#'
|
||||
#define OUTFILE "/usr/local/lib/describe"
|
||||
|
||||
#define FIELD_LEN 9
|
||||
|
||||
#define NAME "Name: "
|
||||
#define VERSION "Version: "
|
||||
#define AUTHOR "Author: "
|
||||
#define CONTACT "Contact: "
|
||||
#define WHERE "Where: "
|
||||
#define FTP "FTP: "
|
||||
void version (char *callname) {
|
||||
Vflag++;
|
||||
fprintf(stderr,"%s version %s\n",callname,_VERSION_);
|
||||
return;
|
||||
}
|
||||
|
||||
/* */
|
||||
/* usage - you know what to do */
|
||||
/* */
|
||||
|
||||
void usage (char *callname)
|
||||
|
||||
{
|
||||
fprintf(stderr,"%s %s\n",callname,_VERSION_);
|
||||
fprintf(stderr,"usage: %s <describe sourcefile>\n",callname);
|
||||
exit(0);
|
||||
}
|
||||
void usage (char *callname) {
|
||||
if (!Vflag) version(callname);
|
||||
fprintf(stderr,"usage: %s [-hV] <describe_sourcefile>\n",callname);
|
||||
exit(-1);
|
||||
}
|
||||
|
||||
/* */
|
||||
/* puke - stdlib errors */
|
||||
/* */
|
||||
|
||||
void puke (int error,int lines)
|
||||
|
||||
{
|
||||
fprintf(stderr,"\nError $%x in line %d of script\n",error,lines);
|
||||
fflush(stdout);
|
||||
exit(error);
|
||||
}
|
||||
void puke (int error,int lines) {
|
||||
fprintf(stderr,"\nError $%x in line %d of script\n",error,lines);
|
||||
fflush(stdout);
|
||||
exit(error);
|
||||
}
|
||||
|
||||
/* */
|
||||
/* mygets - get a line (skipping commented lines) and increment line count */
|
||||
/* */
|
||||
|
||||
int mygets (char *buffer, int *lines, FILE *FInPtr)
|
||||
int mygets (char *buffer, int2 *lines, FILE *FInPtr) {
|
||||
char *p, c;
|
||||
|
||||
{
|
||||
int i;
|
||||
|
||||
do
|
||||
|
||||
{
|
||||
if (fgets(buffer,80,FInPtr)==NULL)
|
||||
return(-1);
|
||||
buffer[strlen(buffer)-1] = '\0'; /* remove trailing \n */
|
||||
lines++;
|
||||
}
|
||||
|
||||
while(buffer[0] == QUOTE_CHAR || buffer[0] == '\n');
|
||||
return(0);
|
||||
}
|
||||
do {
|
||||
if (fgets(buffer,MAX_LINE_LENGTH,FInPtr)==NULL) {
|
||||
return(-1);
|
||||
}
|
||||
p = buffer + strlen(buffer) - 1; /* remove trailing \n */
|
||||
if (*p == '\n') {
|
||||
*p = '\0';
|
||||
} else {
|
||||
fprintf(stderr,"Line %d exceeds %d characters. Remainder ignored.\n",
|
||||
*lines,MAX_LINE_LENGTH-1);
|
||||
do {
|
||||
c = fgetc(FInPtr);
|
||||
} while ((c!='\n') && !feof(FInPtr));
|
||||
}
|
||||
(*lines)++;
|
||||
} while(buffer[0] == QUOTE_CHAR || buffer[0] == '\n');
|
||||
return(0);
|
||||
}
|
||||
|
||||
/* */
|
||||
/* Mainline */
|
||||
/* */
|
||||
|
||||
int main (int argc, char **argv)
|
||||
int main (int argc, char **argv) {
|
||||
FILE *FInPtr, *FOutPtr;
|
||||
long int *record_locs, currLoc, endOfFile;
|
||||
char *buffer;
|
||||
int2 lines, namecount, i, j;
|
||||
nameEntry nameStruct;
|
||||
int c, errflag;
|
||||
|
||||
{
|
||||
FILE *FInPtr, *FOutPtr;
|
||||
long int *record_locs, currLoc, endOfFile;
|
||||
char *tmpPtr, *buffer;
|
||||
int lines, namecount, c, i, j;
|
||||
nameEntry nameStruct;
|
||||
/* initialize globals */
|
||||
Vflag=0;
|
||||
errflag=0;
|
||||
#ifdef STACK_CHECK
|
||||
begin_stack_check();
|
||||
#endif
|
||||
|
||||
if (argc != 2)
|
||||
usage(argv[0]);
|
||||
assert(sizeof(int2)==2);
|
||||
assert(sizeof(int4)==4);
|
||||
|
||||
/* open input and output files */
|
||||
/* parse command line */
|
||||
while ((c = getopt(argc, argv, "hV")) != EOF) {
|
||||
switch (c) {
|
||||
case 'V':
|
||||
version(basename(argv[0]));
|
||||
break;
|
||||
case 'h': /*FALLTHROUGH*/
|
||||
default:
|
||||
errflag++;
|
||||
break;
|
||||
}
|
||||
}
|
||||
if (errflag || (argc-optind != 1))
|
||||
usage(basename(argv[0]));
|
||||
|
||||
buffer = (char *) malloc (81);
|
||||
if ((FInPtr = fopen(argv[1],"r")) == NULL)
|
||||
|
||||
{
|
||||
fprintf(stderr,"Error opening %s; exiting.\n",argv[1]);
|
||||
free(buffer);
|
||||
exit(1);
|
||||
}
|
||||
/* open input and output files */
|
||||
|
||||
if ((FOutPtr = fopen(OUTFILE,"w+")) == NULL)
|
||||
if ((buffer = malloc (MAX_LINE_LENGTH)) == NULL) {
|
||||
fprintf(stderr,"couldn't allocate line buffer\n");
|
||||
exit (-1);
|
||||
}
|
||||
|
||||
if ((FInPtr = fopen(argv[argc-1],"r")) == NULL) {
|
||||
fprintf(stderr,"Error opening %s; exiting.\n",argv[argc-1]);
|
||||
free(buffer);
|
||||
exit(1);
|
||||
}
|
||||
|
||||
{
|
||||
fprintf(stderr,"Error opening output file %s; exiting.\n",OUTFILE);
|
||||
free(buffer);
|
||||
exit(1);
|
||||
}
|
||||
if ((FOutPtr = fopen(DATABASE,"wb+")) == NULL) {
|
||||
fprintf(stderr,"Error opening database file %s; exiting.\n",DATABASE);
|
||||
free(buffer);
|
||||
exit(1);
|
||||
}
|
||||
|
||||
/* Compile array of names */
|
||||
/* Compile array of names */
|
||||
lines = 0;
|
||||
namecount = 0;
|
||||
|
||||
lines = 0;
|
||||
namecount = 0;
|
||||
fseek(FOutPtr,2,SEEK_CUR); /* space for # of array entries */
|
||||
/* space for # of array entries */
|
||||
fwrite(&namecount,sizeof(namecount),1,FOutPtr);
|
||||
|
||||
while(mygets(buffer,&lines,FInPtr) != -1)
|
||||
|
||||
{
|
||||
if (!strncmp(buffer,NAME,FIELD_LEN)) /* found a match */
|
||||
|
||||
{
|
||||
tmpPtr = &buffer[FIELD_LEN];
|
||||
strcpy(nameStruct.name,tmpPtr);
|
||||
fwrite(&nameStruct,sizeof(nameStruct),1,FOutPtr);
|
||||
namecount++;
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
record_locs = (long int *) malloc (namecount*sizeof(long int));
|
||||
rewind(FInPtr);
|
||||
buffer[0] = '\0';
|
||||
lines = 0;
|
||||
fprintf(FOutPtr,"\t");
|
||||
|
||||
/* Increment to first field */
|
||||
|
||||
while (strncmp(buffer,NAME,FIELD_LEN)) /* found a match! */
|
||||
mygets(buffer,&lines,FInPtr);
|
||||
|
||||
for (i = 0; i < namecount; i++)
|
||||
|
||||
{
|
||||
record_locs[i] = ftell(FOutPtr);
|
||||
for (j = 0; j < 5; j++) /* parse additional info */
|
||||
|
||||
{
|
||||
mygets(buffer,&lines,FInPtr);
|
||||
tmpPtr = &buffer[FIELD_LEN];
|
||||
fprintf(FOutPtr,"%s\n",tmpPtr); /* print out fields */
|
||||
}
|
||||
|
||||
/* handle comment field */
|
||||
|
||||
while (1)
|
||||
|
||||
{
|
||||
if (mygets(buffer,&lines,FInPtr) == -1)
|
||||
break;
|
||||
if (!strncmp(buffer,NAME,FIELD_LEN)) /* until next field */
|
||||
break;
|
||||
fprintf(FOutPtr,"%s ",buffer);
|
||||
}
|
||||
|
||||
fprintf(FOutPtr,"\n");
|
||||
}
|
||||
|
||||
endOfFile = ftell(FOutPtr);
|
||||
rewind(FOutPtr);
|
||||
fwrite(&namecount,2,1,FOutPtr);
|
||||
|
||||
/* time to go through the record_locs array and backpatch in */
|
||||
/* all the record locations. A little slower than necessary */
|
||||
/* perhaps, but it gets the job done. */
|
||||
|
||||
for (i = 0; i < namecount; i++)
|
||||
|
||||
{
|
||||
currLoc = ftell(FOutPtr);
|
||||
fread(&nameStruct,sizeof(nameStruct),1,FOutPtr);
|
||||
fseek(FOutPtr,-(sizeof(nameEntry)),SEEK_CUR);
|
||||
nameStruct.offset = record_locs[i];
|
||||
while(mygets(buffer,&lines,FInPtr) != -1) {
|
||||
if (!strncmp(buffer,NAME,FIELD_LEN)) { /* found a match */
|
||||
strncpy(nameStruct.name,&buffer[FIELD_LEN],NAME_LEN-1);
|
||||
nameStruct.name[NAME_LEN-1] = '\0';
|
||||
fwrite(&nameStruct,sizeof(nameStruct),1,FOutPtr);
|
||||
}
|
||||
namecount++;
|
||||
}
|
||||
}
|
||||
|
||||
fseek(FOutPtr,endOfFile,SEEK_SET);
|
||||
fclose(FOutPtr);
|
||||
free(record_locs);
|
||||
free(buffer);
|
||||
}
|
||||
if ((record_locs = malloc (namecount*sizeof(long int)))==NULL) {
|
||||
fprintf(stderr,"malloc of record_locs failed (%ld bytes); exiting\n",
|
||||
(long) namecount*sizeof(long int));
|
||||
exit(-1);
|
||||
}
|
||||
rewind(FInPtr);
|
||||
fflush(FInPtr);
|
||||
buffer[0] = '\0';
|
||||
lines = 0;
|
||||
fprintf(FOutPtr,"\t");
|
||||
|
||||
/* Increment to first field */
|
||||
|
||||
while (strncmp(buffer,NAME,FIELD_LEN)) /* found a match! */
|
||||
mygets(buffer,&lines,FInPtr);
|
||||
|
||||
/* Write out records and keep track of their file offsets */
|
||||
for (i = 0; i < namecount; i++) {
|
||||
record_locs[i] = ftell(FOutPtr);
|
||||
|
||||
/* print out <Version>, <Author>, <Contact>, <Where>, <FTP> */
|
||||
for (j = 0; j < FIELD_COUNT-1; j++) {
|
||||
buffer[FIELD_LEN] = '\0';
|
||||
mygets(buffer,&lines,FInPtr);
|
||||
fprintf(FOutPtr,"%s\n",&buffer[FIELD_LEN]);
|
||||
}
|
||||
|
||||
/* handle <description> field */
|
||||
for (;;) {
|
||||
if (mygets(buffer,&lines,FInPtr) == -1) break;
|
||||
if (!strncmp(buffer,NAME,FIELD_LEN)) break;
|
||||
fprintf(FOutPtr,"%s ",buffer);
|
||||
}
|
||||
fprintf(FOutPtr,"\n");
|
||||
}
|
||||
|
||||
endOfFile = ftell(FOutPtr);
|
||||
fflush(FOutPtr); /*gdr 1*/
|
||||
rewind(FOutPtr);
|
||||
fwrite(&namecount,sizeof(namecount),1,FOutPtr);
|
||||
fflush(FOutPtr); /*gdr 1*/
|
||||
|
||||
/* time to go through the record_locs array and backpatch in */
|
||||
/* all the record locations. A little slower than necessary */
|
||||
/* perhaps, but it gets the job done. */
|
||||
|
||||
for (i = 0; i < namecount; i++) {
|
||||
fread(&nameStruct,sizeof(nameStruct),1,FOutPtr);
|
||||
fseek(FOutPtr,-(sizeof(nameStruct)),SEEK_CUR);
|
||||
nameStruct.offset = record_locs[i];
|
||||
fwrite(&nameStruct,sizeof(nameStruct),(size_t) 1,FOutPtr);
|
||||
fflush(FOutPtr);
|
||||
}
|
||||
|
||||
fseek(FOutPtr,endOfFile,SEEK_SET);
|
||||
fclose(FOutPtr);
|
||||
free(record_locs);
|
||||
free(buffer);
|
||||
|
||||
#ifdef STACK_CHECK
|
||||
fprintf(stderr,"stack usage: %d bytes\n",end_stack_check());
|
||||
#endif
|
||||
return 0;
|
||||
}
|
||||
|
|
|
@ -0,0 +1,46 @@
|
|||
.TH DESCRIBE 1 "Commands and Applications" "7 May 1995" "Version 1.0.1"
|
||||
.SH NAME
|
||||
describe \- show information about a program
|
||||
.SH SYNOPSIS
|
||||
.BR describe " [" -hvV ]
|
||||
.I program
|
||||
.SH DESCRIPTION
|
||||
.BR describe
|
||||
will show current information about
|
||||
.IR program .
|
||||
This information includes:
|
||||
.nf
|
||||
|
||||
The name of the program;
|
||||
The program version number;
|
||||
The author (or the person currently maintaining the program);
|
||||
Contact information for the author;
|
||||
Where the utility should be installed;
|
||||
An FTP site from which the program may be obtained, and;
|
||||
A brief description of the program.
|
||||
|
||||
.fi
|
||||
.LP
|
||||
.BR describe
|
||||
uses a database compiled by
|
||||
.BR descc (8).
|
||||
.SH OPTIONS
|
||||
.nf
|
||||
\fB-h\fR Show usage information.
|
||||
|
||||
\fB-v\fR Verbose debugging mode.
|
||||
|
||||
\fB-V\fR Show version information.
|
||||
.fi
|
||||
.SH FILES
|
||||
/usr/local/lib/describe \- the system
|
||||
.B describe
|
||||
database.
|
||||
.SH AUTHOR
|
||||
James Brookes <jamesb@ecst.csuchico.edu>.
|
||||
.SH "SEE ALSO"
|
||||
.BR apropos (1),
|
||||
.BR man (1),
|
||||
.BR whatis (1),
|
||||
.BR descc (8),
|
||||
.BR descu (8).
|
|
@ -1,16 +1,22 @@
|
|||
#pragma optimize 15
|
||||
#pragma stacksize 512
|
||||
/*
|
||||
* describe(1) -- Copyright 1993-1995 James Brookes. See the README and
|
||||
* man page for details.
|
||||
*
|
||||
* We have to have this pragma in here; Orca/C's bit 5 optimization
|
||||
* (loop invariant removal) kills code somewhere in this file, resulting
|
||||
* in a system panic.
|
||||
*/
|
||||
|
||||
#pragma optimize 31
|
||||
|
||||
#include <stdio.h>
|
||||
#include <stdlib.h>
|
||||
#include <string.h>
|
||||
#include <ctype.h>
|
||||
#include <getopt.h>
|
||||
#include "desc.h"
|
||||
|
||||
#pragma lint -1
|
||||
|
||||
#ifdef STACK_CHECK
|
||||
void begin_stack_check(void);
|
||||
int end_stack_check(void);
|
||||
#endif
|
||||
#define _VERSION_ "v1.0.1"
|
||||
|
||||
/* prototypes */
|
||||
|
||||
|
@ -18,188 +24,165 @@ void usage(char *callname);
|
|||
void print_entry(FILE *FInPtr, long int index);
|
||||
void myprintf(char *string, int wordwrap_size);
|
||||
|
||||
/* defines */
|
||||
int Vflag;
|
||||
|
||||
typedef struct nameEntry_tag
|
||||
void version (char *callname) {
|
||||
Vflag++;
|
||||
fprintf(stderr,"%s version %s\n",callname,_VERSION_);
|
||||
return;
|
||||
}
|
||||
|
||||
{
|
||||
char name[34];
|
||||
long int offset;
|
||||
}nameEntry;
|
||||
void usage(char *callname) {
|
||||
if (!Vflag) version(callname);
|
||||
fprintf(stderr,"usage: %s [-hv] <utility_name>\n",callname);
|
||||
exit(-1);
|
||||
}
|
||||
|
||||
#ifndef FALSE
|
||||
#define FALSE 0
|
||||
#define TRUE 1
|
||||
#endif
|
||||
void myprintf(char *string, int wordwrap_size) {
|
||||
int length = 0;
|
||||
char *headString, *tailString;
|
||||
|
||||
headString = tailString = string;
|
||||
printf("\n");
|
||||
while (1) {
|
||||
tailString++; length++;
|
||||
if (*tailString == '\0') {
|
||||
printf("%s",headString);
|
||||
return;
|
||||
} else if (length == wordwrap_size) {
|
||||
while (*tailString != ' ')
|
||||
tailString--;
|
||||
*tailString = '\0';
|
||||
printf("%s\n",headString);
|
||||
headString = tailString+1;
|
||||
length = 0;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
#define _VERSION_ "v1.0"
|
||||
#define INFILE "/usr/local/lib/describe"
|
||||
void print_entry(FILE *FInPtr, long int index) {
|
||||
char *buffer;
|
||||
|
||||
buffer = (char *) malloc (1024);
|
||||
|
||||
#define NAME "Name: "
|
||||
#define VERSION "Version: "
|
||||
#define AUTHOR "Author: "
|
||||
#define CONTACT "Contact: "
|
||||
#define WHERE "Where: "
|
||||
#define FTP "FTP: "
|
||||
|
||||
void usage(char *callname)
|
||||
|
||||
{
|
||||
fprintf(stderr,"Describe %s\n",_VERSION_);
|
||||
fprintf(stderr,"usage: %s -[v] <utilityname>\n",callname);
|
||||
exit(0);
|
||||
}
|
||||
|
||||
void myprintf(char *string, int wordwrap_size)
|
||||
|
||||
{
|
||||
int length = 0;
|
||||
char *headString, *tailString;
|
||||
|
||||
headString = tailString = string;
|
||||
printf("\n");
|
||||
while (1)
|
||||
|
||||
{
|
||||
tailString++; length++;
|
||||
if (*tailString == '\0')
|
||||
|
||||
{
|
||||
printf("%s",headString);
|
||||
return;
|
||||
}
|
||||
|
||||
else if (length == wordwrap_size)
|
||||
|
||||
{
|
||||
while (*tailString != ' ')
|
||||
tailString--;
|
||||
*tailString = '\0';
|
||||
printf("%s\n",headString);
|
||||
headString = tailString+1;
|
||||
length = 0;
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
void print_entry(FILE *FInPtr, long int index)
|
||||
|
||||
{
|
||||
char *buffer;
|
||||
|
||||
buffer = (char *) malloc (1024);
|
||||
|
||||
fseek(FInPtr,index,SEEK_SET);
|
||||
|
||||
printf("%s",VERSION);
|
||||
fgets(buffer,80,FInPtr);
|
||||
printf("%s",buffer);
|
||||
|
||||
printf("%s",AUTHOR);
|
||||
fgets(buffer,80,FInPtr);
|
||||
printf("%s",buffer);
|
||||
|
||||
printf("%s",CONTACT);
|
||||
fgets(buffer,80,FInPtr);
|
||||
printf("%s",buffer);
|
||||
|
||||
printf("%s",WHERE);
|
||||
fgets(buffer,80,FInPtr);
|
||||
printf("%s",buffer);
|
||||
|
||||
printf("%s",FTP);
|
||||
fgets(buffer,80,FInPtr);
|
||||
printf("%s",buffer);
|
||||
|
||||
fgets(buffer,1024,FInPtr);
|
||||
myprintf(buffer,75);
|
||||
|
||||
free(buffer);
|
||||
fseek(FInPtr,index,SEEK_SET);
|
||||
|
||||
printf("%s",VERSION);
|
||||
fgets(buffer,MAX_LINE_LENGTH,FInPtr);
|
||||
printf("%s",buffer);
|
||||
|
||||
printf("%s",AUTHOR);
|
||||
fgets(buffer,MAX_LINE_LENGTH,FInPtr);
|
||||
printf("%s",buffer);
|
||||
|
||||
printf("%s",CONTACT);
|
||||
fgets(buffer,MAX_LINE_LENGTH,FInPtr);
|
||||
printf("%s",buffer);
|
||||
|
||||
printf("%s",WHERE);
|
||||
fgets(buffer,MAX_LINE_LENGTH,FInPtr);
|
||||
printf("%s",buffer);
|
||||
|
||||
printf("%s",FTP);
|
||||
fgets(buffer,MAX_LINE_LENGTH,FInPtr);
|
||||
printf("%s",buffer);
|
||||
|
||||
fgets(buffer,1024,FInPtr);
|
||||
myprintf(buffer,75);
|
||||
|
||||
free(buffer);
|
||||
#ifdef STACK_CHECK
|
||||
printf("Stack: %d\n",end_stack_check());
|
||||
printf("Stack: %d\n",end_stack_check());
|
||||
#endif
|
||||
exit(0);
|
||||
}
|
||||
|
||||
int main (int argc, char **argv)
|
||||
|
||||
{
|
||||
FILE *FInPtr;
|
||||
char searchName[34];
|
||||
long int index;
|
||||
int verbose, argind, numOfEntries, cmp, offset1, offset2, check, i;
|
||||
nameEntry nameStruct;
|
||||
exit(0);
|
||||
}
|
||||
|
||||
int main (int argc, char **argv) {
|
||||
FILE *FInPtr;
|
||||
char searchName[NAME_LEN];
|
||||
int2 verbose, numOfEntries, cmp, offset1, offset2, check, i;
|
||||
nameEntry nameStruct;
|
||||
int c, errflag;
|
||||
char *p;
|
||||
|
||||
#ifdef STACK_CHECK
|
||||
begin_stack_check();
|
||||
begin_stack_check();
|
||||
#endif
|
||||
|
||||
verbose = FALSE;
|
||||
argind = 1;
|
||||
verbose = FALSE;
|
||||
Vflag = FALSE;
|
||||
errflag = FALSE;
|
||||
|
||||
if ((argc == 3) && (!strcmp(argv[1],"-v")))
|
||||
|
||||
{
|
||||
while ((c = getopt(argc,argv,"hvV")) != EOF) {
|
||||
switch (c) {
|
||||
case 'v':
|
||||
verbose = TRUE;
|
||||
argind++;
|
||||
break;
|
||||
case 'V':
|
||||
version(basename(argv[0]));
|
||||
break;
|
||||
case 'h':
|
||||
default:
|
||||
errflag = TRUE;
|
||||
break;
|
||||
}
|
||||
}
|
||||
if (errflag || (argc-optind != 1))
|
||||
usage(basename(argv[0]));
|
||||
|
||||
|
||||
if ((FInPtr = fopen(DATABASE,"r")) == NULL) {
|
||||
perror("couldn't open database");
|
||||
exit(-1);
|
||||
}
|
||||
fread(&numOfEntries,2,1,FInPtr);
|
||||
offset1 = 0;
|
||||
offset2 = numOfEntries-1;
|
||||
|
||||
strcpy(searchName,argv[optind]);
|
||||
i=0;
|
||||
p = searchName;
|
||||
while (*p) {
|
||||
*p = tolower(*p);
|
||||
p++;
|
||||
}
|
||||
|
||||
if (verbose)
|
||||
printf("Searching...\n");
|
||||
|
||||
while (1) {
|
||||
check = ((offset2-offset1)/2) + offset1;
|
||||
fseek(FInPtr,2+(check*sizeof(nameEntry)),SEEK_SET);
|
||||
fread(&nameStruct,sizeof(nameEntry),1,FInPtr);
|
||||
|
||||
cmp = strcmp(nameStruct.name,searchName);
|
||||
|
||||
if (verbose)
|
||||
printf(" checked %s\n",nameStruct.name);
|
||||
|
||||
if (cmp > 0) {
|
||||
offset2 = check-1;
|
||||
} else if (cmp < 0) {
|
||||
offset1 = check+1;
|
||||
} else {
|
||||
if (verbose) {
|
||||
printf("Found entry %s!\n",searchName);
|
||||
#ifdef STACK_CHECK
|
||||
printf("Stack: %d\n",end_stack_check());
|
||||
#endif
|
||||
exit(0);
|
||||
}
|
||||
|
||||
else if (argc != 2)
|
||||
usage(argv[0]);
|
||||
printf("%s%s\n",NAME,searchName);
|
||||
print_entry(FInPtr,nameStruct.offset);
|
||||
}
|
||||
|
||||
FInPtr = fopen(INFILE,"r");
|
||||
fread(&numOfEntries,2,1,FInPtr);
|
||||
offset1 = 0;
|
||||
offset2 = numOfEntries-1;
|
||||
|
||||
strcpy(searchName,argv[argind]);
|
||||
i=0;
|
||||
while(searchName[i] = tolower(searchName[i++]));
|
||||
|
||||
if (verbose)
|
||||
printf("Searching...\n");
|
||||
|
||||
while (1)
|
||||
|
||||
{
|
||||
check = ((offset2-offset1)/2) + offset1;
|
||||
fseek(FInPtr,2+(check*sizeof(nameEntry)),SEEK_SET);
|
||||
fread(&nameStruct,sizeof(nameEntry),1,FInPtr);
|
||||
|
||||
cmp = strcmp(nameStruct.name,searchName);
|
||||
|
||||
if (verbose)
|
||||
printf(" checked %s\n",nameStruct.name);
|
||||
|
||||
if (cmp > 0)
|
||||
offset2 = check-1;
|
||||
|
||||
else if (cmp < 0)
|
||||
offset1 = check+1;
|
||||
|
||||
else
|
||||
|
||||
{
|
||||
if (verbose)
|
||||
|
||||
{
|
||||
printf("Found entry %s!\n",searchName);
|
||||
exit(0);
|
||||
}
|
||||
|
||||
printf("%s%s\n",NAME,searchName);
|
||||
print_entry(FInPtr,nameStruct.offset);
|
||||
}
|
||||
|
||||
if (offset1 > offset2)
|
||||
|
||||
{
|
||||
printf("Entry '%s' not found in describe database.\n",searchName);
|
||||
exit(1);
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
}
|
||||
if (offset1 > offset2) {
|
||||
printf("Entry '%s' not found in describe database.\n",searchName);
|
||||
#ifdef STACK_CHECK
|
||||
printf("Stack: %d\n",end_stack_check());
|
||||
#endif
|
||||
exit(1);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
|
@ -1,6 +1,6 @@
|
|||
#===============================================================================
|
||||
# List of shell applications for GNO/ME Last revision: 11/2/93
|
||||
#===============================================================================
|
||||
#=============================================================================
|
||||
# List of shell applications for GNO/ME Last revision: 07 May 95
|
||||
#=============================================================================
|
||||
#
|
||||
# About this file
|
||||
# ~~~~~~~~~~~~~~~
|
||||
|
@ -11,12 +11,18 @@
|
|||
# sure the directory structure '/usr/local/lib/' exists first! Information
|
||||
# may be later culled from the file with the command 'describe <utility>'.
|
||||
#
|
||||
# While this file may be updated manually, new entries and updates may
|
||||
# also be merged through the use of 'descu'.
|
||||
#
|
||||
# This file is sorted lexicographically based on the Name field. This
|
||||
# means that any names starting with capital letters will appear before
|
||||
# those starting with lower case letters.
|
||||
#
|
||||
# Send additions/corrections to:
|
||||
# ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
|
||||
# James Brookes
|
||||
#
|
||||
# jamesb@ecst.csuchico.edu <-- Preferred
|
||||
# bb252@cleveland.freenet.edu
|
||||
# jamesb@ecst.csuchico.edu
|
||||
#
|
||||
# To obtain the version number of a file:
|
||||
# ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
|
||||
|
@ -24,9 +30,18 @@
|
|||
# B) any usage or -v/V flag supplied by the utility author
|
||||
#
|
||||
#
|
||||
# NB: "Author" may mean who is maintaing the current port, and may not actually
|
||||
# mean the original author of the program.
|
||||
#===============================================================================
|
||||
# NB: "Author" may mean who is maintaing the current port, and may not
|
||||
# actually mean the original author of the program.
|
||||
#==============================================================================
|
||||
|
||||
Name: DRWM
|
||||
Version: 2.01
|
||||
Author: Dave J. Roberts
|
||||
Contact: dave@mary.iia.org
|
||||
Where: /usr/X/bin
|
||||
FTP: ftp.cco.caltech.edu, grind.isca.uiowa.edu
|
||||
|
||||
Davis Rex Window Manager. A window manager for GNO.
|
||||
|
||||
Name: argv0
|
||||
Version: 1.0
|
||||
|
@ -49,6 +64,28 @@ FTP: ...
|
|||
most options--including underline, boldface, margins, centering--on all
|
||||
terminal types.
|
||||
|
||||
Name: bc
|
||||
Version: 1.01
|
||||
Author: Frank Petroski
|
||||
Contact:
|
||||
Where: /usr/bin
|
||||
FTP: ftp.cco.caltech.edu
|
||||
|
||||
GNU bc is an arbitrary precision numeric processing language. Syntax is
|
||||
similar to C, but differs in many substantial areas. It supports
|
||||
interactive execution of statements. bc is a utility included in the
|
||||
POSIX P1003.2/D11 draft standard. Copyright Free Software Foundation.
|
||||
|
||||
Name: bed
|
||||
Version: 1.1.1
|
||||
Author: Phil Vandry
|
||||
Contact: vandry@cam.org
|
||||
Where: /usr/local/bin
|
||||
FTP: grind.isca.uiowa.edu
|
||||
|
||||
A binary editor that can handle "infinitely" long lines and null bytes
|
||||
in the file. Intended for editing binary files.
|
||||
|
||||
Name: binprint
|
||||
Version: 1.2
|
||||
Author: Phillip Vandry
|
||||
|
@ -59,19 +96,19 @@ FTP:
|
|||
Prints a hex dump of files or standard in
|
||||
|
||||
Name: bison
|
||||
Version: 1.03
|
||||
Version: 1.19
|
||||
Author: Soenke Behrens
|
||||
Contact: behrenss@informatik.tu-muenchen.de
|
||||
Contact: schaf@meadow.muc.de
|
||||
Where: /usr/local/bin
|
||||
FTP: ...
|
||||
|
||||
A port of the FSF's yacc replacement. bison is part of the GNU project. yacc
|
||||
is a parser generator (also known as "compiler compiler").
|
||||
A port of the FSF's yacc replacement. bison is part of the GNU project.
|
||||
yacc is a parser generator (also known as "compiler compiler").
|
||||
|
||||
Name: booz
|
||||
Version: 2.0
|
||||
Author: Soenke Behrens
|
||||
Contact: behrenss@informatik.tu-muenchen.de
|
||||
Contact: schaf@meadow.muc.de
|
||||
Where: /usr/local/bin
|
||||
FTP: ...
|
||||
|
||||
|
@ -87,34 +124,35 @@ FTP:
|
|||
Prints a calendar for the current month or any month.
|
||||
|
||||
Name: calls
|
||||
Version: 2.0
|
||||
Author: Devin Reade
|
||||
Contact: glyn@cs.ualberta.ca, glyn@ersys.edm.ab.ca
|
||||
Where: ??
|
||||
FTP: cco.caltech.edu and grind.isca.uiowa.edu.
|
||||
Version: 2.0 (16 Dec 93)
|
||||
Author: Ported by Devin Reade
|
||||
Contact: gdr@myrias.ab.ca
|
||||
Where: /usr/local/bin
|
||||
FTP: ftp.cco.caltech.edu, grind.isca.uiowa.edu.
|
||||
|
||||
A call chart generator, to show the sequence and calling dependancies of
|
||||
functions within a program. It's more flexible than Orca shell version.
|
||||
Requires cpp.
|
||||
|
||||
Name: cc
|
||||
Version: 1.06
|
||||
Name: cclean
|
||||
Version: 1.02
|
||||
Author: Soenke Behrens
|
||||
Contact: behrenss@informatik.tu-muenchen.de
|
||||
Contact: sbehrens@contech.demon.co.uk
|
||||
Where: /usr/local/bin
|
||||
FTP: ...
|
||||
FTP: ftp.cco.caltech.edu, grind.isca.uiowa.edu
|
||||
|
||||
Unixish front-end for ORCA/C. Particularly useful in combination with dmake.
|
||||
For use with occ. Remove the lines ccprep put into a source file from that
|
||||
source file. Part of the occ 1.12 distribution.
|
||||
|
||||
Name: ccprep
|
||||
Version: 1.01
|
||||
Version: 1.1
|
||||
Author: Soenke Behrens
|
||||
Contact: behrenss@informatik.tu-muenchen.de
|
||||
Contact: sbehrens@contech.demon.co.uk
|
||||
Where: /usr/local/bin
|
||||
FTP: ...
|
||||
FTP: ftp.cco.caltech.edu, grind.isca.uiowa.edu
|
||||
|
||||
For use with cc. Allows the use of a kludge file for specifying #pragma
|
||||
statements from the command line.
|
||||
For use with occ. Puts a "#line 2" statement into source files to
|
||||
get around problems with occ 1.12 and ORCA/C 2.03.
|
||||
|
||||
Name: chat
|
||||
Version: 1.0
|
||||
|
@ -155,6 +193,15 @@ FTP: ...
|
|||
|
||||
Runs certain processes at certain times. cron is started by init.
|
||||
|
||||
Name: cu
|
||||
Version: 1.0
|
||||
Author: Dave J. Roberts
|
||||
Contact: daver@interactive.net
|
||||
Where: /usr/local/bin
|
||||
FTP:
|
||||
|
||||
A simple dialup utility.
|
||||
|
||||
Name: date
|
||||
Version: 1.2
|
||||
Author: Phillip Vandry
|
||||
|
@ -165,25 +212,34 @@ FTP: ...
|
|||
Shows the date and time (optionally, continuously).
|
||||
|
||||
Name: descc
|
||||
Version: 1.0
|
||||
Version: 1.0.1
|
||||
Author: James Brookes
|
||||
Contact: jamesb@ecst.csuchico.edu
|
||||
Where: /usr/local/bin
|
||||
FTP: ...
|
||||
Where: /usr/sbin
|
||||
FTP: ftp.cco.caltech.edu
|
||||
|
||||
Compile a source file into a 'describe' database file.
|
||||
|
||||
Name: describe
|
||||
Version: 1.0
|
||||
Version: 1.0.1
|
||||
Author: James Brookes
|
||||
Contact: jamesb@ecst.csuchico.edu
|
||||
Where: /usr/local/bin
|
||||
FTP: ...
|
||||
FTP: ftp.cco.caltech.edu
|
||||
|
||||
Print a multi-line description obtained from the compiled 'describe'
|
||||
database; giving utility name, version, author, author's contact, where the
|
||||
utility is, as well as where the utility can be FTPd from on the InterNet.
|
||||
|
||||
Name: descu
|
||||
Version: 1.0
|
||||
Author: Devin Reade
|
||||
Contact: gdr@myrias.ab.ca
|
||||
Where: /usr/sbin
|
||||
FTP: ftp.cco.caltech.edu
|
||||
|
||||
Update a 'describe' source file.
|
||||
|
||||
Name: dial
|
||||
Version: 1.0
|
||||
Author: Phillip Vandry
|
||||
|
@ -204,14 +260,35 @@ FTP: ...
|
|||
Run from inittab to handle modems on dialup lines.
|
||||
|
||||
Name: dmake
|
||||
Version: 0.4.3b (17 Jan 94)
|
||||
Author: Devin Reade.
|
||||
Contact: <glyn@cs.ualberta.ca>,<glyn@ersys.edm.ab.ca>
|
||||
Where: /usr/bin
|
||||
FTP: cco.caltech.edu,grind.isca.uiowa.edu.
|
||||
Version: 1.0 (4 Jul 94)
|
||||
Author: Ported by Devin Reade.
|
||||
Contact: gdr@myrias.ab.ca
|
||||
Where: /usr/local/bin
|
||||
FTP: ftp.cco.caltech.edu, grind.isca.uiowa.edu.
|
||||
|
||||
A Unix-style make utility for automated compilation.
|
||||
|
||||
Name: dsort
|
||||
Version: 1.0 (14 Jun 94)
|
||||
Author: Devin Reade.
|
||||
Contact: gdr@myrias.ab.ca
|
||||
Where: /usr/local/bin
|
||||
FTP: ftp.cco.caltech.edu, grind.isca.uiowa.edu (in file sorts10.shk)
|
||||
|
||||
Sort a text file on disk lexicographically. Archived together
|
||||
with msort.
|
||||
|
||||
Name: dsplit
|
||||
Version: 1.0 (19 Dec 93)
|
||||
Author: Ported by Devin Reade.
|
||||
Contact: gdr@myrias.ab.ca
|
||||
Where: /usr/local/bin
|
||||
FTP: ftp.cco.caltech.edu, grind.isca.uiowa.edu
|
||||
|
||||
A file splitter, with a default output size of 811520 bytes, suitable
|
||||
for 800k 3.5" floppies. It will work with any type of regular (no
|
||||
resource fork) file.
|
||||
|
||||
Name: eps
|
||||
Version: 1.0
|
||||
Author: James Brookes
|
||||
|
@ -231,30 +308,52 @@ FTP:
|
|||
Evaluates matehmatical expressions; prints result in normal and
|
||||
scientific notation. Uses C like syntax.
|
||||
|
||||
Name: finger
|
||||
Version: 1.1
|
||||
Author: Leslie M. Barstow III
|
||||
Contact: wdphoenix@delphi.com
|
||||
Where: /usr/bin
|
||||
FTP: ...
|
||||
|
||||
finger is a re-write of the UNIX finger utility. Its purpose is to provide
|
||||
information about a user or users. It shows their real name, home directory,
|
||||
default shell, last login time, and two files that they may create to provide
|
||||
further information.
|
||||
|
||||
Name: flex
|
||||
Version: 2.38
|
||||
Author: Soenke Behrens
|
||||
Contact: berenss@informatik.tu-muenchen.de
|
||||
Contact: schaf@meadow.muc.de
|
||||
Where: /usr/local/bin
|
||||
FTP: ...
|
||||
|
||||
A port of the FSF's lex replacement. flex is part of the GNU project. lex
|
||||
is a tokenizer generator, to be used in conjunction with yacc. Note that due
|
||||
to the way the FSF writes their code (yuck), flex has some problems with ints
|
||||
being 16-bit instead of 32-bit on the GS. A version that fixes these problems
|
||||
will be released as soon as the more annoying bugs are out of ORCA/C 2.0.1.
|
||||
A port of the FSF's lex replacement. flex is part of the GNU project.
|
||||
lex is a tokenizer generator, to be used in conjunction with yacc. Note
|
||||
that due to the way the FSF writes their code (yuck), flex has some problems
|
||||
with ints being 16-bit instead of 32-bit on the GS. A version that fixes
|
||||
these problems will be released as soon as the more annoying bugs are out
|
||||
of ORCA/C 2.0.1.
|
||||
|
||||
Name: fmake
|
||||
Version: 1.0
|
||||
Author: Felix Blank
|
||||
Contact: behrenss@informatik.tu-muenchen.de
|
||||
Contact: schaf@meadow.muc.de
|
||||
Where: /usr/local/bin
|
||||
FTP: ...
|
||||
|
||||
fmake is Unixish make utility. It only understands a small subset of make
|
||||
commands, though, barely enough to maintain small projects. Written originally
|
||||
by Felix Blank, now "maintained" by Soenke Behrens. The need for this utility
|
||||
will vanish with the advent of dmake.
|
||||
vanished with the advent of dmake.
|
||||
|
||||
Name: ftn
|
||||
Version: 1.1 (11 Oct 94)
|
||||
Author: Dave J. Roberts. Version 1.1 changes by Devin Reade.
|
||||
Contact: daver@rush.cc.edu, droberts@chaos.bsu.edu
|
||||
Where: /usr/local/bin
|
||||
FTP: ftp.cco.caltech.edu, grind.isca.uiowa.edu
|
||||
|
||||
A utility to display Apple's DTS File Type Notes.
|
||||
|
||||
Name: getvers
|
||||
Version: 1.2
|
||||
|
@ -266,6 +365,16 @@ FTP: pindarus.cs.uiuc.edu
|
|||
Gets the rVersion information on a EXE, including name, version, and any
|
||||
other information the author wishes to include, printing it to standard out.
|
||||
|
||||
Name: gzip
|
||||
Version: 1.2.4 (Gno)
|
||||
Author: Joseph Lee
|
||||
Contact: eaiu410@ea.oac.uci.edu
|
||||
Where: /usr/local/bin
|
||||
FTP: ftp.cco.caltech.edu, grind.isca.uiowa.edu
|
||||
|
||||
GNU zip -- compress or expand files. Ported from the Free Software
|
||||
Foundation's gzip. Also has functionality of gunzip and gzcat.
|
||||
|
||||
Name: init
|
||||
Version: 1.0
|
||||
Author: Phillip Vandry
|
||||
|
@ -286,25 +395,25 @@ FTP: ...
|
|||
syslogd (log daemon)
|
||||
|
||||
Name: joinpara
|
||||
Version: 1.0
|
||||
Version: 1.0 (16 Dec 93)
|
||||
Author: Devin Reade
|
||||
Contact: glyn@cs.ualberta.ca, glyn@ersys.edm.ab.ca
|
||||
Where: /usr/bin
|
||||
FTP: cco.caltech.edu, grind.isca.uiowa.edu.
|
||||
Contact: gdr@myrias.ab.ca
|
||||
Where: /usr/local/bin
|
||||
FTP: ftp.cco.caltech.edu, grind.isca.uiowa.edu.
|
||||
|
||||
A filter to strip newlines from the middle of paragraphs, but not
|
||||
elsewhere. Written to ease the importing of text files into word
|
||||
processor documents.
|
||||
|
||||
Name: last
|
||||
Version: 1.0
|
||||
Version: 1.1
|
||||
Author: Steve Reeves
|
||||
Contact: reevess@cse.fau.edu
|
||||
Contact: Internet: reevess@cse.fau.edu, GEnie: S.REEVES2
|
||||
Where: /usr/bin
|
||||
FTP: grind.isca.uiowa.edu
|
||||
|
||||
last indicates last logins by user or terminal. It searches
|
||||
through the login accounting file "/etc/wtmp" for this information.
|
||||
Displays last logins for specified users or terminals. It searches
|
||||
through the login accounting file "/var/adm/wtmp" for this information.
|
||||
It is only useful with GNO's Multi-User package.
|
||||
|
||||
Name: machtype
|
||||
|
@ -318,24 +427,33 @@ FTP: pindarus.cs.uiuc.edu
|
|||
memory, versions of GNO, GS/OS, and the ROM, accelerator type if any, and more.
|
||||
|
||||
Name: makedmake
|
||||
Version: 1.1.1
|
||||
Author: Devin Reade
|
||||
Contact: <glyn@cs.ualberta.ca>,<glyn@ersys.edm.ab.ca>
|
||||
Where: /usr/bin
|
||||
FTP: cco.caltech.edu,grind.isca.uiowa.edu,pindarus.cs.uiuc.edu
|
||||
Version: 1.1.1 (16 Jan 94)
|
||||
Author: Ported by Devin Reade
|
||||
Contact: gdr@myrias.ab.ca
|
||||
Where: /usr/local/bin
|
||||
FTP: ftp.cco.caltech.edu, grind.isca.uiowa.edu.
|
||||
|
||||
Calculates program dependencies and generates makefiles for dmake.
|
||||
This is a particularily brain-dead port that will likely be superceded.
|
||||
(By mkmf?) Suitable for simple dependancies.
|
||||
|
||||
Name: makewhatis
|
||||
Version: 1.1 (29 May 94)
|
||||
Author: Devin Reade.
|
||||
Contact: gdr@myrias.ab.ca
|
||||
Where: /usr/sbin
|
||||
FTP: ftp.cco.caltech.edu, grind.isca.uiowa.edu
|
||||
|
||||
Generates the whatis database used by apropos(1) and whatis(1).
|
||||
|
||||
Name: martian
|
||||
Version: ??
|
||||
Author: Soenke Behrens
|
||||
Contact: behrenss@informatik.tu-muenchen.de
|
||||
Contact: schaf@meadow.muc.de
|
||||
Where: /usr/local/bin or /usr/local/games
|
||||
FTP: ...
|
||||
|
||||
Creates martian poetry in nroff format. The source is, alas, lost, it seems.
|
||||
Creates martian poetry in nroff format.
|
||||
|
||||
Name: mem
|
||||
Version: 1.2
|
||||
|
@ -346,6 +464,15 @@ FTP: ...
|
|||
|
||||
Shows memory usage statistics in different formats.
|
||||
|
||||
Name: mkdir
|
||||
Version: 1.2
|
||||
Author: James Brookes
|
||||
Contact: jamesb@ecst.csuchico.edu
|
||||
Where: /bin
|
||||
FTP: ...
|
||||
|
||||
Make a directory.
|
||||
|
||||
Name: mkfs
|
||||
Version: 1.0
|
||||
Author: Phillip Vandry
|
||||
|
@ -355,14 +482,15 @@ FTP: ...
|
|||
|
||||
Formats or erases physical devices and creates file systems on them.
|
||||
|
||||
Name: mkdir
|
||||
Version: 1.2
|
||||
Author: James Brookes
|
||||
Contact: jamesb@ecst.csuchico.edu
|
||||
Where: /bin
|
||||
FTP: ...
|
||||
Name: msort
|
||||
Version: 1.0 (14 Jun 94)
|
||||
Author: Devin Reade.
|
||||
Contact: gdr@myrias.ab.ca
|
||||
Where: /usr/local/bin
|
||||
FTP: ftp.cco.caltech.edu, grind.isca.uiowa.edu (in file sorts10.shk)
|
||||
|
||||
Make a directory.
|
||||
Sort a text file in memory lexicographically. Archived together
|
||||
with dsort.
|
||||
|
||||
Name: mugs
|
||||
Version: 3.0
|
||||
|
@ -395,6 +523,16 @@ FTP: ...
|
|||
Create a home directory with basic gshrc for new user, and add user
|
||||
to /var/adm/newuser/newusers file for validation by the system operator.
|
||||
|
||||
Name: occ
|
||||
Version: 1.12
|
||||
Author: Soenke Behrens
|
||||
Contact: sbehrens@contech.demon.co.uk
|
||||
Where: /usr/local/bin
|
||||
FTP: ftp.cco.caltech.edu, grind.isca.uiowa.edu
|
||||
|
||||
Unixish front-end for ORCA/C. Particularly useful in combination with
|
||||
dmake. Requires ORCA/C 2.0.3 (compiler version 2.0.2).
|
||||
|
||||
Name: parent
|
||||
Version: 1.0
|
||||
Author: Phillip Vandry
|
||||
|
@ -415,10 +553,28 @@ FTP: ...
|
|||
Based on talk, phone allows two users to interactively chat in a
|
||||
split-screen format.
|
||||
|
||||
Name: rdial
|
||||
Version: 1.1 (28 Feb 95)
|
||||
Author: Jeremy Rand.
|
||||
Contact: <u8902848@muss.mcmaster.ca>
|
||||
Where: /usr/local/bin
|
||||
FTP: grind.isca.uiowa.edu
|
||||
|
||||
Auto redial a system with a login script.
|
||||
|
||||
Name: rmdir
|
||||
Version: 1.0 (28 Nov 94)
|
||||
Author: Devin Reade.
|
||||
Contact: gdr@myrias.ab.ca
|
||||
Where: /bin
|
||||
FTP: ftp.cco.caltech.edu, grind.isca.uiowa.edu
|
||||
|
||||
Remove empty directories.
|
||||
|
||||
Name: rndname
|
||||
Version: 4.0
|
||||
Author: Soenke Behrens
|
||||
Contact: behrenss@informatik.tu-muenchen.de
|
||||
Contact: schaf@meadow.muc.de
|
||||
Where: /usr/local/bin or /usr/local/games
|
||||
FTP: ...
|
||||
|
||||
|
@ -435,6 +591,17 @@ FTP: ...
|
|||
|
||||
Converts RTF (Rich Text Format) files to text.
|
||||
|
||||
Name: scpp
|
||||
Version: 1.1 (15 Feb 94)
|
||||
Author: Ported by Devin Reade
|
||||
Contact: gdr@myrias.ab.ca
|
||||
Where: /usr/bin
|
||||
FTP: ftp.cco.caltech.edu, grind.isca.uiowa.edu.
|
||||
|
||||
A selective C preprocessor. It will only interpret directives that it
|
||||
is told to interpret. This makes scpp useful for making source files easier
|
||||
to read by removing unnecessary code (such as that for other architectures).
|
||||
|
||||
Name: sendmail
|
||||
Version: 1.1
|
||||
Author: Phillip Vandry
|
||||
|
@ -473,30 +640,59 @@ FTP: ...
|
|||
|
||||
Causes GS/OS to commit all pending data to disk.
|
||||
|
||||
Name: timelimit
|
||||
Version: 1.1
|
||||
Name: tee
|
||||
Version: 1.1 (23 Nov 93)
|
||||
Author: Devin Reade
|
||||
Contact: glyn@cs.ualberta.ca, glyn@ersys.edm.ab.ca
|
||||
Contact: gdr@myrias.ab.ca
|
||||
Where: /bin
|
||||
FTP: ftp.cco.caltech.edu, grind.isca.uiowa.edu.
|
||||
|
||||
Pipe fitting: copies stdin to stdout while making copies of the stream
|
||||
in one or more text files.
|
||||
|
||||
Name: timelimit
|
||||
Version: 1.1 (16 Dec 93)
|
||||
Author: Ported by Devin Reade
|
||||
Contact: gdr@myrias.ab.ca
|
||||
Where: /usr/bin
|
||||
FTP: cco.caltech.edu, grind.isca.uiowa.edu.
|
||||
FTP: ftp.cco.caltech.edu, grind.isca.uiowa.edu.
|
||||
|
||||
Limits the run time of a process; when the time is up, it sends the
|
||||
specified process a series of SIGINTs.
|
||||
|
||||
Name: udl
|
||||
Version: 1.03
|
||||
Author: Soenke Behrens
|
||||
Contact: behrenss@informatik.tu-muenchen.de
|
||||
Name: tn
|
||||
Version: 1.1 (11 Oct 94)
|
||||
Author: Dave J. Roberts. Version 1.1 changes by Devin Reade.
|
||||
Contact: daver@rush.cc.edu, droberts@chaos.bsu.edu
|
||||
Where: /usr/local/bin
|
||||
FTP: ...
|
||||
FTP: ftp.cco.caltech.edu, grind.isca.uiowa.edu
|
||||
|
||||
Converts text between the CR, LF and CR/LF forms. Somewhat on the slow side,
|
||||
so don't use it.
|
||||
A utility to display Apple's DTS Technical Notes.
|
||||
|
||||
Name: udl
|
||||
Version: 1.14
|
||||
Author: Soenke Behrens, Devin Reade
|
||||
Contact: sbehrens@contech.demon.co.uk, gdr@myrias.ab.ca
|
||||
Where: /usr/local/bin
|
||||
FTP: ftp.cco.caltech.edu, grind.isca.uiowa.edu
|
||||
|
||||
Converts text between the CR, LF and CR/LF forms. Also available for Unix
|
||||
machines, reasonably fast yet secure.
|
||||
|
||||
Name: uname
|
||||
Version: 2.0.2
|
||||
Author: Ian Schmidt
|
||||
Contact: irsman@drift.winternet.com
|
||||
Where: /bin/
|
||||
FTP: grind.isca.uiowa.edu
|
||||
|
||||
Prints the name of the UNIX system (in this case GNO/ME) plus various
|
||||
other information such as your hostname if you are running the MU package.
|
||||
|
||||
Name: unarj
|
||||
Version: 2.41
|
||||
Version: 2.42
|
||||
Author: Soenke Behrens
|
||||
Contact: behrenss@informatik.tu-muenchen.de
|
||||
Contact: schaf@meadow.muc.de
|
||||
Where: /usr/local/bin
|
||||
FTP: ...
|
||||
|
||||
|
@ -505,7 +701,7 @@ FTP: ...
|
|||
Name: unpp
|
||||
Version: 1.1
|
||||
Author: Soenke Behrens
|
||||
Contact: behrenss@informatik.tu-muenchen.de
|
||||
Contact: schaf@meadow.muc.de
|
||||
Where: /usr/local/bin
|
||||
FTP: ...
|
||||
|
||||
|
@ -531,6 +727,16 @@ FTP: ...
|
|||
Keeps track of system load averages for the uptime utility over the last
|
||||
1, 5 and 15 minutes.
|
||||
|
||||
Name: whereis
|
||||
Version: v1.1 (2 Jan 93)
|
||||
Author: v1.1 update by Devin Reade
|
||||
Contact: gdr@myrias.ab.ca
|
||||
Where: /usr/bin
|
||||
FTP: ftp.cco.caltech.edu,grind.isca.uiowa.edu.
|
||||
|
||||
whereis searches certain directories (/bin, /usr/bin, /usr/man, et cetera) and
|
||||
reports the location of source, executables, and man pages.
|
||||
|
||||
Name: wrap
|
||||
Version: 1.1
|
||||
Author: Phillip Vandry
|
||||
|
@ -541,6 +747,27 @@ FTP: ...
|
|||
Word wraps text to a certain length (79 default). Also filters binary
|
||||
data and is very fast.
|
||||
|
||||
Name: write
|
||||
Version: 2.1
|
||||
Author: Leslie M. Barstow III
|
||||
Contact: wdphoenix@delphi.com
|
||||
Where: /usr/bin
|
||||
FTP: ...
|
||||
|
||||
write is a simple utility which writes a message to a user, no matter what
|
||||
terminal he or she is on. The format is: write username [message]
|
||||
If you do not input a message, you will be prompted for message lines until
|
||||
you enter a blank line.
|
||||
|
||||
Name: xargs
|
||||
Version: 0.9 (3 Mar 95)
|
||||
Author: Jeremy Rand.
|
||||
Contact: <u8902848@muss.mcmaster.ca>
|
||||
Where: /usr/local/bin
|
||||
FTP: grind.isca.uiowa.edu
|
||||
|
||||
Pass parameters to a command through standard input.
|
||||
|
||||
Name: xbiff
|
||||
Version: 1.0
|
||||
Author: James Brookes
|
||||
|
@ -553,13 +780,28 @@ aurally and visibly when the user has mail. OA-clicking on the window's
|
|||
content region causes a title bar to appear, allowing the window to be moved.
|
||||
|
||||
Name: xclock
|
||||
Version: 1.0
|
||||
Author: James Brookes
|
||||
Contact: jamesb@ecst.csuchico.edu
|
||||
Where: */system/desk.accs/
|
||||
FTP: ...
|
||||
Version: 1.12
|
||||
Author: Dave J. Roberts
|
||||
Contact: dave@mary.iia.org
|
||||
Where: /usr/X/bin
|
||||
FTP: ftp.cco.caltech.edu, grind.isca.uiowa.edu
|
||||
|
||||
graphical analog time display unit
|
||||
|
||||
XClock is an NDA analog clock, similar to xclock -analog under XWindows.
|
||||
OA-clicking on the window's content region causes a title bar to appear,
|
||||
allowing the window to be moved and/or resized.
|
||||
Name: xlogin
|
||||
Version: 2.21
|
||||
Author: Dave J. Roberts
|
||||
Contact: dave@mary.iia.org
|
||||
Where: /usr/X/bin
|
||||
FTP: ftp.cco.caltech.edu, grind.isca.uiowa.edu
|
||||
|
||||
|
||||
Name: zsh
|
||||
Version: 2.0
|
||||
Author: Leslie M. Barstow III
|
||||
Contact: wdphoenix@delphi.com
|
||||
Where: /bin
|
||||
FTP:
|
||||
|
||||
zsh is a program used to put a user's account in suspension.
|
||||
It prints a message and then exits.
|
||||
|
|
|
@ -0,0 +1,57 @@
|
|||
.TH DESCU 8 "System Administration" "7 May 1995" "Version 1.0"
|
||||
.SH NAME
|
||||
descu \- the describe(1) source updater
|
||||
.SH SYNOPSIS
|
||||
.BR descu " [" -hV ]
|
||||
.I sourcefile
|
||||
.I patchfile1
|
||||
[
|
||||
.IR patchfile2 " ..."
|
||||
]
|
||||
.SH DESCRIPTION
|
||||
.BR descu
|
||||
updates the describe source file
|
||||
.I sourcefile
|
||||
by applying the new and updated records from the \fIpatchfile\fRs
|
||||
and prints the result to standard output.
|
||||
.LP
|
||||
.IR Patchfile s
|
||||
are just one or more describe source entries as defined in
|
||||
.BR descc (8).
|
||||
(They have nothing to do with
|
||||
.BR patch (1).)
|
||||
.LP
|
||||
.IR Patchfile s
|
||||
are assumed to contain at most one entry (in all listed
|
||||
.IR patchfile s)
|
||||
for a given program, keyed on the
|
||||
.BR Name:
|
||||
field. If an entry in
|
||||
.IR patchfile
|
||||
is already in
|
||||
.IR sourcefile ,
|
||||
it replaces the original; otherwise the entry is appended. In both
|
||||
cases, the output is sorted lexicographically, based on the
|
||||
.BR Name:
|
||||
field.
|
||||
.LP
|
||||
.BR descu
|
||||
will create the file
|
||||
.B describe.rej
|
||||
in the current directory. This contains all records that were removed
|
||||
from
|
||||
.IR sourcefile .
|
||||
.SH OPTIONS
|
||||
.nf
|
||||
\fB-h\fR Show usage information.
|
||||
|
||||
\fB-V\fR Show version information.
|
||||
.fi
|
||||
.SH AUTHOR
|
||||
Devin Reade <gdr@myrias.ab.ca>
|
||||
.SH "SEE ALSO"
|
||||
.BR apropos (1),
|
||||
.BR describe (1),
|
||||
.BR man (1),
|
||||
.BR whatis (1),
|
||||
.BR descc (8).
|
|
@ -0,0 +1,497 @@
|
|||
/*
|
||||
* descu - describe(1) update utility for maintaining describe source files
|
||||
*
|
||||
* Usage: descu [-hV] sourcefile patchfile1 [patchfile2 ...]
|
||||
*
|
||||
* Options:
|
||||
* -h show usage information and exit.
|
||||
* -V show version information
|
||||
*
|
||||
* Copyright 1995 by Devin Reade for James Brookes' describe(1) utility.
|
||||
* See the included README file and man page for details.
|
||||
*
|
||||
* $Id: descu.c,v 1.1 1996/01/22 01:38:05 gdr Exp $
|
||||
*/
|
||||
|
||||
#pragma optimize -1
|
||||
|
||||
#include <sys/types.h>
|
||||
#include <sys/stat.h>
|
||||
#include <fcntl.h>
|
||||
#include <unistd.h>
|
||||
#include <stdio.h>
|
||||
#include <errno.h>
|
||||
#include <stdlib.h>
|
||||
#include <string.h>
|
||||
#include <assert.h>
|
||||
#include <ctype.h>
|
||||
#include <getopt.h>
|
||||
#include "desc.h"
|
||||
|
||||
#define _VERSION_ "v1.0.1"
|
||||
#define MAX_BUFFER 65534
|
||||
#define SLOTS_QUANTUM 20
|
||||
#define REJECT_FILE "descu.rej"
|
||||
|
||||
#ifndef __ORCAC__
|
||||
ssize_t read(int, void *, size_t);
|
||||
#endif
|
||||
char *strerror(int);
|
||||
void convert (char *);
|
||||
|
||||
char *versionStr = _VERSION_;
|
||||
static char *header=NULL; /* comments before the first describe entry */
|
||||
static char *trailer=NULL; /* comments after the last describe entry */
|
||||
|
||||
short oflag;
|
||||
short Vflag;
|
||||
short errflag;
|
||||
|
||||
descEntry **entryArray1=NULL;
|
||||
descEntry **entryArray2=NULL;
|
||||
int array1SlotsAlloced=0;
|
||||
int array2SlotsAlloced=0;
|
||||
int array1SlotsUsed=0;
|
||||
int array2SlotsUsed=0;
|
||||
|
||||
/*
|
||||
* inhale - read file into buffer
|
||||
*
|
||||
* Pre: <pathname> is the path name of the file to read in
|
||||
*
|
||||
* Post: returns a malloc'd NULL-terminated buffer containing the contents
|
||||
* of file <pathname>. On error, returns NULL and prints a suitable
|
||||
* message.
|
||||
*
|
||||
* On the Apple IIgs, CR's are also converted to LF's
|
||||
*/
|
||||
|
||||
char *inhale (char *pathname) {
|
||||
char *buffer;
|
||||
long bytecount, bytes_read;
|
||||
ssize_t i;
|
||||
int fd;
|
||||
|
||||
/* open the file */
|
||||
if ((fd = open(pathname,O_RDONLY))==-1) {
|
||||
fprintf(stderr,"inhale: open of %s failed: %s\n",
|
||||
pathname,strerror(errno));
|
||||
return NULL;
|
||||
}
|
||||
|
||||
/* create the buffer */
|
||||
bytecount = lseek(fd,(off_t) 0,SEEK_END);
|
||||
if (bytecount > MAX_BUFFER) {
|
||||
fprintf(stderr,"descu internal error: cannot handle files greater"
|
||||
"than %d bytes\n due to a compiler bug. Sorry.\n",
|
||||
MAX_BUFFER);
|
||||
exit(-1);
|
||||
}
|
||||
lseek(fd,(off_t) 0, SEEK_SET);
|
||||
if ((buffer = malloc(bytecount+1))==NULL) {
|
||||
fprintf(stderr,"inhale: malloc of %ld-byte buffer failed for file %s:%s\n",
|
||||
bytecount+1,pathname,strerror(errno));
|
||||
close(fd);
|
||||
return NULL;
|
||||
}
|
||||
|
||||
/* read file into the buffer */
|
||||
bytes_read=0;
|
||||
while (bytes_read < bytecount) {
|
||||
i = read(fd,&buffer[bytes_read],(size_t)bytecount-bytes_read);
|
||||
if (i==-1) {
|
||||
fprintf(stderr,"inhale: read failed on file %s:%s\n",
|
||||
pathname,strerror(errno));
|
||||
free(buffer);
|
||||
close(fd);
|
||||
return NULL;
|
||||
}
|
||||
bytes_read += i;
|
||||
}
|
||||
|
||||
/* clean up and return buffer */
|
||||
close(fd);
|
||||
buffer[bytecount] = '\0';
|
||||
|
||||
#ifdef __ORCAC__
|
||||
/* convert CR to LF */
|
||||
{
|
||||
char *p;
|
||||
|
||||
for (p=buffer; *p ; p++) {
|
||||
if (*p == 0x0D) *p = 0x0A;
|
||||
}
|
||||
}
|
||||
#endif
|
||||
|
||||
return buffer;
|
||||
}
|
||||
|
||||
|
||||
/*
|
||||
* extract_info -- take a string buffer containing the describe information
|
||||
* and return a malloc'd descEntry structure containing
|
||||
* pointers into the buffer of the various parts. Also
|
||||
* modifies the buffer so that there is a '\0' character
|
||||
* between the parts.
|
||||
*/
|
||||
|
||||
descEntry *extract_info(char *source) {
|
||||
|
||||
char *p;
|
||||
descEntry *entry;
|
||||
|
||||
if ((entry = malloc(sizeof(descEntry))) == NULL) {
|
||||
perror("add_entry: couldn't allocate new entry");
|
||||
exit(1);
|
||||
}
|
||||
|
||||
/* extract out name */
|
||||
if (((entry->name = strstr(source,NAME_SHORT))==NULL) ||
|
||||
((p = strchr(source,'\n'))==NULL)) {
|
||||
fprintf(stderr,"bad or missing describe field: \"%s\"\n"
|
||||
"describe entry is:\n%s\n",NAME,source);
|
||||
free(entry);
|
||||
return NULL;
|
||||
}
|
||||
|
||||
|
||||
/* extract out data */
|
||||
entry->data = p+1;
|
||||
|
||||
/* terminate the name, dropping trailing space */
|
||||
do { --p; } while (isspace(*p));
|
||||
*(p+1) = '\0';
|
||||
|
||||
return entry;
|
||||
}
|
||||
|
||||
|
||||
/*
|
||||
* add_entry -- add entry to the descTable, even if it already exists.
|
||||
*/
|
||||
|
||||
void add_entry(descEntry *entry, int initial_buffer) {
|
||||
descEntry **e, ***array;
|
||||
int *slotsAlloced, *slotsUsed;
|
||||
|
||||
if (initial_buffer) {
|
||||
array = &entryArray1;
|
||||
slotsAlloced = &array1SlotsAlloced;
|
||||
slotsUsed = &array1SlotsUsed;
|
||||
} else {
|
||||
array = &entryArray2;
|
||||
slotsAlloced = &array2SlotsAlloced;
|
||||
slotsUsed = &array2SlotsUsed;
|
||||
}
|
||||
|
||||
/* grow array if necessary */
|
||||
if (*slotsAlloced == *slotsUsed) {
|
||||
*slotsAlloced += SLOTS_QUANTUM;
|
||||
if (*array) {
|
||||
e = realloc(*array,(*slotsAlloced) * sizeof(descEntry *));
|
||||
} else {
|
||||
e = malloc((*slotsAlloced) * sizeof(descEntry *));
|
||||
}
|
||||
if (e == NULL) {
|
||||
perror("couldn't grow describe array");
|
||||
exit(1);
|
||||
}
|
||||
*array = e;
|
||||
}
|
||||
|
||||
/* add in the entry */
|
||||
(*array)[*slotsUsed] = entry;
|
||||
(*slotsUsed)++;
|
||||
return;
|
||||
}
|
||||
|
||||
|
||||
/*
|
||||
* insert - insert all entries contained in buffer into the descTable.
|
||||
* If initial_buffer is non-zero, then use any comments preceeding
|
||||
* the first entry as the output file header, and any comments
|
||||
* following the last entry as the output file trailer. If
|
||||
* initial_buffer is zero, then the respective comment blocks are
|
||||
* ignored, effectively deleting them from the output.
|
||||
*/
|
||||
|
||||
void insert(char *buffer, int initial_buffer) {
|
||||
char *p, *q;
|
||||
descEntry *entry;
|
||||
|
||||
/* pull out the header (if nec) and init p */
|
||||
if (initial_buffer) header = buffer;
|
||||
p = strstr(buffer,NAME_SHORT);
|
||||
if(!p) return; /* buffer doesn't have any describe entries! */
|
||||
*(p-1)='\0';
|
||||
|
||||
/* add all but the last entry */
|
||||
while ((q=strstr(p+1,NAME_SHORT))!=NULL) {
|
||||
*(q-1)='\0';
|
||||
entry = extract_info(p);
|
||||
if (entry) add_entry(entry, initial_buffer);
|
||||
p=q;
|
||||
}
|
||||
|
||||
/* extract out the trailer and add the last entry */
|
||||
if ((q = strstr(p,"\n#"))==NULL) {
|
||||
if (initial_buffer) trailer="";
|
||||
} else {
|
||||
if (initial_buffer) trailer=q+1;
|
||||
*q = '\0';
|
||||
}
|
||||
|
||||
entry = extract_info(p);
|
||||
if (entry) add_entry(entry,initial_buffer);
|
||||
return;
|
||||
}
|
||||
|
||||
|
||||
/*
|
||||
* sortArray - do a heapsort on <array> consisting of <slotsUsed> elements.
|
||||
* The sort is based on the field array[i]->name, sorted
|
||||
* lexicographically.
|
||||
*/
|
||||
|
||||
void sortArray(descEntry **array, int slotsUsed) {
|
||||
|
||||
int l, j, ir, i;
|
||||
descEntry *rra;
|
||||
|
||||
if (slotsUsed==1) return; /* no need to sort one element */
|
||||
--array; /* fudge since the algorithm was designed */
|
||||
/* for a unit-indexing */
|
||||
|
||||
l = (slotsUsed>>1) + 1;
|
||||
ir = slotsUsed;
|
||||
|
||||
/*
|
||||
* The index l will be decremented from its initial value down to 0 during
|
||||
* the heap creation phase. Once it reaches 0, the index ir will be
|
||||
* decremented from its initial value down to 0 during the heap selection
|
||||
* phase.
|
||||
*/
|
||||
for (;;) {
|
||||
if (l > 1) /* still in creation phase */
|
||||
rra = array[--l];
|
||||
else { /* in selection phase */
|
||||
rra= array[ir]; /* clear a space at the end of array */
|
||||
array[ir] = array[1]; /* retire the top of the heap into it */
|
||||
if (--ir == 1) { /* done with the last promotion */
|
||||
array[1] = rra;
|
||||
return;
|
||||
}
|
||||
}
|
||||
i = l; /* set up to sift down element rra to its proper place */
|
||||
j = l << 1;
|
||||
while (j<=ir) {
|
||||
if (j<ir && (strcmp(array[j]->name,array[j+1]->name)<0)) ++j;
|
||||
if (strcmp(rra->name,array[j]->name)<0) { /* demote rra */
|
||||
array[i] = array[j];
|
||||
i = j;
|
||||
j += i;
|
||||
} else j = ir + 1; /* this is rra's level; set j to terminate */
|
||||
} /* the sift-down */
|
||||
array[i] = rra;
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
/*
|
||||
* ns_strcmp (no-space string compare) -- compare two strings, ignoring
|
||||
* a leading NAME_SHORT and whitespace, and ignoring trailing
|
||||
* whitespace.
|
||||
*
|
||||
* Returns zero if strings are equal, -1 if a<b, 1 if a>b.
|
||||
* The following are therefore equal:
|
||||
* "Name: test "
|
||||
* "Name: test "
|
||||
* The following are inequal:
|
||||
* "Name: one"
|
||||
* "Name: One"
|
||||
*/
|
||||
|
||||
int ns_strcmp (char *a, char *b) {
|
||||
char *p;
|
||||
size_t len;
|
||||
|
||||
/* strip NAME_SHORT and leading space */
|
||||
len = strlen(NAME_SHORT);
|
||||
a+=len;
|
||||
b+=len;
|
||||
while (isspace(*a)) a++;
|
||||
while (isspace(*b)) b++;
|
||||
|
||||
/* strip trailing space */
|
||||
p = a + strlen(a);
|
||||
do {
|
||||
--p;
|
||||
} while (isspace(*p));
|
||||
*(p+1) = '\0';
|
||||
|
||||
p = b + strlen(b);
|
||||
do {
|
||||
--p;
|
||||
} while (isspace(*p));
|
||||
*(p+1) = '\0';
|
||||
|
||||
/* do the string comparison */
|
||||
while (*a && *b) {
|
||||
if (*a < *b) return -1;
|
||||
if (*a > *b) return 1;
|
||||
a++; b++;
|
||||
}
|
||||
if (*a == *b) return 0;
|
||||
else if (*a) return -1;
|
||||
else return 1;
|
||||
}
|
||||
|
||||
|
||||
void version (char *progName) {
|
||||
fprintf(stderr,
|
||||
"%s version %s Copyright 1995 Devin Reade\n"
|
||||
"Freeware. See the manual page for copying restrictions.\n",
|
||||
progName,versionStr);
|
||||
return;
|
||||
}
|
||||
|
||||
|
||||
/*
|
||||
* Usage -- print usage info and exit
|
||||
*/
|
||||
|
||||
|
||||
void usage(char *progName) {
|
||||
|
||||
if (!Vflag || errflag) {
|
||||
fprintf(stderr,
|
||||
"%s -- describe(1) source update utility\n"
|
||||
"Usage: %s [-hV] sourcefile patchfile1 [patchfile2 ...]\n"
|
||||
"\t-h\tshow usage information\n"
|
||||
"\t-V\tshow version information\n\n",
|
||||
progName,progName);
|
||||
}
|
||||
version(progName);
|
||||
exit(1);
|
||||
}
|
||||
|
||||
/*
|
||||
* need I say it?
|
||||
*/
|
||||
|
||||
int main(int argc, char **argv) {
|
||||
char *buffer;
|
||||
int i, j;
|
||||
FILE *outfp, *rejfp;
|
||||
int c;
|
||||
char *outputfile=NULL;
|
||||
int compare;
|
||||
|
||||
#ifdef STACK_CHECK
|
||||
begin_stack_check();
|
||||
#endif
|
||||
|
||||
/* initialize */
|
||||
errflag=0;
|
||||
oflag=0;
|
||||
|
||||
/* parse command line */
|
||||
while ((c=getopt(argc,argv,"ho:V"))!=EOF) {
|
||||
switch (c) {
|
||||
case 'o':
|
||||
outputfile = optarg;
|
||||
oflag++;
|
||||
break;
|
||||
|
||||
case 'V':
|
||||
Vflag++;
|
||||
break;
|
||||
|
||||
case 'h':
|
||||
default:
|
||||
errflag++;
|
||||
}
|
||||
}
|
||||
|
||||
/* error and exit if necessary */
|
||||
if (errflag || (argc-optind<2)) usage(basename(argv[0]));
|
||||
|
||||
/* show version info */
|
||||
if (Vflag) version(basename(argv[0]));
|
||||
|
||||
/* open output (if nec) and reject file */
|
||||
if (oflag) {
|
||||
if ((outfp = fopen(outputfile,"w+"))==NULL) {
|
||||
perror("main: couldn't open output file");
|
||||
exit(1);
|
||||
}
|
||||
} else {
|
||||
outfp = stdout;
|
||||
}
|
||||
if ((rejfp = fopen(REJECT_FILE,"w+"))==NULL) {
|
||||
perror("main: couldn't open rejects file");
|
||||
exit(1);
|
||||
}
|
||||
|
||||
/* read in original describe source file */
|
||||
buffer = inhale(argv[optind]);
|
||||
insert(buffer,1);
|
||||
|
||||
/* insert describe patch files */
|
||||
for (optind++; optind<argc; optind++) {
|
||||
buffer = inhale(argv[optind]);
|
||||
insert(buffer,0);
|
||||
}
|
||||
|
||||
/* sort the two arrays */
|
||||
sortArray(entryArray1,array1SlotsUsed);
|
||||
sortArray(entryArray2,array2SlotsUsed);
|
||||
|
||||
/*
|
||||
* merge the two arrays, printing out the result
|
||||
*/
|
||||
i=0; j=0;
|
||||
|
||||
/* print the header */
|
||||
fprintf(outfp,"%s\n",header);
|
||||
|
||||
/* first stage; merge while we have two arrays */
|
||||
while ((i<array1SlotsUsed) && (j<array2SlotsUsed)) {
|
||||
compare = ns_strcmp (entryArray1[i]->name, entryArray2[j]->name);
|
||||
if (compare < 0) {
|
||||
fprintf(outfp,"%s\n%s\n",entryArray1[i]->name,entryArray1[i]->data);
|
||||
i++;
|
||||
} else if (compare > 0) {
|
||||
fprintf(outfp,"%s\n%s\n",entryArray2[j]->name,entryArray2[j]->data);
|
||||
j++;
|
||||
} else {
|
||||
fprintf(rejfp,"%s\n%s\n",entryArray1[i]->name,entryArray1[i]->data);
|
||||
fprintf(outfp,"%s\n%s\n",entryArray2[j]->name,entryArray2[j]->data);
|
||||
i++; j++;
|
||||
}
|
||||
}
|
||||
|
||||
/* second stage; print out remaining list */
|
||||
while (i<array1SlotsUsed) {
|
||||
fprintf(outfp,"%s\n%s\n",entryArray1[i]->name,entryArray1[i]->data);
|
||||
i++;
|
||||
}
|
||||
while (j<array2SlotsUsed) {
|
||||
fprintf(outfp,"%s\n%s\n",entryArray2[j]->name,entryArray2[j]->data);
|
||||
j++;
|
||||
}
|
||||
|
||||
/* print the trailer */
|
||||
fprintf(outfp,"%s",trailer);
|
||||
|
||||
/* close the files and exit */
|
||||
fclose(rejfp);
|
||||
if (oflag) fclose(outfp);
|
||||
|
||||
#ifdef STACK_CHECK
|
||||
fprintf(stderr,"stack usage: %d bytes\n",end_stack_check());
|
||||
#endif
|
||||
|
||||
return 0;
|
||||
}
|
|
@ -0,0 +1,49 @@
|
|||
#
|
||||
# This is the makefile for the describe(1) package. It is for use
|
||||
# with dmake(1).
|
||||
#
|
||||
|
||||
# Use -DSTACK_CHECK in CFLAGS to show stack usage.
|
||||
|
||||
CFLAGS += -O -w -v -I/usr/include -s768
|
||||
LDFLAGS += -v
|
||||
LDLIBS += -l/usr/lib/lgetopt -l/usr/lib/stack
|
||||
BINDIR = /usr/local/bin
|
||||
SBINDIR = /usr/sbin
|
||||
MANDIR = /usr/man
|
||||
INSTALL = /bin/cp
|
||||
|
||||
build: describe descc descu
|
||||
|
||||
descc: descc.o basename.o
|
||||
@purge
|
||||
$(CC) $(LDFLAGS) $< -o $@ $(LDLIBS)
|
||||
|
||||
describe: describe.o basename.o
|
||||
@purge
|
||||
$(CC) $(LDFLAGS) $< -o $@ $(LDLIBS)
|
||||
|
||||
descu: descu.o basename.o
|
||||
@purge
|
||||
$(CC) $(LDFLAGS) $< -o $@ $(LDLIBS)
|
||||
|
||||
basename.o: basename.c
|
||||
$(CC) -c $(CFLAGS) basename.c
|
||||
|
||||
descc.o: descc.c desc.h
|
||||
$(CC) -c $(CFLAGS) descc.c
|
||||
|
||||
describe.o: describe.c desc.h
|
||||
$(CC) -c $(CFLAGS) describe.c
|
||||
|
||||
descu.o: descu.c desc.h
|
||||
$(CC) -c $(CFLAGS) descu.c
|
||||
|
||||
install:
|
||||
$(RM) -f /usr/local/bin/descc
|
||||
$(INSTALL) describe $(BINDIR)
|
||||
$(INSTALL) descc $(SBINDIR)
|
||||
$(INSTALL) descu $(SBINDIR)
|
||||
$(INSTALL) describe.1 $(MANDIR)/man1
|
||||
$(INSTALL) descc.8 $(MANDIR)/man8
|
||||
$(INSTALL) descu.8 $(MANDIR)/man8
|
|
@ -1,31 +0,0 @@
|
|||
About Describe
|
||||
~~~~~~~~~~~~~~
|
||||
First off: make sure the directory /usr/local/lib exists!!!
|
||||
|
||||
This is yet another project I've been sitting on for a while, but have
|
||||
finally decided to release. The basic idea of the 'describe' package
|
||||
(the descc "compiler" and describe itself) is to provide a quick, easy
|
||||
way of accessing information related to the utilities which so many
|
||||
different people are releasing these days. The reason it sat around on
|
||||
my harddrive so long is I was having qualms about its designated role in
|
||||
life. I wasn't sure exactly what I wanted it to do. Well, I've decided
|
||||
to KISS for now: descc simply compiles the utility list, which I maintain,
|
||||
into a (very) simple "database" located in /usr/local/lib/. The companion
|
||||
utility 'describe' is used to fetch information about a particular utility
|
||||
from this "database".
|
||||
|
||||
descc is fairly limited, as is the "database" format itself. Part of the
|
||||
KISS (or it wouldn't be out now) design philosophy ;). Usage is simple:
|
||||
when you get a new listing (I'll provide monthly updates), simply "descc
|
||||
<filename>" where <filename> is the name of the newly released update.
|
||||
descc will simply write over the old database and replace it with the
|
||||
new (note: no appendages allowed).
|
||||
|
||||
As always, coments are appreciated. And, moreso than on other projects,
|
||||
I'd appreciate some comments about the direction I'm going in, suggestions
|
||||
as to where to take this, etc. I have a feeling that some fields in the
|
||||
format (eg, FTP:) are rather useless, and I'd like to know what you guys
|
||||
out there think.
|
||||
|
||||
James Brookes
|
||||
jamesb@ecst.csuchico.edu
|
Loading…
Reference in New Issue