Integrated more to utilbox

This commit is contained in:
Pierre Pronchery 2011-03-21 23:34:26 +00:00
parent c5c09d28e5
commit 981567e218
3 changed files with 22 additions and 6 deletions

View File

@ -32,7 +32,7 @@ typedef struct _Prefs
/* prototypes */
static int _error(char const * message, int ret);
static int _more_error(char const * message, int ret);
/* functions */
@ -60,7 +60,7 @@ static int _more_do(Prefs * prefs, char const * filename)
int c;
if(filename != NULL && (fp = fopen(filename, "r")) == NULL)
return _error(filename, 1);
return _more_error(filename, 1);
while(fgets(buf, sizeof(buf), fp) != NULL)
{
len = strlen(buf);
@ -82,8 +82,8 @@ static int _more_do(Prefs * prefs, char const * filename)
}
/* error */
static int _error(char const * message, int ret)
/* more_error */
static int _more_error(char const * message, int ret)
{
fputs("more: ", stderr);
perror(message);

View File

@ -1,5 +1,5 @@
/* $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 program is free software: you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
@ -393,6 +393,21 @@
#undef _prefs_parse
#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 */
#define main _mv_main
#define _usage _mv_usage
@ -737,6 +752,7 @@ Call calls[] =
{ "ls", _ls_main },
{ "mkdir", _mkdir_main },
{ "mkfifo", _mkfifo_main },
{ "more", _more_main },
{ "mv", _mv_main },
{ "nice", _nice_main },
{ "pr", _pr_main },

View File

@ -49,7 +49,7 @@ EOF
#main
cat > "utils.c" << EOF
/* \$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 program is free software: you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by