diff --git a/usr.bin/link/Makefile b/usr.bin/link/Makefile new file mode 100644 index 0000000..a76ed7c --- /dev/null +++ b/usr.bin/link/Makefile @@ -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 + diff --git a/usr.bin/link/link.1 b/usr.bin/link/link.1 new file mode 100644 index 0000000..f551561 --- /dev/null +++ b/usr.bin/link/link.1 @@ -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" . diff --git a/usr.bin/link/link.c b/usr.bin/link/link.c new file mode 100644 index 0000000..488ec7b --- /dev/null +++ b/usr.bin/link/link.c @@ -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 +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include + +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); +} diff --git a/usr.bin/link/link.desc b/usr.bin/link/link.desc new file mode 100644 index 0000000..30444ab --- /dev/null +++ b/usr.bin/link/link.desc @@ -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. diff --git a/usr.bin/link/link.rez b/usr.bin/link/link.rez new file mode 100644 index 0000000..f86ba7b --- /dev/null +++ b/usr.bin/link/link.rez @@ -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 +}; + diff --git a/usr.bin/removerez/Makefile b/usr.bin/removerez/Makefile new file mode 100644 index 0000000..b9dda25 --- /dev/null +++ b/usr.bin/removerez/Makefile @@ -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 + diff --git a/usr.bin/removerez/removerez.1 b/usr.bin/removerez/removerez.1 new file mode 100644 index 0000000..962f05e --- /dev/null +++ b/usr.bin/removerez/removerez.1 @@ -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) diff --git a/usr.bin/removerez/removerez.c b/usr.bin/removerez/removerez.c new file mode 100644 index 0000000..ff4f061 --- /dev/null +++ b/usr.bin/removerez/removerez.c @@ -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 +#include +#include +#include +#include +#include +#include +#include +#include + +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