1
0
mirror of https://git.FreeBSD.org/src.git synced 2024-12-27 11:55:06 +00:00

rename the NIS related fields to have yp_ prefix.

Suggested by:	delphij
This commit is contained in:
Hajimu UMEMOTO 2005-04-18 18:34:58 +00:00
parent b7c755717c
commit a87b3988c9
Notes: svn2git 2020-12-20 02:59:44 +00:00
svn path=/head/; revision=145245
4 changed files with 38 additions and 38 deletions

View File

@ -49,8 +49,8 @@ getservbyname_r(const char *name, const char *proto, struct servent *se,
int error; int error;
#ifdef YP #ifdef YP
sed->getservbyname_yp = (char *)name; sed->yp_name = (char *)name;
sed->getservbyproto_yp = (char *)proto; sed->yp_proto = (char *)proto;
#endif #endif
setservent_r(sed->stayopen, sed); setservent_r(sed->stayopen, sed);
@ -69,8 +69,8 @@ getservbyname_r(const char *name, const char *proto, struct servent *se,
endservent_r(sed); endservent_r(sed);
#ifdef YP #ifdef YP
sed->getservbyname_yp = NULL; sed->yp_name = NULL;
sed->getservbyproto_yp = NULL; sed->yp_proto = NULL;
#endif #endif
return (error); return (error);

View File

@ -48,8 +48,8 @@ getservbyport_r(int port, const char *proto, struct servent *se,
int error; int error;
#ifdef YP #ifdef YP
sed->getservbyport_yp = port; sed->yp_port = port;
sed->getservbyproto_yp = (char *)proto; sed->yp_proto = (char *)proto;
#endif #endif
setservent_r(sed->stayopen, sed); setservent_r(sed->stayopen, sed);
@ -63,8 +63,8 @@ getservbyport_r(int port, const char *proto, struct servent *se,
endservent_r(sed); endservent_r(sed);
#ifdef YP #ifdef YP
sed->getservbyport_yp = 0; sed->yp_port = 0;
sed->getservbyproto_yp = NULL; sed->yp_proto = NULL;
#endif #endif
return (error); return (error);

View File

@ -67,8 +67,8 @@ servent_data_clear(struct servent_data *sed)
sed->fp = NULL; sed->fp = NULL;
} }
#ifdef YP #ifdef YP
free(sed->key); free(sed->yp_key);
sed->key = NULL; sed->yp_key = NULL;
#endif #endif
} }
@ -119,11 +119,11 @@ _getservbyport_yp(struct servent_data *sed)
char buf[YPMAXRECORD + 2]; char buf[YPMAXRECORD + 2];
int rv; int rv;
snprintf(buf, sizeof(buf), "%d/%s", snprintf(buf, sizeof(buf), "%d/%s", ntohs(sed->yp_port),
ntohs(sed->getservbyport_yp), sed->getservbyproto_yp); sed->yp_proto);
sed->getservbyport_yp = 0; sed->yp_port = 0;
sed->getservbyproto_yp = NULL; sed->yp_proto = NULL;
if (!sed->yp_domain) { if (!sed->yp_domain) {
if (yp_get_default_domain(&sed->yp_domain)) if (yp_get_default_domain(&sed->yp_domain))
@ -168,11 +168,10 @@ _getservbyname_yp(struct servent_data *sed)
return (0); return (0);
} }
snprintf(buf, sizeof(buf), "%s/%s", sed->getservbyname_yp, snprintf(buf, sizeof(buf), "%s/%s", sed->yp_name, sed->yp_proto);
sed->getservbyproto_yp);
sed->getservbyname_yp = 0; sed->yp_name = 0;
sed->getservbyproto_yp = NULL; sed->yp_proto = NULL;
if (yp_match(sed->yp_domain, "services.byname", buf, strlen(buf), if (yp_match(sed->yp_domain, "services.byname", buf, strlen(buf),
&result, &resultlen)) { &result, &resultlen)) {
@ -198,22 +197,23 @@ _getservent_yp(struct servent_data *sed)
return (0); return (0);
} }
if (!sed->stepping_yp) { if (!sed->yp_stepping) {
free(sed->key); free(sed->yp_key);
rv = yp_first(sed->yp_domain, "services.byname", &sed->key, rv = yp_first(sed->yp_domain, "services.byname", &sed->yp_key,
&sed->keylen, &result, &resultlen); &sed->yp_keylen, &result, &resultlen);
if (rv) { if (rv) {
sed->stepping_yp = 0; sed->yp_stepping = 0;
return(0); return(0);
} }
sed->stepping_yp = 1; sed->yp_stepping = 1;
} else { } else {
lastkey = sed->key; lastkey = sed->yp_key;
rv = yp_next(sed->yp_domain, "services.byname", sed->key, rv = yp_next(sed->yp_domain, "services.byname", sed->yp_key,
sed->keylen, &sed->key, &sed->keylen, &result, &resultlen); sed->yp_keylen, &sed->yp_key, &sed->yp_keylen, &result,
&resultlen);
free(lastkey); free(lastkey);
if (rv) { if (rv) {
sed->stepping_yp = 0; sed->yp_stepping = 0;
return (0); return (0);
} }
} }
@ -243,7 +243,7 @@ endservent_r(struct servent_data *sed)
servent_data_clear(sed); servent_data_clear(sed);
sed->stayopen = 0; sed->stayopen = 0;
#ifdef YP #ifdef YP
sed->stepping_yp = 0; sed->yp_stepping = 0;
sed->yp_domain = NULL; sed->yp_domain = NULL;
#endif #endif
} }
@ -256,7 +256,7 @@ getservent_r(struct servent *se, struct servent_data *sed)
long l; long l;
#ifdef YP #ifdef YP
if (sed->stepping_yp && _getservent_yp(sed)) { if (sed->yp_stepping && _getservent_yp(sed)) {
p = sed->line; p = sed->line;
goto unpack; goto unpack;
} }
@ -269,11 +269,11 @@ getservent_r(struct servent *se, struct servent_data *sed)
return (-1); return (-1);
#ifdef YP #ifdef YP
if (*p == '+' && _yp_check(NULL)) { if (*p == '+' && _yp_check(NULL)) {
if (sed->getservbyname_yp != NULL) { if (sed->yp_name != NULL) {
if (!_getservbyname_yp(sed)) if (!_getservbyname_yp(sed))
goto tryagain; goto tryagain;
} }
else if (sed->getservbyport_yp != 0) { else if (sed->yp_port != 0) {
if (!_getservbyport_yp(sed)) if (!_getservbyport_yp(sed))
goto tryagain; goto tryagain;
} }

View File

@ -38,13 +38,13 @@ struct servent_data {
int stayopen; int stayopen;
char line[BUFSIZ + 1]; char line[BUFSIZ + 1];
#ifdef YP #ifdef YP
int stepping_yp; int yp_stepping;
char *getservbyname_yp; char *yp_name;
char *getservbyproto_yp; char *yp_proto;
int getservbyport_yp; int yp_port;
char *yp_domain; char *yp_domain;
char *key; char *yp_key;
int keylen; int yp_keylen;
#endif #endif
}; };