Integrated more to utilbox
This commit is contained in:
parent
c5c09d28e5
commit
981567e218
|
@ -32,7 +32,7 @@ typedef struct _Prefs
|
||||||
|
|
||||||
|
|
||||||
/* prototypes */
|
/* prototypes */
|
||||||
static int _error(char const * message, int ret);
|
static int _more_error(char const * message, int ret);
|
||||||
|
|
||||||
|
|
||||||
/* functions */
|
/* functions */
|
||||||
|
@ -60,7 +60,7 @@ static int _more_do(Prefs * prefs, char const * filename)
|
||||||
int c;
|
int c;
|
||||||
|
|
||||||
if(filename != NULL && (fp = fopen(filename, "r")) == NULL)
|
if(filename != NULL && (fp = fopen(filename, "r")) == NULL)
|
||||||
return _error(filename, 1);
|
return _more_error(filename, 1);
|
||||||
while(fgets(buf, sizeof(buf), fp) != NULL)
|
while(fgets(buf, sizeof(buf), fp) != NULL)
|
||||||
{
|
{
|
||||||
len = strlen(buf);
|
len = strlen(buf);
|
||||||
|
@ -82,8 +82,8 @@ static int _more_do(Prefs * prefs, char const * filename)
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
/* error */
|
/* more_error */
|
||||||
static int _error(char const * message, int ret)
|
static int _more_error(char const * message, int ret)
|
||||||
{
|
{
|
||||||
fputs("more: ", stderr);
|
fputs("more: ", stderr);
|
||||||
perror(message);
|
perror(message);
|
||||||
|
|
|
@ -1,5 +1,5 @@
|
||||||
/* $Id$ */
|
/* $Id$ */
|
||||||
/* Copyright (c) 2010 Pierre Pronchery <khorben@defora.org> */
|
/* Copyright (c) 2011 Pierre Pronchery <khorben@defora.org> */
|
||||||
/* This file is part of DeforaOS Unix utils */
|
/* This file is part of DeforaOS Unix utils */
|
||||||
/* This program is free software: you can redistribute it and/or modify
|
/* This program is free software: you can redistribute it and/or modify
|
||||||
* it under the terms of the GNU General Public License as published by
|
* it under the terms of the GNU General Public License as published by
|
||||||
|
@ -393,6 +393,21 @@
|
||||||
#undef _prefs_parse
|
#undef _prefs_parse
|
||||||
#undef _mkfifo
|
#undef _mkfifo
|
||||||
|
|
||||||
|
/* more.c */
|
||||||
|
#define main _more_main
|
||||||
|
#define _usage _more_usage
|
||||||
|
#define _Prefs _more_Prefs
|
||||||
|
#define Prefs more_Prefs
|
||||||
|
#define _prefs_parse _more_prefs_parse
|
||||||
|
#define _more __more
|
||||||
|
#include "../src/more.c"
|
||||||
|
#undef main
|
||||||
|
#undef _usage
|
||||||
|
#undef _Prefs
|
||||||
|
#undef Prefs
|
||||||
|
#undef _prefs_parse
|
||||||
|
#undef _more
|
||||||
|
|
||||||
/* mv.c */
|
/* mv.c */
|
||||||
#define main _mv_main
|
#define main _mv_main
|
||||||
#define _usage _mv_usage
|
#define _usage _mv_usage
|
||||||
|
@ -737,6 +752,7 @@ Call calls[] =
|
||||||
{ "ls", _ls_main },
|
{ "ls", _ls_main },
|
||||||
{ "mkdir", _mkdir_main },
|
{ "mkdir", _mkdir_main },
|
||||||
{ "mkfifo", _mkfifo_main },
|
{ "mkfifo", _mkfifo_main },
|
||||||
|
{ "more", _more_main },
|
||||||
{ "mv", _mv_main },
|
{ "mv", _mv_main },
|
||||||
{ "nice", _nice_main },
|
{ "nice", _nice_main },
|
||||||
{ "pr", _pr_main },
|
{ "pr", _pr_main },
|
||||||
|
|
|
@ -49,7 +49,7 @@ EOF
|
||||||
#main
|
#main
|
||||||
cat > "utils.c" << EOF
|
cat > "utils.c" << EOF
|
||||||
/* \$Id\$ */
|
/* \$Id\$ */
|
||||||
/* Copyright (c) 2010 Pierre Pronchery <khorben@defora.org> */
|
/* Copyright (c) 2011 Pierre Pronchery <khorben@defora.org> */
|
||||||
/* This file is part of DeforaOS Unix utils */
|
/* This file is part of DeforaOS Unix utils */
|
||||||
/* This program is free software: you can redistribute it and/or modify
|
/* This program is free software: you can redistribute it and/or modify
|
||||||
* it under the terms of the GNU General Public License as published by
|
* it under the terms of the GNU General Public License as published by
|
||||||
|
|
Loading…
Reference in New Issue
Block a user