mirror of
https://github.com/GnoConsortium/gno.git
synced 2024-06-17 03:29:26 +00:00
initial checkin
This commit is contained in:
parent
f6f777413b
commit
109c7880bf
9
usr.bin/link/Makefile
Normal file
9
usr.bin/link/Makefile
Normal file
|
@ -0,0 +1,9 @@
|
||||||
|
#
|
||||||
|
# $Id: Makefile,v 1.1 1998/03/31 03:32:47 gdr-ftp Exp $
|
||||||
|
#
|
||||||
|
|
||||||
|
PROG = link
|
||||||
|
BINDIR = /usr/bin
|
||||||
|
|
||||||
|
.INCLUDE : /src/gno/prog.mk
|
||||||
|
|
31
usr.bin/link/link.1
Normal file
31
usr.bin/link/link.1
Normal file
|
@ -0,0 +1,31 @@
|
||||||
|
.\"
|
||||||
|
.\" Devin Reade, March 1998
|
||||||
|
.\"
|
||||||
|
.\" $Id: link.1,v 1.1 1998/03/31 03:32:48 gdr-ftp Exp $
|
||||||
|
.\"
|
||||||
|
.TH LINK 1 "30 March 1998" GNO "Commands and Applications"
|
||||||
|
.SH NAME
|
||||||
|
link \- link a object files
|
||||||
|
.SH SYNOPSIS
|
||||||
|
\fBlink\fR [\fIoptions\fR] \fIobjectfile\fR ... [\fIqualifiers\fR]
|
||||||
|
.SH DESCRIPTION
|
||||||
|
.BR link
|
||||||
|
is the secondary front end to the ORCA Zaplink program. (The primary
|
||||||
|
front end is
|
||||||
|
.BR occ (1)).
|
||||||
|
.LP
|
||||||
|
For a complete explanation of
|
||||||
|
.BR link
|
||||||
|
including a description of
|
||||||
|
.IR options
|
||||||
|
and
|
||||||
|
.IR qualifiers ,
|
||||||
|
see the chapter
|
||||||
|
.I "The Command Processor"
|
||||||
|
in any of the ORCA/C, ORCA/M, or ORCA/Pascal Reference Manuals.
|
||||||
|
.SH "SEE ALSO"
|
||||||
|
.BR compile (1),
|
||||||
|
.BR dmake (1),
|
||||||
|
.BR occ (1).
|
||||||
|
.br
|
||||||
|
.IR "ORCA/C Reference Manual" .
|
196
usr.bin/link/link.c
Normal file
196
usr.bin/link/link.c
Normal file
|
@ -0,0 +1,196 @@
|
||||||
|
/*
|
||||||
|
* $Id: link.c,v 1.1 1998/03/31 03:32:50 gdr-ftp Exp $
|
||||||
|
*
|
||||||
|
|
||||||
|
parsing code for compile, cmpl, cmplg
|
||||||
|
|
||||||
|
The options are set up in the following format:
|
||||||
|
|
||||||
|
Low High
|
||||||
|
Byte 0 Byte 1 Byte 2 Byte 3
|
||||||
|
76543210 76543210 76543210 76543210
|
||||||
|
yz qrstuvwx ijklmnop abcdefgh
|
||||||
|
|
||||||
|
kflag
|
||||||
|
0 - do not save output
|
||||||
|
1 - save to object filename pointed to by dfile
|
||||||
|
2 - .root has already been made, make .a files
|
||||||
|
3 - at least one alphabetic suffix has been used
|
||||||
|
|
||||||
|
*/
|
||||||
|
|
||||||
|
#include <stdio.h>
|
||||||
|
#include <stdlib.h>
|
||||||
|
#include <string.h>
|
||||||
|
#include <ctype.h>
|
||||||
|
#include <types.h>
|
||||||
|
#include <unistd.h>
|
||||||
|
#include <shell.h>
|
||||||
|
#include <orca.h>
|
||||||
|
#include <texttool.h>
|
||||||
|
#include <gno/gno.h>
|
||||||
|
#include <sys/wait.h>
|
||||||
|
|
||||||
|
longword optTab[] = {
|
||||||
|
0x80000000,
|
||||||
|
0x40000000,
|
||||||
|
0x20000000,
|
||||||
|
0x10000000,
|
||||||
|
0x08000000,
|
||||||
|
0x04000000,
|
||||||
|
0x02000000,
|
||||||
|
0x01000000,
|
||||||
|
0x00800000,
|
||||||
|
0x00400000,
|
||||||
|
0x00200000,
|
||||||
|
0x00100000,
|
||||||
|
/* 0x00080000,*/ 0x00000000, /* disabled because of FASTFILE bug */
|
||||||
|
0x00040000,
|
||||||
|
0x00020000,
|
||||||
|
0x00010000,
|
||||||
|
0x00008000,
|
||||||
|
0x00004000,
|
||||||
|
0x00002000,
|
||||||
|
0x00001000,
|
||||||
|
0x00000800,
|
||||||
|
0x00000400,
|
||||||
|
0x00000200,
|
||||||
|
0x00000100,
|
||||||
|
0x00000080,
|
||||||
|
0x00000040
|
||||||
|
};
|
||||||
|
|
||||||
|
char *invoke;
|
||||||
|
|
||||||
|
void
|
||||||
|
doError(char *err)
|
||||||
|
{
|
||||||
|
printf("%s: %s\n",invoke,err);
|
||||||
|
exit(2);
|
||||||
|
}
|
||||||
|
|
||||||
|
void
|
||||||
|
expandVar2dfile(char *varname,Get_LInfoPB *g)
|
||||||
|
{
|
||||||
|
char varval[80];
|
||||||
|
Get_VarPB gp;
|
||||||
|
int i,n = 1;
|
||||||
|
int l;
|
||||||
|
|
||||||
|
gp.var_name = varname;
|
||||||
|
gp.value = varval;
|
||||||
|
GET_VAR(&gp);
|
||||||
|
for (i = 1; i <= varval[0]; i++) {
|
||||||
|
if (varval[i] == '$') {
|
||||||
|
memcpy(g->dfile+n, g->sfile+1,g->sfile[0]);
|
||||||
|
n+=g->sfile[0];
|
||||||
|
}
|
||||||
|
else if (varval[i] == '%') {
|
||||||
|
doError("% operator in KeepName not supported");
|
||||||
|
}
|
||||||
|
else g->dfile[n++] = varval[i];
|
||||||
|
}
|
||||||
|
g->dfile[0] = n-1;
|
||||||
|
}
|
||||||
|
|
||||||
|
char sfile[65], dfile[65], parms[256], istring[256];
|
||||||
|
Get_LInfoPB gl;
|
||||||
|
|
||||||
|
int
|
||||||
|
main (int argc,char *argv[])
|
||||||
|
{
|
||||||
|
int lastind,ind = 0;
|
||||||
|
char *cmd1,*cmdline;
|
||||||
|
int pid,wpid;
|
||||||
|
#if 1
|
||||||
|
union wait wstat;
|
||||||
|
#else
|
||||||
|
unsigned wstat;
|
||||||
|
#endif
|
||||||
|
int numObjs = 0;
|
||||||
|
|
||||||
|
__REPORT_STACK();
|
||||||
|
|
||||||
|
invoke = basename(argv[0]);
|
||||||
|
if (!strcmp(invoke,"link")) gl.lops = 2;
|
||||||
|
else doError("invalid invokation");
|
||||||
|
|
||||||
|
sfile[0] = sfile[1] = dfile[0] = parms[0] = istring[0] = 0;
|
||||||
|
gl.pflags = 0x8000000l;
|
||||||
|
gl.mflags = 0l;
|
||||||
|
gl.kflag = 0;
|
||||||
|
gl.sfile = sfile;
|
||||||
|
gl.dfile = dfile;
|
||||||
|
gl.parms = parms;
|
||||||
|
gl.istring = istring;
|
||||||
|
ind = 1;
|
||||||
|
|
||||||
|
/* parse option flags */
|
||||||
|
while ((argv[ind][0] == '+') || (argv[ind][0] == '-')) {
|
||||||
|
if (argv[ind][0] == '+')
|
||||||
|
gl.pflags |= optTab[toupper(argv[ind][1])-'A'];
|
||||||
|
else
|
||||||
|
gl.mflags |= optTab[toupper(argv[ind][1])-'A'];
|
||||||
|
ind++;
|
||||||
|
}
|
||||||
|
|
||||||
|
/* parse object file names */
|
||||||
|
while ((ind < argc) && (strincmp(argv[ind],"keep=",5))) {
|
||||||
|
if (strlen(sfile+1) == 0) strcat(sfile+1,argv[ind]);
|
||||||
|
else {
|
||||||
|
strcat(sfile+1," ");
|
||||||
|
strcat(sfile+1,argv[ind]);
|
||||||
|
}
|
||||||
|
ind++;
|
||||||
|
numObjs++;
|
||||||
|
}
|
||||||
|
sfile[0] = strlen(sfile+1); /* set the length */
|
||||||
|
|
||||||
|
/* and if there's a keep field, grab it's stuff, too */
|
||||||
|
if (ind < argc) {
|
||||||
|
if (!strincmp(argv[ind],"keep=",5)) {
|
||||||
|
gl.kflag = 1;
|
||||||
|
dfile[0] = strlen(argv[ind]+5);
|
||||||
|
strcpy(dfile+1,argv[ind]+5);
|
||||||
|
} else doError("illegal option");
|
||||||
|
}
|
||||||
|
gl.merr = 0; gl.merrf = 0;
|
||||||
|
gl.org = 0l;
|
||||||
|
|
||||||
|
if ((gl.dfile[0] == 0) && (numObjs == 1)) {
|
||||||
|
expandVar2dfile("\pKeepName",&gl);
|
||||||
|
if (gl.dfile[0]) gl.kflag = 1; /* was something expanded? */
|
||||||
|
}
|
||||||
|
|
||||||
|
/*
|
||||||
|
printf("source address %08lX\n",&gl);
|
||||||
|
printf("sfile : %p\n",gl.sfile);
|
||||||
|
printf("dfile : %p\n",gl.dfile);
|
||||||
|
printf("parms : %p\n",gl.parms);
|
||||||
|
printf("kflag : %d\n",gl.kflag);
|
||||||
|
printf("istring : %p\n",gl.istring);
|
||||||
|
printf("mflags : %08lX\n",gl.mflags);
|
||||||
|
printf("pflags : %08lX\n\n",gl.pflags);
|
||||||
|
*/
|
||||||
|
|
||||||
|
SET_LINFO(&gl);
|
||||||
|
if ((pid = exec("16/linker","linker")) >= 0) {
|
||||||
|
waitlp2:
|
||||||
|
wpid = wait((union wait *) &wstat);
|
||||||
|
#if 1
|
||||||
|
/*
|
||||||
|
* The GNO v2.0.4 one used the other block in this #ifdef;
|
||||||
|
* was this a compiler problem? -- gdr
|
||||||
|
*/
|
||||||
|
if ((wpid != pid) || WIFSTOPPED(wstat)) {
|
||||||
|
/* ((wpid != pid) || (wstat.w_S.w_Stopval == WSTOPPED)) { */
|
||||||
|
goto waitlp2;
|
||||||
|
}
|
||||||
|
#else
|
||||||
|
if ((wpid != pid) ||
|
||||||
|
((wstat&0xFF) == WSTOPPED)) goto waitlp2;
|
||||||
|
#endif
|
||||||
|
}
|
||||||
|
GET_LINFO(&gl);
|
||||||
|
exit(gl.merrf);
|
||||||
|
}
|
11
usr.bin/link/link.desc
Normal file
11
usr.bin/link/link.desc
Normal file
|
@ -0,0 +1,11 @@
|
||||||
|
Name: link
|
||||||
|
Version: 1.1 (30 Mar 98)
|
||||||
|
Shell: GNO
|
||||||
|
Author: Maintained by Devin Reade.
|
||||||
|
Contact: gdr@trenco.gno.org
|
||||||
|
Where: /usr/bin
|
||||||
|
FTP: ftp.gno.org
|
||||||
|
|
||||||
|
This is the GNO version of the ORCA/Shell "link" command. It is provided
|
||||||
|
for compatibility reasons; occ is the recommended command for linking
|
||||||
|
object files under GNO.
|
28
usr.bin/link/link.rez
Normal file
28
usr.bin/link/link.rez
Normal file
|
@ -0,0 +1,28 @@
|
||||||
|
/*
|
||||||
|
* $Id: link.rez,v 1.1 1998/03/31 03:32:52 gdr-ftp Exp $
|
||||||
|
*/
|
||||||
|
|
||||||
|
#define NAME "link"
|
||||||
|
#define DESC "link object files"
|
||||||
|
|
||||||
|
#include "Types.rez"
|
||||||
|
#include "/src/gno/build.tools/builddate.rez"
|
||||||
|
|
||||||
|
/* Comment Templates */
|
||||||
|
resource rComment (1, purgeable3) {
|
||||||
|
NAME " v1.1\n"
|
||||||
|
DESC
|
||||||
|
};
|
||||||
|
|
||||||
|
/* Version */
|
||||||
|
resource rVersion (1, purgeable3) {
|
||||||
|
{ 1, 1, 0, /* version */
|
||||||
|
release, /* development|alpha|beta|final|release */
|
||||||
|
0 /* non-final release number */
|
||||||
|
},
|
||||||
|
verUS,
|
||||||
|
NAME,
|
||||||
|
DESC "\n"
|
||||||
|
BUILD_DATE
|
||||||
|
};
|
||||||
|
|
13
usr.bin/removerez/Makefile
Normal file
13
usr.bin/removerez/Makefile
Normal file
|
@ -0,0 +1,13 @@
|
||||||
|
#
|
||||||
|
# Devin Reade, February 1998
|
||||||
|
#
|
||||||
|
# $Id: Makefile,v 1.1 1998/03/31 03:32:55 gdr-ftp Exp $
|
||||||
|
#
|
||||||
|
|
||||||
|
PROG = removerez
|
||||||
|
BINDIR = /usr/bin
|
||||||
|
STACK = 1024
|
||||||
|
LDADD += -lcontrib
|
||||||
|
|
||||||
|
.INCLUDE : /src/gno/prog.mk
|
||||||
|
|
51
usr.bin/removerez/removerez.1
Normal file
51
usr.bin/removerez/removerez.1
Normal file
|
@ -0,0 +1,51 @@
|
||||||
|
.\"
|
||||||
|
.\" Devin Reade, March 1998
|
||||||
|
.\"
|
||||||
|
.\" $Id: removerez.1,v 1.1 1998/03/31 03:32:57 gdr-ftp Exp $
|
||||||
|
.\"
|
||||||
|
.TH REMOVEREZ 1 "29 March 1998" GNO "Commands and Applications"
|
||||||
|
.SH NAME
|
||||||
|
removerez \- remove resource fork
|
||||||
|
.SH SYNOPSIS
|
||||||
|
.BR removerez
|
||||||
|
[
|
||||||
|
.BR -qv
|
||||||
|
]
|
||||||
|
.IR file " ..."
|
||||||
|
.SH DESCRIPTION
|
||||||
|
.BR removerez
|
||||||
|
will remove the resource fork for any of the extended
|
||||||
|
.IR file s
|
||||||
|
specified on it's command line; it will not touch standard files, directories,
|
||||||
|
or partitions.
|
||||||
|
.SH OPTIONS
|
||||||
|
.IP \fB-q\fR
|
||||||
|
.BR removerez
|
||||||
|
will normally print warnings for any
|
||||||
|
.IR file s
|
||||||
|
that are not extended files. Using the
|
||||||
|
.BR -q
|
||||||
|
(quiet) flag inhibits this warning. The
|
||||||
|
.BR -q
|
||||||
|
flag will override any previously specified
|
||||||
|
.BR -v
|
||||||
|
flag.
|
||||||
|
.IP \fB-v\fR
|
||||||
|
If the
|
||||||
|
.BR -v
|
||||||
|
(verbose) flag is specified, the name of each
|
||||||
|
.I file
|
||||||
|
will be printed as its resource fork is removed. The
|
||||||
|
.BR -v
|
||||||
|
flag will override any previously specified
|
||||||
|
.BR -q
|
||||||
|
flag.
|
||||||
|
.SH AUTHOR
|
||||||
|
Devin Reade
|
||||||
|
.SH HISTORY
|
||||||
|
A
|
||||||
|
.BR removerez
|
||||||
|
script first appeared in the ORCA v2.1 distribution. This version
|
||||||
|
first appeared in GNO v2.0.6.
|
||||||
|
.SH SEE ALSO
|
||||||
|
.BR catrez (1)
|
115
usr.bin/removerez/removerez.c
Normal file
115
usr.bin/removerez/removerez.c
Normal file
|
@ -0,0 +1,115 @@
|
||||||
|
/*
|
||||||
|
* This is supposed to emulate the behavior of the ORCA/Shell script
|
||||||
|
* 'removerez'.
|
||||||
|
*
|
||||||
|
* Devin Reade, February 1998
|
||||||
|
*
|
||||||
|
* $Id: removerez.c,v 1.1 1998/03/31 03:32:59 gdr-ftp Exp $
|
||||||
|
*/
|
||||||
|
|
||||||
|
#define __USE_DYNAMIC_GSSTRING__
|
||||||
|
|
||||||
|
#include <types.h>
|
||||||
|
#include <errno.h>
|
||||||
|
#include <stdlib.h>
|
||||||
|
#include <err.h>
|
||||||
|
#include <stdio.h>
|
||||||
|
#include <gsos.h>
|
||||||
|
#include <unistd.h>
|
||||||
|
#include <gno/gno.h>
|
||||||
|
#include <gno/contrib.h>
|
||||||
|
|
||||||
|
int
|
||||||
|
main (int argc, char **argv) {
|
||||||
|
static FileInfoRecGS finfo;
|
||||||
|
int i, quiet, usage, verbose;
|
||||||
|
char *filename, *tempfile, *dname;
|
||||||
|
GSStringPtr filenameGS, tempfileGS;
|
||||||
|
unsigned short copyflags;
|
||||||
|
|
||||||
|
__REPORT_STACK();
|
||||||
|
|
||||||
|
/* initialization */
|
||||||
|
quiet = usage = verbose = 0;
|
||||||
|
copyflags = LC_COPY_DATA | LC_COPY_KEEPBUF | LC_COPY_BACKUP;
|
||||||
|
while ((i = getopt(argc, argv, "qv")) != EOF) {
|
||||||
|
switch(i) {
|
||||||
|
case 'v':
|
||||||
|
quiet = 0;
|
||||||
|
verbose = 1;
|
||||||
|
break;
|
||||||
|
case 'q':
|
||||||
|
quiet = 1;
|
||||||
|
verbose = 0;
|
||||||
|
break;
|
||||||
|
default:
|
||||||
|
usage = 1;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
if (usage || (argc-optind)<2) {
|
||||||
|
errx(EXIT_FAILURE, "usage: %s file [...]\n", argv[0]);
|
||||||
|
}
|
||||||
|
for (i=optind; i<argc; i++) {
|
||||||
|
/*
|
||||||
|
* Create a GSString version of the filename and temporary
|
||||||
|
* file. We assume that we're not going to be operating
|
||||||
|
* on a large number of files, and therefore that the cost
|
||||||
|
* of the mallocs and frees are inconsequential.
|
||||||
|
*/
|
||||||
|
filename = argv[i];
|
||||||
|
if (verbose) {
|
||||||
|
warnx("working on %s", filename);
|
||||||
|
}
|
||||||
|
dname = dirname(filename);
|
||||||
|
if ((tempfile = tempnam(dname, "rr.")) == NULL) {
|
||||||
|
err(EXIT_FAILURE, "couldn't create temp file name");
|
||||||
|
}
|
||||||
|
tempfileGS = __C2GSMALLOC(tempfile);
|
||||||
|
filenameGS = __C2GSMALLOC(filename);
|
||||||
|
|
||||||
|
/*
|
||||||
|
* A bit of an optimization here. Make sure there is
|
||||||
|
* actually a resource fork before we try to remove it.
|
||||||
|
*/
|
||||||
|
finfo.pCount = 5;
|
||||||
|
finfo.pathname = filenameGS;
|
||||||
|
GetFileInfoGS(&finfo);
|
||||||
|
if (_toolErr) {
|
||||||
|
errno = _mapErr(_toolErr);
|
||||||
|
warn("couldn't stat %s", filename);
|
||||||
|
continue;
|
||||||
|
}
|
||||||
|
if (finfo.storageType != 0x05) {
|
||||||
|
if (!quiet) {
|
||||||
|
warnx("%s is not an extended file; skipped",
|
||||||
|
filename);
|
||||||
|
}
|
||||||
|
continue;
|
||||||
|
}
|
||||||
|
|
||||||
|
/*
|
||||||
|
* Copy only the data fork to the temporary file. Retain
|
||||||
|
* all attributes.
|
||||||
|
*/
|
||||||
|
if (LC_CopyFileGS(filenameGS, tempfileGS, copyflags) == NULL) {
|
||||||
|
unlink(tempfile);
|
||||||
|
err(EXIT_FAILURE, "copy of %s failed", filename);
|
||||||
|
}
|
||||||
|
|
||||||
|
/* unlink the original and rename the temporary one back */
|
||||||
|
if (unlink(filename) != 0) {
|
||||||
|
err(EXIT_FAILURE, "unlink of %s failed", filename);
|
||||||
|
}
|
||||||
|
if (rename(tempfile, filename) != 0) {
|
||||||
|
err(EXIT_FAILURE, "unable to rename %s to %s; manual "
|
||||||
|
"recovery required", tempfile, filename);
|
||||||
|
}
|
||||||
|
|
||||||
|
again:
|
||||||
|
/* clean up before the next loop */
|
||||||
|
free(tempfile);
|
||||||
|
GIfree(tempfileGS);
|
||||||
|
GIfree(filenameGS);
|
||||||
|
}
|
||||||
|
return EXIT_SUCCESS;
|
||||||
|
}
|
9
usr.bin/removerez/removerez.desc
Normal file
9
usr.bin/removerez/removerez.desc
Normal file
|
@ -0,0 +1,9 @@
|
||||||
|
Name: removerez
|
||||||
|
Version: 1.0 (29 Mar 98)
|
||||||
|
Shell: GNO, ORCA/Shell
|
||||||
|
Author: Devin Reade.
|
||||||
|
Contact: gdr@trenco.gno.org
|
||||||
|
Where: /usr/bin
|
||||||
|
FTP: ftp.gno.org
|
||||||
|
|
||||||
|
Removes resource forks from extended files.
|
19
usr.bin/removerez/removerez.rez
Normal file
19
usr.bin/removerez/removerez.rez
Normal file
|
@ -0,0 +1,19 @@
|
||||||
|
/*
|
||||||
|
* $Id: removerez.rez,v 1.1 1998/03/31 03:33:03 gdr-ftp Exp $
|
||||||
|
*/
|
||||||
|
|
||||||
|
#include "Types.Rez"
|
||||||
|
#include "/src/gno/build.tools/builddate.rez"
|
||||||
|
|
||||||
|
resource rVersion (0x1, purgeable3, nocrossbank) {
|
||||||
|
|
||||||
|
{ 1, 1, 0, /* version 1.1.0 */
|
||||||
|
release, /* development|alpha|beta|final|release */
|
||||||
|
0 /* non-final release number */
|
||||||
|
},
|
||||||
|
verUS,
|
||||||
|
"removerez",
|
||||||
|
"Strip resource fork.\n"
|
||||||
|
"Patterned off the ORCA/Shell script of the same name.\n"
|
||||||
|
BUILD_DATE
|
||||||
|
};
|
Loading…
Reference in New Issue
Block a user