DataMuseum.dk

Presents historical artifacts from the history of:

DKUUG/EUUG Conference tapes

This is an automatic "excavation" of a thematic subset of
artifacts from Datamuseum.dk's BitArchive.

See our Wiki for more about DKUUG/EUUG Conference tapes

Excavated with: AutoArchaeologist - Free & Open Source Software.


top - metrics - download
Index: T s

⟦688abc4e9⟧ TextFile

    Length: 1634 (0x662)
    Types: TextFile
    Names: »sel2str.c«

Derivation

└─⟦3d0c2be1b⟧ Bits:30001254 ISODE-5.0 Tape
    └─⟦eba4602b1⟧ »./isode-5.0.tar.Z« 
        └─⟦d3ac74d73⟧ 
            └─⟦this⟧ »isode-5.0/compat/sel2str.c« 

TextFile

/* sel2str.c - selector to string */

#ifndef	lint
static char *rcsid = "$Header: /f/osi/compat/RCS/sel2str.c,v 6.0 89/03/18 23:25:32 mrose Rel $";
#endif

/* 
 * $Header: /f/osi/compat/RCS/sel2str.c,v 6.0 89/03/18 23:25:32 mrose Rel $
 *
 *
 * $Log:	sel2str.c,v $
 * Revision 6.0  89/03/18  23:25:32  mrose
 * Release 5.0
 * 
 */

/*
 *				  NOTICE
 *
 *    Acquisition, use, and distribution of this module and related
 *    materials are subject to the restrictions of a license agreement.
 *    Consult the Preface in the User's Manual for the full terms of
 *    this agreement.
 *
 */


/* LINTLIBRARY */

#include <ctype.h>
#include <stdio.h>
#include "general.h"
#include "manifest.h"
#include "isoaddrs.h"

/* \f

 */

char   *sel2str (sel, len, quoted)
char   *sel;
int	len,
	quoted;
{
    register char *cp,
		  *dp,
    		  *ep;
    static int    i = 0;
    static char buf1[NASIZE * 2 + 1],
		buf2[NASIZE * 2 + 1],
    		buf3[NASIZE * 2 + 1],
    		buf4[NASIZE * 2 + 1];
    static char *bufs[] = { buf1, buf2, buf3, buf4 };

    cp = bufs[i++];
    i = i % 4;

    if (quoted) {
#ifndef	NOGOSIP
	if (len == 2) {
	    if (quoted < 0)
		goto ugly;
	    (void) sprintf (cp, "#%d",
			    (sel[0] & 0xff) << 8 | (sel[1] & 0xff));
	    goto out;
	}
#endif

	for (ep = (dp = sel) + len; dp < ep; dp++)
	    if (!isprint (*dp))
		goto ugly;

	if (len > NASIZE * 2)
	    len = NASIZE * 2;

	(void) sprintf (cp, len ? "\"%*.*s\"" : "\"\"", len, len, sel);
    }
    else {
ugly: ;
	if (len > NASIZE)	/* XXX */
	    len = NASIZE;

	cp[explode (cp, (u_char *) sel, len)] = NULL;
    }
#ifndef	NOGOSIP
out: ;
#endif
	
    return cp;
}