_cat.c

tmi2_fluffos_v2/lib/cmds/file/_cat.c · 924 B

From the archive tmi2_fluffos_v2.zip

Download the archive   « Back to the archive contents

// _cat.c
// the cat command dumps a file to the screen.
// Original author unknown, probably old. Possbily Lars?
// Help added, probably by Brian@TMI, probably Jan. 1992.
// This comment added by mobydick, 11-9-92

#include <mudlib.h>

inherit DAEMON ;

string help();
int cmd_cat(string file);


int
cmd_cat(string file) {
   seteuid(getuid(previous_object()));
   if(!file) {
      help();
      return 1;
   }
   else {
      file = resolv_path(this_player()->query("cwd"), file);
      if(!cat(file))
         write(file+": no such file\n");
      return 1;
   }
}

string help() {
   return("Usage:\tcat <filename>\n"+
      "Writes the contents of the filename given to standard output.\n" +
      "If the file is over a system-defined maximum (usually 80 lines)\n" +
      "then the message \"*****TRUNCATED****\" will appear.\n" +
      "In this case, you may wish to use the more command instead.\n");
}
/* EOF */

Site Stats

Snippets: 1791
Codebases: 571