Deleted Added
full compact
fileman.c (21308) fileman.c (26497)
1/* fileman.c -- A tiny application which demonstrates how to use the
2 GNU Readline library. This application interactively allows users
3 to manipulate files and their modes. */
1/* fileman.c -- A tiny application which demonstrates how to use the
2 GNU Readline library. This application interactively allows users
3 to manipulate files and their modes. */
4/*
5 * Remove the next line if you're compiling this against an installed
6 * libreadline.a
7 */
8#define READLINE_LIBRARY
4
9
5#include <stdio.h>
10#ifdef HAVE_CONFIG_H
11#include <config.h>
12#endif
13
6#include <sys/types.h>
14#include <sys/types.h>
15#ifdef HAVE_SYS_FILE_H
7#include <sys/file.h>
16#include <sys/file.h>
17#endif
8#include <sys/stat.h>
18#include <sys/stat.h>
9#include <sys/errno.h>
10
19
11#include <readline/readline.h>
12#include <readline/history.h>
20#include <stdio.h>
21#include <errno.h>
13
22
23#if defined (HAVE_STRING_H)
24# include <string.h>
25#else /* !HAVE_STRING_H */
26# include <strings.h>
27#endif /* !HAVE_STRING_H */
28
29#ifdef READLINE_LIBRARY
30# include "readline.h"
31# include "history.h"
32#else
33# include <readline/readline.h>
34# include <readline/history.h>
35#endif
36
14extern char *getwd ();
15extern char *xmalloc ();
16
17/* The names of functions that actually do the manipulation. */
18int com_list (), com_view (), com_rename (), com_stat (), com_pwd ();
19int com_delete (), com_help (), com_cd (), com_quit ();
20
21/* A structure which contains information on the commands this program

--- 27 unchanged lines hidden (view full) ---

49/* The name of this program, as taken from argv[0]. */
50char *progname;
51
52/* When non-zero, this global means the user is done using this program. */
53int done;
54
55char *
56dupstr (s)
37extern char *getwd ();
38extern char *xmalloc ();
39
40/* The names of functions that actually do the manipulation. */
41int com_list (), com_view (), com_rename (), com_stat (), com_pwd ();
42int com_delete (), com_help (), com_cd (), com_quit ();
43
44/* A structure which contains information on the commands this program

--- 27 unchanged lines hidden (view full) ---

72/* The name of this program, as taken from argv[0]. */
73char *progname;
74
75/* When non-zero, this global means the user is done using this program. */
76int done;
77
78char *
79dupstr (s)
57 int s;
80 char *s;
58{
59 char *r;
60
61 r = xmalloc (strlen (s) + 1);
62 strcpy (r, s);
63 return (r);
64}
65

--- 233 unchanged lines hidden (view full) ---

299 if (stat (arg, &finfo) == -1)
300 {
301 perror (arg);
302 return (1);
303 }
304
305 printf ("Statistics for `%s':\n", arg);
306
81{
82 char *r;
83
84 r = xmalloc (strlen (s) + 1);
85 strcpy (r, s);
86 return (r);
87}
88

--- 233 unchanged lines hidden (view full) ---

322 if (stat (arg, &finfo) == -1)
323 {
324 perror (arg);
325 return (1);
326 }
327
328 printf ("Statistics for `%s':\n", arg);
329
307 printf ("%s has %d link%s, and is %d byte%s in length.\n", arg,
330 printf ("%s has %d link%s, and is %d byte%s in length.\n",
331 arg,
308 finfo.st_nlink,
309 (finfo.st_nlink == 1) ? "" : "s",
310 finfo.st_size,
311 (finfo.st_size == 1) ? "" : "s");
312 printf ("Inode Last Change at: %s", ctime (&finfo.st_ctime));
313 printf (" Last access at: %s", ctime (&finfo.st_atime));
314 printf (" Last modified at: %s", ctime (&finfo.st_mtime));
315 return (0);

--- 111 unchanged lines hidden ---
332 finfo.st_nlink,
333 (finfo.st_nlink == 1) ? "" : "s",
334 finfo.st_size,
335 (finfo.st_size == 1) ? "" : "s");
336 printf ("Inode Last Change at: %s", ctime (&finfo.st_ctime));
337 printf (" Last access at: %s", ctime (&finfo.st_atime));
338 printf (" Last modified at: %s", ctime (&finfo.st_mtime));
339 return (0);

--- 111 unchanged lines hidden ---