OpenCores
URL https://opencores.org/ocsvn/or1k/or1k/trunk

Subversion Repositories or1k

[/] [or1k/] [trunk/] [uclinux/] [userland/] [sash/] [hostname.c] - Blame information for rev 1765

Details | Compare with Previous | View Log

Line No. Rev Author Line
1 199 simons
/* hostname.c - poe@daimi.aau.dk */
2
 
3
#include "sash.h"
4
 
5
#include <sys/types.h>
6
#include <sys/param.h>
7
#include <stdio.h>
8
#include <unistd.h>
9
 
10
void do_hostname(int argc, char **argv)
11
{
12
        char hn[PATHLEN + 1];
13
 
14
        if(argc >= 2) {
15
                if(strlen(argv[1]) > PATHLEN) {
16
                        printf("That name is too long.\n");
17
                } else {
18
                        sethostname(argv[1], strlen(argv[1]));
19
                }
20
        } else {
21
                gethostname(hn, PATHLEN);
22
                printf("%s\n", hn);
23
        }
24
}

powered by: WebSVN 2.1.0

© copyright 1999-2024 OpenCores.org, equivalent to Oliscience, all rights reserved. OpenCores®, registered trademark.