Diff for /embedaddon/readline/examples/fileman.c between versions 1.1.1.1 and 1.1.1.2

version 1.1.1.1, 2014/07/30 08:16:46 version 1.1.1.2, 2021/03/17 01:01:01
Line 63 Line 63
   
 extern char *xmalloc PARAMS((size_t));  extern char *xmalloc PARAMS((size_t));
   
   void initialize_readline PARAMS((void));
   void too_dangerous PARAMS((char *));
   
   int execute_line PARAMS((char *));
   int valid_argument PARAMS((char *, char *));
   
 /* The names of functions that actually do the manipulation. */  /* The names of functions that actually do the manipulation. */
 int com_list PARAMS((char *));  int com_list PARAMS((char *));
 int com_view PARAMS((char *));  int com_view PARAMS((char *));
Line 119  dupstr (s) Line 125  dupstr (s)
   return (r);    return (r);
 }  }
   
   int
 main (argc, argv)  main (argc, argv)
      int argc;       int argc;
      char **argv;       char **argv;
Line 241  char **fileman_completion PARAMS((const char *, int, i Line 248  char **fileman_completion PARAMS((const char *, int, i
 /* Tell the GNU Readline library how to complete.  We want to try to complete  /* Tell the GNU Readline library how to complete.  We want to try to complete
    on command names if this is the first word in the line, or on filenames     on command names if this is the first word in the line, or on filenames
    if not. */     if not. */
   void
 initialize_readline ()  initialize_readline ()
 {  {
   /* Allow conditional parsing of the ~/.inputrc file. */    /* Allow conditional parsing of the ~/.inputrc file. */
Line 317  command_generator (text, state) Line 325  command_generator (text, state)
 static char syscom[1024];  static char syscom[1024];
   
 /* List the file(s) named in arg. */  /* List the file(s) named in arg. */
   int
 com_list (arg)  com_list (arg)
      char *arg;       char *arg;
 {  {
Line 327  com_list (arg) Line 336  com_list (arg)
   return (system (syscom));    return (system (syscom));
 }  }
   
   int
 com_view (arg)  com_view (arg)
      char *arg;       char *arg;
 {  {
Line 342  com_view (arg) Line 352  com_view (arg)
   return (system (syscom));    return (system (syscom));
 }  }
   
   int
 com_rename (arg)  com_rename (arg)
      char *arg;       char *arg;
 {  {
Line 349  com_rename (arg) Line 360  com_rename (arg)
   return (1);    return (1);
 }  }
   
   int
 com_stat (arg)  com_stat (arg)
      char *arg;       char *arg;
 {  {
Line 365  com_stat (arg) Line 377  com_stat (arg)
   
   printf ("Statistics for `%s':\n", arg);    printf ("Statistics for `%s':\n", arg);
   
  printf ("%s has %d link%s, and is %d byte%s in length.\n",  printf ("%s has %d link%s, and is %lu byte%s in length.\n",
           arg,            arg,
           finfo.st_nlink,            finfo.st_nlink,
           (finfo.st_nlink == 1) ? "" : "s",            (finfo.st_nlink == 1) ? "" : "s",
          finfo.st_size,          (unsigned long)finfo.st_size,
           (finfo.st_size == 1) ? "" : "s");            (finfo.st_size == 1) ? "" : "s");
   printf ("Inode Last Change at: %s", ctime (&finfo.st_ctime));    printf ("Inode Last Change at: %s", ctime (&finfo.st_ctime));
   printf ("      Last access at: %s", ctime (&finfo.st_atime));    printf ("      Last access at: %s", ctime (&finfo.st_atime));
Line 377  com_stat (arg) Line 389  com_stat (arg)
   return (0);    return (0);
 }  }
   
   int
 com_delete (arg)  com_delete (arg)
      char *arg;       char *arg;
 {  {
Line 386  com_delete (arg) Line 399  com_delete (arg)
   
 /* Print out help for ARG, or for all of the commands if ARG is  /* Print out help for ARG, or for all of the commands if ARG is
    not present. */     not present. */
   int
 com_help (arg)  com_help (arg)
      char *arg;       char *arg;
 {  {
Line 425  com_help (arg) Line 439  com_help (arg)
 }  }
   
 /* Change to the directory ARG. */  /* Change to the directory ARG. */
   int
 com_cd (arg)  com_cd (arg)
      char *arg;       char *arg;
 {  {
Line 439  com_cd (arg) Line 454  com_cd (arg)
 }  }
   
 /* Print out the current working directory. */  /* Print out the current working directory. */
   int
 com_pwd (ignore)  com_pwd (ignore)
      char *ignore;       char *ignore;
 {  {
Line 456  com_pwd (ignore) Line 472  com_pwd (ignore)
 }  }
   
 /* The user wishes to quit using this program.  Just set DONE non-zero. */  /* The user wishes to quit using this program.  Just set DONE non-zero. */
   int
 com_quit (arg)  com_quit (arg)
      char *arg;       char *arg;
 {  {
Line 464  com_quit (arg) Line 481  com_quit (arg)
 }  }
   
 /* Function which tells you that you can't do this. */  /* Function which tells you that you can't do this. */
   void
 too_dangerous (caller)  too_dangerous (caller)
      char *caller;       char *caller;
 {  {

Removed from v.1.1.1.1  
changed lines
  Added in v.1.1.1.2


FreeBSD-CVSweb <freebsd-cvsweb@FreeBSD.org>