Annotation of coherent/d/usr/bin/elvis/alias.c, revision 1.1.1.1

1.1       root        1: /* alias.c */
                      2: 
                      3: /* Author:
                      4:  *             Peter Reinig
                      5:  *             Universitaet Kaiserslautern
                      6:  *             Postfach 3049
                      7:  *             7650 Kaiserslautern
                      8:  *             W. Germany
                      9:  *             [email protected]
                     10:  */
                     11: 
                     12: /* This tiny program executes elvis with the flags that are appropriate
                     13:  * for a given command name.  This program is used only on systems that
                     14:  * don't allow UNIX-style file links.
                     15:  *
                     16:  * The benefit of this program is: instead of having 5 copies of elvis
                     17:  * on your disk, you only need one copy of elvis and 4 copies of this
                     18:  * little program.
                     19:  */
                     20: 
                     21: #include <stdio.h>
                     22: #include "config.h"
                     23: 
                     24: #if OSK
                     25: #define ELVIS  "/dd/usr/cmds/elvis"
                     26: #else
                     27: #define ELVIS  "elvis"
                     28: #endif
                     29: 
                     30: extern char **environ;
                     31: extern int errno;
                     32: 
                     33: main(argc, argv)
                     34:        int argc;
                     35:        char *argv[];
                     36: {
                     37:        int pid, i;
                     38:        char **argblk;
                     39: #if OSK
                     40:        extern int chainc();
                     41: #endif
                     42: 
                     43:        if ((argblk = (char **) malloc((argc + 2) * sizeof(char *))) == 0)
                     44:        {
                     45: #if OSK
                     46:                _errmsg(errno, "Can't get enough memory\n");
                     47: #else
                     48:                fprintf(stderr, "%s: Can't get enough memory\n", argv[0]);
                     49: #endif
                     50:                exit(2);
                     51:        }
                     52:        i = 1;
                     53:        switch (argv[0][strlen(argv[0]) - 1])
                     54:        {
                     55:          case 'w':                     /* "view" */
                     56:          case 'W':
                     57:                argblk[i++] = "-R";
                     58:                break;
                     59: 
                     60: #if !OSK
                     61:          case 'x':                     /* "ex" */
                     62:          case 'X':
                     63:                argblk[i++] = "-x";
                     64:                break;
                     65: #endif
                     66: 
                     67:          case 't':                     /* "input" */
                     68:          case 'T':
                     69:                argblk[i++] = "-i";
                     70:                break;
                     71:        }
                     72:        argv++;
                     73:        while(argc--)
                     74:                argblk[i++] = *argv++;
                     75:        argblk[0] = ELVIS;
                     76: #if OSK
                     77:        pid = os9exec(chainc, argblk[0], argblk, environ, 0, 0, 3);
                     78: #else
                     79:        (void)execvp(argblk[0], argblk);
                     80: #endif
                     81:        fprintf(stderr, "%s: cannot execute\n", argblk[0]);
                     82: }

unix.superglobalmegacorp.com

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