source: rtems/doc/shell/file.t @ 29328f7a

4.104.115
Last change on this file since 29328f7a was 29328f7a, checked in by Sebastian Huber <sebastian.huber@…>, on 05/12/10 at 11:30:52

2010-05-12 Sebastian Huber <sebastian.huber@…>

PR 1512/doc

  • shell/general.t: Add rtc.
  • shell/file.t: Add fdisk.
  • Property mode set to 100644
File size: 34.7 KB
Line 
1@c
2@c  COPYRIGHT (c) 1988-2008.
3@c  On-Line Applications Research Corporation (OAR).
4@c  All rights reserved.
5@c
6@c  $Id$
7@c
8
9@chapter File and Directory Commands
10
11@section Introduction
12
13The RTEMS shell has the following file and directory commands:
14
15@itemize @bullet
16
17@item @code{umask} - Set file mode creation mask
18@item @code{cp} - copy files
19@item @code{pwd} - print work directory
20@item @code{ls} - list files in the directory
21@item @code{chdir} - change the current directory
22@item @code{mkdir} - create a directory
23@item @code{rmdir} - remove empty directories
24@item @code{chroot} - change the root directory
25@item @code{chmod} - change permissions of a file
26@item @code{cat} - display file contents
27@item @code{msdosfmt} - format disk
28@item @code{rm} - remove files
29@item @code{mount} - mount disk
30@item @code{unmount} - unmount disk
31@item @code{blksync} - sync the block driver
32@item @code{fdisk} - format disks
33@item @code{dir} - alias for ls
34@item @code{cd} - alias for chdir
35
36@end itemize
37
38@section Commands
39
40This section details the File and Directory Commands available.  A
41subsection is dedicated to each of the commands and
42describes the behavior and configuration of that
43command as well as providing an example usage.
44
45@c
46@c
47@c
48@page
49@subsection umask - set file mode creation mask
50
51@pgindex umask
52
53@subheading SYNOPSYS:
54
55@example
56umask [new_umask]
57@end example
58
59@subheading DESCRIPTION:
60
61This command sets the user file creation mask to @code{new_umask}.  The
62argument @code{new_umask} may be octal, hexadecimal, or decimal.
63
64@subheading EXIT STATUS:
65
66This command returns 0 on success and non-zero if an error is encountered.
67
68@subheading NOTES:
69
70This command does not currently support symbolic mode masks.
71
72@subheading EXAMPLES:
73
74The following is an example of how to use @code{umask}:
75
76@example
77SHLL [/] $ umask
78022
79SHLL [/] $ umask 0666
800666
81SHLL [/] $ umask
820666
83@end example
84
85@subheading CONFIGURATION:
86
87@findex CONFIGURE_SHELL_NO_COMMAND_UMASK
88@findex CONFIGURE_SHELL_COMMAND_UMASK
89
90This command is included in the default shell command set. 
91When building a custom command set, define
92@code{CONFIGURE_SHELL_COMMAND_UMASK} to have this
93command included.
94
95This command can be excluded from the shell command set by
96defining @code{CONFIGURE_SHELL_NO_COMMAND_UMASK} when all
97shell commands have been configured.
98
99@subheading PROGRAMMING INFORMATION:
100
101@findex rtems_shell_rtems_main_umask
102
103The @code{umask} is implemented by a C language function
104which has the following prototype:
105
106@example
107int rtems_shell_rtems_main_umask(
108  int    argc,
109  char **argv
110);
111@end example
112
113The configuration structure for the @code{umask} has the
114following prototype:
115
116@example
117extern rtems_shell_cmd_t rtems_shell_UMASK_Command;
118@end example
119
120@c
121@c
122@c
123@page
124@subsection cp - copy files
125
126@pgindex cp
127
128@subheading SYNOPSYS:
129
130@example
131cp [-R [-H | -L | -P]] [-f | -i] [-pv] src target
132
133cp [-R [-H | -L] ] [-f | -i] [-NpPv] source_file ... target_directory
134@end example
135
136@subheading DESCRIPTION:
137
138In the first synopsis form, the cp utility copies the contents of the
139source_file to the target_file. In the second synopsis form, the contents of
140each named source_file is copied to the destination target_directory. The names
141of the files themselves are not changed. If cp detects an attempt to copy a
142file to itself, the copy will fail.
143
144The following options are available:
145
146@table @b
147@item -f
148
149For each existing destination pathname, attempt to overwrite it. If permissions
150do not allow copy to succeed, remove it and create a new file, without
151prompting for confirmation. (The -i option is ignored if the -f option is
152specified.)
153
154@item -H
155
156If the -R option is specified, symbolic links on the command line are followed.
157(Symbolic links encountered in the tree traversal are not followed.)
158
159@item -i
160
161Causes cp to write a prompt to the standard error output before copying a file
162that would overwrite an existing file. If the response from the standard input
163begins with the character 'y', the file copy is attempted.
164
165@item -L
166
167If the -R option is specified, all symbolic links are followed.
168
169@item -N
170
171When used with -p, do not copy file flags.
172
173@item -P
174
175No symbolic links are followed.
176
177@item -p
178
179Causes cp to preserve in the copy as many of the modification time, access
180time, file flags, file mode, user ID, and group ID as allowed by permissions.
181
182If the user ID and group ID cannot be preserved, no error message is displayed
183and the exit value is not altered.
184
185If the source file has its set user ID bit on and the user ID cannot be
186preserved, the set user ID bit is not preserved in the copy's permissions. If
187the source file has its set group ID bit on and the group ID cannot be
188preserved, the set group ID bit is not preserved in the copy's permissions. If
189the source file has both its set user ID and set group ID bits on, and either
190the user ID or group ID cannot be preserved, neither the set user ID or set
191group ID bits are preserved in the copy's permissions.
192
193@item -R
194
195If source_file designates a directory, cp copies the directory and the entire
196subtree connected at that point. This option also causes symbolic links to be
197copied, rather than indirected through, and for cp to create special files
198rather than copying them as normal files. Created directories have the same
199mode as the corresponding source directory, unmodified by the process's umask.
200
201@item -v
202
203Cause cp to be verbose, showing files as they are copied.
204
205@end table
206
207For each destination file that already exists, its contents are overwritten if
208permissions allow, but its mode, user ID, and group ID are unchanged.
209
210In the second synopsis form, target_directory must exist unless there is only
211one named source_file which is a directory and the -R flag is specified.
212
213If the destination file does not exist, the mode of the source file is used as
214modified by the file mode creation mask (umask, see csh(1)). If the source file
215has its set user ID bit on, that bit is removed unless both the source file and
216the destination file are owned by the same user. If the source file has its set
217group ID bit on, that bit is removed unless both the source file and the
218destination file are in the same group and the user is a member of that group.
219If both the set user ID and set group ID bits are set, all of the above
220conditions must be fulfilled or both bits are removed.
221
222Appropriate permissions are required for file creation or overwriting.
223
224Symbolic links are always followed unless the -R flag is set, in which case
225symbolic links are not followed, by default. The -H or -L flags (in conjunction
226with the -R flag), as well as the -P flag cause symbolic links to be followed
227as described above. The -H and -L options are ignored unless the -R option is
228specified. In addition, these options override eachsubhedading other and the
229command's actions are determined by the last one specified.
230
231@subheading EXIT STATUS:
232
233This command returns 0 on success and non-zero if an error is encountered.
234
235@subheading NOTES:
236
237NONE
238
239@subheading EXAMPLES:
240
241The following is an example of how to use @code{cp} to
242copy a file to a new name in the current directory:
243
244@example
245SHLL [/] # cat joel
246cat: joel: No such file or directory
247SHLL [/] # cp etc/passwd joel
248SHLL [/] # cat joel
249root:*:0:0:root::/:/bin/sh
250rtems:*:1:1:RTEMS Application::/:/bin/sh
251tty:!:2:2:tty owner::/:/bin/false
252SHLL [/] # ls
253drwxr-xr-x   1   root   root         536 Jan 01 00:00 dev/
254drwxr-xr-x   1   root   root        1072 Jan 01 00:00 etc/
255-rw-r--r--   1   root   root         102 Jan 01 00:00 joel
2563 files 1710 bytes occupied
257@end example
258
259The following is an example of how to use @code{cp} to
260copy one or more files to a destination directory and
261use the same @code{basename} in the destination directory:
262
263@example
264SHLL [/] # mkdir tmp
265SHLL [/] # ls tmp         
2660 files 0 bytes occupied
267SHLL [/] # cp /etc/passwd tmp
268SHLL [/] # ls /tmp
269-rw-r--r--   1   root   root         102 Jan 01 00:01 passwd
2701 files 102 bytes occupied
271SHLL [/] # cp /etc/passwd /etc/group /tmp
272SHLL [/] # ls /tmp
273-rw-r--r--   1   root   root         102 Jan 01 00:01 passwd
274-rw-r--r--   1   root   root          42 Jan 01 00:01 group
2752 files 144 bytes occupied
276SHLL [/] #
277@end example
278
279@subheading CONFIGURATION:
280
281@findex CONFIGURE_SHELL_NO_COMMAND_CP
282@findex CONFIGURE_SHELL_COMMAND_CP
283
284This command is included in the default shell command set. 
285When building a custom command set, define
286@code{CONFIGURE_SHELL_COMMAND_CP} to have this
287command included.
288
289This command can be excluded from the shell command set by
290defining @code{CONFIGURE_SHELL_NO_COMMAND_CP} when all
291shell commands have been configured.
292
293@subheading PROGRAMMING INFORMATION:
294
295@findex rtems_shell_rtems_main_cp
296
297The @code{cp} is implemented by a C language function
298which has the following prototype:
299
300@example
301int rtems_shell_rtems_main_cp(
302  int    argc,
303  char **argv
304);
305@end example
306
307The configuration structure for the @code{cp} has the
308following prototype:
309
310@example
311extern rtems_shell_cmd_t rtems_shell_CP_Command;
312@end example
313
314@subheading ORIGIN:
315
316The implementation and portions of the documentation for this
317command are from NetBSD 4.0.
318
319@c
320@c
321@c
322@page
323@subsection pwd - print work directory
324
325@pgindex pwd
326
327@subheading SYNOPSYS:
328
329@example
330pwd
331@end example
332
333@subheading DESCRIPTION:
334
335This command prints the fully qualified filename of the current
336working directory.
337
338@subheading EXIT STATUS:
339
340This command returns 0 on success and non-zero if an error is encountered.
341
342@subheading NOTES:
343
344NONE
345
346@subheading EXAMPLES:
347
348The following is an example of how to use @code{pwd}:
349
350@example
351SHLL [/] $ pwd
352/
353SHLL [/] $ cd dev
354SHLL [/dev] $ pwd
355/dev
356@end example
357
358@subheading CONFIGURATION:
359
360@findex CONFIGURE_SHELL_NO_COMMAND_PWD
361@findex CONFIGURE_SHELL_COMMAND_PWD
362
363This command is included in the default shell command set. 
364When building a custom command set, define
365@code{CONFIGURE_SHELL_COMMAND_PWD} to have this
366command included.
367
368This command can be excluded from the shell command set by
369defining @code{CONFIGURE_SHELL_NO_COMMAND_PWD} when all
370shell commands have been configured.
371
372@subheading PROGRAMMING INFORMATION:
373
374@findex rtems_shell_rtems_main_pwd
375
376The @code{pwd} is implemented by a C language function
377which has the following prototype:
378
379@example
380int rtems_shell_rtems_main_pwd(
381  int    argc,
382  char **argv
383);
384@end example
385
386The configuration structure for the @code{pwd} has the
387following prototype:
388
389@example
390extern rtems_shell_cmd_t rtems_shell_PWD_Command;
391@end example
392
393@c
394@c
395@c
396@page
397@subsection ls - list files in the directory
398
399@pgindex ls
400
401@subheading SYNOPSYS:
402
403@example
404ls [dir]
405@end example
406
407@subheading DESCRIPTION:
408
409This command displays the contents of the specified directory.  If
410no arguments are given, then it displays the contents of the current
411working directory.
412
413@subheading EXIT STATUS:
414
415This command returns 0 on success and non-zero if an error is encountered.
416
417@subheading NOTES:
418
419This command currently does not display information on a set of
420files like the POSIX ls(1).  It only displays the contents of
421entire directories.
422
423@subheading EXAMPLES:
424
425The following is an example of how to use @code{ls}:
426
427@example
428SHLL [/] $ ls
429drwxr-xr-x   1   root   root         536 Jan 01 00:00 dev/
430drwxr-xr-x   1   root   root        1072 Jan 01 00:00 etc/
4312 files 1608 bytes occupied
432SHLL [/] $ ls etc
433-rw-r--r--   1   root   root         102 Jan 01 00:00 passwd
434-rw-r--r--   1   root   root          42 Jan 01 00:00 group
435-rw-r--r--   1   root   root          30 Jan 01 00:00 issue
436-rw-r--r--   1   root   root          28 Jan 01 00:00 issue.net
4374 files 202 bytes occupied
438SHLL [/] $ ls dev etc
439-rwxr-xr-x   1  rtems   root           0 Jan 01 00:00 console
440-rwxr-xr-x   1   root   root           0 Jan 01 00:00 console_b
441@end example
442
443@subheading CONFIGURATION:
444
445@findex CONFIGURE_SHELL_NO_COMMAND_LS
446@findex CONFIGURE_SHELL_COMMAND_LS
447
448This command is included in the default shell command set. 
449When building a custom command set, define
450@code{CONFIGURE_SHELL_COMMAND_LS} to have this
451command included.
452
453This command can be excluded from the shell command set by
454defining @code{CONFIGURE_SHELL_NO_COMMAND_LS} when all
455shell commands have been configured.
456
457@subheading PROGRAMMING INFORMATION:
458
459@findex rtems_shell_rtems_main_ls
460
461The @code{ls} is implemented by a C language function
462which has the following prototype:
463
464@example
465int rtems_shell_rtems_main_ls(
466  int    argc,
467  char **argv
468);
469@end example
470
471The configuration structure for the @code{ls} has the
472following prototype:
473
474@example
475extern rtems_shell_cmd_t rtems_shell_LS_Command;
476@end example
477
478@c
479@c
480@c
481@page
482@subsection chdir - change the current directory
483
484@pgindex chdir
485
486@subheading SYNOPSYS:
487
488@example
489chdir [dir]
490@end example
491
492@subheading DESCRIPTION:
493
494This command is used to change the current working directory to
495the specified directory.  If no arguments are given, the current
496working directory will be changed to @code{/}.
497
498@subheading EXIT STATUS:
499
500This command returns 0 on success and non-zero if an error is encountered.
501
502@subheading NOTES:
503
504NONE
505
506@subheading EXAMPLES:
507
508The following is an example of how to use @code{chdir}:
509
510@example
511SHLL [/] $ pwd
512/
513SHLL [/] $ chdir etc
514SHLL [/etc] $ pwd
515/etc
516@end example
517
518@subheading CONFIGURATION:
519
520@findex CONFIGURE_SHELL_NO_COMMAND_CHDIR
521@findex CONFIGURE_SHELL_COMMAND_CHDIR
522
523This command is included in the default shell command set. 
524When building a custom command set, define
525@code{CONFIGURE_SHELL_COMMAND_CHDIR} to have this
526command included.
527
528This command can be excluded from the shell command set by
529defining @code{CONFIGURE_SHELL_NO_COMMAND_CHDIR} when all
530shell commands have been configured.
531
532@subheading PROGRAMMING INFORMATION:
533
534@findex rtems_shell_rtems_main_chdir
535
536The @code{chdir} is implemented by a C language function
537which has the following prototype:
538
539@example
540int rtems_shell_rtems_main_chdir(
541  int    argc,
542  char **argv
543);
544@end example
545
546The configuration structure for the @code{chdir} has the
547following prototype:
548
549@example
550extern rtems_shell_cmd_t rtems_shell_CHDIR_Command;
551@end example
552
553@c
554@c
555@c
556@page
557@subsection mkdir - create a directory
558
559@pgindex mkdir
560
561@subheading SYNOPSYS:
562
563@example
564mkdir  dir [dir1 .. dirN]
565@end example
566
567@subheading DESCRIPTION:
568
569This command creates the set of directories in the order they
570are specified on the command line.  If an error is encountered
571making one of the directories, the command will continue to
572attempt to create the remaining directories on the command line.
573
574@subheading EXIT STATUS:
575
576This command returns 0 on success and non-zero if an error is encountered.
577
578@subheading NOTES:
579
580If this command is invoked with no arguments, nothing occurs.
581
582The user must have sufficient permissions to create the directory.
583For the @code{fileio} test provided with RTEMS, this means the user
584must login as @code{root} not @code{rtems}.
585
586@subheading EXAMPLES:
587
588The following is an example of how to use @code{mkdir}:
589
590@example
591SHLL [/] # ls
592drwxr-xr-x   1   root   root         536 Jan 01 00:00 dev/
593drwxr-xr-x   1   root   root        1072 Jan 01 00:00 etc/
5942 files 1608 bytes occupied
595SHLL [/] # mkdir joel
596SHLL [/] # ls joel
5970 files 0 bytes occupied
598SHLL [/] # cp etc/passwd joel
599SHLL [/] # ls joel
600-rw-r--r--   1   root   root         102 Jan 01 00:02 passwd
6011 files 102 bytes occupied
602@end example
603
604@subheading CONFIGURATION:
605
606@findex CONFIGURE_SHELL_NO_COMMAND_MKDIR
607@findex CONFIGURE_SHELL_COMMAND_MKDIR
608
609This command is included in the default shell command set. 
610When building a custom command set, define
611@code{CONFIGURE_SHELL_COMMAND_MKDIR} to have this
612command included.
613
614This command can be excluded from the shell command set by
615defining @code{CONFIGURE_SHELL_NO_COMMAND_MKDIR} when all
616shell commands have been configured.
617
618@subheading PROGRAMMING INFORMATION:
619
620@findex rtems_shell_rtems_main_mkdir
621
622The @code{mkdir} is implemented by a C language function
623which has the following prototype:
624
625@example
626int rtems_shell_rtems_main_mkdir(
627  int    argc,
628  char **argv
629);
630@end example
631
632The configuration structure for the @code{mkdir} has the
633following prototype:
634
635@example
636extern rtems_shell_cmd_t rtems_shell_MKDIR_Command;
637@end example
638
639@c
640@c
641@c
642@page
643@subsection rmdir - remove empty directories
644
645@pgindex rmdir
646
647@subheading SYNOPSYS:
648
649@example
650rmdir  [dir1 .. dirN]
651@end example
652
653@subheading DESCRIPTION:
654
655This command removes the specified set of directories.  If no
656directories are provided on the command line, no actions are taken.
657
658@subheading EXIT STATUS:
659
660This command returns 0 on success and non-zero if an error is encountered.
661
662@subheading NOTES:
663
664This command is a implemented using the @code{rmdir(2)} system
665call and all reasons that call may fail apply to this command.
666
667@subheading EXAMPLES:
668
669The following is an example of how to use @code{rmdir}:
670
671@example
672SHLL [/] # mkdir joeldir
673SHLL [/] # rmdir joeldir
674SHLL [/] # ls joeldir
675joeldir: No such file or directory.
676@end example
677
678@subheading CONFIGURATION:
679
680@findex CONFIGURE_SHELL_NO_COMMAND_RMDIR
681@findex CONFIGURE_SHELL_COMMAND_RMDIR
682
683This command is included in the default shell command set. 
684When building a custom command set, define
685@code{CONFIGURE_SHELL_COMMAND_RMDIR} to have this
686command included.
687
688This command can be excluded from the shell command set by
689defining @code{CONFIGURE_SHELL_NO_COMMAND_RMDIR} when all
690shell commands have been configured.
691
692@subheading PROGRAMMING INFORMATION:
693
694@findex rtems_shell_rtems_main_rmdir
695
696The @code{rmdir} is implemented by a C language function
697which has the following prototype:
698
699@example
700int rtems_shell_rtems_main_rmdir(
701  int    argc,
702  char **argv
703);
704@end example
705
706The configuration structure for the @code{rmdir} has the
707following prototype:
708
709@example
710extern rtems_shell_cmd_t rtems_shell_RMDIR_Command;
711@end example
712
713@c
714@c
715@c
716@page
717@subsection chroot - change the root directory
718
719@pgindex chroot
720
721@subheading SYNOPSYS:
722
723@example
724chroot [dir]
725@end example
726
727@subheading DESCRIPTION:
728
729This command changes the root directory to @code{dir} for subsequent
730commands.
731
732@subheading EXIT STATUS:
733
734This command returns 0 on success and non-zero if an error is encountered.
735
736The destination directory @code{dir} must exist.
737
738@subheading NOTES:
739
740NONE
741
742@subheading EXAMPLES:
743
744The following is an example of how to use @code{chroot}
745and the impact it has on the environment for subsequent
746command invocations:
747
748@example
749SHLL [/] $ cat passwd
750cat: passwd: No such file or directory
751SHLL [/] $ chroot etc
752SHLL [/] $ cat passwd
753root:*:0:0:root::/:/bin/sh
754rtems:*:1:1:RTEMS Application::/:/bin/sh
755tty:!:2:2:tty owner::/:/bin/false
756SHLL [/] $ cat /etc/passwd
757cat: /etc/passwd: No such file or directory
758@end example
759
760@subheading CONFIGURATION:
761
762@findex CONFIGURE_SHELL_NO_COMMAND_CHROOT
763@findex CONFIGURE_SHELL_COMMAND_CHROOT
764
765This command is included in the default shell command set. 
766When building a custom command set, define
767@code{CONFIGURE_SHELL_COMMAND_CHROOT} to have this
768command included.
769
770This command can be excluded from the shell command set by
771defining @code{CONFIGURE_SHELL_NO_COMMAND_CHROOT} when all
772shell commands have been configured.
773
774@subheading PROGRAMMING INFORMATION:
775
776@findex rtems_shell_rtems_main_chroot
777
778The @code{chroot} is implemented by a C language function
779which has the following prototype:
780
781@example
782int rtems_shell_rtems_main_chroot(
783  int    argc,
784  char **argv
785);
786@end example
787
788The configuration structure for the @code{chroot} has the
789following prototype:
790
791@example
792extern rtems_shell_cmd_t rtems_shell_CHROOT_Command;
793@end example
794
795@c
796@c
797@c
798@page
799@subsection chmod - change permissions of a file
800
801@pgindex chmod
802
803@subheading SYNOPSYS:
804
805@example
806chmod permissions file1 [file2...]
807@end example
808
809@subheading DESCRIPTION:
810
811This command changes the permissions on the files specified to the
812indicated @code{permissions}.  The permission values are POSIX based
813with owner, group, and world having individual read, write, and
814executive permission bits.
815
816@subheading EXIT STATUS:
817
818This command returns 0 on success and non-zero if an error is encountered.
819
820@subheading NOTES:
821
822The @code{chmod} command only takes numeric representations of
823the permissions.
824
825@subheading EXAMPLES:
826
827The following is an example of how to use @code{chmod}:
828
829@example
830SHLL [/] # cd etc
831SHLL [/etc] # ls
832-rw-r--r--   1   root   root         102 Jan 01 00:00 passwd
833-rw-r--r--   1   root   root          42 Jan 01 00:00 group
834-rw-r--r--   1   root   root          30 Jan 01 00:00 issue
835-rw-r--r--   1   root   root          28 Jan 01 00:00 issue.net
8364 files 202 bytes occupied
837SHLL [/etc] # chmod 0777 passwd
838SHLL [/etc] # ls
839-rwxrwxrwx   1   root   root         102 Jan 01 00:00 passwd
840-rw-r--r--   1   root   root          42 Jan 01 00:00 group
841-rw-r--r--   1   root   root          30 Jan 01 00:00 issue
842-rw-r--r--   1   root   root          28 Jan 01 00:00 issue.net
8434 files 202 bytes occupied
844SHLL [/etc] # chmod 0322 passwd
845SHLL [/etc] # ls
846--wx-w--w-   1 nouser   root         102 Jan 01 00:00 passwd
847-rw-r--r--   1 nouser   root          42 Jan 01 00:00 group
848-rw-r--r--   1 nouser   root          30 Jan 01 00:00 issue
849-rw-r--r--   1 nouser   root          28 Jan 01 00:00 issue.net
8504 files 202 bytes occupied
851SHLL [/etc] # chmod 0644 passwd
852SHLL [/etc] # ls
853-rw-r--r--   1   root   root         102 Jan 01 00:00 passwd
854-rw-r--r--   1   root   root          42 Jan 01 00:00 group
855-rw-r--r--   1   root   root          30 Jan 01 00:00 issue
856-rw-r--r--   1   root   root          28 Jan 01 00:00 issue.net
8574 files 202 bytes occupied
858@end example
859
860@subheading CONFIGURATION:
861
862@findex CONFIGURE_SHELL_NO_COMMAND_CHMOD
863@findex CONFIGURE_SHELL_COMMAND_CHMOD
864
865This command is included in the default shell command set. 
866When building a custom command set, define
867@code{CONFIGURE_SHELL_COMMAND_CHMOD} to have this
868command included.
869
870This command can be excluded from the shell command set by
871defining @code{CONFIGURE_SHELL_NO_COMMAND_CHMOD} when all
872shell commands have been configured.
873
874@subheading PROGRAMMING INFORMATION:
875
876@findex rtems_shell_rtems_main_chmod
877
878The @code{chmod} is implemented by a C language function
879which has the following prototype:
880
881@example
882int rtems_shell_rtems_main_chmod(
883  int    argc,
884  char **argv
885);
886@end example
887
888The configuration structure for the @code{chmod} has the
889following prototype:
890
891@example
892extern rtems_shell_cmd_t rtems_shell_CHMOD_Command;
893@end example
894
895@c
896@c
897@c
898@page
899@subsection cat - display file contents
900
901@pgindex cat
902
903@subheading SYNOPSYS:
904
905@example
906cat file1 [file2 .. fileN]
907@end example
908
909@subheading DESCRIPTION:
910
911This command displays the contents of the specified files.
912
913@subheading EXIT STATUS:
914
915This command returns 0 on success and non-zero if an error is encountered.
916
917@subheading NOTES:
918
919It is possible to read the input from a device file using @code{cat}.
920
921@subheading EXAMPLES:
922
923The following is an example of how to use @code{cat}:
924
925@example
926SHLL [/] # cat /etc/passwd
927root:*:0:0:root::/:/bin/sh
928rtems:*:1:1:RTEMS Application::/:/bin/sh
929tty:!:2:2:tty owner::/:/bin/false
930@end example
931
932@subheading CONFIGURATION:
933
934@findex CONFIGURE_SHELL_NO_COMMAND_CAT
935@findex CONFIGURE_SHELL_COMMAND_CAT
936
937This command is included in the default shell command set. 
938When building a custom command set, define
939@code{CONFIGURE_SHELL_COMMAND_CAT} to have this
940command included.
941
942This command can be excluded from the shell command set by
943defining @code{CONFIGURE_SHELL_NO_COMMAND_CAT} when all
944shell commands have been configured.
945
946@subheading PROGRAMMING INFORMATION:
947
948@findex rtems_shell_rtems_main_cat
949
950The @code{cat} is implemented by a C language function
951which has the following prototype:
952
953@example
954int rtems_shell_rtems_main_cat(
955  int    argc,
956  char **argv
957);
958@end example
959
960The configuration structure for the @code{cat} has the
961following prototype:
962
963@example
964extern rtems_shell_cmd_t rtems_shell_CAT_Command;
965@end example
966
967@c
968@c
969@c
970@page
971@subsection rm - remove files
972
973@pgindex rm
974
975@subheading SYNOPSYS:
976
977@example
978rm file1 [file2 ... fileN]
979@end example
980
981@subheading DESCRIPTION:
982
983This command deletes a name from the filesystem.  If the specified file name
984was the last link to a file and there are no @code{open} file descriptor
985references to that file, then it is deleted and the associated space in
986the file system is made available for subsequent use.
987
988If the filename specified was the last link to a file but there
989are open file descriptor references to it, then the file will
990remain in existence until the last file descriptor referencing
991it is closed.
992
993@subheading EXIT STATUS:
994
995This command returns 0 on success and non-zero if an error is encountered.
996
997@subheading NOTES:
998
999NONE
1000
1001@subheading EXAMPLES:
1002
1003The following is an example of how to use @code{rm}:
1004
1005@example
1006SHLL [/] # cp /etc/passwd tmpfile
1007SHLL [/] # cat tmpfile
1008root:*:0:0:root::/:/bin/sh
1009rtems:*:1:1:RTEMS Application::/:/bin/sh
1010tty:!:2:2:tty owner::/:/bin/false
1011SHLL [/] # rm tmpfile
1012SHLL [/] # cat tmpfile
1013cat: tmpfile: No such file or directory
1014@end example
1015
1016@subheading CONFIGURATION:
1017
1018@findex CONFIGURE_SHELL_NO_COMMAND_RM
1019@findex CONFIGURE_SHELL_COMMAND_RM
1020
1021This command is included in the default shell command set. 
1022When building a custom command set, define
1023@code{CONFIGURE_SHELL_COMMAND_RM} to have this
1024command included.
1025
1026This command can be excluded from the shell command set by
1027defining @code{CONFIGURE_SHELL_NO_COMMAND_RM} when all
1028shell commands have been configured.
1029
1030@subheading PROGRAMMING INFORMATION:
1031
1032@findex rtems_shell_rtems_main_rm
1033
1034The @code{rm} is implemented by a C language function
1035which has the following prototype:
1036
1037@example
1038int rtems_shell_rtems_main_rm(
1039  int    argc,
1040  char **argv
1041);
1042@end example
1043
1044The configuration structure for the @code{rm} has the
1045following prototype:
1046
1047@example
1048extern rtems_shell_cmd_t rtems_shell_RM_Command;
1049@end example
1050
1051@c
1052@c
1053@c
1054@page
1055@subsection mount - mount disk
1056
1057@pgindex mount
1058
1059@subheading SYNOPSYS:
1060
1061@example
1062mount [-t fstype] [-r] [-L] device path
1063@end example
1064
1065@subheading DESCRIPTION:
1066
1067The @code{mount} command will mount a block device to a mount point
1068using the specified file system. The files systems are:
1069
1070@itemize @bullet
1071@item msdos - MSDOS File System
1072@item tftp  - TFTP Network File System
1073@item ftp   - FTP Network File System
1074@item nfs   - Network File System
1075@end itemize
1076
1077When the file system type is 'msdos' the driver is a "block device driver"
1078node present in the file system. The driver is ignored with the 'tftp' and
1079'ftp' file systems. For the 'nfs' file system the driver is the 'host:/path'
1080string that described NFS host and the exported file system path.
1081
1082@subheading EXIT STATUS:
1083
1084This command returns 0 on success and non-zero if an error is encountered.
1085
1086@subheading NOTES:
1087
1088The mount point must exist.
1089
1090The services offered by each file-system vary. For example you cannot list the
1091directory of a TFTP file-system as this server is not provided in the TFTP
1092protocol. You need to check each file-system's documentation for the services
1093provided.
1094
1095@subheading EXAMPLES:
1096
1097Mount the Flash Disk driver to the '/fd' mount point:
1098
1099@example
1100$ mount -t msdos /dev/flashdisk0 /fd
1101@end example
1102
1103Mount the NFS file system exported path 'bar' by host 'foo':
1104
1105@example
1106$ mount -t nfs foo:/bar /nfs
1107@end example
1108
1109Mount the TFTP file system on '/tftp':
1110
1111@example
1112$ mount -t tftp /tftp
1113@end example
1114
1115To access the TFTP files on server '10.10.10.10':
1116
1117@example
1118$ cat /tftp/10.10.10.10/test.txt
1119@end example
1120
1121
1122@subheading CONFIGURATION:
1123
1124@findex CONFIGURE_SHELL_NO_COMMAND_MOUNT
1125@findex CONFIGURE_SHELL_COMMAND_MOUNT
1126
1127This command is included in the default shell command set. 
1128When building a custom command set, define
1129@code{CONFIGURE_SHELL_COMMAND_MOUNT} to have this
1130command included.
1131
1132This command can be excluded from the shell command set by
1133defining @code{CONFIGURE_SHELL_NO_COMMAND_MOUNT} when all
1134shell commands have been configured.
1135
1136The mount command includes references to file-system code. If you do not wish
1137to include file-system that you do not use do not define the mount command
1138support for that file-system. The file-system mount command defines are:
1139
1140@itemize @bullet
1141@item msdos - CONFIGURE_SHELL_MOUNT_MSDOS
1142@item tftp - CONFIGURE_SHELL_MOUNT_TFTP
1143@item ftp - CONFIGURE_SHELL_MOUNT_FTP
1144@item nfs - CONFIGURE_SHELL_MOUNT_NFS
1145@end itemize
1146
1147An example configuration is:
1148
1149@example
1150#define CONFIGURE_SHELL_MOUNT_MSDOS
1151#ifdef RTEMS_NETWORKING
1152  #define CONFIGURE_SHELL_MOUNT_TFTP
1153  #define CONFIGURE_SHELL_MOUNT_FTP
1154  #define CONFIGURE_SHELL_MOUNT_NFS
1155#endif
1156@end example
1157
1158@subheading PROGRAMMING INFORMATION:
1159
1160@findex rtems_shell_rtems_main_mount
1161
1162The @code{mount} is implemented by a C language function
1163which has the following prototype:
1164
1165@example
1166int rtems_shell_rtems_main_mount(
1167  int    argc,
1168  char **argv
1169);
1170@end example
1171
1172The configuration structure for the @code{mount} has the
1173following prototype:
1174
1175@example
1176extern rtems_shell_cmd_t rtems_shell_MOUNT_Command;
1177@end example
1178
1179@c
1180@c
1181@c
1182@page
1183@subsection unmount - unmount disk
1184
1185@pgindex unmount
1186
1187@subheading SYNOPSYS:
1188
1189@example
1190unmount path
1191@end example
1192
1193@subheading DESCRIPTION:
1194
1195This command unmounts the device at the specified @code{path}.
1196
1197@subheading EXIT STATUS:
1198
1199This command returns 0 on success and non-zero if an error is encountered.
1200
1201@subheading NOTES:
1202
1203TBD - Surely there must be some warnings to go here.
1204
1205@subheading EXAMPLES:
1206
1207The following is an example of how to use @code{unmount}:
1208
1209@example
1210EXAMPLE_TBD
1211@end example
1212
1213@subheading CONFIGURATION:
1214
1215@findex CONFIGURE_SHELL_NO_COMMAND_UNMOUNT
1216@findex CONFIGURE_SHELL_COMMAND_UNMOUNT
1217
1218This command is included in the default shell command set. 
1219When building a custom command set, define
1220@code{CONFIGURE_SHELL_COMMAND_UNMOUNT} to have this
1221command included.
1222
1223This command can be excluded from the shell command set by
1224defining @code{CONFIGURE_SHELL_NO_COMMAND_UNMOUNT} when all
1225shell commands have been configured.
1226
1227@subheading PROGRAMMING INFORMATION:
1228
1229@findex rtems_shell_rtems_main_unmount
1230
1231The @code{unmount} is implemented by a C language function
1232which has the following prototype:
1233
1234@example
1235int rtems_shell_rtems_main_unmount(
1236  int    argc,
1237  char **argv
1238);
1239@end example
1240
1241The configuration structure for the @code{unmount} has the
1242following prototype:
1243
1244@example
1245extern rtems_shell_cmd_t rtems_shell_UNMOUNT_Command;
1246@end example
1247
1248@c
1249@c
1250@c
1251@page
1252@subsection blksync - sync the block driver
1253
1254@pgindex blksync
1255
1256@subheading SYNOPSYS:
1257
1258@example
1259blksync driver
1260@end example
1261
1262@subheading DESCRIPTION:
1263
1264This command XXX
1265
1266@subheading EXIT STATUS:
1267
1268This command returns 0 on success and non-zero if an error is encountered.
1269
1270@subheading NOTES:
1271
1272NONE
1273
1274@subheading EXAMPLES:
1275
1276The following is an example of how to use @code{blksync}:
1277
1278@example
1279EXAMPLE_TBD
1280@end example
1281
1282@subheading CONFIGURATION:
1283
1284@findex CONFIGURE_SHELL_NO_COMMAND_BLKSYNC
1285@findex CONFIGURE_SHELL_COMMAND_BLKSYNC
1286
1287This command is included in the default shell command set. 
1288When building a custom command set, define
1289@code{CONFIGURE_SHELL_COMMAND_BLKSYNC} to have this
1290command included.
1291
1292This command can be excluded from the shell command set by
1293defining @code{CONFIGURE_SHELL_NO_COMMAND_BLKSYNC} when all
1294shell commands have been configured.
1295
1296@subheading PROGRAMMING INFORMATION:
1297
1298@findex rtems_shell_rtems_main_blksync
1299
1300The @code{blksync} is implemented by a C language function
1301which has the following prototype:
1302
1303@example
1304int rtems_shell_rtems_main_blksync(
1305  int    argc,
1306  char **argv
1307);
1308@end example
1309
1310The configuration structure for the @code{blksync} has the
1311following prototype:
1312
1313@example
1314extern rtems_shell_cmd_t rtems_shell_BLKSYNC_Command;
1315@end example
1316
1317@c
1318@c
1319@c
1320@page
1321@subsection fdisk - format disk
1322
1323@pgindex fdisk
1324
1325@subheading SYNOPSYS:
1326
1327@example
1328fdisk
1329@end example
1330
1331@subheading CONFIGURATION:
1332
1333@findex CONFIGURE_SHELL_NO_COMMAND_FDISK
1334@findex CONFIGURE_SHELL_COMMAND_FDISK
1335
1336This command is included in the default shell command set. 
1337When building a custom command set, define
1338@code{CONFIGURE_SHELL_COMMAND_FDISK} to have this
1339command included.
1340
1341This command can be excluded from the shell command set by
1342defining @code{CONFIGURE_SHELL_NO_COMMAND_FDISK} when all
1343shell commands have been configured.
1344
1345@c
1346@c
1347@c
1348@page
1349@subsection dir - alias for ls
1350
1351@pgindex dir
1352
1353@subheading SYNOPSYS:
1354
1355@example
1356dir [dir]
1357@end example
1358
1359@subheading DESCRIPTION:
1360
1361This command is an alias or alternate name for the @code{ls}.
1362See @ref{File and Directory Commands ls - list files in the directory, ls}
1363for more information.
1364
1365@subheading EXIT STATUS:
1366
1367This command returns 0 on success and non-zero if an error is encountered.
1368
1369@subheading NOTES:
1370
1371NONE
1372
1373@subheading EXAMPLES:
1374
1375The following is an example of how to use @code{dir}:
1376
1377@example
1378SHLL [/] $ dir
1379drwxr-xr-x   1   root   root         536 Jan 01 00:00 dev/
1380drwxr-xr-x   1   root   root        1072 Jan 01 00:00 etc/
13812 files 1608 bytes occupied
1382SHLL [/] $ dir etc
1383-rw-r--r--   1   root   root         102 Jan 01 00:00 passwd
1384-rw-r--r--   1   root   root          42 Jan 01 00:00 group
1385-rw-r--r--   1   root   root          30 Jan 01 00:00 issue
1386-rw-r--r--   1   root   root          28 Jan 01 00:00 issue.net
13874 files 202 bytes occupied
1388@end example
1389
1390@subheading CONFIGURATION:
1391
1392@findex CONFIGURE_SHELL_NO_COMMAND_DIR
1393@findex CONFIGURE_SHELL_COMMAND_DIR
1394
1395This command is included in the default shell command set. 
1396When building a custom command set, define
1397@code{CONFIGURE_SHELL_COMMAND_DIR} to have this
1398command included.
1399
1400This command can be excluded from the shell command set by
1401defining @code{CONFIGURE_SHELL_NO_COMMAND_DIR} when all
1402shell commands have been configured.
1403
1404@subheading PROGRAMMING INFORMATION:
1405
1406@findex rtems_shell_rtems_main_dir
1407
1408The @code{dir} is implemented by a C language function
1409which has the following prototype:
1410
1411@example
1412int rtems_shell_rtems_main_dir(
1413  int    argc,
1414  char **argv
1415);
1416@end example
1417
1418The configuration structure for the @code{dir} has the
1419following prototype:
1420
1421@example
1422extern rtems_shell_cmd_t rtems_shell_DIR_Command;
1423@end example
1424
1425@c
1426@c
1427@c
1428@page
1429@subsection cd - alias for chdir
1430
1431@pgindex cd
1432
1433@subheading SYNOPSYS:
1434
1435@example
1436cd directory
1437@end example
1438
1439@subheading DESCRIPTION:
1440
1441This command is an alias or alternate name for the @code{chdir}.
1442See @ref{File and Directory Commands chdir - change the current directory, cd}
1443for more information.
1444
1445@subheading EXIT STATUS:
1446
1447This command returns 0 on success and non-zero if an error is encountered.
1448
1449@subheading NOTES:
1450
1451NONE
1452
1453@subheading EXAMPLES:
1454
1455The following is an example of how to use @code{cd}:
1456
1457@example
1458SHLL [/] $ cd etc
1459SHLL [/etc] $ cd /
1460SHLL [/] $ cd /etc
1461SHLL [/etc] $ pwd
1462/etc
1463SHLL [/etc] $ cd /
1464SHLL [/] $ pwd
1465/
1466SHLL [/] $ cd etc
1467SHLL [/etc] $ cd ..
1468SHLL [/] $ pwd
1469/
1470@end example
1471
1472@subheading CONFIGURATION:
1473
1474@findex CONFIGURE_SHELL_NO_COMMAND_CD
1475@findex CONFIGURE_SHELL_COMMAND_CD
1476
1477This command is included in the default shell command set. 
1478When building a custom command set, define
1479@code{CONFIGURE_SHELL_COMMAND_CD} to have this
1480command included.
1481
1482This command can be excluded from the shell command set by
1483defining @code{CONFIGURE_SHELL_NO_COMMAND_CD} when all
1484shell commands have been configured.
1485
1486@subheading PROGRAMMING INFORMATION:
1487
1488@findex rtems_shell_rtems_main_cd
1489
1490The @code{cd} is implemented by a C language function
1491which has the following prototype:
1492
1493@example
1494int rtems_shell_rtems_main_cd(
1495  int    argc,
1496  char **argv
1497);
1498@end example
1499
1500The configuration structure for the @code{cd} has the
1501following prototype:
1502
1503@example
1504extern rtems_shell_cmd_t rtems_shell_CD_Command;
1505@end example
1506
Note: See TracBrowser for help on using the repository browser.