Code cleanup
This commit is contained in:
parent
d37abf30d0
commit
edc72ad965
|
@ -1,5 +1,5 @@
|
||||||
/* $Id$ */
|
/* $Id$ */
|
||||||
/* Copyright (c) 2007 Pierre Pronchery <khorben@defora.org> */
|
/* Copyright (c) 2009 Pierre Pronchery <khorben@defora.org> */
|
||||||
/* This file is part of DeforaOS Unix utils */
|
/* This file is part of DeforaOS Unix utils */
|
||||||
/* utils is not free software; you can redistribute it and/or modify it under
|
/* utils is not free software; you can redistribute it and/or modify it under
|
||||||
* the terms of the Creative Commons Attribution-NonCommercial-ShareAlike 3.0
|
* the terms of the Creative Commons Attribution-NonCommercial-ShareAlike 3.0
|
||||||
|
@ -22,6 +22,7 @@
|
||||||
|
|
||||||
/* tty */
|
/* tty */
|
||||||
static int _tty_error(char const * message, int ret);
|
static int _tty_error(char const * message, int ret);
|
||||||
|
|
||||||
static int _tty(void)
|
static int _tty(void)
|
||||||
{
|
{
|
||||||
char * tty;
|
char * tty;
|
||||||
|
@ -30,10 +31,10 @@ static int _tty(void)
|
||||||
{
|
{
|
||||||
if((tty = ttyname(0)) == NULL)
|
if((tty = ttyname(0)) == NULL)
|
||||||
return _tty_error("ttyname", 2);
|
return _tty_error("ttyname", 2);
|
||||||
printf("%s\n", tty);
|
puts(tty);
|
||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
printf("%s", "not a tty\n");
|
puts("not a tty");
|
||||||
return 1;
|
return 1;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -1,5 +1,5 @@
|
||||||
/* $Id$ */
|
/* $Id$ */
|
||||||
/* Copyright (c) 2007 Pierre Pronchery <khorben@defora.org> */
|
/* Copyright (c) 2009 Pierre Pronchery <khorben@defora.org> */
|
||||||
/* This file is part of DeforaOS Unix utils */
|
/* This file is part of DeforaOS Unix utils */
|
||||||
/* utils is not free software; you can redistribute it and/or modify it under
|
/* utils is not free software; you can redistribute it and/or modify it under
|
||||||
* the terms of the Creative Commons Attribution-NonCommercial-ShareAlike 3.0
|
* the terms of the Creative Commons Attribution-NonCommercial-ShareAlike 3.0
|
||||||
|
@ -35,6 +35,7 @@
|
||||||
static int _uniq_error(char const * message, int ret);
|
static int _uniq_error(char const * message, int ret);
|
||||||
static int _uniq_do(int opts, char const * fields, unsigned int skip,
|
static int _uniq_do(int opts, char const * fields, unsigned int skip,
|
||||||
FILE * infp, FILE * outfp);
|
FILE * infp, FILE * outfp);
|
||||||
|
|
||||||
static int _uniq(int opts, char const * fields, unsigned int skip,
|
static int _uniq(int opts, char const * fields, unsigned int skip,
|
||||||
char const * in, char const * out)
|
char const * in, char const * out)
|
||||||
{
|
{
|
||||||
|
@ -166,6 +167,8 @@ static int _usage(void)
|
||||||
return 1;
|
return 1;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
/* main */
|
||||||
int main(int argc, char * argv[])
|
int main(int argc, char * argv[])
|
||||||
{
|
{
|
||||||
int opts = 0;
|
int opts = 0;
|
||||||
|
@ -206,5 +209,5 @@ int main(int argc, char * argv[])
|
||||||
else if(argc - optind > 2)
|
else if(argc - optind > 2)
|
||||||
return _usage();
|
return _usage();
|
||||||
}
|
}
|
||||||
return _uniq(opts, fields, skip, in, out) == 0 ? 0 : 2;
|
return (_uniq(opts, fields, skip, in, out) == 0) ? 0 : 2;
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in New Issue
Block a user