Annotation of coherent/d/etc/build/coh_intro.c, revision 1.1

1.1     ! root        1: /*
        !             2:  * coh_intro.c
        !             3:  * 6/5/91
        !             4:  * Usage: coh_intro
        !             5:  * Uses routines in build0.c: cc -o coh_intro coh_intro.c build0.c
        !             6:  */
        !             7: 
        !             8: #include <stdio.h>
        !             9: #include "build0.h"
        !            10: 
        !            11: #define        VERSION         "1.5"
        !            12: #define        DEFPAGER        "exec more -d"
        !            13: 
        !            14: /* External. */
        !            15: extern char    *getenv();
        !            16: 
        !            17: /* Forward. */
        !            18: int    lcdir();
        !            19: void   mycls();
        !            20: void   tour();
        !            21: 
        !            22: /* Global. */
        !            23: char   *pager;
        !            24: int    ttyflag;
        !            25: 
        !            26: main(argc, argv) int argc; char *argv[];
        !            27: {
        !            28:        if (argc > 1 && argv[1][0] == '-' && argv[1][1] == 'V')
        !            29:                fprintf(stderr, "%s: V%s\n", argv[0], VERSION);
        !            30:        ttyflag = isatty(fileno(stdout));
        !            31:        if ((pager = getenv("PAGER")) == NULL || *pager == '\0')
        !            32:                pager = DEFPAGER;
        !            33:        if (!ttyflag || yes_no("Would you like an introductory tour of COHERENT"))
        !            34:                tour();
        !            35:        exit(0);
        !            36: }
        !            37: 
        !            38: /*
        !            39:  * List the contents of a directory.
        !            40:  * Flush stdout in case output is redirected.
        !            41:  * If pflag is true (big directory), pipe output through PAGER.
        !            42:  */
        !            43: int
        !            44: lcdir(dir, msg, pflag) char *dir, *msg; int pflag;
        !            45: {
        !            46:        mycls(1);
        !            47:        printf(msg);
        !            48:        fflush(stdout);
        !            49:        if (ttyflag && pflag)
        !            50:                sprintf(cmd, "lc %s | %s", dir, pager);
        !            51:        else
        !            52:                sprintf(cmd, "lc %s", dir);
        !            53:        return sys(cmd, S_IGNORE);
        !            54: }
        !            55: 
        !            56: /* Print newlines if stdout is redirected; otherwise, clear the screen. */
        !            57: void
        !            58: mycls(flag)
        !            59: {
        !            60:        if (ttyflag)
        !            61:                cls(flag);
        !            62:        else
        !            63:                printf("\n\n");
        !            64: }
        !            65: 
        !            66: /* Take a walk on the Boardwalk... */
        !            67: void
        !            68: tour()
        !            69: {
        !            70:        mycls(0);
        !            71:        /* Startup and shutdown. */
        !            72:        printf(
        !            73: "When you boot your computer system (by turning on the power,\n"
        !            74: "by hitting the reset switch, or by typing <Ctrl><Alt><Del>),\n"
        !            75: "the bootstrap program by default runs the operating system on\n"
        !            76: "the partition marked as active.  To boot an operating system\n"
        !            77: "system on a different partition, type a partition number (0 to 7)\n"
        !            78: "when the boot tries to read the floppy disk.\n"
        !            79: "\n"
        !            80: "When you boot COHERENT, it starts up in single-user mode.\n"
        !            81: "It automatically executes the commands in the file /etc/brc,\n"
        !            82: "which typically check COHERENT filesystems for consistency\n"
        !            83: "using /etc/fsck.  If the filesystems check without errors,\n"
        !            84: "the system goes into multi-user mode, automatically executing\n"
        !            85: "the commands in the file /etc/rc.  You can interrupt file system\n"
        !            86: "checking by typing <Ctrl-C>.\n"
        !            87: "\n"
        !            88: "To shut down COHERENT from multi-user mode, log in as root and\n"
        !            89: "execute /etc/shutdown to return the system to single-user mode.\n"
        !            90: "Then type sync before rebooting or turning off the power.\n"
        !            91: "Your COHERENT filesystems may be damaged if you reboot or\n"
        !            92: "power down without following this procedure.\n"
        !            93: "\n"
        !            94:                );
        !            95: 
        !            96:        /* Root. */
        !            97:        lcdir("/", 
        !            98: "Now we will take a quick tour of your COHERENT filesystem.\n"
        !            99: "The root directory / contains:\n\n",
        !           100:                0);
        !           101:        printf(
        !           102: "\n"
        !           103: "COHERENT executes file /.profile when the superuser root logs in.\n"
        !           104: "File /coherent (linked to /autoboot) is the COHERENT system image.\n"
        !           105: "Empty directories /f0 and /f1 are used for mounting diskettes.\n"
        !           106: "Empty directory /mnt is used for mounting other devices.\n"
        !           107: "The filesystem checking program /etc/fsck uses empty directory\n"
        !           108: "/lost+found if it finds a problem with the root filesystem.\n"
        !           109: "COHERENT uses directory /tmp for temporary files; it removes files\n"
        !           110: "in /tmp automatically when the system goes multiuser (via /etc/rc).\n"
        !           111: "\n"
        !           112:                );
        !           113: 
        !           114:        /* /bin. */
        !           115:        mycls(1);
        !           116:        printf(
        !           117: "Directory /bin contains executable programs (commands).\n"
        !           118: "Some of the most commonly used commands are:\n"
        !           119: "\tbc\tinteractive calculator with arbitrary precision\n"
        !           120: "\tcat\tconcatenate/print files\n"
        !           121: "\tcc\tC compiler\n"
        !           122: "\tcmp\tcompare files\n"
        !           123: "\tcp\tcopy files\n"
        !           124: "\tcpdir\tcopy directory hierarchy\n"
        !           125: "\tdiff\tsummarize differences between files\n"
        !           126: "\tdos\ttransfer files to or from MS-DOS\n"
        !           127: "\ted\tinteractive line-oriented text editor\n"
        !           128: "\tegrep\textended pattern search\n"
        !           129: "\thelp\tprint concise command description\n"
        !           130: "\tlc\tcategorize files in a directory\n"
        !           131: "\tls\tlist directory contents\n"
        !           132: "\tmail\tcomputer mail\n"
        !           133: "\tps\tprint process status\n"
        !           134: "\trm\tremove files\n"
        !           135: "\trmdir\tremove directories\n"
        !           136: "\tscat\tsegmented concatenation\n"
        !           137: "\tsort\tsort lines of text\n"
        !           138: "\twc\tcount words, lines, characters in a file\n"
        !           139: "The next screen lists all the commands in /bin.\n"
        !           140:                );
        !           141:        lcdir("/bin", "", 1);
        !           142:        putchar('\n');
        !           143: 
        !           144:        /* /conf. */
        !           145:        lcdir("/conf", "Directory /conf contains:\n\n", 0);
        !           146:        putchar('\n');
        !           147: 
        !           148:        /* /conf/kbd. */
        !           149:        lcdir ("/conf/kbd",
        !           150:                "Subdirectory /conf/kbd contains keyboard support:\n\n",
        !           151:                0);
        !           152:        printf(
        !           153: "\n"
        !           154: "You can change the operation of various keys on your keyboard by changing\n"
        !           155: "the appropriate file in /conf/kbd and running /etc/kbdinstall.\n"
        !           156:                );
        !           157: 
        !           158:        /* /dev. */
        !           159:        lcdir("/dev", "Directory /dev contains COHERENT devices:\n\n", 0);
        !           160:        putchar('\n');
        !           161:        mycls(1);
        !           162:        printf(
        !           163: "Some important devices are:\n"
        !           164: "\t/dev/at*\tCooked (block-by-block) hard disk partitions\n"
        !           165: "\t/dev/com*\tSerial port devices (COM1, COM2, COM3, COM4)\n"
        !           166: "\t/dev/console\tConsole terminal\n"
        !           167: "\t/dev/f*\t\tFloppy disk devices\n"
        !           168: "\t/dev/lpt*\tParallel port devices (LPT1, LPT2 and LPT3)\n"
        !           169: "\t/dev/null\tBit bucket\n"
        !           170: "\t/dev/rat*\tRaw (character-by-character) hard disk partitions\n"
        !           171: "\t/dev/rf*\tRaw (character-by-character) floppy disk devices\n"
        !           172: "\n"
        !           173:                );
        !           174: 
        !           175:        /* /drv. */
        !           176:        lcdir("/drv", "Directory /drv contains loadable device drivers:\n\n", 0);
        !           177:        putchar('\n');
        !           178: 
        !           179:        /* /etc. */
        !           180:        lcdir("/etc",
        !           181: "Directory /etc contains files and programs used in system administration:\n\n",
        !           182:                0);
        !           183:        putchar('\n');
        !           184:        mycls(1);
        !           185:        printf(
        !           186: "Files of particular interest in /etc include:\n"
        !           187: "\t/etc/brc\tExecuted when the system comes up single-user\n"
        !           188: "\t/etc/group\tDefines user group membership information\n"
        !           189: "\t/etc/passwd\tDefines user login information\n"
        !           190: "\t/etc/profile\tExecuted for each shell\n"
        !           191: "\t/etc/rc\t\tExecuted when the system comes up multi-user\n"
        !           192: "\t/etc/ttys\tDefines status of terminals attached to system\n"
        !           193: "\n"
        !           194:                );
        !           195: 
        !           196:        /* /lib. */
        !           197:        lcdir("/lib",
        !           198:                "Directory /lib contains libraries and C compiler phases:\n\n",
        !           199:                0);
        !           200:        putchar('\n');
        !           201: 
        !           202:        /* /usr. */
        !           203:        lcdir("/usr",
        !           204:                "Directory /usr contains a number of subdirectories:\n\n",
        !           205:                0);
        !           206:        printf(
        !           207: "\n"
        !           208: "\t/usr/adm\tSystem administration files\n"
        !           209: "\t/usr/bin\tAdditional COHERENT commands\n"
        !           210: "\t/usr/dict\tDictionary for spell command\n"
        !           211: "\t/usr/games\tGames\n"
        !           212: "\t/usr/include\tHeader files\n"
        !           213: "\t/usr/lib\tAdditional libraries\n"
        !           214: "\t/usr/man\tCOHERENT online manual pages\n"
        !           215: "\t/usr/msgs\tSystem-wide messages\n"
        !           216: "\t/usr/pub\tPublic information\n"
        !           217: "\t/usr/spool\tWork area for daemon processes\n"
        !           218: "\t/usr/src\tSome sources and sample programs\n"
        !           219: "\t/usr/tmp\tTemporary file directory\n"
        !           220: "\n"
        !           221:                );
        !           222: 
        !           223:        /* File types. */
        !           224:        mycls(1);
        !           225:        printf(
        !           226: "COHERENT filenames often contain an extension following '.' which\n"
        !           227: "indicates the contents of the file.  Some common extensions are:\n"
        !           228: "\n"
        !           229: "\t.a\tarchive (or library) in ar format\n"
        !           230: "\t.b\tbc source\n"
        !           231: "\t.c\tC source\n"
        !           232: "\t.h\tC header\n"
        !           233: "\t.i\tC intermediate file (cpp output)\n"
        !           234: "\t.l\tlex source\n"
        !           235: "\t.m\tmacro assembler source\n"
        !           236: "\t.o\tobject file (unlinked)\n"
        !           237: "\t.r\tnroff or troff input\n"
        !           238: "\t.s\tassembler source\n"
        !           239: "\t.tar\tarchive in tar format\n"
        !           240: "\t.tar.Z\tcompressed tar-format archive, cf. tar, compress\n"
        !           241: "\t.tmp\ttemporary file\n"
        !           242: "\t.y\tyacc source\n"
        !           243: "\t.Z\tcompressed file, cf. compress/uncompress\n"
        !           244: "\n"
        !           245:        );
        !           246: 
        !           247:        /* Diskettes. */
        !           248:        mycls(1);
        !           249:        printf(
        !           250: "Some commonly used diskette device names and formats are:\n"
        !           251: "\tDevice name  Sectors/track  Heads  Sectors  Bytes   Format\n"
        !           252: "\t/dev/f9a0          9          2      720    360 KB   5.25\"\n"
        !           253: "\t/dev/fqa0          9          2     1440    720 KB   3.5\"\n"
        !           254: "\t/dev/fha0         15          2     2400    1.2 MB   5.25\"\n"
        !           255: "\t/dev/fva0         18          2     2880    1.44 MB  3.5\"\n"
        !           256: "Device names ending in '0' and '1' indicate drives A: and B:.\n"
        !           257: "\n"
        !           258:                );
        !           259:        mycls(1);
        !           260:        printf(
        !           261: "To use a floppy disk with COHERENT, you must:\n"
        !           262: "\t(1) format it with /etc/fdformat,\n"
        !           263: "\t(2) check it for bad blocks with /etc/badscan,\n"
        !           264: "\t(3) build an empty filesystem on it with /etc/mkfs,\n"
        !           265: "\t(4) mount it with /bin/mount or /etc/mount,\n"
        !           266: "\t(5) copy files to or from it, e.g. with /bin/cp or /bin/cpdir,\n"
        !           267: "and\t(6) unmount it with /bin/umount or /etc/umount.\n"
        !           268: "\n"
        !           269: "For example, to copy directory /dir to a 5.25\" high density diskette in A:\n"
        !           270: "\t/etc/fdformat /dev/fha0\n"
        !           271: "\t/etc/badscan -o /tmp/proto /dev/fha0 2400\n"
        !           272: "\t/etc/mkfs /dev/fha0 /tmp/proto\n"
        !           273: "\t/etc/mount /dev/fha0 /f0\n"
        !           274: "\tcpdir -vd /dir /f0/dir\n"
        !           275: "\t/etc/umount /dev/fha0\n"
        !           276: "/bin/mount and /bin/umount provide handy abbreviations for mount commands.\n"
        !           277: "\n"
        !           278:                );
        !           279: 
        !           280:        /* Done. */
        !           281:        mycls(1);
        !           282:        printf(
        !           283: "This concludes your brief introduction to COHERENT.\n"
        !           284: "To see this introduction again, type \"/etc/coh_intro\".\n"
        !           285: "To create a file with this information, type \"/etc/coh_intro >/tmp/tour\".\n"
        !           286: "\n"
        !           287:                );
        !           288: }
        !           289: 
        !           290: /* end of coh_intro.c */

unix.superglobalmegacorp.com

This archive runs on limited infrastructure. Preserving old code on modern bandwidth. Automated agents are requested to crawl responsibly.