Annotation of 43BSD/contrib/icon/functions/string.c, revision 1.1.1.1

1.1       root        1: #include "../h/rt.h"
                      2: 
                      3: /*
                      4:  * string(x) - convert x to string.
                      5:  */
                      6: 
                      7: Xstring(nargs, arg1, arg0)
                      8: int nargs;
                      9: struct descrip arg1, arg0;
                     10:    {
                     11:    char sbuf[MAXSTRING];
                     12:    extern char *alcstr();
                     13: 
                     14:    arg0 = arg1;
                     15:    switch (cvstr(&arg0, sbuf)) {
                     16:       /*
                     17:        * If x isn't a string, allocate it and return it; if it is a
                     18:        *  string, just return it; fail if it isn't a string and can't
                     19:        *  be converted.
                     20:        */
                     21:       case 1:
                     22:          sneed(STRLEN(arg0));
                     23:          STRLOC(arg0) = alcstr(STRLOC(arg0), STRLEN(arg0));
                     24:       case 2:
                     25:          return;
                     26:       default:
                     27:          fail();
                     28:       }
                     29:    }
                     30: 
                     31: Procblock(string,1)

unix.superglobalmegacorp.com

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