Differences between revisions 3 and 4
Revision 3 as of 2020-03-21 20:03:15
Size: 1244
Editor: FrBrGeorge
Revision 4 as of 2020-03-21 20:03:28
Size: 1245
Editor: FrBrGeorge
Deletions are marked like this. Additions are marked like this.
Line 2: Line 2:
Make `14_String` subdirectory. All code should reside there. Make `14_Strings` subdirectory. All code should reside there.

14. Strings

Make 14_Strings subdirectory. All code should reside there.

  1. Write a program catargs.c that concatenate all the command line parameters in one string (this is required) and prints this string with "<" and ">":

    •   $ ./catargs qwe   ASD  "1 2 3"
        <qweASD1 2 3>
  2. Look at lsdir2.c program from ../Lab_12_DirectoryWalk. Modify it to do recursive directory listing.

    • Do not forget to free what you've malloc-ed
    • Add second shift parameter to listdir(), initially 0, to make every recursive listdir() call insert shift spaces before printing a file object name. Increase shift by 2 every recursive call.

      $ ./lsdir2 ../13_Permissions2/
      a.out: 8
      o.c: 8
      o: 8
      proj: directory
        prog.o: 8
        lib.o: 8
        prog: 8
        lib.c: 8
        Makefile: 8
        prog.c: 8
      dir: directory
  3. Look at lsdir3.c program from ../Lab_12_DirectoryWalk. Modify it:

    • To make a recursive list, like previous one, and print every directory, but only matching file names.

    • To check exit status of every function and print error message with perror (e. g. ./lsdir3 /tmp or ./lsdir3 /etc/ shall stop normally on sugon server).


Finish all tasks

HSE/ProgrammingOS/Lab_14_Strings (last edited 2020-03-21 20:03:28 by FrBrGeorge)