mirror of
https://github.com/GnoConsortium/gno.git
synced 2025-01-21 12:29:42 +00:00
reformatted source and cleaned up some comments
This commit is contained in:
parent
6f96d148e5
commit
d686ae9f02
sbin/renram5
@ -1,7 +1,11 @@
|
|||||||
This is a quick and dirty program intended to rename /RAM5 at
|
This is a quick and dirty program intended to rename /RAM5 at boot time.
|
||||||
boot time.
|
Why do we bother? Well, many GNO utils make use of '/tmp' (which by
|
||||||
|
default resides on the '/' partition via /etc/namespace mappings) for
|
||||||
|
scratch files. This "partition" should therefore be on a fast disk.
|
||||||
|
A RAMDisk is a logical choice; not only is it fast, but it also is
|
||||||
|
empty after each power-on.
|
||||||
|
|
||||||
See the man page for details.
|
See the man page for usage information.
|
||||||
|
|
||||||
If you decide to launch this program automatically from ProSel-16
|
If you decide to launch this program automatically from ProSel-16
|
||||||
(as I do), ensure you change the file type to S16, otherwise ProSel
|
(as I do), ensure you change the file type to S16, otherwise ProSel
|
||||||
|
@ -1,6 +1,6 @@
|
|||||||
.\" $Id: renram5.8,v 1.1 1996/01/29 06:20:11 gdr Exp $
|
.\" $Id: renram5.8,v 1.2 1997/09/21 22:27:40 gdr Exp $
|
||||||
.\"
|
.\"
|
||||||
.TH RENRAM5 8 "System Administration" "28 January 1996" "Version 1.0"
|
.TH RENRAM5 8 "3 August 1997" GNO "System Administration"
|
||||||
.SH NAME
|
.SH NAME
|
||||||
renram5 \- rename /RAM5 at boot time
|
renram5 \- rename /RAM5 at boot time
|
||||||
.SH SYNOPSIS
|
.SH SYNOPSIS
|
||||||
|
@ -18,7 +18,9 @@
|
|||||||
* Written by Devin Reade <gdr@myrias.com> January 1996.
|
* Written by Devin Reade <gdr@myrias.com> January 1996.
|
||||||
* This program is placed in the public domain.
|
* This program is placed in the public domain.
|
||||||
*
|
*
|
||||||
* $Id: renram5.c,v 1.1 1996/01/29 06:20:12 gdr Exp $
|
* $Id: renram5.c,v 1.2 1997/09/21 22:27:40 gdr Exp $
|
||||||
|
*
|
||||||
|
* This file is formatted with tab tops every 8 columns.
|
||||||
*/
|
*/
|
||||||
|
|
||||||
#include <types.h>
|
#include <types.h>
|
||||||
@ -41,115 +43,115 @@ extern GSString255Ptr __C2GSMALLOC(char *);
|
|||||||
extern int _mapErr(int);
|
extern int _mapErr(int);
|
||||||
|
|
||||||
void usage(char *progname) {
|
void usage(char *progname) {
|
||||||
printf("Usage: %s [-d] [oldvolume [newvolume]]\n",progname);
|
printf("Usage: %s [-d] [oldvolume [newvolume]]\n",progname);
|
||||||
printf("\toldvolume defaults to %s\n",OLD_TMP);
|
printf("\toldvolume defaults to %s\n",OLD_TMP);
|
||||||
printf("\tnewvolume defaults to %s\n",NEW_TMP);
|
printf("\tnewvolume defaults to %s\n",NEW_TMP);
|
||||||
printf("\t-d\tproduce debug information\n\n");
|
printf("\t-d\tproduce debug information\n\n");
|
||||||
printf("This program renames volumes. It was intended to rename\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",
|
printf("%s at boot time. As a side effect, it can also rename files.\n\n",
|
||||||
OLD_TMP);
|
OLD_TMP);
|
||||||
printf("Version 1.0 by Devin Reade <gdr@myrias.com>\n");
|
printf("Version 1.0 by Devin Reade <gdr@myrias.com>\n");
|
||||||
printf("This program is in the public domain.\n");
|
printf("This program is in the public domain.\n");
|
||||||
exit(1);
|
exit(1);
|
||||||
}
|
}
|
||||||
|
|
||||||
int main (int argc, char **argv) {
|
int main (int argc, char **argv) {
|
||||||
DevNumRecGS devrec;
|
DevNumRecGS devrec;
|
||||||
ChangePathRecGS pathrec;
|
ChangePathRecGS pathrec;
|
||||||
char *file1, *file2;
|
char *file1, *file2;
|
||||||
int i, filecount, debug;
|
int i, filecount, debug;
|
||||||
|
|
||||||
filecount=0;
|
filecount=0;
|
||||||
debug=0;
|
debug=0;
|
||||||
|
|
||||||
/* parse the command line, if any */
|
/* parse the command line, if any */
|
||||||
if (argc > 1) {
|
if (argc > 1) {
|
||||||
for (i=1; i<argc; i++) {
|
for (i=1; i<argc; i++) {
|
||||||
if (!strcmp(argv[i],"-d")) {
|
if (!strcmp(argv[i],"-d")) {
|
||||||
debug++;
|
debug++;
|
||||||
} else if ((argv[i][0] == '-') || (filecount > 2)) {
|
} else if ((argv[i][0] == '-') || (filecount > 2)) {
|
||||||
usage(argv[0]);
|
usage(argv[0]);
|
||||||
} else if (filecount==0) {
|
} else if (filecount==0) {
|
||||||
file1 = argv[i];
|
file1 = argv[i];
|
||||||
filecount++;
|
filecount++;
|
||||||
} else if (filecount==1) {
|
} else if (filecount==1) {
|
||||||
file2 = argv[i];
|
file2 = argv[i];
|
||||||
filecount++;
|
filecount++;
|
||||||
} else assert(0);
|
} else assert(0);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
switch (filecount) {
|
switch (filecount) {
|
||||||
case 0:
|
case 0:
|
||||||
file1 = OLD_TMP;
|
file1 = OLD_TMP;
|
||||||
file2 = NEW_TMP;
|
file2 = NEW_TMP;
|
||||||
break;
|
break;
|
||||||
case 1:
|
case 1:
|
||||||
file2 = NEW_TMP;
|
file2 = NEW_TMP;
|
||||||
break;
|
break;
|
||||||
case 2:
|
case 2:
|
||||||
break;
|
break;
|
||||||
default:
|
default:
|
||||||
assert(0);
|
assert(0);
|
||||||
}
|
}
|
||||||
|
|
||||||
assert(file1);
|
assert(file1);
|
||||||
assert(file2);
|
assert(file2);
|
||||||
|
|
||||||
/*
|
/*
|
||||||
* see if file2 is already around
|
* see if file2 is already around
|
||||||
*/
|
*/
|
||||||
|
|
||||||
devrec.pCount = 2;
|
devrec.pCount = 2;
|
||||||
if ((devrec.devName = (GSString32Ptr) __C2GSMALLOC(file2)) == NULL) {
|
if ((devrec.devName = (GSString32Ptr) __C2GSMALLOC(file2)) == NULL) {
|
||||||
perror("couldn't duplicate destination volume name");
|
perror("couldn't duplicate destination volume name");
|
||||||
exit(1);
|
exit(1);
|
||||||
}
|
}
|
||||||
GetDevNumberGS(&devrec);
|
GetDevNumberGS(&devrec);
|
||||||
i=toolerror();
|
i=toolerror();
|
||||||
switch (i) {
|
switch (i) {
|
||||||
case 0:
|
case 0:
|
||||||
if (debug) {
|
if (debug) {
|
||||||
printf("volume %s already exists on device %d\n",file2,
|
printf("volume %s already exists on device %d\n",file2,
|
||||||
devrec.devNum);
|
devrec.devNum);
|
||||||
}
|
}
|
||||||
exit(1);
|
exit(1);
|
||||||
case devNotFound:
|
case devNotFound:
|
||||||
case volNotFound:
|
case volNotFound:
|
||||||
/* this is what we're normally expecting */
|
/* this is what we're normally expecting */
|
||||||
break;
|
break;
|
||||||
default:
|
default:
|
||||||
fprintf(stderr,"couldn't get %s device number: %s\n",file2,
|
fprintf(stderr,"couldn't get %s device number: %s\n",file2,
|
||||||
strerror(_mapErr(i)));
|
strerror(_mapErr(i)));
|
||||||
exit(1);
|
exit(1);
|
||||||
}
|
}
|
||||||
|
|
||||||
/*
|
/*
|
||||||
* rename the volume
|
* rename the volume
|
||||||
*/
|
*/
|
||||||
|
|
||||||
pathrec.pCount = 3;
|
pathrec.pCount = 3;
|
||||||
pathrec.pathname = __C2GSMALLOC(file1);
|
pathrec.pathname = __C2GSMALLOC(file1);
|
||||||
pathrec.newPathname = __C2GSMALLOC(file2);
|
pathrec.newPathname = __C2GSMALLOC(file2);
|
||||||
pathrec.flags = 0;
|
pathrec.flags = 0;
|
||||||
if (!pathrec.pathname || !pathrec.newPathname) {
|
if (!pathrec.pathname || !pathrec.newPathname) {
|
||||||
perror("couldn't duplicate volume names");
|
perror("couldn't duplicate volume names");
|
||||||
exit(1);
|
exit(1);
|
||||||
}
|
}
|
||||||
ChangePathGS(&pathrec);
|
ChangePathGS(&pathrec);
|
||||||
i=toolerror();
|
i=toolerror();
|
||||||
switch (i) {
|
switch (i) {
|
||||||
case 0:
|
case 0:
|
||||||
if (debug) printf("device renamed\n");
|
if (debug) printf("device renamed\n");
|
||||||
break;
|
break;
|
||||||
case pathNotFound:
|
case pathNotFound:
|
||||||
case volNotFound:
|
case volNotFound:
|
||||||
if (debug) printf("device not renamed: %s\n",strerror(_mapErr(i)));
|
if (debug) printf("device not renamed: %s\n",strerror(_mapErr(i)));
|
||||||
break;
|
break;
|
||||||
default:
|
default:
|
||||||
fprintf(stderr,"couldn't rename %s to %s: %s\n",file1, file2,
|
fprintf(stderr,"couldn't rename %s to %s: %s\n",file1, file2,
|
||||||
strerror(_mapErr(i)));
|
strerror(_mapErr(i)));
|
||||||
exit(1);
|
exit(1);
|
||||||
}
|
}
|
||||||
|
|
||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
|
@ -1,5 +1,5 @@
|
|||||||
Name: renram5
|
Name: renram5
|
||||||
Version: 1.0 (26 Jan 96)
|
Version: 1.0.1 (3 Aug 97)
|
||||||
Shell: ORCA/Shell, GNO/ME
|
Shell: ORCA/Shell, GNO/ME
|
||||||
Author: Devin Reade
|
Author: Devin Reade
|
||||||
Contact: gdr@myrias.ab.ca
|
Contact: gdr@myrias.ab.ca
|
||||||
|
@ -1,12 +1,12 @@
|
|||||||
/*
|
/*
|
||||||
* $Id: renram5.rez,v 1.1 1996/01/29 06:20:12 gdr Exp $
|
* $Id: renram5.rez,v 1.2 1997/09/21 22:27:40 gdr Exp $
|
||||||
*/
|
*/
|
||||||
|
|
||||||
#include "Types.Rez"
|
#include "Types.Rez"
|
||||||
|
|
||||||
resource rVersion (0x1, purgeable3, nocrossbank) {
|
resource rVersion (0x1, purgeable3, nocrossbank) {
|
||||||
|
|
||||||
{ 1, 0, 0, /* version 1.0.0 */
|
{ 1, 0, 1, /* version 1.0.1 */
|
||||||
release, /* development|alpha|beta|final|release */
|
release, /* development|alpha|beta|final|release */
|
||||||
0 /* non-final release number */
|
0 /* non-final release number */
|
||||||
},
|
},
|
||||||
|
Loading…
x
Reference in New Issue
Block a user