Annotation of coherent/g/usr/bin/vi/amiprsv.c, revision 1.1

1.1     ! root        1: /* amiprsv.c */
        !             2: 
        !             3: /*-
        !             4:  *     Mike Rieser                             Dale Rahn
        !             5:  *     2410 Happy Hollow Rd. Apt D-10          540 Vine St.
        !             6:  *     West Lafayette, IN 47906                West Lafayette, IN 47906
        !             7:  *     [email protected]           [email protected]
        !             8:  */
        !             9: 
        !            10: /* This file contains the AmigaDOS-specific parts of the "elvprsv" program. */
        !            11: 
        !            12: #include <stdio.h>
        !            13: 
        !            14: /* This function returns the login name of the owner of a file */
        !            15: char        *
        !            16: ownername(filename)
        !            17:     char        *filename;     /* name of a file */
        !            18: {
        !            19:     return ("Amigan");
        !            20: }
        !            21: 
        !            22: 
        !            23: /*
        !            24:  * This function sends a mail message to a given user, saying that a file has
        !            25:  * been preserved.
        !            26:  */
        !            27: void 
        !            28: mail(user, file, when)
        !            29:     char        *user;         /* name of user who should receive the mail */
        !            30:     char        *file;         /* name of original text file that was
        !            31:                                 * preserved */
        !            32:     char        *when;         /* description of why the file was preserved */
        !            33: {
        !            34:     char         cmd[80];      /* buffer used for constructing a "mail"
        !            35:                                 * command */
        !            36:     FILE        *m;            /* stream used for giving text to the "mail"
        !            37:                                 * program */
        !            38:     char        *base;         /* basename of the file */
        !            39: 
        !            40:     /* separate the directory name from the basename. */
        !            41:     for (base = file + strlen(file); --base > file && *base != SLASH;)
        !            42:     {
        !            43:     }
        !            44:     if (*base == SLASH)
        !            45:     {
        !            46:        *base++ = '\0';
        !            47:     }
        !            48:     /* for anonymous buffers, pretend the name was "foo" */
        !            49:     if (!strcmp(base, "*"))
        !            50:     {
        !            51:        base = "foo";
        !            52:     }
        !            53:     m = fopen("CON:0/50/600/150/Elvis/CLOSE/WAIT", "w");
        !            54:     if ((FILE *) 0 == m)
        !            55:        m = stdout;
        !            56: 
        !            57:     /* Tell the user that the file was preserved */
        !            58:     fprintf(m, "A version of your file \"%s%c%s\"\n", file, SLASH, base);
        !            59:     fprintf(m, "was preserved when %s.\n", when);
        !            60:     fprintf(m, "To recover this file, do the following:\n");
        !            61:     fprintf(m, "\n");
        !            62:     fprintf(m, "     cd %s\n", file);
        !            63:     fprintf(m, "     elvrec %s\n", base);
        !            64:     fprintf(m, "\n");
        !            65: 
        !            66:     fclose(m);
        !            67: }

unix.superglobalmegacorp.com

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