## root/clib/tlogcode.c

/* [<][>][^][v][top][bottom][index][help] */

## DEFINITIONS

This source file includes following definitions.

1. ts_code_string

    /* Timesync error translation module.
       Rick Smereka, Copyright (C) 2001-2003.

       This program is free software; you can redistribute it and/or modify
       it under the terms of the GNU General Public License as published by
       the Free Software Foundation; either version 2 of the License, or
       (at your option) any later version.

       This program is distributed in the hope that it will be useful,
       but WITHOUT ANY WARRANTY; without even the implied warranty of
       MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
       GNU General Public License for more details.

       You should have received a copy of the GNU General Public License
       along with this program; if not, get a copy via the Internet at
       http://gnu.org/copyleft/gpl.html or write to the Free Software
       Foundation, Inc., 59 Temple Place, Suite 330, Boston,
       MA 02111-1307 USA

       You can contact the author via email at rsmereka@future-lab.com

       Original Linux version and ported to QNX 4.x and 32-bit Windows.
       Dec/2001, Rick Smereka

       Ported to Debian Linux. Nov/2002, Rick Smereka

       Added translation of code 'TS_NOT_IMPLEMENTED'.
       Jun/2003, Rick Smereka */

    #include "stdhead.h"
    #include "flsocket.h"
    #include "timesync.h"

    void ts_code_string(int code, char *mes)
    {
       /* Interpret a timesync code ('code') and return the
          English description in 'mes' which must be
          already allocated to sufficient size. */

       switch(code)
          {
          case TS_OK:
             strcpy(mes, "ok");
             break;

          case TS_VC_ERROR:
    #ifdef IPC_TCP
             strcpy(mes, "socket communication error");
    #else
             strcpy(mes, "virtual circuit error");
    #endif

             break;

          case TS_ACCESS_DENIED:
             strcpy(mes, "access denied");
             break;

          case TS_MEMORY_FAIL:
             strcpy(mes, "memory allocation failure");
             break;

          case TS_INVALID_FUNCTION:
             strcpy(mes, "invalid function");
             break;

          case TS_INTERNAL_ERROR:
             strcpy(mes, "unexpected internal error");
             break;

          case TS_INVALID_PARAMETER:
             strcpy(mes, "invalid parameter");
             break;

          case TS_LOG_ALREADY_OFF:
             strcpy(mes, "log is already off");
             break;

          case TS_LOG_ALREADY_ON:
             strcpy(mes, "log is already on");
             break;

          case TS_NO_SERVER:
             strcpy(mes, "no timesync server");
             break;

          case TS_NOT_FOUND:
             strcpy(mes, "not found");
             break;

          case TS_LOG_ERROR:
             strcpy(mes, "error writing log");
             break;

          case TS_SOCLOC_NO_INIT:
             strcpy(mes, "socloc not initialized");
             break;

          case TS_NOT_IMPLEMENTED:
             strcpy(mes, "not implemented");
             break;
          };
    }

/* [<][>][^][v][top][bottom][index][help] */