"Fossies" - the Fresh Open Source Software Archive

Member "fdupes-2.1.2/positive_wcwidth.c" (12 Aug 2020, 1063 Bytes) of package /linux/privat/fdupes-2.1.2.tar.gz:


As a special service "Fossies" has tried to format the requested source page into HTML format using (guessed) C and C++ source code syntax highlighting (style: standard) with prefixed line numbers and code folding option. Alternatively you can here view or download the uninterpreted source code file. For more information about "positive_wcwidth.c" see the Fossies "Dox" file reference documentation.

    1 /* Copyright (c) 2019 Adrian Lopez
    2 
    3    This software is provided 'as-is', without any express or implied
    4    warranty. In no event will the authors be held liable for any damages
    5    arising from the use of this software.
    6 
    7    Permission is granted to anyone to use this software for any purpose,
    8    including commercial applications, and to alter it and redistribute it
    9    freely, subject to the following restrictions:
   10 
   11    1. The origin of this software must not be misrepresented; you must not
   12       claim that you wrote the original software. If you use this software
   13       in a product, an acknowledgment in the product documentation would be
   14       appreciated but is not required.
   15    2. Altered source versions must be plainly marked as such, and must not be
   16       misrepresented as being the original software.
   17    3. This notice may not be removed or altered from any source distribution. */
   18 
   19 #include "config.h"
   20 #include "positive_wcwidth.h"
   21 
   22 int positive_wcwidth(wchar_t ch)
   23 {
   24   int w;
   25 
   26   w = wcwidth(ch);
   27 
   28   if (w >= 0)
   29     return w;
   30   else
   31     return 1;
   32 }