Work on ansi shell

This commit is contained in:
2022-08-23 02:35:54 +02:00
parent 23360febfa
commit d94239679d
7 changed files with 365 additions and 57 deletions

View File

@ -25,4 +25,8 @@
#define ANSI_ITALIC "\x1b[3m"
#define ANSI_BOLD "\x1b[1m"
#define ANSI_HOME "[H"
#endif /* __ANSI_COLORS_H */

View File

@ -31,6 +31,7 @@
#include <sys/types.h>
#include <sys/socket.h>
#include <sys/un.h>
#include <arpa/inet.h>
#include <netinet/in.h>
@ -88,7 +89,7 @@ char *sock_addrtostr(const struct sockaddr *sa, char *s, size_t maxlen, int addp
}
break;
#endif /* AF_LINLK */
#endif /* AF_LINLK */
#ifdef AF_PACKET
case AF_PACKET:
@ -103,11 +104,17 @@ char *sock_addrtostr(const struct sockaddr *sa, char *s, size_t maxlen, int addp
sprintf(sp, "%02X", sl->sll_addr[i]);
}
break;
#endif /* AF_PACKET */
#endif /* AF_PACKET */
case AF_UNIX:
{
struct sockaddr_un *addr = (struct sockaddr_un *) sa;
snprintf(s, maxlen, "%s", addr->sun_path);
}
break;
default:
strncpy(s, "Unknown AF", maxlen);
snprintf(s,maxlen, "Unknown AF: %d", sa->sa_family);
return NULL;
}
return s;