mirror of
https://github.com/GnoConsortium/gno.git
synced 2024-12-30 04:33:01 +00:00
Initial checkin.
This commit is contained in:
parent
5ab0aa962f
commit
cfa60026c9
12
sbin/renram5/Makefile
Normal file
12
sbin/renram5/Makefile
Normal file
@ -0,0 +1,12 @@
|
||||
CFLAGS = -w -O
|
||||
LDFLAGS =
|
||||
|
||||
renram5: renram5.o renram5.r
|
||||
$(CC) $(LDFLAGS) renram5.o $(LDLIBS) -o $@
|
||||
copyfork renram5.r renram5 -r
|
||||
|
||||
clean:
|
||||
$(RM) -f renram5.o renram5.root renram5.r
|
||||
|
||||
clobber: clean
|
||||
$(RM) -f renram5
|
12
sbin/renram5/README
Normal file
12
sbin/renram5/README
Normal file
@ -0,0 +1,12 @@
|
||||
This is a quick and dirty program intended to rename /RAM5 at
|
||||
boot time.
|
||||
|
||||
See the man page for details.
|
||||
|
||||
If you decide to launch this program automatically from ProSel-16
|
||||
(as I do), ensure you change the file type to S16, otherwise ProSel
|
||||
will always prompt you when it is done ... most annoying.
|
||||
|
||||
This program is in the public domain.
|
||||
|
||||
Devin Reade <gdr@myrias.com> January 1996.
|
52
sbin/renram5/renram5.8
Normal file
52
sbin/renram5/renram5.8
Normal file
@ -0,0 +1,52 @@
|
||||
.\" $Id: renram5.8,v 1.1 1996/01/29 06:20:11 gdr Exp $
|
||||
.\"
|
||||
.TH RENRAM5 8 "System Administration" "28 January 1996" "Version 1.0"
|
||||
.SH NAME
|
||||
renram5 \- rename /RAM5 at boot time
|
||||
.SH SYNOPSIS
|
||||
.BR renram5
|
||||
[
|
||||
.B \-d
|
||||
] [
|
||||
.I oldvolume
|
||||
[
|
||||
.I newvolume
|
||||
]]
|
||||
.SH DESCRIPTION
|
||||
.BR renram5
|
||||
is intended to be run automatically at boot time. It renames
|
||||
the volume
|
||||
.I oldvolume
|
||||
to
|
||||
.IR newvolume ,
|
||||
if
|
||||
.I newvolume
|
||||
does not already exist. If
|
||||
.I oldvolume
|
||||
or
|
||||
.I newvolume
|
||||
aren't specified, they default to
|
||||
.BR /RAM5
|
||||
and
|
||||
.BR /tmp .
|
||||
.LP
|
||||
If you are running
|
||||
.BR renram5
|
||||
automatically from ProSel-16 (and perhaps other launchers) you should
|
||||
change the filetype to
|
||||
.BR S16 .
|
||||
This will keep ProSel from prompting after the program is finished.
|
||||
When run as a
|
||||
.BR S16
|
||||
program, no command line arguments are possible.
|
||||
.SH OPTIONS
|
||||
.IP \fB-d\fP
|
||||
Enable debugging information.
|
||||
.SH AUTHOR
|
||||
Devin Reade, <gdr@myrias.com>
|
||||
.LP
|
||||
This program is in the public domain.
|
||||
.LP
|
||||
This program contains material from the ORCA/C Run-Time
|
||||
Libraries, copyright 1987-1996 by Byte Words, Inc.
|
||||
Used with permission.
|
155
sbin/renram5/renram5.c
Normal file
155
sbin/renram5/renram5.c
Normal file
@ -0,0 +1,155 @@
|
||||
/*
|
||||
* renram5
|
||||
*
|
||||
* This program is intended to be launched during boot time. It
|
||||
* renames the volume /RAM5 to /tmp if /tmp does not already exist.
|
||||
*
|
||||
* It can also be invoked as a shell command (in which it should
|
||||
* be changed to an exec file rather than a s16 file). As a shell
|
||||
* command, its usage is:
|
||||
* renram5 [-d] [ oldname [newname]]
|
||||
*
|
||||
* If <oldname> is not specified, it defaults to "/RAM5". If <newname> is
|
||||
* not specified, it defaults to "/tmp". The -d flag enables debugging
|
||||
* output.
|
||||
*
|
||||
* You probably need GNO/ME libraries in order to link this program.
|
||||
*
|
||||
* Written by Devin Reade <gdr@myrias.com> January 1996.
|
||||
* This program is placed in the public domain.
|
||||
*
|
||||
* $Id: renram5.c,v 1.1 1996/01/29 06:20:12 gdr Exp $
|
||||
*/
|
||||
|
||||
#include <types.h>
|
||||
#include <gsos.h>
|
||||
#include <orca.h>
|
||||
#include <stdio.h>
|
||||
#include <errno.h>
|
||||
#include <stdlib.h>
|
||||
#include <string.h>
|
||||
#include <assert.h>
|
||||
|
||||
#ifndef P_tmpdir
|
||||
#define P_tmpdir "/tmp"
|
||||
#endif
|
||||
|
||||
#define OLD_TMP "/RAM5"
|
||||
#define NEW_TMP P_tmpdir
|
||||
|
||||
extern GSString255Ptr __C2GSMALLOC(char *);
|
||||
extern int _mapErr(int);
|
||||
|
||||
void usage(char *progname) {
|
||||
printf("Usage: %s [-d] [oldvolume [newvolume]]\n",progname);
|
||||
printf("\toldvolume defaults to %s\n",OLD_TMP);
|
||||
printf("\tnewvolume defaults to %s\n",NEW_TMP);
|
||||
printf("\t-d\tproduce debug information\n\n");
|
||||
printf("This program renames volumes. It was intended to rename\n");
|
||||
printf("%s at boot time. As a side effect, it can also rename files.\n\n",
|
||||
OLD_TMP);
|
||||
printf("Version 1.0 by Devin Reade <gdr@myrias.com>\n");
|
||||
printf("This program is in the public domain.\n");
|
||||
exit(1);
|
||||
}
|
||||
|
||||
int main (int argc, char **argv) {
|
||||
DevNumRecGS devrec;
|
||||
ChangePathRecGS pathrec;
|
||||
char *file1, *file2;
|
||||
int i, filecount, debug;
|
||||
|
||||
filecount=0;
|
||||
debug=0;
|
||||
|
||||
/* parse the command line, if any */
|
||||
if (argc > 1) {
|
||||
for (i=1; i<argc; i++) {
|
||||
if (!strcmp(argv[i],"-d")) {
|
||||
debug++;
|
||||
} else if ((argv[i][0] == '-') || (filecount > 2)) {
|
||||
usage(argv[0]);
|
||||
} else if (filecount==0) {
|
||||
file1 = argv[i];
|
||||
filecount++;
|
||||
} else if (filecount==1) {
|
||||
file2 = argv[i];
|
||||
filecount++;
|
||||
} else assert(0);
|
||||
}
|
||||
}
|
||||
switch (filecount) {
|
||||
case 0:
|
||||
file1 = OLD_TMP;
|
||||
file2 = NEW_TMP;
|
||||
break;
|
||||
case 1:
|
||||
file2 = NEW_TMP;
|
||||
break;
|
||||
case 2:
|
||||
break;
|
||||
default:
|
||||
assert(0);
|
||||
}
|
||||
|
||||
assert(file1);
|
||||
assert(file2);
|
||||
|
||||
/*
|
||||
* see if file2 is already around
|
||||
*/
|
||||
|
||||
devrec.pCount = 2;
|
||||
if ((devrec.devName = (GSString32Ptr) __C2GSMALLOC(file2)) == NULL) {
|
||||
perror("couldn't duplicate destination volume name");
|
||||
exit(1);
|
||||
}
|
||||
GetDevNumberGS(&devrec);
|
||||
i=toolerror();
|
||||
switch (i) {
|
||||
case 0:
|
||||
if (debug) {
|
||||
printf("volume %s already exists on device %d\n",file2,
|
||||
devrec.devNum);
|
||||
}
|
||||
exit(1);
|
||||
case devNotFound:
|
||||
case volNotFound:
|
||||
/* this is what we're normally expecting */
|
||||
break;
|
||||
default:
|
||||
fprintf(stderr,"couldn't get %s device number: %s\n",file2,
|
||||
strerror(_mapErr(i)));
|
||||
exit(1);
|
||||
}
|
||||
|
||||
/*
|
||||
* rename the volume
|
||||
*/
|
||||
|
||||
pathrec.pCount = 3;
|
||||
pathrec.pathname = __C2GSMALLOC(file1);
|
||||
pathrec.newPathname = __C2GSMALLOC(file2);
|
||||
pathrec.flags = 0;
|
||||
if (!pathrec.pathname || !pathrec.newPathname) {
|
||||
perror("couldn't duplicate volume names");
|
||||
exit(1);
|
||||
}
|
||||
ChangePathGS(&pathrec);
|
||||
i=toolerror();
|
||||
switch (i) {
|
||||
case 0:
|
||||
if (debug) printf("device renamed\n");
|
||||
break;
|
||||
case pathNotFound:
|
||||
case volNotFound:
|
||||
if (debug) printf("device not renamed: %s\n",strerror(_mapErr(i)));
|
||||
break;
|
||||
default:
|
||||
fprintf(stderr,"couldn't rename %s to %s: %s\n",file1, file2,
|
||||
strerror(_mapErr(i)));
|
||||
exit(1);
|
||||
}
|
||||
|
||||
return 0;
|
||||
}
|
10
sbin/renram5/renram5.desc
Normal file
10
sbin/renram5/renram5.desc
Normal file
@ -0,0 +1,10 @@
|
||||
Name: renram5
|
||||
Version: 1.0
|
||||
Shell: ORCA/Shell, GNO/ME
|
||||
Author: Devin Reade
|
||||
Contact: gdr@myrias.ab.ca
|
||||
Where: /usr/sbin
|
||||
FTP: ftp.cco.caltech.edu, grind.isca.uiowa.edu
|
||||
|
||||
Renames /RAM5 to /tmp on boot.
|
||||
|
18
sbin/renram5/renram5.rez
Normal file
18
sbin/renram5/renram5.rez
Normal file
@ -0,0 +1,18 @@
|
||||
/*
|
||||
* $Id: renram5.rez,v 1.1 1996/01/29 06:20:12 gdr Exp $
|
||||
*/
|
||||
|
||||
#include "Types.Rez"
|
||||
|
||||
resource rVersion (0x1, purgeable3, nocrossbank) {
|
||||
|
||||
{ 1, 0, 0, /* version 1.0.0 */
|
||||
release, /* development|alpha|beta|final|release */
|
||||
0 /* non-final release number */
|
||||
},
|
||||
verBritain, /* close enough */
|
||||
"renram5",
|
||||
"Rename /RAM5 at boot time.\n"
|
||||
"Devin Reade <gdr@myrias.com>\n"
|
||||
"Canada"
|
||||
};
|
Loading…
Reference in New Issue
Block a user