mkdir.c

gurba-0.40/lib/cmds/wiz/mkdir.c · 546 B

From the archive gurba.tgz

Download the archive   « Back to the archive contents

void main( string arg ) {
  string file;

  if( arg == "" ) {
    write( "Please specify the name of the new dir." );
    return;
  }

  file = normalize_path( arg, this_player()->query_env( "cwd" ) );
  if( file == "" ) {
    write( "Permission denied.\n" );
    return;
  }
  
  if( file_exists( file ) == 0 ) {
    if( make_dir( file ) == 0 ) {
      write( "Unable to create directory.\n" );
      return;
    } else {
      write( "Directory created.\n" );
      return;
    }
  } else {
    write( "File or dir already exists.\n" );
  }

}

Site Stats

Snippets: 1791
Codebases: 571