Annotation of 43BSD/contrib/notes/src/nfcomment.c, revision 1.1

1.1     ! root        1: #include "parms.h"
        !             2: #include "structs.h"
        !             3: 
        !             4: #ifdef RCSIDENT
        !             5: static char rcsid[] = "$Header: nfcomment.c,v 1.7 85/01/18 15:25:46 notes Rel $";
        !             6: #endif RCSIDENT
        !             7: 
        !             8: /*
        !             9:  *     nfcomment(nfname, text, title, dirflag, anonflag)
        !            10:  *     char *nfname, *text, *title;
        !            11:  *
        !            12:  *     Allows the user to insert notes into notesfiles from his programs.
        !            13:  *     The text is inserted into the notesfile 'nfname' with the 
        !            14:  *     title specified. If dirflag or anonflag are non-null the
        !            15:  *     director or anonymous bits are enabled, provided the user has
        !            16:  *     permission.
        !            17:  *     If text is NULL, the text for the note will be taken from
        !            18:  *     standard input.
        !            19:  *
        !            20:  *     Original Coding:        Ray Essick      April 1982
        !            21:  */
        !            22: 
        !            23: FILE * popen ();
        !            24: 
        !            25: nfcomment (nfname, text, title, dirflag, anonflag)
        !            26: char   *nfname;
        !            27: char   *text;
        !            28: char   *title;
        !            29: {
        !            30: 
        !            31:     FILE * zpipe;
        !            32:     char    cmdline[CMDLEN];
        !            33: 
        !            34:     if (nfname == NULL)
        !            35:     {
        !            36:        fprintf (stderr, "nfcomment: No notesfile specified\n");
        !            37:        return (-1);
        !            38:     }
        !            39:     if (title == NULL)
        !            40:        title = "From nfcomment";
        !            41: 
        !            42:     sprintf (cmdline, "%s/nfpipe %s -t \"%s\" %s %s",
        !            43:            BIN,                                        /* where nfpipe lives */
        !            44:            nfname,
        !            45:            title,
        !            46:            dirflag ? "-d" : " ",
        !            47:            anonflag ? "-a" : " ");
        !            48: 
        !            49:     if (text == NULL)
        !            50:     {
        !            51:        system (cmdline);
        !            52:        fprintf (stderr, "EOT\n");                      /* let him know he hit EOT */
        !            53:     }
        !            54:     else
        !            55:     {
        !            56:        if ((zpipe = popen (cmdline, "w")) == NULL)
        !            57:            return (-1);
        !            58:        while (*text)
        !            59:            putc (*text++, zpipe);
        !            60:        pclose (zpipe);
        !            61:     }
        !            62:     return 0;
        !            63: }

unix.superglobalmegacorp.com

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