OrionLibC
Barry Using POSIX names for structs 11f4683 (2 years, 2 months ago)diff --git a/grp/getgr.c b/grp/getgr.c index e77d50c..0a4c4e9 100644 --- a/grp/getgr.c +++ b/grp/getgr.c @@ -80,16 +80,16 @@ line_to_group(char *line) j++; } - entry.name = entryName; - entry.gid = number(gidstr); - entry.members = entryMembers; + entry.gr_name = entryName; + entry.gr_gid = number(gidstr); + entry.gr_mem = entryMembers; return &entry; } /* Get group file entry by name */ Group * -getgrname(const char *name) +getgrnam(const char *name) { int fd = open("/etc/group", O_RDONLY); if (fd < 0) diff --git a/include/dirent.h b/include/dirent.h index abdad04..d5ddba7 100644 --- a/include/dirent.h +++ b/include/dirent.h @@ -17,10 +17,10 @@ enum DirType { /* Structure for a Directory Entry */ typedef struct dirent { - ino_t ino; - enum DirType type; - size_t namelen; - char name[]; + ino_t d_ino; + enum DirType d_type; + size_t d_namelen; + char d_name[]; } DirEnt; #ifdef __cplusplus diff --git a/include/grp.h b/include/grp.h index a6e07d6..2916b68 100644 --- a/include/grp.h +++ b/include/grp.h @@ -3,12 +3,12 @@ /* Structure of a group entry */ typedef struct group { - char *name; - gid_t gid; - char **members; + char *gr_name; + gid_t gr_gid; + char **gr_mem; } Group; -Group *getgrname(const char *name); +Group *getgrnam(const char *name); Group *getgrgid(gid_t gid); #endif diff --git a/include/pwd.h b/include/pwd.h index df872d4..840ef6c 100644 --- a/include/pwd.h +++ b/include/pwd.h @@ -5,16 +5,16 @@ /* Structure of a password entry */ typedef struct passwd { - char *username; - char *password; - uid_t uid; - gid_t gid; - char *info; - char *homedir; - char *shell; + char *pw_name; + char *pw_passwd; + uid_t pw_uid; + gid_t pw_gid; + char *pw_gecos; + char *pw_dir; + char *pw_shell; } Passwd; -Passwd *getpwname(const char *username); +Passwd *getpwnam(const char *username); Passwd *getpwuid(uid_t uid); #endif diff --git a/include/sys/stat.h b/include/sys/stat.h index b83cf2d..4be596e 100644 --- a/include/sys/stat.h +++ b/include/sys/stat.h @@ -43,12 +43,13 @@ /* Structure for a stat() call */ typedef struct stat { - ino_t inode; - mode_t mode; - nlink_t nlink; - uid_t uid; - gid_t gid; - size_t size; + dev_t st_dev; + ino_t st_ino; + mode_t st_mode; + nlink_t st_nlink; + uid_t st_uid; + gid_t st_gid; + size_t st_size; } Stat; #ifdef __cplusplus diff --git a/include/termios.h b/include/termios.h index 259695b..3f84cf8 100644 --- a/include/termios.h +++ b/include/termios.h @@ -17,11 +17,11 @@ enum TTYLineDiscipline { typedef unsigned int tcflag_t; /* Terminal I/O Settings */ -typedef struct Termios { - tcflag_t iflag; - tcflag_t oflag; - tcflag_t cflag; - tcflag_t lflag; +typedef struct termios { + tcflag_t c_iflag; + tcflag_t c_oflag; + tcflag_t c_cflag; + tcflag_t c_lflag; } Termios; /* Terminal Window Size */ diff --git a/pwd/getpw.c b/pwd/getpw.c index 116cf97..bc2c92b 100644 --- a/pwd/getpw.c +++ b/pwd/getpw.c @@ -81,20 +81,20 @@ line_to_passwd(char *line) get_part(line, PASSWD_HOMEDIR, entryHomeDir); get_part(line, PASSWD_SHELL, entryShell); - entry.username = entryUsername; - entry.password = entryPassword; - entry.uid = number(uidstr); - entry.gid = number(gidstr); - entry.info = entryInfo; - entry.homedir = entryHomeDir; - entry.shell = entryShell; + entry.pw_name = entryUsername; + entry.pw_passwd = entryPassword; + entry.pw_uid = number(uidstr); + entry.pw_gid = number(gidstr); + entry.pw_gecos = entryInfo; + entry.pw_dir = entryHomeDir; + entry.pw_shell = entryShell; return &entry; } /* Get password file entry by name */ Passwd * -getpwname(const char *username) +getpwnam(const char *username) { int fd = open("/etc/passwd", O_RDONLY);