Cleanup: convert function definitions to ANSI style in minix/commands
Task from minix wishlist. No functional changes intended.
This commit is contained in:
parent
e47e5f1694
commit
a23f413dfb
|
|
@ -211,7 +211,7 @@ boolean Func3(Enumeration EnumParIn);
|
||||||
Enumeration Func1(int CharPar1, int CharPar2);
|
Enumeration Func1(int CharPar1, int CharPar2);
|
||||||
|
|
||||||
|
|
||||||
int main()
|
int main(void)
|
||||||
{
|
{
|
||||||
Proc0();
|
Proc0();
|
||||||
return(0);
|
return(0);
|
||||||
|
|
@ -224,14 +224,13 @@ volatile int done;
|
||||||
int done;
|
int done;
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
void prep_timer()
|
void prep_timer(void)
|
||||||
{
|
{
|
||||||
signal(SIGALRM, timeout);
|
signal(SIGALRM, timeout);
|
||||||
done = 0;
|
done = 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
void timeout(sig)
|
void timeout(int sig)
|
||||||
int sig;
|
|
||||||
{
|
{
|
||||||
done = 1;
|
done = 1;
|
||||||
}
|
}
|
||||||
|
|
@ -247,7 +246,7 @@ RecordPtr PtrGlb;
|
||||||
RecordPtr PtrGlbNext;
|
RecordPtr PtrGlbNext;
|
||||||
|
|
||||||
|
|
||||||
void Proc0()
|
void Proc0(void)
|
||||||
{
|
{
|
||||||
OneToFifty IntLoc1;
|
OneToFifty IntLoc1;
|
||||||
REG OneToFifty IntLoc2;
|
REG OneToFifty IntLoc2;
|
||||||
|
|
@ -383,8 +382,7 @@ void Proc0()
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
void Proc1(PtrParIn)
|
void Proc1(REG RecordPtr PtrParIn)
|
||||||
REG RecordPtr PtrParIn;
|
|
||||||
{
|
{
|
||||||
#define NextRecord (*(PtrParIn->PtrComp))
|
#define NextRecord (*(PtrParIn->PtrComp))
|
||||||
|
|
||||||
|
|
@ -407,8 +405,7 @@ REG RecordPtr PtrParIn;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
void Proc2(IntParIO)
|
void Proc2(OneToFifty *IntParIO)
|
||||||
OneToFifty *IntParIO;
|
|
||||||
{
|
{
|
||||||
REG OneToFifty IntLoc;
|
REG OneToFifty IntLoc;
|
||||||
REG Enumeration EnumLoc;
|
REG Enumeration EnumLoc;
|
||||||
|
|
@ -426,8 +423,7 @@ OneToFifty *IntParIO;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
void Proc3(PtrParOut)
|
void Proc3(RecordPtr *PtrParOut)
|
||||||
RecordPtr *PtrParOut;
|
|
||||||
{
|
{
|
||||||
if (PtrGlb != NULL)
|
if (PtrGlb != NULL)
|
||||||
*PtrParOut = PtrGlb->PtrComp;
|
*PtrParOut = PtrGlb->PtrComp;
|
||||||
|
|
@ -437,7 +433,7 @@ RecordPtr *PtrParOut;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
void Proc4()
|
void Proc4(void)
|
||||||
{
|
{
|
||||||
REG boolean BoolLoc;
|
REG boolean BoolLoc;
|
||||||
|
|
||||||
|
|
@ -448,16 +444,14 @@ void Proc4()
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
void Proc5()
|
void Proc5(void)
|
||||||
{
|
{
|
||||||
Char1Glob = 'A';
|
Char1Glob = 'A';
|
||||||
BoolGlob = FALSE;
|
BoolGlob = FALSE;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
void Proc6(EnumParIn, EnumParOut)
|
void Proc6(REG Enumeration EnumParIn, REG Enumeration *EnumParOut)
|
||||||
REG Enumeration EnumParIn;
|
|
||||||
REG Enumeration *EnumParOut;
|
|
||||||
{
|
{
|
||||||
*EnumParOut = EnumParIn;
|
*EnumParOut = EnumParIn;
|
||||||
if (!Func3(EnumParIn)) *EnumParOut = Ident4;
|
if (!Func3(EnumParIn)) *EnumParOut = Ident4;
|
||||||
|
|
@ -477,10 +471,7 @@ REG Enumeration *EnumParOut;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
void Proc7(IntParI1, IntParI2, IntParOut)
|
void Proc7(OneToFifty IntParI1, OneToFifty IntParI2, OneToFifty *IntParOut)
|
||||||
OneToFifty IntParI1;
|
|
||||||
OneToFifty IntParI2;
|
|
||||||
OneToFifty *IntParOut;
|
|
||||||
{
|
{
|
||||||
REG OneToFifty IntLoc;
|
REG OneToFifty IntLoc;
|
||||||
|
|
||||||
|
|
@ -490,11 +481,8 @@ OneToFifty *IntParOut;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
void Proc8(Array1Par, Array2Par, IntParI1, IntParI2)
|
void Proc8(Array1Dim Array1Par, Array2Dim Array2Par,
|
||||||
Array1Dim Array1Par;
|
OneToFifty IntParI1, OneToFifty IntParI2)
|
||||||
Array2Dim Array2Par;
|
|
||||||
OneToFifty IntParI1;
|
|
||||||
OneToFifty IntParI2;
|
|
||||||
{
|
{
|
||||||
REG OneToFifty IntLoc;
|
REG OneToFifty IntLoc;
|
||||||
REG OneToFifty IntIndex;
|
REG OneToFifty IntIndex;
|
||||||
|
|
@ -512,9 +500,7 @@ OneToFifty IntParI2;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
Enumeration Func1(CharPar1, CharPar2)
|
Enumeration Func1(CapitalLetter CharPar1, CapitalLetter CharPar2)
|
||||||
CapitalLetter CharPar1;
|
|
||||||
CapitalLetter CharPar2;
|
|
||||||
{
|
{
|
||||||
REG CapitalLetter CharLoc1;
|
REG CapitalLetter CharLoc1;
|
||||||
REG CapitalLetter CharLoc2;
|
REG CapitalLetter CharLoc2;
|
||||||
|
|
@ -529,9 +515,7 @@ CapitalLetter CharPar2;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
boolean Func2(StrParI1, StrParI2)
|
boolean Func2(String30 StrParI1, String30 StrParI2)
|
||||||
String30 StrParI1;
|
|
||||||
String30 StrParI2;
|
|
||||||
{
|
{
|
||||||
REG OneToThirty IntLoc;
|
REG OneToThirty IntLoc;
|
||||||
REG CapitalLetter CharLoc;
|
REG CapitalLetter CharLoc;
|
||||||
|
|
@ -556,8 +540,7 @@ String30 StrParI2;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
boolean Func3(EnumParIn)
|
boolean Func3(REG Enumeration EnumParIn)
|
||||||
REG Enumeration EnumParIn;
|
|
||||||
{
|
{
|
||||||
REG Enumeration EnumLoc;
|
REG Enumeration EnumLoc;
|
||||||
|
|
||||||
|
|
@ -569,10 +552,7 @@ REG Enumeration EnumParIn;
|
||||||
|
|
||||||
|
|
||||||
#ifdef NOSTRUCTASSIGN
|
#ifdef NOSTRUCTASSIGN
|
||||||
memcpy(d, s, l)
|
memcpy(register char *d, register char *s, register int l)
|
||||||
register char *d;
|
|
||||||
register char *s;
|
|
||||||
register int l;
|
|
||||||
{
|
{
|
||||||
while (l--) *d++ = *s++;
|
while (l--) *d++ = *s++;
|
||||||
}
|
}
|
||||||
|
|
|
||||||
|
|
@ -146,29 +146,26 @@ BOOL free_range(unsigned short *first, unsigned short *last);
|
||||||
long lmin(long a, long b);
|
long lmin(long a, long b);
|
||||||
|
|
||||||
|
|
||||||
void usage(prog_name)
|
void usage(register char *prog_name)
|
||||||
register char *prog_name;
|
|
||||||
{
|
{
|
||||||
fprintf (stderr, "Usage: %s [%s\n", prog_name,
|
fprintf (stderr, "Usage: %s [%s\n", prog_name,
|
||||||
(dos_dir ? "-lr] drive [dir]" : "-a] drive file"));
|
(dos_dir ? "-lr] drive [dir]" : "-a] drive file"));
|
||||||
exit(1);
|
exit(1);
|
||||||
}
|
}
|
||||||
|
|
||||||
unsigned c2u2(ucarray)
|
unsigned c2u2(unsigned char *ucarray)
|
||||||
unsigned char *ucarray;
|
|
||||||
{
|
{
|
||||||
return ucarray[0] + (ucarray[1] << 8); /* parens vital */
|
return ucarray[0] + (ucarray[1] << 8); /* parens vital */
|
||||||
}
|
}
|
||||||
|
|
||||||
unsigned long c4u4(ucarray)
|
unsigned long c4u4(unsigned char *ucarray)
|
||||||
unsigned char *ucarray;
|
|
||||||
{
|
{
|
||||||
return ucarray[0] + ((unsigned long) ucarray[1] << 8) +
|
return ucarray[0] + ((unsigned long) ucarray[1] << 8) +
|
||||||
((unsigned long) ucarray[2] << 16) +
|
((unsigned long) ucarray[2] << 16) +
|
||||||
((unsigned long) ucarray[3] << 24);
|
((unsigned long) ucarray[3] << 24);
|
||||||
}
|
}
|
||||||
|
|
||||||
void determine()
|
void determine(void)
|
||||||
{
|
{
|
||||||
struct dosboot {
|
struct dosboot {
|
||||||
unsigned char cjump[2]; /* unsigneds avoid bugs */
|
unsigned char cjump[2]; /* unsigneds avoid bugs */
|
||||||
|
|
@ -292,9 +289,7 @@ void determine()
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
int main(argc, argv)
|
int main(int argc, register char *argv[])
|
||||||
int argc;
|
|
||||||
register char *argv[];
|
|
||||||
{
|
{
|
||||||
register char *arg_ptr = slash(argv[0]);
|
register char *arg_ptr = slash(argv[0]);
|
||||||
DIRECTORY *entry;
|
DIRECTORY *entry;
|
||||||
|
|
@ -438,11 +433,7 @@ register char *argv[];
|
||||||
* separated by slashes, but can be longer than than
|
* separated by slashes, but can be longer than than
|
||||||
* 8+3 characters (The rest is ignored).
|
* 8+3 characters (The rest is ignored).
|
||||||
*/
|
*/
|
||||||
DIRECTORY *directory(dir, entries, function, pathname)
|
DIRECTORY *directory(DIRECTORY *dir, int entries, int function, register char *pathname)
|
||||||
DIRECTORY *dir;
|
|
||||||
int entries;
|
|
||||||
int function;
|
|
||||||
register char *pathname;
|
|
||||||
{
|
{
|
||||||
register DIRECTORY *dir_ptr = dir;
|
register DIRECTORY *dir_ptr = dir;
|
||||||
DIRECTORY *mem = NULL;
|
DIRECTORY *mem = NULL;
|
||||||
|
|
@ -564,8 +555,7 @@ register char *pathname;
|
||||||
return NULL;
|
return NULL;
|
||||||
}
|
}
|
||||||
|
|
||||||
void extract(entry)
|
void extract(register DIRECTORY *entry)
|
||||||
register DIRECTORY *entry;
|
|
||||||
{
|
{
|
||||||
register unsigned short cl_no = entry->d_cluster;
|
register unsigned short cl_no = entry->d_cluster;
|
||||||
char buffer[MAX_CLUSTER_SIZE];
|
char buffer[MAX_CLUSTER_SIZE];
|
||||||
|
|
@ -614,18 +604,14 @@ register DIRECTORY *entry;
|
||||||
|
|
||||||
/* Minimum of two long values
|
/* Minimum of two long values
|
||||||
*/
|
*/
|
||||||
long lmin (a, b)
|
long lmin (long a, long b)
|
||||||
long a, b;
|
|
||||||
{
|
{
|
||||||
if (a < b) return a;
|
if (a < b) return a;
|
||||||
else return b;
|
else return b;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
void make_file(dir_ptr, entries, name)
|
void make_file(DIRECTORY *dir_ptr, int entries, char *name)
|
||||||
DIRECTORY *dir_ptr;
|
|
||||||
int entries;
|
|
||||||
char *name;
|
|
||||||
{
|
{
|
||||||
register DIRECTORY *entry = new_entry(dir_ptr, entries);
|
register DIRECTORY *entry = new_entry(dir_ptr, entries);
|
||||||
register char *ptr;
|
register char *ptr;
|
||||||
|
|
@ -693,8 +679,7 @@ done:
|
||||||
|
|
||||||
unsigned short mon_len[] = {31, 28, 31, 30, 31, 30, 31, 31, 30, 31, 30, 31};
|
unsigned short mon_len[] = {31, 28, 31, 30, 31, 30, 31, 31, 30, 31, 30, 31};
|
||||||
|
|
||||||
void fill_date(entry)
|
void fill_date(DIRECTORY *entry)
|
||||||
DIRECTORY *entry;
|
|
||||||
{
|
{
|
||||||
register long cur_time = time(NULL) - DOS_TIME;
|
register long cur_time = time(NULL) - DOS_TIME;
|
||||||
unsigned short year = 0, month = 1, day, hour, minutes, seconds;
|
unsigned short year = 0, month = 1, day, hour, minutes, seconds;
|
||||||
|
|
@ -733,9 +718,7 @@ DIRECTORY *entry;
|
||||||
entry->d_time = (hour << 11) | (minutes << 5) | seconds;
|
entry->d_time = (hour << 11) | (minutes << 5) | seconds;
|
||||||
}
|
}
|
||||||
|
|
||||||
char *make_name(dir_ptr, dir_fl)
|
char *make_name(register DIRECTORY *dir_ptr, short dir_fl)
|
||||||
register DIRECTORY *dir_ptr;
|
|
||||||
short dir_fl;
|
|
||||||
{
|
{
|
||||||
static char name_buf[14];
|
static char name_buf[14];
|
||||||
register char *ptr = name_buf;
|
register char *ptr = name_buf;
|
||||||
|
|
@ -760,9 +743,7 @@ short dir_fl;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
int fill(buffer, size)
|
int fill(register char *buffer, size_t size)
|
||||||
register char *buffer;
|
|
||||||
size_t size;
|
|
||||||
{
|
{
|
||||||
static BOOL nl_mark = FALSE;
|
static BOOL nl_mark = FALSE;
|
||||||
char *last = &buffer[size];
|
char *last = &buffer[size];
|
||||||
|
|
@ -799,17 +780,14 @@ char *month[] = {
|
||||||
"Jul", "Aug", "Sep", "Oct", "Nov", "Dec"
|
"Jul", "Aug", "Sep", "Oct", "Nov", "Dec"
|
||||||
};
|
};
|
||||||
|
|
||||||
void xmodes(mode)
|
void xmodes(int mode)
|
||||||
int mode;
|
|
||||||
{
|
{
|
||||||
printf ( "\t%c%c%c%c%c", (mode & SUB_DIR) ? 'd' : '-',
|
printf ( "\t%c%c%c%c%c", (mode & SUB_DIR) ? 'd' : '-',
|
||||||
(mode & 02) ? 'h' : '-', (mode & 04) ? 's' : '-',
|
(mode & 02) ? 'h' : '-', (mode & 04) ? 's' : '-',
|
||||||
(mode & 01) ? '-' : 'w', (mode & 0x20) ? 'a' : '-');
|
(mode & 01) ? '-' : 'w', (mode & 0x20) ? 'a' : '-');
|
||||||
}
|
}
|
||||||
|
|
||||||
void show(dir_ptr, name)
|
void show(DIRECTORY *dir_ptr, char *name)
|
||||||
DIRECTORY *dir_ptr;
|
|
||||||
char *name;
|
|
||||||
{
|
{
|
||||||
register unsigned short e_date = dir_ptr->d_date;
|
register unsigned short e_date = dir_ptr->d_date;
|
||||||
register unsigned short e_time = dir_ptr->d_time;
|
register unsigned short e_time = dir_ptr->d_time;
|
||||||
|
|
@ -837,7 +815,7 @@ char *name;
|
||||||
month[((e_date & MONTH) >> 5) - 1], ((e_date & YEAR) >> 9) + 1980);
|
month[((e_date & MONTH) >> 5) - 1], ((e_date & YEAR) >> 9) + 1980);
|
||||||
}
|
}
|
||||||
|
|
||||||
void free_blocks()
|
void free_blocks(void)
|
||||||
{
|
{
|
||||||
register unsigned short cl_no;
|
register unsigned short cl_no;
|
||||||
long nr_free = 0;
|
long nr_free = 0;
|
||||||
|
|
@ -856,8 +834,7 @@ void free_blocks()
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
DIRECTORY *read_cluster(cluster)
|
DIRECTORY *read_cluster(register unsigned int cluster)
|
||||||
register unsigned int cluster;
|
|
||||||
{
|
{
|
||||||
register DIRECTORY *sub_dir;
|
register DIRECTORY *sub_dir;
|
||||||
|
|
||||||
|
|
@ -879,8 +856,7 @@ static unsigned short cl_index = 2;
|
||||||
* Warning: Assumes that all of the range is used before the next call
|
* Warning: Assumes that all of the range is used before the next call
|
||||||
* to free_range or free_cluster.
|
* to free_range or free_cluster.
|
||||||
*/
|
*/
|
||||||
BOOL free_range (first, last)
|
BOOL free_range (unsigned short *first, unsigned short *last)
|
||||||
unsigned short *first, *last;
|
|
||||||
{
|
{
|
||||||
while (cl_index < total_clusters && next_cluster(cl_index) != FREE)
|
while (cl_index < total_clusters && next_cluster(cl_index) != FREE)
|
||||||
cl_index++;
|
cl_index++;
|
||||||
|
|
@ -902,8 +878,7 @@ unsigned short *first, *last;
|
||||||
* Warning: Assumes that the cluster is used before the next call
|
* Warning: Assumes that the cluster is used before the next call
|
||||||
* to free_range or free_cluster.
|
* to free_range or free_cluster.
|
||||||
*/
|
*/
|
||||||
unsigned short free_cluster(leave_fl)
|
unsigned short free_cluster(BOOL leave_fl)
|
||||||
BOOL leave_fl;
|
|
||||||
{
|
{
|
||||||
while (cl_index < total_clusters && next_cluster(cl_index) != FREE)
|
while (cl_index < total_clusters && next_cluster(cl_index) != FREE)
|
||||||
cl_index++;
|
cl_index++;
|
||||||
|
|
@ -918,8 +893,7 @@ BOOL leave_fl;
|
||||||
|
|
||||||
/* read a portion of the fat containing |cl_no| into the cache
|
/* read a portion of the fat containing |cl_no| into the cache
|
||||||
*/
|
*/
|
||||||
void read_fat (cl_no)
|
void read_fat (unsigned int cl_no)
|
||||||
unsigned int cl_no;
|
|
||||||
{
|
{
|
||||||
|
|
||||||
if (!cooked_fat) {
|
if (!cooked_fat) {
|
||||||
|
|
@ -999,7 +973,7 @@ void read_fat (cl_no)
|
||||||
|
|
||||||
/* flush the fat cache out to disk
|
/* flush the fat cache out to disk
|
||||||
*/
|
*/
|
||||||
void flush_fat ()
|
void flush_fat (void)
|
||||||
{
|
{
|
||||||
if (fat_16) {
|
if (fat_16) {
|
||||||
if (big_endian) {
|
if (big_endian) {
|
||||||
|
|
@ -1037,9 +1011,7 @@ void flush_fat ()
|
||||||
|
|
||||||
/* make cl_2 the successor of cl_1
|
/* make cl_2 the successor of cl_1
|
||||||
*/
|
*/
|
||||||
void link_fat(cl_1, cl_2)
|
void link_fat(unsigned int cl_1, unsigned int cl_2)
|
||||||
unsigned int cl_1;
|
|
||||||
unsigned int cl_2;
|
|
||||||
{
|
{
|
||||||
if (cl_1 < fat_low || cl_1 > fat_high) {
|
if (cl_1 < fat_low || cl_1 > fat_high) {
|
||||||
if (fat_dirty) flush_fat ();
|
if (fat_dirty) flush_fat ();
|
||||||
|
|
@ -1050,8 +1022,7 @@ unsigned int cl_2;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
unsigned short next_cluster(cl_no)
|
unsigned short next_cluster(register unsigned int cl_no)
|
||||||
register unsigned int cl_no;
|
|
||||||
{
|
{
|
||||||
if (cl_no < fat_low || cl_no > fat_high) {
|
if (cl_no < fat_low || cl_no > fat_high) {
|
||||||
if (fat_dirty) flush_fat ();
|
if (fat_dirty) flush_fat ();
|
||||||
|
|
@ -1060,8 +1031,7 @@ register unsigned int cl_no;
|
||||||
return cooked_fat [cl_no - fat_low];
|
return cooked_fat [cl_no - fat_low];
|
||||||
}
|
}
|
||||||
|
|
||||||
char *slash(str)
|
char *slash(register char *str)
|
||||||
register char *str;
|
|
||||||
{
|
{
|
||||||
register char *result = str;
|
register char *result = str;
|
||||||
|
|
||||||
|
|
@ -1071,9 +1041,7 @@ register char *str;
|
||||||
return result;
|
return result;
|
||||||
}
|
}
|
||||||
|
|
||||||
void add_path(file, slash_fl)
|
void add_path(char *file, BOOL slash_fl)
|
||||||
char *file;
|
|
||||||
BOOL slash_fl;
|
|
||||||
{
|
{
|
||||||
register char *ptr = path;
|
register char *ptr = path;
|
||||||
|
|
||||||
|
|
@ -1091,11 +1059,7 @@ BOOL slash_fl;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
void disk_io(op, seek, address, bytes)
|
void disk_io(register BOOL op, unsigned long seek, void *address, register unsigned bytes)
|
||||||
register BOOL op;
|
|
||||||
unsigned long seek;
|
|
||||||
void *address;
|
|
||||||
register unsigned bytes;
|
|
||||||
{
|
{
|
||||||
unsigned int r;
|
unsigned int r;
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -224,7 +224,7 @@ void printtotal(void);
|
||||||
void chkdev(char *f, char **clist, char **ilist, char **zlist);
|
void chkdev(char *f, char **clist, char **ilist, char **zlist);
|
||||||
|
|
||||||
/* Initialize the variables used by this program. */
|
/* Initialize the variables used by this program. */
|
||||||
void initvars()
|
void initvars(void)
|
||||||
{
|
{
|
||||||
register int level;
|
register int level;
|
||||||
|
|
||||||
|
|
@ -238,23 +238,20 @@ void initvars()
|
||||||
}
|
}
|
||||||
|
|
||||||
/* Print the string `s' and exit. */
|
/* Print the string `s' and exit. */
|
||||||
void fatal(s)
|
void fatal(char *s)
|
||||||
char *s;
|
|
||||||
{
|
{
|
||||||
printf("%s\nfatal\n", s);
|
printf("%s\nfatal\n", s);
|
||||||
exit(FSCK_EXIT_CHECK_FAILED);
|
exit(FSCK_EXIT_CHECK_FAILED);
|
||||||
}
|
}
|
||||||
|
|
||||||
/* Test for end of line. */
|
/* Test for end of line. */
|
||||||
int eoln(c)
|
int eoln(int c)
|
||||||
int c;
|
|
||||||
{
|
{
|
||||||
return(c == EOF || c == '\n' || c == '\r');
|
return(c == EOF || c == '\n' || c == '\r');
|
||||||
}
|
}
|
||||||
|
|
||||||
/* Ask a question and get the answer unless automatic is set. */
|
/* Ask a question and get the answer unless automatic is set. */
|
||||||
int yes(question)
|
int yes(char *question)
|
||||||
char *question;
|
|
||||||
{
|
{
|
||||||
register int c, answerchar;
|
register int c, answerchar;
|
||||||
static int note = 0;
|
static int note = 0;
|
||||||
|
|
@ -280,8 +277,7 @@ char *question;
|
||||||
}
|
}
|
||||||
|
|
||||||
/* Convert string to integer. Representation is octal. */
|
/* Convert string to integer. Representation is octal. */
|
||||||
int atoo(s)
|
int atoo(register char *s)
|
||||||
register char *s;
|
|
||||||
{
|
{
|
||||||
register int n = 0;
|
register int n = 0;
|
||||||
|
|
||||||
|
|
@ -293,9 +289,7 @@ register char *s;
|
||||||
}
|
}
|
||||||
|
|
||||||
/* If repairing the file system, print a prompt and get a string from user. */
|
/* If repairing the file system, print a prompt and get a string from user. */
|
||||||
int input(buf, size)
|
int input(char *buf, int size)
|
||||||
char *buf;
|
|
||||||
int size;
|
|
||||||
{
|
{
|
||||||
register char *p = buf;
|
register char *p = buf;
|
||||||
|
|
||||||
|
|
@ -319,8 +313,7 @@ int size;
|
||||||
}
|
}
|
||||||
|
|
||||||
/* Allocate some memory and zero it. */
|
/* Allocate some memory and zero it. */
|
||||||
char *alloc(nelem, elsize)
|
char *alloc(unsigned nelem, unsigned elsize)
|
||||||
unsigned nelem, elsize;
|
|
||||||
{
|
{
|
||||||
char *p;
|
char *p;
|
||||||
|
|
||||||
|
|
@ -334,8 +327,7 @@ unsigned nelem, elsize;
|
||||||
}
|
}
|
||||||
|
|
||||||
/* Print the name in a directory entry. */
|
/* Print the name in a directory entry. */
|
||||||
void printname(s)
|
void printname(char *s)
|
||||||
char *s;
|
|
||||||
{
|
{
|
||||||
register int n = MFS_NAME_MAX;
|
register int n = MFS_NAME_MAX;
|
||||||
int c;
|
int c;
|
||||||
|
|
@ -361,9 +353,7 @@ void printrec(struct stack *sp)
|
||||||
}
|
}
|
||||||
|
|
||||||
/* Print the current pathname. */
|
/* Print the current pathname. */
|
||||||
void printpath(mode, nlcr)
|
void printpath(int mode, int nlcr)
|
||||||
int mode;
|
|
||||||
int nlcr;
|
|
||||||
{
|
{
|
||||||
if (ftop->st_next == 0)
|
if (ftop->st_next == 0)
|
||||||
putchar('/');
|
putchar('/');
|
||||||
|
|
@ -381,7 +371,7 @@ int nlcr;
|
||||||
}
|
}
|
||||||
|
|
||||||
/* Open the device. */
|
/* Open the device. */
|
||||||
void devopen()
|
void devopen(void)
|
||||||
{
|
{
|
||||||
if ((dev = open(fsck_device,
|
if ((dev = open(fsck_device,
|
||||||
(repair || markdirty) ? O_RDWR : O_RDONLY)) < 0) {
|
(repair || markdirty) ? O_RDWR : O_RDONLY)) < 0) {
|
||||||
|
|
@ -391,7 +381,7 @@ void devopen()
|
||||||
}
|
}
|
||||||
|
|
||||||
/* Close the device. */
|
/* Close the device. */
|
||||||
void devclose()
|
void devclose(void)
|
||||||
{
|
{
|
||||||
if (close(dev) != 0) {
|
if (close(dev) != 0) {
|
||||||
perror("close");
|
perror("close");
|
||||||
|
|
@ -400,9 +390,7 @@ void devclose()
|
||||||
}
|
}
|
||||||
|
|
||||||
/* Read or write a block. */
|
/* Read or write a block. */
|
||||||
void devio(bno, dir)
|
void devio(block_nr bno, int dir)
|
||||||
block_nr bno;
|
|
||||||
int dir;
|
|
||||||
{
|
{
|
||||||
off_t r;
|
off_t r;
|
||||||
|
|
||||||
|
|
@ -437,11 +425,7 @@ printf("%s at block %5d\n", dir == READING ? "reading " : "writing", bno);
|
||||||
/* Read `size' bytes from the disk starting at block 'block' and
|
/* Read `size' bytes from the disk starting at block 'block' and
|
||||||
* byte `offset'.
|
* byte `offset'.
|
||||||
*/
|
*/
|
||||||
void devread(block, offset, buf, size)
|
void devread(long block, long offset, char *buf, int size)
|
||||||
long block;
|
|
||||||
long offset;
|
|
||||||
char *buf;
|
|
||||||
int size;
|
|
||||||
{
|
{
|
||||||
if(!block_size) fatal("devread() with unknown block size");
|
if(!block_size) fatal("devread() with unknown block size");
|
||||||
if (offset >= block_size)
|
if (offset >= block_size)
|
||||||
|
|
@ -456,11 +440,7 @@ int size;
|
||||||
/* Write `size' bytes to the disk starting at block 'block' and
|
/* Write `size' bytes to the disk starting at block 'block' and
|
||||||
* byte `offset'.
|
* byte `offset'.
|
||||||
*/
|
*/
|
||||||
void devwrite(block, offset, buf, size)
|
void devwrite(long block, long offset, char *buf, int size)
|
||||||
long block;
|
|
||||||
long offset;
|
|
||||||
char *buf;
|
|
||||||
int size;
|
|
||||||
{
|
{
|
||||||
if(!block_size) fatal("devwrite() with unknown block size");
|
if(!block_size) fatal("devwrite() with unknown block size");
|
||||||
if (!repair) fatal("internal error (devwrite)");
|
if (!repair) fatal("internal error (devwrite)");
|
||||||
|
|
@ -476,24 +456,19 @@ int size;
|
||||||
}
|
}
|
||||||
|
|
||||||
/* Print a string with either a singular or a plural pronoun. */
|
/* Print a string with either a singular or a plural pronoun. */
|
||||||
void pr(fmt, cnt, s, p)
|
void pr(char *fmt, int cnt, char *s, char *p)
|
||||||
char *fmt, *s, *p;
|
|
||||||
int cnt;
|
|
||||||
{
|
{
|
||||||
printf(fmt, cnt, cnt == 1 ? s : p);
|
printf(fmt, cnt, cnt == 1 ? s : p);
|
||||||
}
|
}
|
||||||
|
|
||||||
/* Same as above, but with a long argument */
|
/* Same as above, but with a long argument */
|
||||||
void lpr(fmt, cnt, s, p)
|
void lpr(char *fmt, long cnt, char *s, char *p)
|
||||||
char *fmt, *s, *p;
|
|
||||||
long cnt;
|
|
||||||
{
|
{
|
||||||
printf(fmt, cnt, cnt == 1 ? s : p);
|
printf(fmt, cnt, cnt == 1 ? s : p);
|
||||||
}
|
}
|
||||||
|
|
||||||
/* Convert string to number. */
|
/* Convert string to number. */
|
||||||
bit_nr getnumber(s)
|
bit_nr getnumber(register char *s)
|
||||||
register char *s;
|
|
||||||
{
|
{
|
||||||
register bit_nr n = 0;
|
register bit_nr n = 0;
|
||||||
|
|
||||||
|
|
@ -505,8 +480,7 @@ register char *s;
|
||||||
}
|
}
|
||||||
|
|
||||||
/* See if the list pointed to by `argv' contains numbers. */
|
/* See if the list pointed to by `argv' contains numbers. */
|
||||||
char **getlist(argv, type)
|
char **getlist(char ***argv, char *type)
|
||||||
char ***argv, *type;
|
|
||||||
{
|
{
|
||||||
register char **list = *argv;
|
register char **list = *argv;
|
||||||
register int empty = 1;
|
register int empty = 1;
|
||||||
|
|
@ -525,7 +499,7 @@ char ***argv, *type;
|
||||||
/* Make a listing of the super block. If `repair' is set, ask the user
|
/* Make a listing of the super block. If `repair' is set, ask the user
|
||||||
* for changes.
|
* for changes.
|
||||||
*/
|
*/
|
||||||
void lsuper()
|
void lsuper(void)
|
||||||
{
|
{
|
||||||
char buf[80];
|
char buf[80];
|
||||||
|
|
||||||
|
|
@ -599,7 +573,7 @@ void rw_super(int put)
|
||||||
}
|
}
|
||||||
|
|
||||||
/* Check the super block for reasonable contents. */
|
/* Check the super block for reasonable contents. */
|
||||||
void chksuper()
|
void chksuper(void)
|
||||||
{
|
{
|
||||||
register int n;
|
register int n;
|
||||||
register off_t maxsize;
|
register off_t maxsize;
|
||||||
|
|
@ -667,8 +641,7 @@ int inooff(int inn)
|
||||||
/* Make a listing of the inodes given by `clist'. If `repair' is set, ask
|
/* Make a listing of the inodes given by `clist'. If `repair' is set, ask
|
||||||
* the user for changes.
|
* the user for changes.
|
||||||
*/
|
*/
|
||||||
void lsi(clist)
|
void lsi(char **clist)
|
||||||
char **clist;
|
|
||||||
{
|
{
|
||||||
register bit_nr bit;
|
register bit_nr bit;
|
||||||
register ino_t ino;
|
register ino_t ino;
|
||||||
|
|
@ -698,8 +671,7 @@ char **clist;
|
||||||
}
|
}
|
||||||
|
|
||||||
/* Allocate `nblk' blocks worth of bitmap. */
|
/* Allocate `nblk' blocks worth of bitmap. */
|
||||||
bitchunk_t *allocbitmap(nblk)
|
bitchunk_t *allocbitmap(int nblk)
|
||||||
int nblk;
|
|
||||||
{
|
{
|
||||||
register bitchunk_t *bitmap;
|
register bitchunk_t *bitmap;
|
||||||
|
|
||||||
|
|
@ -709,10 +681,7 @@ int nblk;
|
||||||
}
|
}
|
||||||
|
|
||||||
/* Load the bitmap starting at block `bno' from disk. */
|
/* Load the bitmap starting at block `bno' from disk. */
|
||||||
void loadbitmap(bitmap, bno, nblk)
|
void loadbitmap(bitchunk_t *bitmap, block_nr bno, int nblk)
|
||||||
bitchunk_t *bitmap;
|
|
||||||
block_nr bno;
|
|
||||||
int nblk;
|
|
||||||
{
|
{
|
||||||
register int i;
|
register int i;
|
||||||
register bitchunk_t *p;
|
register bitchunk_t *p;
|
||||||
|
|
@ -724,10 +693,7 @@ int nblk;
|
||||||
}
|
}
|
||||||
|
|
||||||
/* Write the bitmap starting at block `bno' to disk. */
|
/* Write the bitmap starting at block `bno' to disk. */
|
||||||
void dumpbitmap(bitmap, bno, nblk)
|
void dumpbitmap(bitchunk_t *bitmap, block_nr bno, int nblk)
|
||||||
bitchunk_t *bitmap;
|
|
||||||
block_nr bno;
|
|
||||||
int nblk;
|
|
||||||
{
|
{
|
||||||
register int i;
|
register int i;
|
||||||
register bitchunk_t *p = bitmap;
|
register bitchunk_t *p = bitmap;
|
||||||
|
|
@ -737,10 +703,7 @@ int nblk;
|
||||||
}
|
}
|
||||||
|
|
||||||
/* Set the bits given by `list' in the bitmap. */
|
/* Set the bits given by `list' in the bitmap. */
|
||||||
void fillbitmap(bitmap, lwb, upb, list)
|
void fillbitmap(bitchunk_t *bitmap, bit_nr lwb, bit_nr upb, char **list)
|
||||||
bitchunk_t *bitmap;
|
|
||||||
bit_nr lwb, upb;
|
|
||||||
char **list;
|
|
||||||
{
|
{
|
||||||
register bit_nr bit;
|
register bit_nr bit;
|
||||||
|
|
||||||
|
|
@ -757,14 +720,13 @@ char **list;
|
||||||
}
|
}
|
||||||
|
|
||||||
/* Deallocate the bitmap `p'. */
|
/* Deallocate the bitmap `p'. */
|
||||||
void freebitmap(p)
|
void freebitmap(bitchunk_t *p)
|
||||||
bitchunk_t *p;
|
|
||||||
{
|
{
|
||||||
free((char *) p);
|
free((char *) p);
|
||||||
}
|
}
|
||||||
|
|
||||||
/* Get all the bitmaps used by this program. */
|
/* Get all the bitmaps used by this program. */
|
||||||
void getbitmaps()
|
void getbitmaps(void)
|
||||||
{
|
{
|
||||||
imap = allocbitmap(N_IMAP);
|
imap = allocbitmap(N_IMAP);
|
||||||
zmap = allocbitmap(N_ZMAP);
|
zmap = allocbitmap(N_ZMAP);
|
||||||
|
|
@ -774,7 +736,7 @@ void getbitmaps()
|
||||||
}
|
}
|
||||||
|
|
||||||
/* Release all the space taken by the bitmaps. */
|
/* Release all the space taken by the bitmaps. */
|
||||||
void putbitmaps()
|
void putbitmaps(void)
|
||||||
{
|
{
|
||||||
freebitmap(imap);
|
freebitmap(imap);
|
||||||
freebitmap(zmap);
|
freebitmap(zmap);
|
||||||
|
|
@ -786,12 +748,7 @@ void putbitmaps()
|
||||||
/* `w1' and `w2' are differing words from two bitmaps that should be
|
/* `w1' and `w2' are differing words from two bitmaps that should be
|
||||||
* identical. Print what's the matter with them.
|
* identical. Print what's the matter with them.
|
||||||
*/
|
*/
|
||||||
void chkword(w1, w2, bit, type, n, report, phys)
|
void chkword(unsigned w1, unsigned w2, bit_nr bit, char *type, int *n, int *report, bit_nr phys)
|
||||||
unsigned w1, w2;
|
|
||||||
char *type;
|
|
||||||
bit_nr bit;
|
|
||||||
int *n, *report;
|
|
||||||
bit_nr phys;
|
|
||||||
{
|
{
|
||||||
for (; (w1 | w2); w1 >>= 1, w2 >>= 1, bit++, phys++)
|
for (; (w1 | w2); w1 >>= 1, w2 >>= 1, bit++, phys++)
|
||||||
if ((w1 ^ w2) & 1 && ++(*n) % MAXPRINT == 0 && *report &&
|
if ((w1 ^ w2) & 1 && ++(*n) % MAXPRINT == 0 && *report &&
|
||||||
|
|
@ -810,12 +767,7 @@ bit_nr phys;
|
||||||
/* Check if the given (correct) bitmap is identical with the one that is
|
/* Check if the given (correct) bitmap is identical with the one that is
|
||||||
* on the disk. If not, ask if the disk should be repaired.
|
* on the disk. If not, ask if the disk should be repaired.
|
||||||
*/
|
*/
|
||||||
void chkmap(cmap, dmap, bit, blkno, nblk, type)
|
void chkmap(bitchunk_t *cmap, bitchunk_t *dmap, bit_nr bit, block_nr blkno, int nblk, char *type)
|
||||||
bitchunk_t *cmap, *dmap;
|
|
||||||
bit_nr bit;
|
|
||||||
block_nr blkno;
|
|
||||||
int nblk;
|
|
||||||
char *type;
|
|
||||||
{
|
{
|
||||||
register bitchunk_t *p = dmap, *q = cmap;
|
register bitchunk_t *p = dmap, *q = cmap;
|
||||||
int report = 1, nerr = 0;
|
int report = 1, nerr = 0;
|
||||||
|
|
@ -841,7 +793,7 @@ char *type;
|
||||||
}
|
}
|
||||||
|
|
||||||
/* See if the inodes that aren't allocated are cleared. */
|
/* See if the inodes that aren't allocated are cleared. */
|
||||||
void chkilist()
|
void chkilist(void)
|
||||||
{
|
{
|
||||||
register ino_t ino = 1;
|
register ino_t ino = 1;
|
||||||
mode_t mode;
|
mode_t mode;
|
||||||
|
|
@ -864,7 +816,7 @@ void chkilist()
|
||||||
}
|
}
|
||||||
|
|
||||||
/* Allocate an array to maintain the inode reference counts in. */
|
/* Allocate an array to maintain the inode reference counts in. */
|
||||||
void getcount()
|
void getcount(void)
|
||||||
{
|
{
|
||||||
count = (nlink_t *) alloc((unsigned) (sb.s_ninodes + 1), sizeof(nlink_t));
|
count = (nlink_t *) alloc((unsigned) (sb.s_ninodes + 1), sizeof(nlink_t));
|
||||||
}
|
}
|
||||||
|
|
@ -898,7 +850,7 @@ void counterror(ino_t ino)
|
||||||
* Thus, when the whole file system has been traversed, all the entries
|
* Thus, when the whole file system has been traversed, all the entries
|
||||||
* should be zero.
|
* should be zero.
|
||||||
*/
|
*/
|
||||||
void chkcount()
|
void chkcount(void)
|
||||||
{
|
{
|
||||||
register ino_t ino;
|
register ino_t ino;
|
||||||
|
|
||||||
|
|
@ -908,7 +860,7 @@ void chkcount()
|
||||||
}
|
}
|
||||||
|
|
||||||
/* Deallocate the `count' array. */
|
/* Deallocate the `count' array. */
|
||||||
void freecount()
|
void freecount(void)
|
||||||
{
|
{
|
||||||
free((char *) count);
|
free((char *) count);
|
||||||
}
|
}
|
||||||
|
|
@ -983,10 +935,7 @@ int Remove(dir_struct *dp)
|
||||||
}
|
}
|
||||||
|
|
||||||
/* Convert string so that embedded control characters are printable. */
|
/* Convert string so that embedded control characters are printable. */
|
||||||
void make_printable_name(dst, src, n)
|
void make_printable_name(register char *dst, register char *src, register int n)
|
||||||
register char *dst;
|
|
||||||
register char *src;
|
|
||||||
register int n;
|
|
||||||
{
|
{
|
||||||
register int c;
|
register int c;
|
||||||
|
|
||||||
|
|
@ -1194,11 +1143,7 @@ int chksymlinkzone(ino_t ino, d_inode *ip, off_t pos, zone_nr zno)
|
||||||
}
|
}
|
||||||
|
|
||||||
/* There is something wrong with the given zone. Print some details. */
|
/* There is something wrong with the given zone. Print some details. */
|
||||||
void errzone(mess, zno, level, pos)
|
void errzone(char *mess, zone_nr zno, int level, off_t pos)
|
||||||
char *mess;
|
|
||||||
zone_nr zno;
|
|
||||||
int level;
|
|
||||||
off_t pos;
|
|
||||||
{
|
{
|
||||||
printf("%s zone in ", mess);
|
printf("%s zone in ", mess);
|
||||||
printpath(1, 0);
|
printpath(1, 0);
|
||||||
|
|
@ -1215,10 +1160,7 @@ off_t pos;
|
||||||
/* Found the given zone in the given inode. Check it, and if ok, mark it
|
/* Found the given zone in the given inode. Check it, and if ok, mark it
|
||||||
* in the zone bitmap.
|
* in the zone bitmap.
|
||||||
*/
|
*/
|
||||||
int markzone(zno, level, pos)
|
int markzone(zone_nr zno, int level, off_t pos)
|
||||||
zone_nr zno;
|
|
||||||
int level;
|
|
||||||
off_t pos;
|
|
||||||
{
|
{
|
||||||
register bit_nr bit = (bit_nr) zno - FIRST + 1;
|
register bit_nr bit = (bit_nr) zno - FIRST + 1;
|
||||||
|
|
||||||
|
|
@ -1259,8 +1201,7 @@ int chkindzone(ino_t ino, d_inode *ip, off_t *pos, zone_nr zno, int level)
|
||||||
/* Return the size of a gap in the file, represented by a null zone number
|
/* Return the size of a gap in the file, represented by a null zone number
|
||||||
* at some level of indirection.
|
* at some level of indirection.
|
||||||
*/
|
*/
|
||||||
off_t jump(level)
|
off_t jump(int level)
|
||||||
int level;
|
|
||||||
{
|
{
|
||||||
off_t power = ZONE_SIZE;
|
off_t power = ZONE_SIZE;
|
||||||
|
|
||||||
|
|
@ -1451,8 +1392,7 @@ int chkinode(ino_t ino, d_inode *ip)
|
||||||
}
|
}
|
||||||
|
|
||||||
/* Check the directory entry pointed to by dp, by checking the inode. */
|
/* Check the directory entry pointed to by dp, by checking the inode. */
|
||||||
int descendtree(dp)
|
int descendtree(dir_struct *dp)
|
||||||
dir_struct *dp;
|
|
||||||
{
|
{
|
||||||
d_inode inode;
|
d_inode inode;
|
||||||
register ino_t ino = dp->d_inum;
|
register ino_t ino = dp->d_inum;
|
||||||
|
|
@ -1488,7 +1428,7 @@ dir_struct *dp;
|
||||||
}
|
}
|
||||||
|
|
||||||
/* Check the file system tree. */
|
/* Check the file system tree. */
|
||||||
void chktree()
|
void chktree(void)
|
||||||
{
|
{
|
||||||
dir_struct dir;
|
dir_struct dir;
|
||||||
|
|
||||||
|
|
@ -1501,7 +1441,7 @@ void chktree()
|
||||||
}
|
}
|
||||||
|
|
||||||
/* Print the totals of all the objects found. */
|
/* Print the totals of all the objects found. */
|
||||||
void printtotal()
|
void printtotal(void)
|
||||||
{
|
{
|
||||||
if(preen) {
|
if(preen) {
|
||||||
printf("%d files, %d directories, %d free inodes, %ld free zones\n",
|
printf("%d files, %d directories, %d free inodes, %ld free zones\n",
|
||||||
|
|
@ -1535,8 +1475,7 @@ void printtotal()
|
||||||
* listed by `zlist' should be watched for while checking the file system.
|
* listed by `zlist' should be watched for while checking the file system.
|
||||||
*/
|
*/
|
||||||
|
|
||||||
void chkdev(f, clist, ilist, zlist)
|
void chkdev(char *f, char **clist, char **ilist, char **zlist)
|
||||||
char *f, **clist, **ilist, **zlist;
|
|
||||||
{
|
{
|
||||||
if (automatic) repair = 1;
|
if (automatic) repair = 1;
|
||||||
fsck_device = f;
|
fsck_device = f;
|
||||||
|
|
@ -1613,9 +1552,7 @@ char *f, **clist, **ilist, **zlist;
|
||||||
devclose();
|
devclose();
|
||||||
}
|
}
|
||||||
|
|
||||||
int main(argc, argv)
|
int main(int argc, char **argv)
|
||||||
int argc;
|
|
||||||
char **argv;
|
|
||||||
{
|
{
|
||||||
register char **clist = 0, **ilist = 0, **zlist = 0;
|
register char **clist = 0, **ilist = 0, **zlist = 0;
|
||||||
int badflag = 0;
|
int badflag = 0;
|
||||||
|
|
|
||||||
|
|
@ -66,13 +66,11 @@ void gettable(void);
|
||||||
void parse(void);
|
void parse(void);
|
||||||
void usage(void);
|
void usage(void);
|
||||||
|
|
||||||
#ifdef __STDC__
|
|
||||||
|
/* Get next arg from file into cbuf, */
|
||||||
|
/* returning the character that */
|
||||||
|
/* terminated it. Cbuf returns 0 */
|
||||||
char fgetarg ( FILE *stream , char *cbuf )
|
char fgetarg ( FILE *stream , char *cbuf )
|
||||||
#else
|
|
||||||
char fgetarg(stream, cbuf) /* Get next arg from file into cbuf, */
|
|
||||||
FILE *stream; /* returning the character that */
|
|
||||||
char *cbuf; /* terminated it. Cbuf returns 0 */
|
|
||||||
#endif
|
|
||||||
{ /* if no arg. EOF is returned if no */
|
{ /* if no arg. EOF is returned if no */
|
||||||
int ch; /* args left in file. */
|
int ch; /* args left in file. */
|
||||||
int i;
|
int i;
|
||||||
|
|
@ -95,12 +93,7 @@ char *cbuf; /* terminated it. Cbuf returns 0 */
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
#ifdef __STDC__
|
|
||||||
int find ( char *sym )
|
int find ( char *sym )
|
||||||
#else
|
|
||||||
int find(sym)
|
|
||||||
char *sym;
|
|
||||||
#endif
|
|
||||||
{ /* Return DEF if defined else UNDEF */
|
{ /* Return DEF if defined else UNDEF */
|
||||||
|
|
||||||
deftemp = defptr;
|
deftemp = defptr;
|
||||||
|
|
@ -118,14 +111,10 @@ char *sym;
|
||||||
#define Undefine(x,y) defit(x,y,UNDEF)
|
#define Undefine(x,y) defit(x,y,UNDEF)
|
||||||
#define Ignore(x,y) defit(x,y,IGN)
|
#define Ignore(x,y) defit(x,y,IGN)
|
||||||
|
|
||||||
#ifdef __STDC__
|
/* Add symbol to the define list */
|
||||||
|
/* Mode: MUTABLE etc */
|
||||||
|
/* Type: DEF, UNDEF, IGN */
|
||||||
void defit ( char *sym , int redef , int type )
|
void defit ( char *sym , int redef , int type )
|
||||||
#else
|
|
||||||
void defit(sym, redef, type) /* Add symbol to the define list */
|
|
||||||
char *sym;
|
|
||||||
char redef; /* Mode: MUTABLE etc */
|
|
||||||
char type; /* Type: DEF, UNDEF, IGN */
|
|
||||||
#endif
|
|
||||||
{
|
{
|
||||||
struct DEFINE *temp;
|
struct DEFINE *temp;
|
||||||
char c;
|
char c;
|
||||||
|
|
@ -167,11 +156,7 @@ char type; /* Type: DEF, UNDEF, IGN */
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
#ifdef __STDC__
|
|
||||||
void stop ( void )
|
void stop ( void )
|
||||||
#else
|
|
||||||
void stop()
|
|
||||||
#endif
|
|
||||||
{ /* Stop: Tidy up at EOF */
|
{ /* Stop: Tidy up at EOF */
|
||||||
if (table) printtable();
|
if (table) printtable();
|
||||||
(void)fclose(zin);
|
(void)fclose(zin);
|
||||||
|
|
@ -181,23 +166,16 @@ void stop()
|
||||||
#define Goto { line++; if (ch!='\n') gotoeoln(); }
|
#define Goto { line++; if (ch!='\n') gotoeoln(); }
|
||||||
#define Print { line++; if (ch!='\n') prteoln(); }
|
#define Print { line++; if (ch!='\n') prteoln(); }
|
||||||
|
|
||||||
#ifdef __STDC__
|
/* Go to the end of the line */
|
||||||
void gotoeoln ( void )
|
void gotoeoln ( void )
|
||||||
#else
|
|
||||||
void gotoeoln() /* Go to the end of the line */
|
|
||||||
#endif
|
|
||||||
{
|
{
|
||||||
int ch;
|
int ch;
|
||||||
while ((ch = fgetc(zin)) != '\n')
|
while ((ch = fgetc(zin)) != '\n')
|
||||||
if (ch == EOF) stop();
|
if (ch == EOF) stop();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/* Print to the end of the line */
|
||||||
#ifdef __STDC__
|
|
||||||
void prteoln ( void )
|
void prteoln ( void )
|
||||||
#else
|
|
||||||
void prteoln() /* Print to the end of the line */
|
|
||||||
#endif
|
|
||||||
{
|
{
|
||||||
int ch;
|
int ch;
|
||||||
while ((ch = fgetc(zin)) != '\n')
|
while ((ch = fgetc(zin)) != '\n')
|
||||||
|
|
@ -209,11 +187,8 @@ void prteoln() /* Print to the end of the line */
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
#ifdef __STDC__
|
/* Print the defines in the SLL */
|
||||||
void printtable ( void )
|
void printtable ( void )
|
||||||
#else
|
|
||||||
void printtable() /* Print the defines in the SLL */
|
|
||||||
#endif
|
|
||||||
{
|
{
|
||||||
struct DEFINE *temp;
|
struct DEFINE *temp;
|
||||||
|
|
||||||
|
|
@ -234,11 +209,7 @@ void printtable() /* Print the defines in the SLL */
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
#ifdef __STDC__
|
|
||||||
char getendif ( void )
|
char getendif ( void )
|
||||||
#else
|
|
||||||
char getendif()
|
|
||||||
#endif
|
|
||||||
{ /* Find matching endif when ignoring */
|
{ /* Find matching endif when ignoring */
|
||||||
char word[80]; /* Buffer for symbols */
|
char word[80]; /* Buffer for symbols */
|
||||||
int ch;
|
int ch;
|
||||||
|
|
@ -268,11 +239,8 @@ char getendif()
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
#ifdef __STDC__
|
/* Get & print a table of defines etc. */
|
||||||
void gettable ( void )
|
void gettable ( void )
|
||||||
#else
|
|
||||||
void gettable() /* Get & print a table of defines etc. */
|
|
||||||
#endif
|
|
||||||
{
|
{
|
||||||
|
|
||||||
char word[80]; /* Buffer for symbols */
|
char word[80]; /* Buffer for symbols */
|
||||||
|
|
@ -313,11 +281,7 @@ void gettable() /* Get & print a table of defines etc. */
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
#ifdef __STDC__
|
|
||||||
void parse ( void )
|
void parse ( void )
|
||||||
#else
|
|
||||||
void parse()
|
|
||||||
#endif
|
|
||||||
{ /* Parse & remove ifdefs from C source */
|
{ /* Parse & remove ifdefs from C source */
|
||||||
char word[80]; /* Buffer for symbols */
|
char word[80]; /* Buffer for symbols */
|
||||||
int ch;
|
int ch;
|
||||||
|
|
@ -435,24 +399,14 @@ void parse()
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
#ifdef __STDC__
|
|
||||||
void usage ( void )
|
void usage ( void )
|
||||||
#else
|
|
||||||
void usage()
|
|
||||||
#endif
|
|
||||||
{
|
{
|
||||||
(void)fprintf(stderr, "Usage: ifdef [-t] [-Dsymbol] [-dsymbol] [-Usymbol] [-Isymbol] <file>\n");
|
(void)fprintf(stderr, "Usage: ifdef [-t] [-Dsymbol] [-dsymbol] [-Usymbol] [-Isymbol] <file>\n");
|
||||||
exit(0);
|
exit(0);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
#ifdef __STDC__
|
|
||||||
int main(int argc , char *argv [])
|
int main(int argc , char *argv [])
|
||||||
#else
|
|
||||||
int main(argc, argv)
|
|
||||||
int argc;
|
|
||||||
char *argv[];
|
|
||||||
#endif
|
|
||||||
{
|
{
|
||||||
char sym[80]; /* Temp symbol storage */
|
char sym[80]; /* Temp symbol storage */
|
||||||
int c;
|
int c;
|
||||||
|
|
|
||||||
|
|
@ -184,10 +184,7 @@ int Verbose = 0; /* 1 = Print all info on directories */
|
||||||
int ByteOffset = 0; /* 1 = Print byte offset and length of files */
|
int ByteOffset = 0; /* 1 = Print byte offset and length of files */
|
||||||
int Aflag = 0; /* 1 = Suppress output of \r */
|
int Aflag = 0; /* 1 = Suppress output of \r */
|
||||||
|
|
||||||
int iso_cmp(name, dir_ptr, dir_flag)
|
int iso_cmp(char *name, struct dir_entry *dir_ptr, int dir_flag)
|
||||||
char *name;
|
|
||||||
struct dir_entry *dir_ptr;
|
|
||||||
int dir_flag;
|
|
||||||
{
|
{
|
||||||
/* Compare name with directory entries, looking for match with a dirname.
|
/* Compare name with directory entries, looking for match with a dirname.
|
||||||
* An iso9660 filename is terminated by ";n", where n will probably
|
* An iso9660 filename is terminated by ";n", where n will probably
|
||||||
|
|
@ -215,7 +212,7 @@ int dir_flag;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
void usage()
|
void usage(void)
|
||||||
{
|
{
|
||||||
if (Read_Dir)
|
if (Read_Dir)
|
||||||
fprintf (STDERR, "Usage: isodir [-lrB] inputfile [dir]\n");
|
fprintf (STDERR, "Usage: isodir [-lrB] inputfile [dir]\n");
|
||||||
|
|
@ -227,9 +224,7 @@ void usage()
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
int main(argc, argv)
|
int main(int argc, char **argv)
|
||||||
int argc;
|
|
||||||
char **argv;
|
|
||||||
{
|
{
|
||||||
struct dir_entry *entry;
|
struct dir_entry *entry;
|
||||||
char path[MAX_PATH_LENGTH];
|
char path[MAX_PATH_LENGTH];
|
||||||
|
|
@ -352,8 +347,7 @@ char **argv;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
struct dir_entry *look_up(path)
|
struct dir_entry *look_up(char *path)
|
||||||
char *path;
|
|
||||||
{
|
{
|
||||||
/* Lookup a file name */
|
/* Lookup a file name */
|
||||||
|
|
||||||
|
|
@ -428,9 +422,7 @@ char *path;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
void recurse_dir(path, dir_ptr)
|
void recurse_dir(char *path, struct dir_entry *dir_ptr)
|
||||||
char *path;
|
|
||||||
struct dir_entry *dir_ptr;
|
|
||||||
{
|
{
|
||||||
/* Recursively descend all directories starting with dir_ptr */
|
/* Recursively descend all directories starting with dir_ptr */
|
||||||
|
|
||||||
|
|
@ -503,8 +495,7 @@ struct dir_entry *dir_ptr;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
void list_dir(dir_ptr)
|
void list_dir(struct dir_entry *dir_ptr)
|
||||||
struct dir_entry *dir_ptr;
|
|
||||||
{
|
{
|
||||||
/* List all entries in a directory */
|
/* List all entries in a directory */
|
||||||
int tty;
|
int tty;
|
||||||
|
|
@ -601,8 +592,7 @@ struct dir_entry *dir_ptr;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
void print_dir_date(date)
|
void print_dir_date(char *date)
|
||||||
char *date;
|
|
||||||
{
|
{
|
||||||
/* Print date in a directory entry */
|
/* Print date in a directory entry */
|
||||||
|
|
||||||
|
|
@ -623,8 +613,7 @@ char *date;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
void list_file(dir_ptr)
|
void list_file(struct dir_entry *dir_ptr)
|
||||||
struct dir_entry *dir_ptr;
|
|
||||||
{
|
{
|
||||||
/* List contents of a file */
|
/* List contents of a file */
|
||||||
|
|
||||||
|
|
@ -658,8 +647,7 @@ struct dir_entry *dir_ptr;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
void print_date(date)
|
void print_date(char *date)
|
||||||
char *date;
|
|
||||||
{
|
{
|
||||||
/* Print the date in a volume descriptor */
|
/* Print the date in a volume descriptor */
|
||||||
|
|
||||||
|
|
@ -680,8 +668,7 @@ char *date;
|
||||||
date[13]);
|
date[13]);
|
||||||
}
|
}
|
||||||
|
|
||||||
void iso_info(vol_desc)
|
void iso_info(struct iso9660_descriptor *vol_desc)
|
||||||
struct iso9660_descriptor *vol_desc;
|
|
||||||
{
|
{
|
||||||
int i;
|
int i;
|
||||||
|
|
||||||
|
|
@ -711,8 +698,7 @@ struct iso9660_descriptor *vol_desc;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
void hs_info(vol_desc)
|
void hs_info(struct high_sierra_descriptor *vol_desc)
|
||||||
struct high_sierra_descriptor *vol_desc;
|
|
||||||
{
|
{
|
||||||
int i;
|
int i;
|
||||||
|
|
||||||
|
|
@ -730,7 +716,7 @@ struct high_sierra_descriptor *vol_desc;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
int valid_fs()
|
int valid_fs(void)
|
||||||
{
|
{
|
||||||
|
|
||||||
int i;
|
int i;
|
||||||
|
|
@ -764,10 +750,7 @@ int valid_fs()
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
void read_device(offset, nr_of_bytes, buffer)
|
void read_device(long offset, int nr_of_bytes, char *buffer)
|
||||||
long offset;
|
|
||||||
int nr_of_bytes;
|
|
||||||
char *buffer;
|
|
||||||
{
|
{
|
||||||
int bytes_read;
|
int bytes_read;
|
||||||
|
|
||||||
|
|
@ -790,15 +773,13 @@ char *buffer;
|
||||||
|
|
||||||
/* The ISO9660 functions */
|
/* The ISO9660 functions */
|
||||||
|
|
||||||
int iso_711 (c)
|
int iso_711 (char *c)
|
||||||
char *c;
|
|
||||||
{
|
{
|
||||||
return (*c & 0xff);
|
return (*c & 0xff);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
int iso_712 (c)
|
int iso_712 (char *c)
|
||||||
char *c;
|
|
||||||
{
|
{
|
||||||
int n;
|
int n;
|
||||||
|
|
||||||
|
|
@ -807,20 +788,17 @@ char *c;
|
||||||
return n;
|
return n;
|
||||||
}
|
}
|
||||||
|
|
||||||
int iso_721 (c)
|
int iso_721 (char *c)
|
||||||
char *c;
|
|
||||||
{
|
{
|
||||||
return ((c[0] & 0xff) | ((c[1] & 0xff) << 8));
|
return ((c[0] & 0xff) | ((c[1] & 0xff) << 8));
|
||||||
}
|
}
|
||||||
|
|
||||||
int iso_722 (c)
|
int iso_722 (char *c)
|
||||||
char *c;
|
|
||||||
{
|
{
|
||||||
return (((c[0] & 0xff) << 8) | (c[1] & 0xff));
|
return (((c[0] & 0xff) << 8) | (c[1] & 0xff));
|
||||||
}
|
}
|
||||||
|
|
||||||
int iso_723 (c)
|
int iso_723 (char *c)
|
||||||
char *c;
|
|
||||||
{
|
{
|
||||||
if (c[0] != c[3] || c[1] != c[2])
|
if (c[0] != c[3] || c[1] != c[2])
|
||||||
{
|
{
|
||||||
|
|
@ -830,8 +808,7 @@ char *c;
|
||||||
return (iso_721 (c));
|
return (iso_721 (c));
|
||||||
}
|
}
|
||||||
|
|
||||||
long iso_731 (c)
|
long iso_731 (char *c)
|
||||||
char *c;
|
|
||||||
{
|
{
|
||||||
return ((long)(c[0] & 0xff)
|
return ((long)(c[0] & 0xff)
|
||||||
| ((long)(c[1] & 0xff) << 8)
|
| ((long)(c[1] & 0xff) << 8)
|
||||||
|
|
@ -840,8 +817,7 @@ char *c;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
long iso_732 (c)
|
long iso_732 (char *c)
|
||||||
char *c;
|
|
||||||
{
|
{
|
||||||
return (((long)(c[0] & 0xff) << 24)
|
return (((long)(c[0] & 0xff) << 24)
|
||||||
| (((long)c[1] & 0xff) << 16)
|
| (((long)c[1] & 0xff) << 16)
|
||||||
|
|
@ -849,8 +825,7 @@ char *c;
|
||||||
| ((long)c[3] & 0xff));
|
| ((long)c[3] & 0xff));
|
||||||
}
|
}
|
||||||
|
|
||||||
long iso_733 (c)
|
long iso_733 (char *c)
|
||||||
char *c;
|
|
||||||
{
|
{
|
||||||
int i;
|
int i;
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -91,9 +91,7 @@ char *whoami(void);
|
||||||
void dohelp(void);
|
void dohelp(void);
|
||||||
int filesize(char *name);
|
int filesize(char *name);
|
||||||
|
|
||||||
int main(argc, argv)
|
int main(int argc, char *argv[])
|
||||||
int argc;
|
|
||||||
char *argv[];
|
|
||||||
{
|
{
|
||||||
int c;
|
int c;
|
||||||
|
|
||||||
|
|
@ -161,9 +159,7 @@ char *argv[];
|
||||||
return(0);
|
return(0);
|
||||||
}
|
}
|
||||||
|
|
||||||
int deliver(count, vec)
|
int deliver(int count, char *vec[])
|
||||||
int count;
|
|
||||||
char *vec[];
|
|
||||||
{
|
{
|
||||||
int i, j;
|
int i, j;
|
||||||
int errs = 0; /* count of errors */
|
int errs = 0; /* count of errors */
|
||||||
|
|
@ -343,7 +339,7 @@ nobox:
|
||||||
* for interactive mails, this might be the place to do it (though the
|
* for interactive mails, this might be the place to do it (though the
|
||||||
* case where a MAILER is being used would also need to be handled).
|
* case where a MAILER is being used would also need to be handled).
|
||||||
*/
|
*/
|
||||||
FILE *makerewindable()
|
FILE *makerewindable(void)
|
||||||
{
|
{
|
||||||
FILE *tempfp; /* temp file used for copy */
|
FILE *tempfp; /* temp file used for copy */
|
||||||
int c; /* character being copied */
|
int c; /* character being copied */
|
||||||
|
|
@ -387,8 +383,7 @@ done:
|
||||||
return tempfp;
|
return tempfp;
|
||||||
}
|
}
|
||||||
|
|
||||||
int copy(fromfp, tofp)
|
int copy(FILE *fromfp, FILE *tofp)
|
||||||
FILE *fromfp, *tofp;
|
|
||||||
{
|
{
|
||||||
int c; /* character being copied */
|
int c; /* character being copied */
|
||||||
int state; /* ".\n" and postmark detection state */
|
int state; /* ".\n" and postmark detection state */
|
||||||
|
|
@ -455,7 +450,7 @@ done:
|
||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
void readbox()
|
void readbox(void)
|
||||||
{
|
{
|
||||||
char linebuf[512];
|
char linebuf[512];
|
||||||
struct letter *let;
|
struct letter *let;
|
||||||
|
|
@ -496,7 +491,7 @@ void readbox()
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
void printall()
|
void printall(void)
|
||||||
{
|
{
|
||||||
struct letter *let;
|
struct letter *let;
|
||||||
|
|
||||||
|
|
@ -512,7 +507,7 @@ void printall()
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
void interact()
|
void interact(void)
|
||||||
{
|
{
|
||||||
char linebuf[512]; /* user input line */
|
char linebuf[512]; /* user input line */
|
||||||
struct letter *let, *next; /* current and next letter */
|
struct letter *let, *next; /* current and next letter */
|
||||||
|
|
@ -592,15 +587,13 @@ void interact()
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
void onint(dummy)
|
/* dummy to satisfy ANSI compilers */
|
||||||
int dummy; /* to satisfy ANSI compilers */
|
void onint(int dummy)
|
||||||
{
|
{
|
||||||
longjmp(printjump, 1);
|
longjmp(printjump, 1);
|
||||||
}
|
}
|
||||||
|
|
||||||
void savelet(let, savefile)
|
void savelet(struct letter *let, char *savefile)
|
||||||
struct letter *let;
|
|
||||||
char *savefile;
|
|
||||||
{
|
{
|
||||||
int waitstat, pid;
|
int waitstat, pid;
|
||||||
FILE *savefp;
|
FILE *savefp;
|
||||||
|
|
@ -628,7 +621,7 @@ char *savefile;
|
||||||
exit(0);
|
exit(0);
|
||||||
}
|
}
|
||||||
|
|
||||||
void updatebox()
|
void updatebox(void)
|
||||||
{
|
{
|
||||||
FILE *tempfp; /* fp for tempfile */
|
FILE *tempfp; /* fp for tempfile */
|
||||||
char lockname[PATHLEN]; /* maildrop lock */
|
char lockname[PATHLEN]; /* maildrop lock */
|
||||||
|
|
@ -683,9 +676,7 @@ void updatebox()
|
||||||
if (usedrop) unlink(lockname);
|
if (usedrop) unlink(lockname);
|
||||||
}
|
}
|
||||||
|
|
||||||
void printlet(let, tofp)
|
void printlet(struct letter *let, FILE *tofp)
|
||||||
struct letter *let;
|
|
||||||
FILE *tofp;
|
|
||||||
{
|
{
|
||||||
off_t current, limit;
|
off_t current, limit;
|
||||||
int c;
|
int c;
|
||||||
|
|
@ -699,8 +690,7 @@ FILE *tofp;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
void doshell(command)
|
void doshell(char *command)
|
||||||
char *command;
|
|
||||||
{
|
{
|
||||||
int waitstat, pid;
|
int waitstat, pid;
|
||||||
char *shell;
|
char *shell;
|
||||||
|
|
@ -725,14 +715,13 @@ char *command;
|
||||||
exit(127);
|
exit(127);
|
||||||
}
|
}
|
||||||
|
|
||||||
void usage()
|
void usage(void)
|
||||||
{
|
{
|
||||||
fprintf(stderr, "usage: mail [-epqr] [-f file]\n");
|
fprintf(stderr, "usage: mail [-epqr] [-f file]\n");
|
||||||
fprintf(stderr, " mail [-dtv] [-s subject] user [...]\n");
|
fprintf(stderr, " mail [-dtv] [-s subject] user [...]\n");
|
||||||
}
|
}
|
||||||
|
|
||||||
char *basename(name)
|
char *basename(char *name)
|
||||||
char *name;
|
|
||||||
{
|
{
|
||||||
char *p;
|
char *p;
|
||||||
|
|
||||||
|
|
@ -742,7 +731,7 @@ char *name;
|
||||||
return p + 1;
|
return p + 1;
|
||||||
}
|
}
|
||||||
|
|
||||||
char *whoami()
|
char *whoami(void)
|
||||||
{
|
{
|
||||||
struct passwd *pw;
|
struct passwd *pw;
|
||||||
|
|
||||||
|
|
@ -752,7 +741,7 @@ char *whoami()
|
||||||
return "nobody";
|
return "nobody";
|
||||||
}
|
}
|
||||||
|
|
||||||
void dohelp()
|
void dohelp(void)
|
||||||
{
|
{
|
||||||
FILE *fp;
|
FILE *fp;
|
||||||
char buffer[80];
|
char buffer[80];
|
||||||
|
|
@ -768,8 +757,7 @@ void dohelp()
|
||||||
fclose(fp);
|
fclose(fp);
|
||||||
}
|
}
|
||||||
|
|
||||||
int filesize(name)
|
int filesize(char *name)
|
||||||
char *name ;
|
|
||||||
{
|
{
|
||||||
struct stat buf;
|
struct stat buf;
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -20,9 +20,7 @@ int mount_all(void);
|
||||||
|
|
||||||
static int write_mtab = 1;
|
static int write_mtab = 1;
|
||||||
|
|
||||||
int main(argc, argv)
|
int main(int argc, char *argv[])
|
||||||
int argc;
|
|
||||||
char *argv[];
|
|
||||||
{
|
{
|
||||||
int all = 0, i, v = 0, mountflags, srvflags;
|
int all = 0, i, v = 0, mountflags, srvflags;
|
||||||
char **ap, *opt, *err, *type, *args, *device;
|
char **ap, *opt, *err, *type, *args, *device;
|
||||||
|
|
@ -88,7 +86,7 @@ char *argv[];
|
||||||
return(EXIT_SUCCESS);
|
return(EXIT_SUCCESS);
|
||||||
}
|
}
|
||||||
|
|
||||||
void list()
|
void list(void)
|
||||||
{
|
{
|
||||||
int n;
|
int n;
|
||||||
char dev[PATH_MAX], mountpoint[PATH_MAX], type[MNTNAMELEN], flags[MNTFLAGLEN];
|
char dev[PATH_MAX], mountpoint[PATH_MAX], type[MNTNAMELEN], flags[MNTFLAGLEN];
|
||||||
|
|
@ -121,7 +119,7 @@ has_opt(char *mntopts, char *option)
|
||||||
|
|
||||||
|
|
||||||
int
|
int
|
||||||
mount_all()
|
mount_all(void)
|
||||||
{
|
{
|
||||||
struct fstab *fs;
|
struct fstab *fs;
|
||||||
int ro, mountflags;
|
int ro, mountflags;
|
||||||
|
|
@ -165,7 +163,7 @@ mount_all()
|
||||||
return(EXIT_SUCCESS);
|
return(EXIT_SUCCESS);
|
||||||
}
|
}
|
||||||
|
|
||||||
void usage()
|
void usage(void)
|
||||||
{
|
{
|
||||||
std_err("Usage: mount [-a] [-r] [-e] [-t type] [-o options] special name\n");
|
std_err("Usage: mount [-a] [-r] [-e] [-t type] [-o options] special name\n");
|
||||||
exit(1);
|
exit(1);
|
||||||
|
|
|
||||||
|
|
@ -60,7 +60,7 @@ DWORD data_len;
|
||||||
/******** End of wave definitions *********/
|
/******** End of wave definitions *********/
|
||||||
|
|
||||||
|
|
||||||
void usage()
|
void usage(void)
|
||||||
{
|
{
|
||||||
fprintf(stderr, "Usage: playwav [-i] file\n");
|
fprintf(stderr, "Usage: playwav [-i] file\n");
|
||||||
exit(-1);
|
exit(-1);
|
||||||
|
|
|
||||||
|
|
@ -17,9 +17,7 @@ void skipline(void);
|
||||||
int backslash(void);
|
int backslash(void);
|
||||||
void usage(void);
|
void usage(void);
|
||||||
|
|
||||||
int main(argc, argv)
|
int main(int argc, char *argv[])
|
||||||
int argc;
|
|
||||||
char *argv[];
|
|
||||||
{
|
{
|
||||||
|
|
||||||
int c;
|
int c;
|
||||||
|
|
@ -66,7 +64,7 @@ char *argv[];
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
void skipline()
|
void skipline(void)
|
||||||
{
|
{
|
||||||
char c;
|
char c;
|
||||||
|
|
||||||
|
|
@ -74,7 +72,7 @@ void skipline()
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
int backslash()
|
int backslash(void)
|
||||||
{
|
{
|
||||||
/* A backslash has been seen. Eat troff stuff. */
|
/* A backslash has been seen. Eat troff stuff. */
|
||||||
|
|
||||||
|
|
@ -129,7 +127,7 @@ int backslash()
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
void usage()
|
void usage(void)
|
||||||
{
|
{
|
||||||
printf("Usage: prep [file]\n");
|
printf("Usage: prep [file]\n");
|
||||||
exit(1);
|
exit(1);
|
||||||
|
|
|
||||||
|
|
@ -31,9 +31,7 @@ int rflag;
|
||||||
int main(int argc, char **argv);
|
int main(int argc, char **argv);
|
||||||
void done(char *name, int status);
|
void done(char *name, int status);
|
||||||
|
|
||||||
int main(argc, argv)
|
int main(int argc, char **argv)
|
||||||
int argc;
|
|
||||||
char **argv;
|
|
||||||
{
|
{
|
||||||
DIR *dp;
|
DIR *dp;
|
||||||
struct dirent *entry;
|
struct dirent *entry;
|
||||||
|
|
@ -56,9 +54,7 @@ char **argv;
|
||||||
return(0); /* not reached */
|
return(0); /* not reached */
|
||||||
}
|
}
|
||||||
|
|
||||||
void done(name, status)
|
void done(char *name, int status)
|
||||||
char *name;
|
|
||||||
int status;
|
|
||||||
{
|
{
|
||||||
int v;
|
int v;
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -196,7 +196,7 @@ int handle_args(int argc, char *argv[])
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
int start()
|
int start(void)
|
||||||
{
|
{
|
||||||
/* This is the "starter process" for statistical profiling.
|
/* This is the "starter process" for statistical profiling.
|
||||||
*
|
*
|
||||||
|
|
@ -262,7 +262,7 @@ int start()
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
int stop()
|
int stop(void)
|
||||||
{
|
{
|
||||||
/* This is the "stopper" process for statistical profiling.
|
/* This is the "stopper" process for statistical profiling.
|
||||||
*
|
*
|
||||||
|
|
@ -296,7 +296,7 @@ int stop()
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
int alloc_mem()
|
int alloc_mem(void)
|
||||||
{
|
{
|
||||||
if ((mem_ptr = malloc(mem_size)) == 0) {
|
if ((mem_ptr = malloc(mem_size)) == 0) {
|
||||||
fprintf(stderr, "Unable to allocate memory.\n");
|
fprintf(stderr, "Unable to allocate memory.\n");
|
||||||
|
|
@ -308,7 +308,7 @@ int alloc_mem()
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
int init_outfile()
|
int init_outfile(void)
|
||||||
{
|
{
|
||||||
if ((outfile_fd = open(outfile, O_CREAT | O_TRUNC | O_WRONLY)) <= 0) {
|
if ((outfile_fd = open(outfile, O_CREAT | O_TRUNC | O_WRONLY)) <= 0) {
|
||||||
fprintf(stderr, "Unable to create outfile %s.\n", outfile);
|
fprintf(stderr, "Unable to create outfile %s.\n", outfile);
|
||||||
|
|
|
||||||
|
|
@ -44,9 +44,7 @@ prettyprogress(long b, long maxb, time_t starttime)
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
int main(argc, argv)
|
int main(int argc, char *argv[])
|
||||||
int argc;
|
|
||||||
char *argv[];
|
|
||||||
{
|
{
|
||||||
long i = 0, count = 0;
|
long i = 0, count = 0;
|
||||||
int l;
|
int l;
|
||||||
|
|
|
||||||
|
|
@ -74,7 +74,7 @@ int old_stdin;
|
||||||
struct termios old_tty, new_tty;
|
struct termios old_tty, new_tty;
|
||||||
int audio, file;
|
int audio, file;
|
||||||
|
|
||||||
void usage()
|
void usage(void)
|
||||||
{
|
{
|
||||||
fprintf(stderr, "Usage: recwav [-b -s -r] file_name\n");
|
fprintf(stderr, "Usage: recwav [-b -s -r] file_name\n");
|
||||||
exit(-1);
|
exit(-1);
|
||||||
|
|
@ -90,7 +90,7 @@ void terminate(int s)
|
||||||
exit(0);
|
exit(0);
|
||||||
}
|
}
|
||||||
|
|
||||||
void write_wave_header()
|
void write_wave_header(void)
|
||||||
{
|
{
|
||||||
/* RIFF fields */
|
/* RIFF fields */
|
||||||
r_fields.RIFF_id = RIFF_ID;
|
r_fields.RIFF_id = RIFF_ID;
|
||||||
|
|
|
||||||
|
|
@ -104,7 +104,7 @@ int main (int argc, char *argv[])
|
||||||
return(EXIT_FAILURE);
|
return(EXIT_FAILURE);
|
||||||
}
|
}
|
||||||
|
|
||||||
static void usage()
|
static void usage(void)
|
||||||
{
|
{
|
||||||
fprintf(stderr, "Usage:\n");
|
fprintf(stderr, "Usage:\n");
|
||||||
fprintf(stderr, " %s <vfs|pm> set <request> <value>\n", bin_name);
|
fprintf(stderr, " %s <vfs|pm> set <request> <value>\n", bin_name);
|
||||||
|
|
|
||||||
|
|
@ -46,10 +46,7 @@ static unsigned db_extend[] = { /* table for sign-extending */
|
||||||
};
|
};
|
||||||
|
|
||||||
void
|
void
|
||||||
db_read_bytes(addr, size, data)
|
db_read_bytes(vm_offset_t addr, register int size, register char *data)
|
||||||
vm_offset_t addr;
|
|
||||||
register int size;
|
|
||||||
register char *data;
|
|
||||||
{
|
{
|
||||||
register char *src;
|
register char *src;
|
||||||
|
|
||||||
|
|
@ -60,10 +57,7 @@ db_read_bytes(addr, size, data)
|
||||||
}
|
}
|
||||||
|
|
||||||
db_expr_t
|
db_expr_t
|
||||||
db_get_value(addr, size, is_signed)
|
db_get_value(db_addr_t addr, register int size, boolean_t is_signed)
|
||||||
db_addr_t addr;
|
|
||||||
register int size;
|
|
||||||
boolean_t is_signed;
|
|
||||||
{
|
{
|
||||||
char data[sizeof(int)];
|
char data[sizeof(int)];
|
||||||
register db_expr_t value;
|
register db_expr_t value;
|
||||||
|
|
|
||||||
|
|
@ -866,11 +866,7 @@ static db_addr_t
|
||||||
* Read address at location and return updated location.
|
* Read address at location and return updated location.
|
||||||
*/
|
*/
|
||||||
static db_addr_t
|
static db_addr_t
|
||||||
db_read_address(loc, short_addr, regmodrm, addrp)
|
db_read_address(db_addr_t loc, int short_addr, int regmodrm, struct i_addr *addrp /* out */)
|
||||||
db_addr_t loc;
|
|
||||||
int short_addr;
|
|
||||||
int regmodrm;
|
|
||||||
struct i_addr * addrp; /* out */
|
|
||||||
{
|
{
|
||||||
int mod, rm, sib, index, disp;
|
int mod, rm, sib, index, disp;
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -137,10 +137,7 @@ void text_write_ub(void *addr, unsigned char value)
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
void load_nlist(exe_name, btextp, etextp)
|
void load_nlist(char *exe_name, unsigned long *btextp, unsigned long *etextp)
|
||||||
char *exe_name;
|
|
||||||
unsigned long *btextp;
|
|
||||||
unsigned long *etextp;
|
|
||||||
{
|
{
|
||||||
int i;
|
int i;
|
||||||
unsigned long btext, etext;
|
unsigned long btext, etext;
|
||||||
|
|
|
||||||
|
|
@ -126,7 +126,7 @@ struct mode {
|
||||||
static char *arg0; /* basename(argv[0]) */
|
static char *arg0; /* basename(argv[0]) */
|
||||||
static int ex= 0; /* exit status. */
|
static int ex= 0; /* exit status. */
|
||||||
|
|
||||||
static void because()
|
static void because(void)
|
||||||
{
|
{
|
||||||
fprintf(stderr, ": %s\n", strerror(errno));
|
fprintf(stderr, ": %s\n", strerror(errno));
|
||||||
ex= 1;
|
ex= 1;
|
||||||
|
|
@ -255,7 +255,7 @@ static void sort(struct entry **ae)
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
static void enter()
|
static void enter(void)
|
||||||
/* Collect directory entries of E. */
|
/* Collect directory entries of E. */
|
||||||
{
|
{
|
||||||
struct entry **last= &E->con, *new;
|
struct entry **last= &E->con, *new;
|
||||||
|
|
@ -399,7 +399,7 @@ static char *link_islink(struct stat *stp, const char *file)
|
||||||
|
|
||||||
#define cancellink() ((void) islink())
|
#define cancellink() ((void) islink())
|
||||||
|
|
||||||
static char *islink()
|
static char *islink(void)
|
||||||
/* Returns the name of the file path is linked to. If no such link can be
|
/* Returns the name of the file path is linked to. If no such link can be
|
||||||
* found, then path is added to the list and nil is returned. If all the
|
* found, then path is added to the list and nil is returned. If all the
|
||||||
* links of a file have been seen, then it is removed from the list.
|
* links of a file have been seen, then it is removed from the list.
|
||||||
|
|
@ -464,7 +464,7 @@ static int getstat(char *name, struct stat *stp)
|
||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
static int advance()
|
static int advance(void)
|
||||||
/* Determine next pathname, return true on success. */
|
/* Determine next pathname, return true on success. */
|
||||||
{
|
{
|
||||||
for (;;) {
|
for (;;) {
|
||||||
|
|
@ -517,7 +517,7 @@ static int advance()
|
||||||
return 1;
|
return 1;
|
||||||
}
|
}
|
||||||
|
|
||||||
static enum orders request()
|
static enum orders request(void)
|
||||||
/* Slave reads command sent by master. */
|
/* Slave reads command sent by master. */
|
||||||
{
|
{
|
||||||
static char buf[64], *bp;
|
static char buf[64], *bp;
|
||||||
|
|
@ -547,7 +547,7 @@ static enum orders request()
|
||||||
return (enum orders) req;
|
return (enum orders) req;
|
||||||
}
|
}
|
||||||
|
|
||||||
static void report()
|
static void report(void)
|
||||||
{
|
{
|
||||||
int r;
|
int r;
|
||||||
|
|
||||||
|
|
@ -614,7 +614,7 @@ static void sendstat(struct stat *stp)
|
||||||
|
|
||||||
static int ask();
|
static int ask();
|
||||||
|
|
||||||
static void slave()
|
static void slave(void)
|
||||||
/* Carry out orders from the master, such as transmitting path names.
|
/* Carry out orders from the master, such as transmitting path names.
|
||||||
* Note that the slave uses path, not Spath, the master uses Spath.
|
* Note that the slave uses path, not Spath, the master uses Spath.
|
||||||
*/
|
*/
|
||||||
|
|
@ -763,7 +763,7 @@ static void rread(char *buf, int n)
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
static enum answers answer()
|
static enum answers answer(void)
|
||||||
/* Master reads slave's reply. */
|
/* Master reads slave's reply. */
|
||||||
{
|
{
|
||||||
char c;
|
char c;
|
||||||
|
|
@ -777,7 +777,7 @@ static enum answers answer()
|
||||||
return (enum answers) a;
|
return (enum answers) a;
|
||||||
}
|
}
|
||||||
|
|
||||||
static long recnum()
|
static long recnum(void)
|
||||||
/* Read number as pack of bytes from least to most significant. The data
|
/* Read number as pack of bytes from least to most significant. The data
|
||||||
* is on the wire in little-endian format. (Mostly run on PC's).
|
* is on the wire in little-endian format. (Mostly run on PC's).
|
||||||
*/
|
*/
|
||||||
|
|
@ -822,7 +822,7 @@ static void recstat(struct stat *stp)
|
||||||
stp->st_mtime= recnum();
|
stp->st_mtime= recnum();
|
||||||
}
|
}
|
||||||
|
|
||||||
static int key()
|
static int key(void)
|
||||||
{
|
{
|
||||||
int c;
|
int c;
|
||||||
static int tty= -1;
|
static int tty= -1;
|
||||||
|
|
@ -1105,7 +1105,7 @@ static int delete(int update)
|
||||||
return 1;
|
return 1;
|
||||||
}
|
}
|
||||||
|
|
||||||
static int different()
|
static int different(void)
|
||||||
/* Return true iff path and Spath are different. */
|
/* Return true iff path and Spath are different. */
|
||||||
{
|
{
|
||||||
if (! ( (linkpath == nil && Slinkpath == nil)
|
if (! ( (linkpath == nil && Slinkpath == nil)
|
||||||
|
|
@ -1136,7 +1136,7 @@ static int different()
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
static void compare()
|
static void compare(void)
|
||||||
/* See if path and Spath are same. */
|
/* See if path and Spath are same. */
|
||||||
{
|
{
|
||||||
if (different()) {
|
if (different()) {
|
||||||
|
|
@ -1158,7 +1158,7 @@ static void compare()
|
||||||
|
|
||||||
static int done= 0, Sdone= 0;
|
static int done= 0, Sdone= 0;
|
||||||
|
|
||||||
static enum action { ADD, COMPARE, DELETE } action()
|
static enum action { ADD, COMPARE, DELETE } action(void)
|
||||||
/* Look at path's of master and slave, compare them alphabetically to see
|
/* Look at path's of master and slave, compare them alphabetically to see
|
||||||
* who is ahead of who, then tell what is to be done.
|
* who is ahead of who, then tell what is to be done.
|
||||||
*/
|
*/
|
||||||
|
|
@ -1178,7 +1178,7 @@ static enum action { ADD, COMPARE, DELETE } action()
|
||||||
return (c= strcmp(Sp, p)) == 0 ? COMPARE : c < 0 ? ADD : DELETE;
|
return (c= strcmp(Sp, p)) == 0 ? COMPARE : c < 0 ? ADD : DELETE;
|
||||||
}
|
}
|
||||||
|
|
||||||
static void master()
|
static void master(void)
|
||||||
/* Synchronise file tree to that of its slave. */
|
/* Synchronise file tree to that of its slave. */
|
||||||
{
|
{
|
||||||
enum action a= COMPARE; /* Trick first advances. */
|
enum action a= COMPARE; /* Trick first advances. */
|
||||||
|
|
@ -1244,7 +1244,7 @@ static void master()
|
||||||
order(ex == 0 ? DIE : DIE_BAD);
|
order(ex == 0 ? DIE : DIE_BAD);
|
||||||
}
|
}
|
||||||
|
|
||||||
static void mediator()
|
static void mediator(void)
|
||||||
/* Sits at the local machine and passes orders from master to slave, both
|
/* Sits at the local machine and passes orders from master to slave, both
|
||||||
* on remote machines. Only diagnostics and questions are handled.
|
* on remote machines. Only diagnostics and questions are handled.
|
||||||
*/
|
*/
|
||||||
|
|
@ -1346,7 +1346,7 @@ void splitcolon(char *path, char **amach, char **adir)
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
static void Usage()
|
static void Usage(void)
|
||||||
{
|
{
|
||||||
fprintf(stderr,
|
fprintf(stderr,
|
||||||
"Usage: %s [-iuf] [[user@]machine:]dir1 [[user@]machine:]dir2\n",
|
"Usage: %s [-iuf] [[user@]machine:]dir1 [[user@]machine:]dir2\n",
|
||||||
|
|
|
||||||
|
|
@ -125,9 +125,7 @@ void set_uart(int argc, char *argv[], struct termios *tcp);
|
||||||
void set_raw(struct termios *tcp);
|
void set_raw(struct termios *tcp);
|
||||||
void quit(int code);
|
void quit(int code);
|
||||||
|
|
||||||
int main(argc, argv)
|
int main(int argc, char *argv[])
|
||||||
int argc;
|
|
||||||
char *argv[];
|
|
||||||
{
|
{
|
||||||
int i;
|
int i;
|
||||||
unsigned char key;
|
unsigned char key;
|
||||||
|
|
@ -298,8 +296,7 @@ void tell(int fd, ...)
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
void reader(on)
|
void reader(int on)
|
||||||
int on;
|
|
||||||
{
|
{
|
||||||
/* Start or end a process that copies from the modem to the screen. */
|
/* Start or end a process that copies from the modem to the screen. */
|
||||||
|
|
||||||
|
|
@ -390,8 +387,7 @@ void shell(char *cmd)
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
void lock_device(device)
|
void lock_device(char *device)
|
||||||
char *device;
|
|
||||||
{
|
{
|
||||||
/* Lock a device by creating a lock file using SYSV style locking. */
|
/* Lock a device by creating a lock file using SYSV style locking. */
|
||||||
|
|
||||||
|
|
@ -473,10 +469,7 @@ void setnum(char *s, int n)
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
void set_uart(argc, argv, tcp)
|
void set_uart(int argc, char *argv[], struct termios *tcp)
|
||||||
int argc;
|
|
||||||
char *argv[];
|
|
||||||
struct termios *tcp;
|
|
||||||
{
|
{
|
||||||
/* Set up the UART parameters. */
|
/* Set up the UART parameters. */
|
||||||
|
|
||||||
|
|
@ -515,8 +508,7 @@ struct termios *tcp;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
void set_raw(tcp)
|
void set_raw(struct termios *tcp)
|
||||||
struct termios *tcp;
|
|
||||||
{
|
{
|
||||||
/* Set termios attributes for RAW mode. */
|
/* Set termios attributes for RAW mode. */
|
||||||
|
|
||||||
|
|
@ -528,8 +520,7 @@ struct termios *tcp;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
void quit(code)
|
void quit(int code)
|
||||||
int code;
|
|
||||||
{
|
{
|
||||||
/* Stop the reader process, reset the terminal, and exit. */
|
/* Stop the reader process, reset the terminal, and exit. */
|
||||||
reader(0);
|
reader(0);
|
||||||
|
|
|
||||||
|
|
@ -20,9 +20,7 @@ int main(int argc, char **argv);
|
||||||
void Print(char *comment, char *name);
|
void Print(char *comment, char *name);
|
||||||
void Error(char *message, char *arg);
|
void Error(char *message, char *arg);
|
||||||
|
|
||||||
int main(argc, argv)
|
int main(int argc, char **argv)
|
||||||
int argc;
|
|
||||||
char *argv[];
|
|
||||||
|
|
||||||
{
|
{
|
||||||
char *term;
|
char *term;
|
||||||
|
|
@ -154,9 +152,7 @@ void Print( comment, name )
|
||||||
/****************************************************************/
|
/****************************************************************/
|
||||||
|
|
||||||
|
|
||||||
void Error( message, arg )
|
void Error( char *message, char *arg )
|
||||||
char *message;
|
|
||||||
char *arg;
|
|
||||||
|
|
||||||
{
|
{
|
||||||
fprintf( stderr, message, arg );
|
fprintf( stderr, message, arg );
|
||||||
|
|
|
||||||
|
|
@ -22,9 +22,7 @@ void usage(void);
|
||||||
static char device[PATH_MAX], mount_point[PATH_MAX], type[MNTNAMELEN],
|
static char device[PATH_MAX], mount_point[PATH_MAX], type[MNTNAMELEN],
|
||||||
flags[MNTFLAGLEN];
|
flags[MNTFLAGLEN];
|
||||||
|
|
||||||
int main(argc, argv)
|
int main(int argc, char *argv[])
|
||||||
int argc;
|
|
||||||
char *argv[];
|
|
||||||
{
|
{
|
||||||
int found;
|
int found;
|
||||||
int umount_flags = 0UL;
|
int umount_flags = 0UL;
|
||||||
|
|
@ -62,8 +60,7 @@ char *argv[];
|
||||||
return(0);
|
return(0);
|
||||||
}
|
}
|
||||||
|
|
||||||
int find_mtab_entry(name)
|
int find_mtab_entry(char *name)
|
||||||
char *name;
|
|
||||||
{
|
{
|
||||||
/* Find a matching mtab entry for 'name' which may be a special or a path,
|
/* Find a matching mtab entry for 'name' which may be a special or a path,
|
||||||
* and generate a new mtab file without this entry on the fly. Do not write
|
* and generate a new mtab file without this entry on the fly. Do not write
|
||||||
|
|
@ -97,7 +94,7 @@ char *name;
|
||||||
return found;
|
return found;
|
||||||
}
|
}
|
||||||
|
|
||||||
void usage()
|
void usage(void)
|
||||||
{
|
{
|
||||||
std_err("Usage: umount [-e] name\n");
|
std_err("Usage: umount [-e] name\n");
|
||||||
exit(1);
|
exit(1);
|
||||||
|
|
|
||||||
|
|
@ -6,7 +6,7 @@
|
||||||
|
|
||||||
int main(void);
|
int main(void);
|
||||||
|
|
||||||
int main()
|
int main(void)
|
||||||
{
|
{
|
||||||
/* Release all (?) open file descriptors. */
|
/* Release all (?) open file descriptors. */
|
||||||
close(0);
|
close(0);
|
||||||
|
|
|
||||||
|
|
@ -58,9 +58,7 @@ void tape_inquire(char *name, int fd);
|
||||||
void allocate_buffer(void);
|
void allocate_buffer(void);
|
||||||
void diskio(int fd1, int fd2, char *file1, char *file2);
|
void diskio(int fd1, int fd2, char *file1, char *file2);
|
||||||
|
|
||||||
int main(argc, argv)
|
int main(int argc, char *argv[])
|
||||||
int argc;
|
|
||||||
char *argv[];
|
|
||||||
{
|
{
|
||||||
int volume = 1, fd, tty, i, init, autovolsize;
|
int volume = 1, fd, tty, i, init, autovolsize;
|
||||||
char *p, *name;
|
char *p, *name;
|
||||||
|
|
@ -208,18 +206,14 @@ char *argv[];
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
void usage()
|
void usage(void)
|
||||||
{
|
{
|
||||||
fprintf(stderr,
|
fprintf(stderr,
|
||||||
"Usage: vol [-rw1] [-b blocksize] [-m max] [size] block-special\n");
|
"Usage: vol [-rw1] [-b blocksize] [-m max] [size] block-special\n");
|
||||||
exit(1);
|
exit(1);
|
||||||
}
|
}
|
||||||
|
|
||||||
long str2size(name, str, min, max, assume_kb)
|
long str2size(char *name, char *str, long min, long max, int assume_kb)
|
||||||
char *name;
|
|
||||||
char *str;
|
|
||||||
long min, max;
|
|
||||||
int assume_kb;
|
|
||||||
{
|
{
|
||||||
/* Convert a string to a size. The number may be followed by 'm', 'k', 'b'
|
/* Convert a string to a size. The number may be followed by 'm', 'k', 'b'
|
||||||
* or 'w' to multiply the size as shown below. If 'assume_kb' is set then
|
* or 'w' to multiply the size as shown below. If 'assume_kb' is set then
|
||||||
|
|
@ -259,9 +253,7 @@ int assume_kb;
|
||||||
return size;
|
return size;
|
||||||
}
|
}
|
||||||
|
|
||||||
void tape_inquire(name, fd)
|
void tape_inquire(char *name, int fd)
|
||||||
char *name;
|
|
||||||
int fd;
|
|
||||||
{
|
{
|
||||||
/* If the device happens to be a tape, then what is its block size? */
|
/* If the device happens to be a tape, then what is its block size? */
|
||||||
struct mtget mtget;
|
struct mtget mtget;
|
||||||
|
|
@ -288,7 +280,7 @@ int fd;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
void allocate_buffer()
|
void allocate_buffer(void)
|
||||||
{
|
{
|
||||||
/* Set block size and maximum multiple. */
|
/* Set block size and maximum multiple. */
|
||||||
if (block_size == 0) block_size = variable ? 1 : FIX_BLKSIZ;
|
if (block_size == 0) block_size = variable ? 1 : FIX_BLKSIZ;
|
||||||
|
|
@ -313,9 +305,7 @@ void allocate_buffer()
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
void diskio(fd1, fd2, file1, file2)
|
void diskio(int fd1, int fd2, char *file1, char *file2)
|
||||||
int fd1, fd2;
|
|
||||||
char *file1, *file2;
|
|
||||||
{
|
{
|
||||||
/* Read 'volume_size' bytes from 'fd1' and write them on 'fd2'. Watch out for
|
/* Read 'volume_size' bytes from 'fd1' and write them on 'fd2'. Watch out for
|
||||||
* the fact that reads on pipes can return less than the desired data.
|
* the fact that reads on pipes can return less than the desired data.
|
||||||
|
|
|
||||||
|
|
@ -62,7 +62,7 @@ Howmany must be 255 or less
|
||||||
*/
|
*/
|
||||||
int Fromcu; /* Were called from cu or yam */
|
int Fromcu; /* Were called from cu or yam */
|
||||||
|
|
||||||
void from_cu()
|
void from_cu(void)
|
||||||
{
|
{
|
||||||
struct stat a, b;
|
struct stat a, b;
|
||||||
|
|
||||||
|
|
@ -71,7 +71,7 @@ void from_cu()
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
void cucheck()
|
void cucheck(void)
|
||||||
{
|
{
|
||||||
if (Fromcu)
|
if (Fromcu)
|
||||||
fprintf(stderr,"Please read the manual page BUGS chapter!\r\n");
|
fprintf(stderr,"Please read the manual page BUGS chapter!\r\n");
|
||||||
|
|
@ -123,7 +123,7 @@ char checked = '\0' ;
|
||||||
/*
|
/*
|
||||||
* Nonblocking I/O is a bit different in System V, Release 2
|
* Nonblocking I/O is a bit different in System V, Release 2
|
||||||
*/
|
*/
|
||||||
int rdchk(f)
|
int rdchk(int f)
|
||||||
{
|
{
|
||||||
int lf, savestat;
|
int lf, savestat;
|
||||||
|
|
||||||
|
|
@ -170,8 +170,7 @@ int iofd = 0; /* File descriptor for ioctls & reads */
|
||||||
* 1: save old tty stat, set raw mode
|
* 1: save old tty stat, set raw mode
|
||||||
* 0: restore original tty mode
|
* 0: restore original tty mode
|
||||||
*/
|
*/
|
||||||
int mode(n)
|
int mode(int n)
|
||||||
int n;
|
|
||||||
{
|
{
|
||||||
static int did0 = FALSE;
|
static int did0 = FALSE;
|
||||||
|
|
||||||
|
|
@ -397,7 +396,7 @@ int n;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
void sendbrk()
|
void sendbrk(void)
|
||||||
{
|
{
|
||||||
#ifdef POSIX
|
#ifdef POSIX
|
||||||
tcsendbreak(iofd, 1);
|
tcsendbreak(iofd, 1);
|
||||||
|
|
|
||||||
|
|
@ -178,7 +178,7 @@ FILE *fout;
|
||||||
* Routine to calculate the free bytes on the current file system
|
* Routine to calculate the free bytes on the current file system
|
||||||
* ~0 means many free bytes (unknown)
|
* ~0 means many free bytes (unknown)
|
||||||
*/
|
*/
|
||||||
long getfree()
|
long getfree(void)
|
||||||
{
|
{
|
||||||
return(~0L); /* many free bytes ... */
|
return(~0L); /* many free bytes ... */
|
||||||
}
|
}
|
||||||
|
|
@ -240,8 +240,7 @@ jmp_buf tohere; /* For the interrupt on RX timeout */
|
||||||
|
|
||||||
int tryzhdrtype=ZRINIT; /* Header type to send corresponding to Last rx close */
|
int tryzhdrtype=ZRINIT; /* Header type to send corresponding to Last rx close */
|
||||||
|
|
||||||
void alrm(sig)
|
void alrm(int sig)
|
||||||
int sig;
|
|
||||||
{
|
{
|
||||||
longjmp(tohere, -1);
|
longjmp(tohere, -1);
|
||||||
}
|
}
|
||||||
|
|
@ -373,7 +372,7 @@ int main(int argc, char *argv[])
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
int usage()
|
int usage(void)
|
||||||
{
|
{
|
||||||
cucheck();
|
cucheck();
|
||||||
#ifdef vax11c
|
#ifdef vax11c
|
||||||
|
|
@ -513,7 +512,7 @@ et_tu:
|
||||||
* Jack M. Wierda and Roderick W. Hart
|
* Jack M. Wierda and Roderick W. Hart
|
||||||
*/
|
*/
|
||||||
|
|
||||||
int wcrx()
|
int wcrx(void)
|
||||||
{
|
{
|
||||||
register int sectnum, sectcurr;
|
register int sectnum, sectcurr;
|
||||||
register char sendchar;
|
register char sendchar;
|
||||||
|
|
@ -711,7 +710,7 @@ int readline(int timeout)
|
||||||
/*
|
/*
|
||||||
* Purge the modem input queue of all characters
|
* Purge the modem input queue of all characters
|
||||||
*/
|
*/
|
||||||
void purgeline()
|
void purgeline(void)
|
||||||
{
|
{
|
||||||
Lleft = 0;
|
Lleft = 0;
|
||||||
#ifdef USG
|
#ifdef USG
|
||||||
|
|
@ -1032,7 +1031,7 @@ void zperr(char *s, char *p, char *u)
|
||||||
}
|
}
|
||||||
|
|
||||||
/* send cancel string to get the other end to shut up */
|
/* send cancel string to get the other end to shut up */
|
||||||
void canit()
|
void canit(void)
|
||||||
{
|
{
|
||||||
static char canistr[] = {
|
static char canistr[] = {
|
||||||
24,24,24,24,24,24,24,24,24,24,8,8,8,8,8,8,8,8,8,8,0
|
24,24,24,24,24,24,24,24,24,24,8,8,8,8,8,8,8,8,8,8,0
|
||||||
|
|
@ -1113,7 +1112,7 @@ void checkpath(char *name)
|
||||||
* Return ZFILE if Zmodem filename received, -1 on error,
|
* Return ZFILE if Zmodem filename received, -1 on error,
|
||||||
* ZCOMPL if transaction finished, else 0
|
* ZCOMPL if transaction finished, else 0
|
||||||
*/
|
*/
|
||||||
int tryz()
|
int tryz(void)
|
||||||
{
|
{
|
||||||
register int c, n;
|
register int c, n;
|
||||||
register int cmdzack1flg;
|
register int cmdzack1flg;
|
||||||
|
|
@ -1209,7 +1208,7 @@ again:
|
||||||
/*
|
/*
|
||||||
* Receive 1 or more files with ZMODEM protocol
|
* Receive 1 or more files with ZMODEM protocol
|
||||||
*/
|
*/
|
||||||
int rzfiles()
|
int rzfiles(void)
|
||||||
{
|
{
|
||||||
register int c;
|
register int c;
|
||||||
|
|
||||||
|
|
@ -1238,7 +1237,7 @@ int rzfiles()
|
||||||
* Receive a file with ZMODEM protocol
|
* Receive a file with ZMODEM protocol
|
||||||
* Assumes file name frame is in secbuf
|
* Assumes file name frame is in secbuf
|
||||||
*/
|
*/
|
||||||
int rzfile()
|
int rzfile(void)
|
||||||
{
|
{
|
||||||
register int c, n;
|
register int c, n;
|
||||||
long rxbytes;
|
long rxbytes;
|
||||||
|
|
@ -1437,7 +1436,7 @@ void zmputs(char *s)
|
||||||
/*
|
/*
|
||||||
* Close the receive dataset, return OK or ERROR
|
* Close the receive dataset, return OK or ERROR
|
||||||
*/
|
*/
|
||||||
int closeit()
|
int closeit(void)
|
||||||
{
|
{
|
||||||
time_t q;
|
time_t q;
|
||||||
|
|
||||||
|
|
@ -1468,7 +1467,7 @@ int closeit()
|
||||||
/*
|
/*
|
||||||
* Ack a ZFIN packet, let byegones be byegones
|
* Ack a ZFIN packet, let byegones be byegones
|
||||||
*/
|
*/
|
||||||
void ackbibi()
|
void ackbibi(void)
|
||||||
{
|
{
|
||||||
register int n;
|
register int n;
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -652,7 +652,7 @@ int wctxpn(char *name)
|
||||||
return OK;
|
return OK;
|
||||||
}
|
}
|
||||||
|
|
||||||
int getnak()
|
int getnak(void)
|
||||||
{
|
{
|
||||||
register int firstch;
|
register int firstch;
|
||||||
|
|
||||||
|
|
@ -850,7 +850,7 @@ int filbuf(char *buf, int count)
|
||||||
}
|
}
|
||||||
|
|
||||||
/* Fill buffer with blklen chars */
|
/* Fill buffer with blklen chars */
|
||||||
int zfilbuf()
|
int zfilbuf(void)
|
||||||
{
|
{
|
||||||
int n;
|
int n;
|
||||||
|
|
||||||
|
|
@ -984,13 +984,13 @@ int readline(int timeout)
|
||||||
return (byt[0]&0377);
|
return (byt[0]&0377);
|
||||||
}
|
}
|
||||||
|
|
||||||
void flushmo()
|
void flushmo(void)
|
||||||
{
|
{
|
||||||
fflush(stdout);
|
fflush(stdout);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
void purgeline()
|
void purgeline(void)
|
||||||
{
|
{
|
||||||
#ifdef USG
|
#ifdef USG
|
||||||
ioctl(iofd, TCFLSH, 0);
|
ioctl(iofd, TCFLSH, 0);
|
||||||
|
|
@ -1001,7 +1001,7 @@ void purgeline()
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
/* send cancel string to get the other end to shut up */
|
/* send cancel string to get the other end to shut up */
|
||||||
void canit()
|
void canit(void)
|
||||||
{
|
{
|
||||||
static char canistr[] = {
|
static char canistr[] = {
|
||||||
24,24,24,24,24,24,24,24,24,24,8,8,8,8,8,8,8,8,8,8,0
|
24,24,24,24,24,24,24,24,24,24,8,8,8,8,8,8,8,8,8,8,0
|
||||||
|
|
@ -1099,7 +1099,7 @@ char *babble[] = {
|
||||||
""
|
""
|
||||||
};
|
};
|
||||||
|
|
||||||
int usage()
|
int usage(void)
|
||||||
{
|
{
|
||||||
char **pp;
|
char **pp;
|
||||||
|
|
||||||
|
|
@ -1115,7 +1115,7 @@ int usage()
|
||||||
/*
|
/*
|
||||||
* Get the receiver's init parameters
|
* Get the receiver's init parameters
|
||||||
*/
|
*/
|
||||||
int getzrxinit()
|
int getzrxinit(void)
|
||||||
{
|
{
|
||||||
register int n;
|
register int n;
|
||||||
struct stat f;
|
struct stat f;
|
||||||
|
|
@ -1220,7 +1220,7 @@ int getzrxinit()
|
||||||
}
|
}
|
||||||
|
|
||||||
/* Send send-init information */
|
/* Send send-init information */
|
||||||
int sendzsinit()
|
int sendzsinit(void)
|
||||||
{
|
{
|
||||||
register int c;
|
register int c;
|
||||||
|
|
||||||
|
|
@ -1308,7 +1308,7 @@ again:
|
||||||
}
|
}
|
||||||
|
|
||||||
/* Send the data in the file */
|
/* Send the data in the file */
|
||||||
int zsendfdata()
|
int zsendfdata(void)
|
||||||
{
|
{
|
||||||
register int c, e, n;
|
register int c, e, n;
|
||||||
register int newcnt;
|
register int newcnt;
|
||||||
|
|
@ -1564,7 +1564,7 @@ int getinsync(int flag)
|
||||||
|
|
||||||
|
|
||||||
/* Say "bibi" to the receiver, try to do it cleanly */
|
/* Say "bibi" to the receiver, try to do it cleanly */
|
||||||
void saybibi()
|
void saybibi(void)
|
||||||
{
|
{
|
||||||
for (;;) {
|
for (;;) {
|
||||||
stohdr(0L); /* CAF Was zsbhdr - minor change */
|
stohdr(0L); /* CAF Was zsbhdr - minor change */
|
||||||
|
|
|
||||||
Loading…
Reference in New Issue
Block a user