Home | History | Annotate | Download | only in MagickCore
      1 /*
      2 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
      3 %                                                                             %
      4 %                                                                             %
      5 %                                                                             %
      6 %                  CCCC  L      IIIII  EEEEE  N   N  TTTTT                    %
      7 %                 C      L        I    E      NN  N    T                      %
      8 %                 C      L        I    EEE    N N N    T                      %
      9 %                 C      L        I    E      N  NN    T                      %
     10 %                  CCCC  LLLLL  IIIII  EEEEE  N   N    T                      %
     11 %                                                                             %
     12 %                                                                             %
     13 %                         MagickCore Client Methods                           %
     14 %                                                                             %
     15 %                             Software Design                                 %
     16 %                                  Cristy                                     %
     17 %                               March 2003                                    %
     18 %                                                                             %
     19 %                                                                             %
     20 %  Copyright 1999-2019 ImageMagick Studio LLC, a non-profit organization      %
     21 %  dedicated to making software imaging solutions freely available.           %
     22 %                                                                             %
     23 %  You may not use this file except in compliance with the License.  You may  %
     24 %  obtain a copy of the License at                                            %
     25 %                                                                             %
     26 %    https://imagemagick.org/script/license.php                               %
     27 %                                                                             %
     28 %  Unless required by applicable law or agreed to in writing, software        %
     29 %  distributed under the License is distributed on an "AS IS" BASIS,          %
     30 %  WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.   %
     31 %  See the License for the specific language governing permissions and        %
     32 %  limitations under the License.                                             %
     33 %                                                                             %
     34 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
     35 %
     36 %
     37 */
     38 
     39 /*
     41   Include declarations.
     42 */
     43 #include "MagickCore/studio.h"
     44 #include "MagickCore/client.h"
     45 #include "MagickCore/string_.h"
     46 
     47 /*
     49 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
     50 %                                                                             %
     51 %                                                                             %
     52 %                                                                             %
     53 %   G e t C l i e n t N a m e                                                 %
     54 %                                                                             %
     55 %                                                                             %
     56 %                                                                             %
     57 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
     58 %
     59 %  GetClientName returns the current client name.
     60 %
     61 %  The format of the GetClientName method is:
     62 %
     63 %      const char *GetClientName(void)
     64 %
     65 */
     66 MagickExport const char *GetClientName(void)
     67 {
     68   return(SetClientName((const char *) NULL));
     69 }
     70 
     71 /*
     73 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
     74 %                                                                             %
     75 %                                                                             %
     76 %                                                                             %
     77 %   G e t C l i e n t P a t h                                                 %
     78 %                                                                             %
     79 %                                                                             %
     80 %                                                                             %
     81 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
     82 %
     83 %  GetClientPath returns the current client name.
     84 %
     85 %  The format of the GetClientPath method is:
     86 %
     87 %      const char *GetClientPath(void)
     88 %
     89 */
     90 MagickExport const char *GetClientPath(void)
     91 {
     92   return(SetClientPath((const char *) NULL));
     93 }
     94 
     95 /*
     97 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
     98 %                                                                             %
     99 %                                                                             %
    100 %                                                                             %
    101 %   S e t C l i e n t N a m e                                                 %
    102 %                                                                             %
    103 %                                                                             %
    104 %                                                                             %
    105 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
    106 %
    107 %  SetClientName sets the client name and returns it.
    108 %
    109 %  The format of the SetClientName method is:
    110 %
    111 %      const char *SetClientName(const char *name)
    112 %
    113 %  A description of each parameter follows:
    114 %
    115 %    o name: Specifies the new client name.
    116 %
    117 */
    118 MagickExport const char *SetClientName(const char *name)
    119 {
    120   static char
    121     client_name[MagickPathExtent] = "Magick";
    122 
    123   if ((name != (char *) NULL) && (*name != '\0'))
    124     (void) CopyMagickString(client_name,name,MagickPathExtent);
    125   return(client_name);
    126 }
    127 
    128 /*
    130 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
    131 %                                                                             %
    132 %                                                                             %
    133 %                                                                             %
    134 %   S e t C l i e n t P a t h                                                 %
    135 %                                                                             %
    136 %                                                                             %
    137 %                                                                             %
    138 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
    139 %
    140 %  SetClientPath() sets the client path if the name is specified.  Otherwise
    141 %  the current client path is returned. A zero-length string is returned if
    142 %  the client path has never been set.
    143 %
    144 %  The format of the SetClientPath method is:
    145 %
    146 %      const char *SetClientPath(const char *path)
    147 %
    148 %  A description of each parameter follows:
    149 %
    150 %    o path: Specifies the new client path.
    151 %
    152 */
    153 MagickExport const char *SetClientPath(const char *path)
    154 {
    155   static char
    156     client_path[MagickPathExtent] = "";
    157 
    158   if ((path != (char *) NULL) && (*path != '\0'))
    159     (void) CopyMagickString(client_path,path,MagickPathExtent);
    160   return(client_path);
    161 }
    162