Author Topic: longcat  (Read 2161 times)

Offline cratylus

  • Your favorite and best
  • Administrator
  • ***
  • Posts: 1022
  • Cratylus@Dead Souls <ds> np
    • View Profile
    • About Cratylus
longcat
« on: November 21, 2006, 12:14:59 pm »
Amylase,

code:
#include <lib.h>

inherit LIB_DAEMON;

mixed cmd(string str) {
    string *arr;
    string tmp;

    if( !str ) return "You must specify a file to cat.";
    else str = absolute_path((string)this_player()->query_cwd(), str);
    if( !file_exists(str) ) return "File " + str + " not found.";
    else if( !(tmp = read_file(str)) )
        return "Unable to read file " + str + ".";
    arr = explode(tmp,"\n");
    foreach(string line in arr){
        message("system", line, this_player());
    }
    return 1;
}

int help() {
    message("help", "Syntax: <longcat [file]>\n\n"
      "Displays the contents of the file mentioned all at once.",
      this_player());
}


put this in /secure/cmds/creators/longcat.c

then
update /secure/cmds/creators/longcat.c
then
update /daemon/command