Rechercher une page de manuel
setaliasent
Langue: ja
Version: 2003-09-09 (openSuse - 09/10/07)
Section: 3 (Bibliothèques de fonctions)
̾Á°
setaliasent, endaliasent, getaliasent, getaliasent_r, getaliasbyname, getaliasbyname_r - ¥¨¥¤¥ê¥¢¥¹¥¨¥ó¥È¥ê¤òÆɤ߹þ¤à½ñ¼°
#include <aliases.h>void setaliasent(void);
void endaliasent(void);
struct aliasent *getaliasent(void);
int getaliasent_r(struct aliasent *result,
char *buffer, size_t buflen, struct aliasent **res);
struct aliasent *getaliasbyname(const char *name);
int getaliasbyname_r(const char *name, struct aliasent *result,
char *buffer, size_t buflen, struct aliasent **res);
ÀâÌÀ
¥Í¡¼¥à¥µ¡¼¥Ó¥¹¥¹¥¤¥Ã¥Á (Name Service Switch, NSS) ¤Ç ÍøÍѲÄǽ¤Ê¥Ç¡¼¥¿¥Ù¡¼¥¹¤Î 1 ¤Ä¤È¤·¤Æ¡¢ ¥á¡¼¥ë¥¨¥¤¥ê¥¢¥¹¤òÊÝ»ý¤¹¤ë¥¨¥¤¥ê¥¢¥¹¥Ç¡¼¥¿¥Ù¡¼¥¹¤¬¤¢¤ë¡£ (¤É¤Î¥Ç¡¼¥¿¥Ù¡¼¥¹¤¬¥µ¥Ý¡¼¥È¤µ¤ì¤Æ¤¤¤ë¤«¤òÄ´¤Ù¤ë¤Ë¤Ï¡¢ getent --help ¤ò¼Â¹Ô¤¹¤ë¤³¤È¡£) ¥¨¥¤¥ê¥¢¥¹¥Ç¡¼¥¿¥Ù¡¼¥¹¤Ë¥¢¥¯¥»¥¹¤¹¤ë¤¿¤á¤Ë¡¢ 6 ¤Ä¤Î´Ø¿ô¤¬Ä󶡤µ¤ì¤Æ¤¤¤ë¡£getaliasent() ´Ø¿ô¤Ï¥¨¥¤¥ê¥¢¥¹¥Ç¡¼¥¿¥Ù¡¼¥¹¤«¤é¼è¤ê½Ð¤·¤¿ ¥°¥ë¡¼¥×¾ðÊó¤ò´Þ¤à¹½Â¤ÂΤؤΥݥ¤¥ó¥¿¤òÊÖ¤¹¡£ 1 ²óÌܤ˴ؿô¤¬¸Æ¤Ð¤ì¤¿¤È¤¤Ë¤Ï¡¢ºÇ½é¤Î¥¨¥ó¥È¥ê¤òÊÖ¤¹; ¤½¤ì°Ê¹ß¤Ï¤½¤Î¸å¤Î¥¨¥ó¥È¥ê¤òÊÖ¤¹¡£
setaliasent() ´Ø¿ô¤Ï¥Õ¥¡¥¤¥ë¥Ý¥¤¥ó¥¿¤ò¥¨¥¤¥ê¥¢¥¹¥Ç¡¼¥¿¥Ù¡¼¥¹¤ÎÀèƬ¤Ë´¬¤Ì᤹¡£
endaliasent() ´Ø¿ô¤Ï¥¨¥¤¥ê¥¢¥¹¥Ç¡¼¥¿¥Ù¡¼¥¹¤ò¥¯¥í¡¼¥º¤¹¤ë¡£
getaliasent_r() ´Ø¿ô¤Ï¾åµ¤Î´Ø¿ô¤Î¥ê¥¨¥ó¥È¥é¥ó¥ÈÈǤǤ¢¤ë¡£ Í׵ᤵ¤ì¤¿¹½Â¤ÂΤÏÂè 1 °ú¤¿ô¤Ë³ÊǼ¤µ¤ì¤ë¤¬¡¢ ¥×¥í¥°¥é¥Þ¤Ï¾¤Î°ú¤¿ô¤âËä¤á¤Æ¤ä¤ëɬÍפ¬¤¢¤ë¡£ ½¼Ê¬¤ÊÎΰ褬Ϳ¤¨¤é¤ì¤Ê¤¤¤È¡¢¤³¤Î´Ø¿ô¤Ï¼ºÇÔ¤¹¤ë¡£
´Ø¿ô getaliasbyname() ¤Ï name °ú¤¿ô¤ò¤È¤ê¡¢¥¨¥¤¥ê¥¢¥¹¥Ç¡¼¥¿¥Ù¡¼¥¹¤ò¸¡º÷¤¹¤ë¡£ ¥¨¥ó¥È¥ê¤Ï struct aliasent ¤Ø¤Î¥Ý¥¤¥ó¥¿¤È¤·¤ÆÊÖ¤µ¤ì¤ë¡£
getaliasbyname_r() ¤Ï¾åµ¤Î´Ø¿ô¤Î¥ê¥¨¥ó¥È¥é¥ó¥ÈÈǤǤ¢¤ë¡£ Í׵ᤵ¤ì¤¿¹½Â¤ÂΤÏÂè 2 °ú¤¿ô¤Ë³ÊǼ¤µ¤ì¤ë¤¬¡¢ ¥×¥í¥°¥é¥Þ¤Ï¾¤Î°ú¤¿ô¤âËä¤á¤Æ¤ä¤ëɬÍפ¬¤¢¤ë¡£ ½¼Ê¬¤ÊÎΰ褬Ϳ¤¨¤é¤ì¤Ê¤¤¤È¡¢¤³¤Î´Ø¿ô¤Ï¼ºÇÔ¤¹¤ë¡£
struct aliasent ¤Ï <aliases.h> ¤ÇÄêµÁ¤µ¤ì¤Æ¤¤¤ë¡£
struct aliasent { char *alias_name; /* ¥¨¥¤¥ê¥¢¥¹Ì¾ */ size_t alias_members_len; char **alias_members; /* ¥¨¥¤¥ê¥¢¥¹Ì¾¤Î¥ê¥¹¥È */ int alias_local; };
ÊÖ¤êÃÍ
´Ø¿ô getaliasent_r() ¤È getaliasbyname_r() ¤Ï¡¢¥¨¥é¡¼¤Î¾ì¹ç¤Ë 0 °Ê³°¤ÎÃͤòÊÖ¤¹¡£¥Õ¥¡¥¤¥ë
¥Ç¥Õ¥©¥ë¥È¤Î¥¨¥¤¥ê¥¢¥¹¥Ç¡¼¥¿¥Ù¡¼¥¹¤Ï¡¢¥Õ¥¡¥¤¥ë /etc/aliases ¤Ç¤¢¤ë¡£ ¤³¤ì¤Ï /etc/nsswitch.conf ¥Õ¥¡¥¤¥ë¤ÇÊѹ¹¤Ç¤¤ë¡£½àµò
¤³¤Î¥ë¡¼¥Á¥ó¤Ï glibc ¸ÇͤΤâ¤Î¤Ç¤¢¤ë¡£ NeXT ¤Ë¤ÏƱÍͤΥ롼¥Á¥ó¤¬¤¢¤ë¡£-
#include <aliasdb.h> void alias_setent(void); void alias_endent(void); alias_ent *alias_getent(void); alias_ent *alias_getbyname(char *name);
Îã
°Ê²¼¤ÎÎã¤Ï gcc example.c -o example ¤Ç¥³¥ó¥Ñ¥¤¥ë¤Ç¤¤ë¡£ ¤³¤ì¤Ï¥¨¥¤¥ê¥¢¥¹¥Ç¡¼¥¿¥Ù¡¼¥¹¤Ë¤¢¤ëÁ´¤Æ¤Î̾Á°¤ò¥À¥ó¥×¤¹¤ë¡£#include <aliases.h> #include <stdio.h> #include <stdlib.h> #include <errno.h> int main(void) { struct aliasent *al; setaliasent(); for (;;) { al = getaliasent(); if (al == NULL) break; printf("Name: %s\n", al->alias_name); } if (errno) { perror("reading alias"); exit(EXIT_FAILURE); } endaliasent(); exit(EXIT_SUCCESS);
´ØÏ¢¹àÌÜ
getgrent(3), getpwent(3), getspent(3), aliases(5)Contenus ©2006-2024 Benjamin Poulain
Design ©2006-2024 Maxime Vantorre