SRCS = banner.c \
bd.c \
cal.c \
+ chmem.c \
cksum.c \
cut.c \
dd.c \
sed.c \
seq.c \
setdate.c \
+ size.c \
sleep.c \
ssh.c \
sort.c \
bd.c \
bogomips.c \
cal.c \
+ chmem.c \
cksum.c \
cut.c \
dd.c \
sed.c \
seq.c \
setdate.c \
+ size.c \
sleep.c \
ssh.c \
socktest.c \
bd.c \
bogomips.c \
cal.c \
+ chmem.c \
cksum.c \
cpuinfo.c \
cut.c \
remount.c \
seq.c \
setdate.c \
+ size.c \
sleep.c \
ssh.c \
sort.c \
--- /dev/null
+CHMEM(8)
+## NAME
+*chmem* - change memory allocation for a binary
+## SYNOPSIS
+*chmem* \[size\] path
+
+## DESCRIPTION
+*Chmem* shows and updates the header field in a Fuzix binary that indicates
+the largest amount of dynamic memory and stack required. The zero value means
+unlimited. The application is not guaranteed to get that much memory, it is
+instead a promise by the application not to use any more.
+
+When *size* is specified the binary is updated for that size in bytes. When
+no size is specified the current setting is displayed.
+
+## SEE ALSO ##
+*size*(1)
+
+## BUGS ##
+It would be far more useful to be able to specify the amount of stack
+required.
+Only certain memory manager support this field, others will always allocate
+as it was zero. This makes testing chmem settings difficult.
+
+## FUTURE ##
+This interface will be obsoleted in favour of a stack size setting in some future
+release.
+
+## STANDARDS ##
+Fuzix specific. Minix has a similar chmem feature.
--- /dev/null
+LABELFS(8)
+## NAME
+*labelfs* - label a file system with a name or geometry
+## SYNPOSIS
+*labelfs* \[-l label\] \[-g heads,cyls,secs\[,blocksize\[,skew\]\]\] path
+
+## DESCRIPTION
+The *labelfs* utility allows the display or modification of geometry and
+label data applied to a file system. It is primarily intended to be used
+with floppy disk media.
+
+When no label or geometry option is given the program will display the
+current label and geometry if present.
+
+When the options are provided the values are written into the media. The
+sector size must be a power of two and at least 128 bytes. Labels are an
+arbitrar text string of up to 32 bytes.
+
+## BUGS
+None known
+
+## STANDARDS
+Fuzix specific.
+
+## AUTHOR
+Alan Cox
--- /dev/null
+MKFS(8)
+## NAME
+*mkfs* \[-f\] device isize fsize
+
+## DESCRIPTION
+The *mkfs* tool initializes a new file system on a device.
+
+The isize field specifies the number of inode blocks on the file system.
+Each inode block holds 8 inodes. This determines the number of individual
+files and directories that may be present on the disk.
+
+The fsize field gives the size of the media in 512 byte blocks - up to 65535
+blocks for 32MB media.
+
+The default behaviour is to zero the entire file system and then write the
+new metadata to the device. If the -f flag is passed then the data areas are
+not cleared, bad data blocks may not be found and old data may persist in
+blocks not allocated to files.
+
+## BUGS
+None know
+
+## STANDARDS
+Whilst most Fuzix-like systems have a mkfs command the syntax, functionality
+and file system format varies extensively.
--- /dev/null
+SIZE(1)
+## NAME
+*size* path... - display the size of a binary
+## DESCRIPTION
+The *size* command displays the amount of memory required by an application
+for the text, data, and BSS (base stack segment - zeroed data), as well as
+the total size. This does not include stack and any dynamic space required
+to execute it.
+## SEE ALSO
+*chmem*(8)
+## AUTHOR
+Written by Alan Cox
--- /dev/null
+#include <stdio.h>
+#include <unistd.h>
+#include <stdlib.h>
+#include <string.h>
+
+static unsigned int
+bufpair(int bigend, unsigned char *p, int n)
+{
+ if (bigend) {
+ /* mc6809, big endian */
+ return (p[n] << 8) | p[n+1];
+ }
+ return p[n] | (p[n+1] << 8);
+}
+
+int main(int argc, char *argv[])
+{
+ FILE *fp;
+ unsigned char buf[16];
+ unsigned int basepage;
+ int n, endian;
+ unsigned int txtsz, datsz, bsssz;
+
+ if (argc < 2) {
+ fprintf(stderr, "%s [executable]\n", argv[0]);
+ exit(1);
+ }
+ for (n = 1; n < argc; n++) {
+ fp = fopen(argv[n], "r");
+ if (fp == NULL) {
+ perror(argv[n]);
+ exit(1);
+ }
+ if (fread(buf, 16, 1, fp) != 1) {
+ fprintf(stderr, "%s: too short ?\n", argv[0]);
+ exit(1);
+ }
+
+ basepage = 0;
+ if (buf[0] == 0xC3 || buf[0] == 0x18 || buf[0] == 0x4C || buf[0] == 0x38) {
+ /* Z-80 or 6502 */
+ endian = 0;
+ basepage = buf[7] << 8;
+ } else if (buf[0] == 0x7E || buf[0] == 0x20) {
+ /* 6809 */
+ endian = 1;
+ } else {
+ endian = -1;
+ }
+ if ((endian == -1) ||
+ (buf[3] != 'F') ||
+ (buf[4] != 'Z') ||
+ (buf[5] != 'X') ||
+ (buf[6] != '1')) {
+ fprintf(stderr, "%s: not a Fuzix binary format.\n", argv[1]);
+ exit(1);
+ }
+ fclose(fp);
+ printf(" base text data bss size hex filename\n");
+
+ /* Text, data, BSS */
+ txtsz = bufpair(endian, buf, 10);
+ datsz = bufpair(endian, buf, 12);
+ bsssz = bufpair(endian, buf, 14);
+
+ printf("%5x%5x%5x%5x%7d%5x %s\n",
+ basepage,
+ txtsz, datsz, bsssz,
+ txtsz+datsz+bsssz,
+ txtsz+datsz+bsssz,
+ argv[n]);
+ }
+ exit(0);
+}