URL
https://opencores.org/ocsvn/or1k_old/or1k_old/trunk
Subversion Repositories or1k_old
[/] [or1k_old/] [trunk/] [uclinux/] [userland/] [sash/] [hostname.c] - Rev 1782
Compare with Previous | Blame | View Log
/* hostname.c - poe@daimi.aau.dk */ #include "sash.h" #include <sys/types.h> #include <sys/param.h> #include <stdio.h> #include <unistd.h> void do_hostname(int argc, char **argv) { char hn[PATHLEN + 1]; if(argc >= 2) { if(strlen(argv[1]) > PATHLEN) { printf("That name is too long.\n"); } else { sethostname(argv[1], strlen(argv[1])); } } else { gethostname(hn, PATHLEN); printf("%s\n", hn); } }