You are an expert in writing code in many different languages. Your goal is to perform code completion for the following code, keeping in mind the rest of the code and the file meta data.
    Metadata details:
    filename: m_gshhs.m
    path of file: ./repos/tracacode/1911-COAWST/script/mfiles/m_map
    
    the code of the file until where you have to start completion: function h=m_gshhs(resolution,varargin)
% M_GSHHS Add a coastline to a given map using 
%           the Global Self-consistant Hierarchical High-resolution 
%           Shorelines, Rivers, and Borders
%
%         M_GSHHS(RES, (standard line option,...,...) ) draws the coastline
%         river network, or borders as  simple lines.
%
%         M_GSHHS(RES,'patch' ( ,standard patch options,...,...) ) draws the 
%         coastline as a number of patches (rivers and borders are not
%         arranged so patches can be drawn).
%
%         M_GSHHS(RES,'save',FILENAME) saves the extracted coastline data
%         for the current projection in a file FILENAME. This allows 
%         speedier replotting using M_USERCOAST(FILENAME). 
%    
%         RES: A one-char string (optionally 2 or 3)
%         
%         First char: resolution - one of
%                      'c'  crude
%                      'l'  low
%                      'i'  intermediate
%                      'h'  high
%                      'f'  full
%
%         Second char: type - one of
%                      'c' GSHHS coastline (default)
%                      'b' WDB Border
%                      'r' WDB River
%  
%         Third char - if 2nd char is 'b':
%                      '1' Country borders
%                      '2' State/Province and Country borders
%                    - if 2nd char is 'r': '1','2','3','4' 
%                      add successively more tributaries
%
%         (also maintained is this optional format:
%
%         RES - selections resolution
%                  1  or 'crude'	

    
function h=m_gshhs(resolution,varargin)
% M_GSHHS Add a coastline to a given map using 
%           the Global Self-consistant Hierarchical High-resolution 
%           Shorelines, Rivers, and Borders
%
%         M_GSHHS(RES, (standard line option,...,...) ) draws the coastline
%         river network, or borders as  simple lines.
%
%         M_GSHHS(RES,'patch' ( ,standard patch options,...,...) ) draws the 
%         coastline as a number of patches (rivers and borders are not
%         arranged so patches can be drawn).
%
%         M_GSHHS(RES,'save',FILENAME) saves the extracted coastline data
%         for the current projection in a file FILENAME. This allows 
%         speedier replotting using M_USERCOAST(FILENAME). 
%    
%         RES: A one-char string (optionally 2 or 3)
%         
%         First char: resolution - one of
%                      'c'  crude
%                      'l'  low
%                      'i'  intermediate
%                      'h'  high
%                      'f'  full
%
%         Second char: type - one of
%                      'c' GSHHS coastline (default)
%                      'b' WDB Border
%                      'r' WDB River
%  
%         Third char - if 2nd char is 'b':
%                      '1' Country borders
%                      '2' State/Province and Country borders
%                    - if 2nd char is 'r': '1','2','3','4' 
%                      add successively more tributaries
%
%         (also maintained is this optional format:
%
%         RES - selections resolution
%                  1  or 'crude'	
%                  2  or 'low'  	
%                  3  or 'intermediate'  
%                  4  or 'high' 	
%                  5  or 'full  	
%
%         but please don't use this).
%
%         See also M_PROJ, M_GRID, M_COAST, M_GSHHS_L, M_GSHHS_H, M_GSHHS_C 
%         M_USERCOAST    

% Rich Pawlowicz (rich@ocgy.ubc.ca) 15/June/98
%
%
% This software is provided "as is" without warranty of any kind. But
% it's mine, so you can't sell it.
%
%  16/Dec/2005
%*********************************************************************
%  Modified after code provided by Bruce Lipphardt (brucel@udel.edu) to 
%  reduce the hierarchy of M_GSHHS_* routines to a single routine with a
%  variable resolution input:
% 20/Jan/2008 - added borders and rivers from gshhs v1.10
% 4/DEc/11 - isstr to ischar
% Sep/14 - added hierarchy to borders
% Aug/18 - fixed error that occurred when called m_gshhs_X with 'save'
%          option (Thanks to H. Grant for pointing this out).


% Root of directories where all the gshhs_X.b, wdb_borders-X.b and wdb_rivers_X.b
% files live
FILNAME='private/';


%-------------don't change below here----------------------------

res_list = {'c','l','i','h','f'};
typ_list={'c','b','r'};
typ_names={'gshhs_','wdb_borders_','wdb_rivers_'};

typ=1;
flaglim='9';

if ischar(resolution)
 if length(resolution)>=2
   typ = find(strcmpi(resolution(2),typ_list));
 end