From ee8b2b4253930cd53a9f376f4364e47a85e4c459 Mon Sep 17 00:00:00 2001 From: Viktor Dukhovni Date: Sun, 13 Nov 2016 05:36:11 +1100 Subject: [PATCH] Drop code that's been dead for 10 years or more --- lib/roken/getcap.c | 150 ----------------------------------------------------- 1 file changed, 150 deletions(-) diff --git a/lib/roken/getcap.c b/lib/roken/getcap.c index bfebe8a65..a341c104b 100644 --- a/lib/roken/getcap.c +++ b/lib/roken/getcap.c @@ -52,9 +52,6 @@ #include #define BFRAG 1024 -#if 0 -#define BSIZE 1024 -#endif #define ESC ('[' & 037) /* ASCII ESC */ #define MAX_RECURSION 32 /* maximum getent recursion */ #define SFRAG 100 /* cgetstr mallocs in SFRAG chunks */ @@ -67,15 +64,6 @@ static size_t topreclen; /* toprec length */ static char *toprec; /* Additional record specified by cgetset() */ static int gottoprec; /* Flag indicating retrieval of toprecord */ -#if 0 /* - * Don't use db support unless it's build into libc but we don't - * check for that now, so just disable the code. - */ -#if defined(HAVE_DBOPEN) && defined(HAVE_DB_H) -#define USE_DB -#endif -#endif - #ifdef USE_DB static int cdbget (DB *, char **, const char *); #endif @@ -88,10 +76,6 @@ ROKEN_LIB_FUNCTION char * ROKEN_LIB_CALL cgetcap(char *buf, const char *cap, int ROKEN_LIB_FUNCTION int ROKEN_LIB_CALL cgetent(char **buf, char **db_array, const char *name); ROKEN_LIB_FUNCTION int ROKEN_LIB_CALL cgetmatch(const char *buf, const char *name); ROKEN_LIB_FUNCTION int ROKEN_LIB_CALL cgetclose(void); -#if 0 -int cgetfirst(char **buf, char **db_array); -int cgetnext(char **bp, char **db_array); -#endif ROKEN_LIB_FUNCTION int ROKEN_LIB_CALL cgetstr(char *buf, const char *cap, char **str); ROKEN_LIB_FUNCTION int ROKEN_LIB_CALL cgetustr(char *buf, const char *cap, char **str); ROKEN_LIB_FUNCTION int ROKEN_LIB_CALL cgetnum(char *buf, const char *cap, long *num); @@ -687,15 +671,6 @@ cgetmatch(const char *buf, const char *name) } } -#if 0 -int -cgetfirst(char **buf, char **db_array) -{ - (void)cgetclose(); - return (cgetnext(buf, db_array)); -} -#endif - static FILE *pfp; static int slash; static char **dbp; @@ -713,131 +688,6 @@ cgetclose(void) return(0); } -#if 0 -/* - * Cgetnext() gets either the first or next entry in the logical database - * specified by db_array. It returns 0 upon completion of the database, 1 - * upon returning an entry with more remaining, and -1 if an error occurs. - */ -int -cgetnext(char **bp, char **db_array) -{ - size_t len; - int status, done; - char *cp, *line, *rp, *np, buf[BSIZE], nbuf[BSIZE]; - size_t dummy; - - if (dbp == NULL) - dbp = db_array; - - if (pfp == NULL && (pfp = fopen(*dbp, "r")) == NULL) { - (void)cgetclose(); - return (-1); - } - for(;;) { - if (toprec && !gottoprec) { - gottoprec = 1; - line = toprec; - } else { - line = fgetln(pfp, &len); - if (line == NULL && pfp) { - if (ferror(pfp)) { - (void)cgetclose(); - return (-1); - } else { - (void)fclose(pfp); - pfp = NULL; - if (*++dbp == NULL) { - (void)cgetclose(); - return (0); - } else if ((pfp = - fopen(*dbp, "r")) == NULL) { - (void)cgetclose(); - return (-1); - } else - continue; - } - } else - line[len - 1] = '\0'; - if (len == 1) { - slash = 0; - continue; - } - if (isspace((unsigned char)*line) || - *line == ':' || *line == '#' || slash) { - if (line[len - 2] == '\\') - slash = 1; - else - slash = 0; - continue; - } - if (line[len - 2] == '\\') - slash = 1; - else - slash = 0; - } - - - /* - * Line points to a name line. - */ - done = 0; - np = nbuf; - for (;;) { - for (cp = line; *cp != '\0'; cp++) { - if (*cp == ':') { - *np++ = ':'; - done = 1; - break; - } - if (*cp == '\\') - break; - *np++ = *cp; - } - if (done) { - *np = '\0'; - break; - } else { /* name field extends beyond the line */ - line = fgetln(pfp, &len); - if (line == NULL && pfp) { - if (ferror(pfp)) { - (void)cgetclose(); - return (-1); - } - (void)fclose(pfp); - pfp = NULL; - *np = '\0'; - break; - } else - line[len - 1] = '\0'; - } - } - rp = buf; - for(cp = nbuf; *cp != '\0'; cp++) - if (*cp == '|' || *cp == ':') - break; - else - *rp++ = *cp; - - *rp = '\0'; - /* - * XXX - * Last argument of getent here should be nbuf if we want true - * sequential access in the case of duplicates. - * With NULL, getent will return the first entry found - * rather than the duplicate entry record. This is a - * matter of semantics that should be resolved. - */ - status = getent(bp, &dummy, db_array, -1, buf, 0, NULL); - if (status == -2 || status == -3) - (void)cgetclose(); - - return (status + 1); - } - /* NOTREACHED */ -} -#endif - /* * Cgetstr retrieves the value of the string capability cap from the * capability record pointed to by buf. A pointer to a decoded, NUL -- 2.11.4.GIT