Update: orig2001_11_27_05_17 -> orig2001_11_27_22_58 lace_unixserial
authorshort <>
Tue, 27 Nov 2001 23:34:48 +0000 (23:34 +0000)
committershort <>
Tue, 27 Nov 2001 23:34:48 +0000 (23:34 +0000)
14 files changed:
common/data/at-emulator.c
common/devices/unixserial.c
common/gsm-sms.c
common/links/fbus-3110.c
common/links/fbus.c
common/phones/nk3110.c
common/phones/nk7110.c
gnokii/gnokii.c
include/data/rlp-common.h
include/data/rlp-crc24.h
include/devices/tekram.h
include/devices/unixserial.h
include/gsm-api.h
include/gsm-sms.h

index de23c4c..e1b6d37 100644 (file)
   kernel AT Emulator IDSN code by Fritz Elfert and others.
   
   $Log$
-  Revision 1.1.1.1  2001/11/25 21:59:07  short
-  :pserver:cvs@pserver.samba.org:/cvsroot - gnokii - Sun Nov 25 22:56 CET 2001
+  Revision 1.1.1.1.12.1  2001/11/27 23:34:48  short
+  Update: orig2001_11_27_05_17 -> orig2001_11_27_22_58
+
+  Revision 1.1.1.1.8.1  2001/11/27 23:06:09  short
+  Update: orig2001_11_27_05_17 -> orig2001_11_27_22_58
+
+  Revision 1.1.1.1.2.1  2001/11/27 22:48:37  short
+  Update: orig2001_11_27_05_17 -> orig2001_11_27_22_58
+
+  Revision 1.1.1.2  2001/11/27 22:01:13  short
+  :pserver:cvs@pserver.samba.org:/cvsroot - gnokii - Tue Nov 27 22:58 CET 2001
+
+  Revision 1.6  2001/11/27 12:19:01  pkot
+  Cleanup, indentation, ANSI complaint preprocesor symbols (Jan Kratochvil, me)
 
   Revision 1.5  2001/11/08 16:34:19  pkot
   Updates to work with new libsms
@@ -48,7 +60,7 @@
 
 #ifndef WIN32
 
-  #include <termios.h>
+#  include <termios.h>
 
 #endif
 
index 1ca84cf..04abf7f 100644 (file)
@@ -11,6 +11,9 @@
   Released under the terms of the GNU GPL, see file COPYING for more details.
 
   $Log$
+  Revision 1.1.1.1.12.2  2001/11/27 23:34:48  short
+  Update: orig2001_11_27_05_17 -> orig2001_11_27_22_58
+
   Revision 1.1.1.1.12.1  2001/11/25 23:31:56  short
   WARNING! dependency on: lace_cfgreader (branchpoint), lace_utils
 
 #include "devices/unixserial.h"
 
 #ifdef HAVE_SYS_IOCTL_COMPAT_H
-  #include <sys/ioctl_compat.h>
+#  include <sys/ioctl_compat.h>
 #endif
 
 #ifdef HAVE_SYS_SELECT_H
-#include <sys/select.h>
+#  include <sys/select.h>
 #endif
 
 /* If the target operating system does not have cfsetspeed, we can emulate
    it. */
 
 #ifndef HAVE_CFSETSPEED
-  #if defined(HAVE_CFSETISPEED) && defined(HAVE_CFSETOSPEED)
-     #define cfsetspeed(t, speed) \
-     (cfsetispeed(t, speed) || cfsetospeed(t, speed))
-  #else
-    static int cfsetspeed(struct termios *t, int speed) {
-    #ifdef HAVE_TERMIOS_CSPEED
-      t->c_ispeed = speed;
-      t->c_ospeed = speed;
-    #else
-      t->c_cflag |= speed;
-    #endif
-      return 0;
-    }
-  #endif
-#endif
+#  if defined(HAVE_CFSETISPEED) && defined(HAVE_CFSETOSPEED)
+#    define cfsetspeed(t, speed) \
+           (cfsetispeed(t, speed) || cfsetospeed(t, speed))
+#  else
+static int cfsetspeed(struct termios *t, int speed)
+{
+#    ifdef HAVE_TERMIOS_CSPEED
+       t->c_ispeed = speed;
+       t->c_ospeed = speed;
+#    else
+       t->c_cflag |= speed;
+#    endif                     /* HAVE_TERMIOS_CSPEED */
+       return 0;
+}
+#  endif                       /* HAVE_CFSETISPEED && HAVE_CFSETOSPEED */
+#endif                         /* HAVE_CFSETSPEED */
 
 #ifndef O_NONBLOCK
-  #define O_NONBLOCK  0
+#  define O_NONBLOCK  0
 #endif
 
 /* Structure to backup the setting of the terminal. */
-
 struct termios serial_termios;
 
 /* Script handling: */
 
-static void device_script_cfgfunc(const char *section,const char *key,const char *value)
+static void device_script_cfgfunc(const char *section, const char *key,
+                                 const char *value)
 {
-  setenv(key,value,1/*overwrite*/);    /* errors ignored */
+       setenv(key, value, 1 /*overwrite */ );  /* errors ignored */
 }
 
 static int device_script(int fd, const char *section)
 {
-pid_t pid;
-const char *scriptname = CFG_Get(CFG_Info, "global", section);
-
-  if (!scriptname)
-    return(0);
-
-  errno=0;
-  switch ((pid=fork())) {
-    case -1:
-      fprintf(stderr,_("device_script(\"%s\"): fork() failure: %s!\n"),scriptname,strerror(errno));
-      return(-1);
-
-    default: { /* parent */
-int status;
-      if (pid==waitpid(pid,&status,0/*options*/) && WIFEXITED(status) && !WEXITSTATUS(status))
-       return(0);
-      fprintf(stderr,_("device_script(\"%s\"): child script failure: %s, exit code=%d\n"),scriptname,
-          (WIFEXITED(status) ? _("normal exit") : _("abnormal exit")),
-         (WIFEXITED(status) ? WEXITSTATUS(status) : -1));
-      errno=EIO;
-      return(-1);
-      }
-
-    case 0: {  /* child */
-      CFG_GetForeach(CFG_Info,section,device_script_cfgfunc);
-      errno=0;
-      if (0!=dup2(fd,0) || 1!=dup2(fd,1) || close(fd)) {
-       fprintf(stderr,_("device_script(\"%s\"): file descriptor prepare: %s\n"),scriptname,strerror(errno));
-       _exit(-1);
+       pid_t pid;
+       const char *scriptname = CFG_Get(CFG_Info, "global", section);
+
+       if (!scriptname)
+               return (0);
+
+       errno = 0;
+       switch ((pid = fork())) {
+       case -1:
+               fprintf(stderr,
+                       _("device_script(\"%s\"): fork() failure: %s!\n"),
+                       scriptname, strerror(errno));
+               return (-1);
+
+       default:{               /* parent */
+                       int status;
+                       if (pid == waitpid(pid, &status, 0 /*options */ )
+                           && WIFEXITED(status) && !WEXITSTATUS(status))
+                               return (0);
+                       fprintf(stderr,
+                               _
+                               ("device_script(\"%s\"): child script failure: %s, exit code=%d\n"),
+                               scriptname,
+                               (WIFEXITED(status) ? _("normal exit") :
+                                _("abnormal exit")),
+                               (WIFEXITED(status) ? WEXITSTATUS(status) :
+                                -1));
+                       errno = EIO;
+                       return (-1);
+               }
+
+       case 0:{                /* child */
+                       CFG_GetForeach(CFG_Info, section,
+                                      device_script_cfgfunc);
+                       errno = 0;
+                       if (0 != dup2(fd, 0) || 1 != dup2(fd, 1)
+                           || close(fd)) {
+                               fprintf(stderr,
+                                       _
+                                       ("device_script(\"%s\"): file descriptor prepare: %s\n"),
+                                       scriptname, strerror(errno));
+                               _exit(-1);
+                       }
+                       /* FIXME: close all open descriptors - how to track them?
+                        */
+                       execl("/bin/sh", "sh", "-c", scriptname, NULL);
+                       fprintf(stderr,
+                               _
+                               ("device_script(\"%s\"): execute script: %s\n"),
+                               scriptname, strerror(errno));
+                       _exit(-1);
+                       /* NOTREACHED */
+               }
        }
-      /* FIXME: close all open descriptors - how to track them?
-       */
-      execl("/bin/sh","sh","-c",scriptname,NULL);
-      fprintf(stderr,_("device_script(\"%s\"): execute script: %s\n"),scriptname,strerror(errno));
-      _exit(-1);
-      /* NOTREACHED */
-      }
-    }
-  /* NOTREACHED */
+       /* NOTREACHED */
 }
 
 int serial_close_all_openfds[0x10];    /* -1 when entry not used, fd otherwise */
@@ -174,12 +194,12 @@ int serial_close(int __fd);
 
 static void serial_close_all(void)
 {
-  int i;
+       int i;
 
-  dprintf("serial_close_all() executed\n");
-  for (i=0;i<ARRAY_LEN(serial_close_all_openfds);i++)
-    if (serial_close_all_openfds[i]!=-1)
-      serial_close(serial_close_all_openfds[i]);
+       dprintf("serial_close_all() executed\n");
+       for (i = 0; i < ARRAY_LEN(serial_close_all_openfds); i++)
+               if (serial_close_all_openfds[i] != -1)
+                       serial_close(serial_close_all_openfds[i]);
 }
 
 static void unixserial_interrupted(int signo)
@@ -189,297 +209,316 @@ static void unixserial_interrupted(int signo)
 }
 
 /* Open the serial port and store the settings. */
+int serial_open(__const char *__file, int __oflag)
+{
+       int __fd;
+       int retcode, i;
+       static bool atexit_registered = false;
+
+       if (!atexit_registered) {
+               memset(serial_close_all_openfds, -1,
+                      sizeof(serial_close_all_openfds));
+#if 0                          /* Disabled for now as atexit() functions are then called multiple times for pthreads! */
+               signal(SIGINT, unixserial_interrupted);
+#endif
+               atexit(serial_close_all);
+               atexit_registered = true;
+       }
 
-int serial_open(__const char *__file, int __oflag) {
+       __fd = open(__file, __oflag);
+       if (__fd == -1) {
+               perror("Gnokii serial_open: open");
+               return (-1);
+       }
 
-  int __fd;
-  int retcode,i;
-  static bool atexit_registered=false;
+       for (i = 0; i < ARRAY_LEN(serial_close_all_openfds); i++)
+               if (serial_close_all_openfds[i] == -1
+                   || serial_close_all_openfds[i] == __fd) {
+                       serial_close_all_openfds[i] = __fd;
+                       break;
+               }
 
-  if (!atexit_registered) {
-    memset(serial_close_all_openfds,-1,sizeof(serial_close_all_openfds));
-#if 0  /* Disabled for now as atexit() functions are then called multiple times for pthreads! */
-    signal(SIGINT,unixserial_interrupted);
-#endif
-    atexit(serial_close_all);
-    atexit_registered=true;
-    }
-
-  __fd = open(__file, __oflag);
-  if (__fd == -1) {
-    perror("Gnokii serial_open: open");
-    return (-1);
-  }
-
-  for (i=0;i<ARRAY_LEN(serial_close_all_openfds);i++)
-    if (serial_close_all_openfds[i]==-1 || serial_close_all_openfds[i]==__fd) {
-      serial_close_all_openfds[i]=__fd;
-      break;
-      }
-
-  retcode=tcgetattr(__fd, &serial_termios);
-  if(retcode==-1) {
-    perror("Gnokii serial_open:tcgetattr");
-    /* Don't call serial_close since serial_termios is not valid */
-    close(__fd);
-    return(-1);
-  }
-  
-  return __fd;
+       retcode = tcgetattr(__fd, &serial_termios);
+       if (retcode == -1) {
+               perror("Gnokii serial_open:tcgetattr");
+               /* Don't call serial_close since serial_termios is not valid */
+               close(__fd);
+               return (-1);
+       }
+
+       return __fd;
 }
 
 /* Close the serial port and restore old settings. */
+int serial_close(int __fd)
+{
+       int i;
 
-int serial_close(int __fd) {
-  int i;
-
-  for (i=0;i<ARRAY_LEN(serial_close_all_openfds);i++)
-    if (serial_close_all_openfds[i]==__fd)
-      serial_close_all_openfds[i]=-1;          /* fd closed */
+       for (i = 0; i < ARRAY_LEN(serial_close_all_openfds); i++)
+               if (serial_close_all_openfds[i] == __fd)
+                       serial_close_all_openfds[i] = -1;       /* fd closed */
 
-  /* handle config file disconnect_script:
-   */
-  if (-1 == device_script(__fd,"disconnect_script"))
-    fprintf(stderr,"Gnokii serial_close: disconnect_script\n");
+       /* handle config file disconnect_script:
+        */
+       if (-1 == device_script(__fd, "disconnect_script"))
+               fprintf(stderr,
+                       "Gnokii serial_close: disconnect_script\n");
 
-  if (__fd >= 0) {
-#if 1 /* HACK */
-    serial_termios.c_cflag |= HUPCL;   /* production == 1 */
+       if (__fd >= 0) {
+#if 1                          /* HACK */
+               serial_termios.c_cflag |= HUPCL;        /* production == 1 */
 #else
-    serial_termios.c_cflag &= ~HUPCL;  /* debugging  == 0 */
+               serial_termios.c_cflag &= ~HUPCL;       /* debugging  == 0 */
 #endif
 
-    tcsetattr(__fd, TCSANOW, &serial_termios);
-    }
+               tcsetattr(__fd, TCSANOW, &serial_termios);
+       }
 
-  return (close(__fd));
+       return (close(__fd));
 }
 
 /* Open a device with standard options.
  * Use value (-1) for "__with_hw_handshake" if its specification is required from the user
  */
-int serial_opendevice(__const char *__file, int __with_odd_parity, int __with_async, int __with_hw_handshake) {
-
-  int fd;
-  int retcode;
-  struct termios tp;
-
-  /* handle config file handshake override: */
-  {
-char *s=CFG_Get(CFG_Info, "global", "handshake");
-
-        if (s && (!strcasecmp(s,"software") || !strcasecmp(s,"rtscts")))
-      __with_hw_handshake=false;
-    else if (s && (!strcasecmp(s,"hardware") || !strcasecmp(s,"xonxoff")))
-      __with_hw_handshake=true;
-    else if (s)
-      fprintf(stderr,_("Unrecognized [%s] option \"%s\", use \"%s\" or \"%s\" value, ignoring!"),
-         "global","handshake","software","hardware");
-
-    if (__with_hw_handshake==-1) {
-      fprintf(stderr,_("[%s] option \"%s\" not found, trying to use \"%s\" value!"),
-         "global","handshake","software");
-      __with_hw_handshake=false;
-      }
-  }
-
-  /* Open device */
-
-  /* O_NONBLOCK MUST be used here as the CLOCAL may be currently off
-   * and if DCD is down the "open" syscall would be stuck wating for DCD.
-   */
-  fd = serial_open(__file, O_RDWR | O_NOCTTY | O_NONBLOCK);
-
-  if (fd < 0) 
-    return fd;
-
-  /* Initialise the port settings */
-
-  memcpy(&tp, &serial_termios, sizeof(struct termios));
-
-  /* Set port settings for canonical input processing */
-
-  tp.c_cflag = B0 | CS8 | CLOCAL | CREAD | HUPCL;
-  if (__with_odd_parity) {
-    tp.c_cflag |= (PARENB | PARODD);
-    tp.c_iflag = 0;
-  }
-  else
-    tp.c_iflag = IGNPAR;
-  if (__with_hw_handshake)
-    tp.c_cflag |= CRTSCTS;
-  else
-    tp.c_cflag &= ~CRTSCTS;
-
-  tp.c_oflag = 0;
-  tp.c_lflag = 0;
-  tp.c_cc[VMIN] = 1;
-  tp.c_cc[VTIME] = 0;
-
-  retcode=tcflush(fd, TCIFLUSH);
-  if (retcode == -1) {
-    perror("Gnokii serial_opendevice: tcflush");
-    serial_close(fd);
-    return(-1);
-  }
-
-  retcode=tcsetattr(fd, TCSANOW, &tp);
-  if (retcode == -1){
-    perror("Gnokii serial_opendevice: tcsetattr");
-    serial_close(fd);
-    return(-1);
-  }
-
-  /* Set speed */
-  { 
-char *baudratestring=CFG_Get(CFG_Info, "global", "serial_baudrate");
-int baudrate=0;
-
-  if (baudratestring)
-    baudrate=atoi(baudratestring);
-  if (baudrate && GE_NONE!=serial_changespeed(fd,baudrate))
-    baudrate=0;
-  if (!baudrate)
-    serial_changespeed(fd,19200/*default value*/);
-  }
-
-  /* We need to turn off O_NONBLOCK now (we have CLOCAL set so it is safe).
-   * When we run some device script it really doesn't expect NONBLOCK!
-   */
-
-  retcode=fcntl(fd, F_SETFL, 0);
-  if (retcode == -1){
-    perror("Gnokii serial_opendevice: fnctl(F_SETFL)");
-    serial_close(fd);
-    return(-1);
-  }
-
-  /* handle config file connect_script:
-   */
-  if (-1 == device_script(fd,"connect_script")) {
-    fprintf(stderr,"Gnokii serial_opendevice: connect_script\n");
-    serial_close(fd);
-    return(-1);
-  }
-
-  /* Allow process/thread to receive SIGIO */
+int serial_opendevice(__const char *__file, int __with_odd_parity,
+                     int __with_async, int __with_hw_handshake)
+{
+       int fd;
+       int retcode;
+       struct termios tp;
+
+       /* handle config file handshake override: */
+       {
+               char *s = CFG_Get(CFG_Info, "global", "handshake");
+
+               if (s && (!strcasecmp(s, "software")
+                         || !strcasecmp(s, "rtscts")))
+                       __with_hw_handshake = false;
+               else if (s && (!strcasecmp(s, "hardware")
+                              || !strcasecmp(s, "xonxoff")))
+                       __with_hw_handshake = true;
+               else if (s)
+                       fprintf(stderr,
+                               _
+                               ("Unrecognized [%s] option \"%s\", use \"%s\" or \"%s\" value, ignoring!"),
+                               "global", "handshake", "software",
+                               "hardware");
+
+               if (__with_hw_handshake == -1) {
+                       fprintf(stderr,
+                               _
+                               ("[%s] option \"%s\" not found, trying to use \"%s\" value!"),
+                               "global", "handshake", "software");
+                       __with_hw_handshake = false;
+               }
+       }
 
-#if !(__unices__)
-  retcode = fcntl(fd, F_SETOWN, getpid());
-  if (retcode == -1){
-    perror("Gnokii serial_opendevice: fnctl(F_SETOWN)");
-    serial_close(fd);
-    return(-1);
-  }
-#endif
+       /* Open device */
+
+       /* O_NONBLOCK MUST be used here as the CLOCAL may be currently off
+        * and if DCD is down the "open" syscall would be stuck wating for DCD.
+        */
+       fd = serial_open(__file, O_RDWR | O_NOCTTY | O_NONBLOCK);
+
+       if (fd < 0)
+               return fd;
+
+       /* Initialise the port settings */
+       memcpy(&tp, &serial_termios, sizeof(struct termios));
+
+       /* Set port settings for canonical input processing */
+       tp.c_cflag = B0 | CS8 | CLOCAL | CREAD | HUPCL;
+       if (__with_odd_parity) {
+               tp.c_cflag |= (PARENB | PARODD);
+               tp.c_iflag = 0;
+       } else
+               tp.c_iflag = IGNPAR;
+       if (__with_hw_handshake)
+               tp.c_cflag |= CRTSCTS;
+       else
+               tp.c_cflag &= ~CRTSCTS;
+
+       tp.c_oflag = 0;
+       tp.c_lflag = 0;
+       tp.c_cc[VMIN] = 1;
+       tp.c_cc[VTIME] = 0;
+
+       retcode = tcflush(fd, TCIFLUSH);
+       if (retcode == -1) {
+               perror("Gnokii serial_opendevice: tcflush");
+               serial_close(fd);
+               return (-1);
+       }
 
-  /* Make filedescriptor asynchronous. */
-
-  /* We need to supply FNONBLOCK (or O_NONBLOCK) again as it would get reset
-   * by F_SETFL as a side-effect!
-   */
-  retcode=fcntl(fd, F_SETFL, (__with_async ? FASYNC : 0) | FNONBLOCK);
-  if (retcode == -1){
-    perror("Gnokii serial_opendevice: fnctl(F_SETFL)");
-    serial_close(fd);
-    return(-1);
-  }
-  
-  return fd;
-}
+       retcode = tcsetattr(fd, TCSANOW, &tp);
+       if (retcode == -1) {
+               perror("Gnokii serial_opendevice: tcsetattr");
+               serial_close(fd);
+               return (-1);
+       }
 
-/* Set the DTR and RTS bit of the serial device. */
+       /* Set speed */
+       {
+               char *baudratestring =
+                   CFG_Get(CFG_Info, "global", "serial_baudrate");
+               int baudrate = 0;
+
+               if (baudratestring)
+                       baudrate = atoi(baudratestring);
+               if (baudrate
+                   && GE_NONE != serial_changespeed(fd, baudrate))
+                       baudrate = 0;
+               if (!baudrate)
+                       serial_changespeed(fd, 19200 /*default value */ );
+       }
 
-void serial_setdtrrts(int __fd, int __dtr, int __rts) {
+       /* We need to turn off O_NONBLOCK now (we have CLOCAL set so it is safe).
+        * When we run some device script it really doesn't expect NONBLOCK!
+        */
 
-  unsigned int flags;
+       retcode = fcntl(fd, F_SETFL, 0);
+       if (retcode == -1) {
+               perror("Gnokii serial_opendevice: fnctl(F_SETFL)");
+               serial_close(fd);
+               return (-1);
+       }
+
+       /* handle config file connect_script:
+        */
+       if (-1 == device_script(fd, "connect_script")) {
+               fprintf(stderr,
+                       "Gnokii serial_opendevice: connect_script\n");
+               serial_close(fd);
+               return (-1);
+       }
 
-  flags = TIOCM_DTR;
+       /* Allow process/thread to receive SIGIO */
 
-  if (__dtr)
-    ioctl(__fd, TIOCMBIS, &flags);
-  else
-    ioctl(__fd, TIOCMBIC, &flags);
+#if !(__unices__)
+       retcode = fcntl(fd, F_SETOWN, getpid());
+       if (retcode == -1) {
+               perror("Gnokii serial_opendevice: fnctl(F_SETOWN)");
+               serial_close(fd);
+               return (-1);
+       }
+#endif
 
-  flags = TIOCM_RTS;
+       /* Make filedescriptor asynchronous. */
+
+       /* We need to supply FNONBLOCK (or O_NONBLOCK) again as it would get reset
+        * by F_SETFL as a side-effect!
+        */
+       retcode =
+           fcntl(fd, F_SETFL, (__with_async ? FASYNC : 0) | FNONBLOCK);
+       if (retcode == -1) {
+               perror("Gnokii serial_opendevice: fnctl(F_SETFL)");
+               serial_close(fd);
+               return (-1);
+       }
 
-  if (__rts)
-    ioctl(__fd, TIOCMBIS, &flags);
-  else
-    ioctl(__fd, TIOCMBIC, &flags);
+       return fd;
 }
 
+/* Set the DTR and RTS bit of the serial device. */
+void serial_setdtrrts(int __fd, int __dtr, int __rts)
+{
+       unsigned int flags;
+
+       flags = TIOCM_DTR;
+
+       if (__dtr)
+               ioctl(__fd, TIOCMBIS, &flags);
+       else
+               ioctl(__fd, TIOCMBIC, &flags);
+
+       flags = TIOCM_RTS;
 
-int serial_select(int fd, struct timeval *timeout) {
+       if (__rts)
+               ioctl(__fd, TIOCMBIS, &flags);
+       else
+               ioctl(__fd, TIOCMBIC, &flags);
+}
 
-  fd_set readfds;
 
-  FD_ZERO(&readfds);
-  FD_SET(fd, &readfds);
+int serial_select(int fd, struct timeval *timeout)
+{
+       fd_set readfds;
 
-  return (select(fd + 1, &readfds, NULL, NULL, timeout));
+       FD_ZERO(&readfds);
+       FD_SET(fd, &readfds);
 
+       return (select(fd + 1, &readfds, NULL, NULL, timeout));
 }
 
 
 /* Change the speed of the serial device.
  * RETURNS: Success
  */
-
-GSM_Error serial_changespeed(int __fd, int __speed) {
-  GSM_Error retcode = true;
+GSM_Error serial_changespeed(int __fd, int __speed)
+{
+       GSM_Error retcode = true;
 
 #ifndef SGTTY
-  struct termios t;
+       struct termios t;
 #else
-  struct sgttyb t;
+       struct sgttyb t;
 #endif
-
-  int speed=B9600;
-
-  switch (__speed) {
-    case 9600:   speed = B9600;   break;
-    case 19200:  speed = B19200;  break;
-    case 38400:  speed = B38400;  break;
-    case 57600:  speed = B57600;  break;
-    case 115200: speed = B115200; break;
-    default:
-      fprintf(stderr,_("Serial port speed %d not supported!\n"),__speed);
-      return(GE_NOTSUPPORTED);
-  }
+       int speed = B9600;
+
+       switch (__speed) {
+       case 9600:
+               speed = B9600;
+               break;
+       case 19200:
+               speed = B19200;
+               break;
+       case 38400:
+               speed = B38400;
+               break;
+       case 57600:
+               speed = B57600;
+               break;
+       case 115200:
+               speed = B115200;
+               break;
+       default:
+               fprintf(stderr, _("Serial port speed %d not supported!\n"),
+                       __speed);
+               return (GE_NOTSUPPORTED);
+       }
 
 #ifndef SGTTY
-  if (tcgetattr(__fd, &t))
-    retcode = GE_INTERNALERROR;
-
-  // This is not needed! We set up the speed via cfsetspeed
-  //  t.c_cflag &= ~CBAUD;
-  //  t.c_cflag |= speed;
-  if (cfsetspeed(&t, speed) == -1) {
-    dprintf(_("Serial port speed setting failed\n"));
-    retcode = GE_INTERNALERROR;
-    }
-
-  tcsetattr(__fd, TCSADRAIN, &t);
+       if (tcgetattr(__fd, &t))
+               retcode = GE_INTERNALERROR;
+
+       // This is not needed! We set up the speed via cfsetspeed
+       //  t.c_cflag &= ~CBAUD;
+       //  t.c_cflag |= speed;
+       if (cfsetspeed(&t, speed) == -1) {
+               dprintf(_("Serial port speed setting failed\n"));
+               retcode = GE_INTERNALERROR;
+       }
+
+       tcsetattr(__fd, TCSADRAIN, &t);
 #else
-  if (ioctl(__fd, TIOCGETP, &t))
-    retcode = GE_INTERNALERROR;
+       if (ioctl(__fd, TIOCGETP, &t))
+               retcode = GE_INTERNALERROR;
 
-  t.sg_ispeed = speed;
-  t.sg_ospeed = speed;
+       t.sg_ispeed = speed;
+       t.sg_ospeed = speed;
 
-  if (ioctl(__fd, TIOCSETN, &t))
-    retcode = GE_INTERNALERROR;
+       if (ioctl(__fd, TIOCSETN, &t))
+               retcode = GE_INTERNALERROR;
 #endif
 
-  return(retcode);
+       return (retcode);
 }
 
 /* Read from serial device. */
 
-size_t serial_read(int __fd, __ptr_t __buf, size_t __nbytes) {
-
-  return (read(__fd, __buf, __nbytes));
+size_t serial_read(int __fd, __ptr_t __buf, size_t __nbytes)
+{
+       return (read(__fd, __buf, __nbytes));
 }
 
 #if !defined(TIOCMGET) && defined(TIOCMODG)
@@ -489,12 +528,14 @@ size_t serial_read(int __fd, __ptr_t __buf, size_t __nbytes) {
 static void check_dcd(int __fd)
 {
 #ifdef TIOCMGET
-int mcs;
+       int mcs;
 
        if (ioctl(__fd, TIOCMGET, &mcs) || !(mcs & TIOCM_CAR)) {
-               fprintf(stderr,_("ERROR: Modem DCD is down and global/require_dcd parameter is set!\n"));
-               exit(EXIT_FAILURE);             /* Hard quit of all threads */
-               }
+               fprintf(stderr,
+                       _
+                       ("ERROR: Modem DCD is down and global/require_dcd parameter is set!\n"));
+               exit(EXIT_FAILURE);     /* Hard quit of all threads */
+       }
 #else
        /* Impossible!! (eg. Coherent) */
 #endif
@@ -502,45 +543,53 @@ int mcs;
 
 /* Write to serial device. */
 
-size_t serial_write(int __fd, __const __ptr_t __buf, size_t __n) {
+size_t serial_write(int __fd, __const __ptr_t __buf, size_t __n)
+{
 
-size_t r=0;
-ssize_t got;
-static long serial_write_usleep=LONG_MIN;
-static int require_dcd=-1;
+       size_t r = 0;
+       ssize_t got;
+       static long serial_write_usleep = LONG_MIN;
+       static int require_dcd = -1;
 
-       if (serial_write_usleep==LONG_MIN) {
-char *s=CFG_Get(CFG_Info, "global", "serial_write_usleep");
+       if (serial_write_usleep == LONG_MIN) {
+               char *s =
+                   CFG_Get(CFG_Info, "global", "serial_write_usleep");
 
-               serial_write_usleep=(!s ?
-                       SERIAL_WRITE_USLEEP_DEFAULT : atol(CFG_Get(CFG_Info, "global", "serial_write_usleep")));
-               }
+               serial_write_usleep = (!s ?
+                                      SERIAL_WRITE_USLEEP_DEFAULT :
+                                      atol(CFG_Get
+                                           (CFG_Info, "global",
+                                            "serial_write_usleep")));
+       }
 
-       if (require_dcd==-1) {
-               require_dcd=(!!CFG_Get(CFG_Info, "global", "require_dcd"));
+       if (require_dcd == -1) {
+               require_dcd =
+                   (!!CFG_Get(CFG_Info, "global", "require_dcd"));
 #ifndef TIOCMGET
                if (require_dcd)
-                       fprintf(stderr,_("WARNING: global/require_dcd argument was set but it is not supported on this system!\n"));
+                       fprintf(stderr,
+                               _
+                               ("WARNING: global/require_dcd argument was set but it is not supported on this system!\n"));
 #endif
-               }
+       }
 
        if (require_dcd)
                check_dcd(__fd);
 
-       if (serial_write_usleep<0)
-               return(write(__fd, __buf, __n));
+       if (serial_write_usleep < 0)
+               return (write(__fd, __buf, __n));
 
-       while (__n>0) {
-               got=write(__fd, __buf, 1);
-               if (got<=0)
-                       return((!r ? -1 : r));
+       while (__n > 0) {
+               got = write(__fd, __buf, 1);
+               if (got <= 0)
+                       return ((!r ? -1 : r));
                __buf++;
                __n--;
                r++;
                if (serial_write_usleep)
                        usleep(serial_write_usleep);
-               }
-       return(r);
+       }
+       return (r);
 }
 
-#endif  /* WIN32 */
+#endif                         /* WIN32 */
index 58b21bc..2db90bb 100644 (file)
   Library for parsing and creating Short Messages (SMS).
 
   $Log$
-  Revision 1.1.1.1  2001/11/25 21:59:06  short
-  :pserver:cvs@pserver.samba.org:/cvsroot - gnokii - Sun Nov 25 22:56 CET 2001
+  Revision 1.1.1.1.12.1  2001/11/27 23:34:48  short
+  Update: orig2001_11_27_05_17 -> orig2001_11_27_22_58
+
+  Revision 1.1.1.1.8.1  2001/11/27 23:06:09  short
+  Update: orig2001_11_27_05_17 -> orig2001_11_27_22_58
+
+  Revision 1.1.1.1.2.1  2001/11/27 22:48:37  short
+  Update: orig2001_11_27_05_17 -> orig2001_11_27_22_58
+
+  Revision 1.1.1.2  2001/11/27 22:01:13  short
+  :pserver:cvs@pserver.samba.org:/cvsroot - gnokii - Tue Nov 27 22:58 CET 2001
+
+  Revision 1.14  2001/11/27 12:19:00  pkot
+  Cleanup, indentation, ANSI complaint preprocesor symbols (Jan Kratochvil, me)
 
   Revision 1.13  2001/11/23 22:07:44  machek
   Fix SMS receiving to work, again. Unfortunately, it is not possible to
@@ -115,7 +127,7 @@ static int SemiOctetPack(char *Number, unsigned char *Output, SMS_NumberType typ
           the Type-of-Address. This field is described in the official GSM
           specification 03.40 version 6.1.0, section 9.1.2.5, page 33. We support
           only international and unknown number. */
-       
+
        *OUT++ = type;
        if (type == SMS_International) IN++; /* Skip '+' */
        if ((type == SMS_Unknown) && (*IN == '+')) IN++; /* Optional '+' in Unknown number type */
@@ -145,12 +157,12 @@ static int SemiOctetPack(char *Number, unsigned char *Output, SMS_NumberType typ
 
 char *GetBCDNumber(u8 *Number)
 {
-        static char Buffer[20] = "";
-        int length = Number[0]; /* This is the length of BCD coded number */
-        int count, Digit;
+       static char Buffer[20] = "";
+       int length = Number[0]; /* This is the length of BCD coded number */
+       int count, Digit;
 
        memset(Buffer, 0, 20);
-        switch (Number[1]) {
+       switch (Number[1]) {
        case SMS_Alphanumeric:
                Unpack7BitCharacters(0, length, length, Number+2, Buffer);
                Buffer[length] = 0;
@@ -169,45 +181,45 @@ char *GetBCDNumber(u8 *Number)
                        Digit = Number[count+2] >> 4;
                        if (Digit < 10) sprintf(Buffer, "%s%d", Buffer, Digit);
                }
-                break;
-        }
-        return Buffer;
+               break;
+       }
+       return Buffer;
 }
 
 static char *PrintDateTime(u8 *Number) 
 {
-        static char Buffer[23] = "";
+       static char Buffer[23] = "";
 
        memset(Buffer, 0, 23);
        if (Number[0] < 70) sprintf(Buffer, "20");
        else sprintf(Buffer, "19");
-        sprintf(Buffer, "%s%d%d-", Buffer, Number[0] & 0x0f, Number[0] >> 4);
-        sprintf(Buffer, "%s%d%d-", Buffer, Number[1] & 0x0f, Number[1] >> 4);
-        sprintf(Buffer, "%s%d%d ", Buffer, Number[2] & 0x0f, Number[2] >> 4);
-        sprintf(Buffer, "%s%d%d:", Buffer, Number[3] & 0x0f, Number[3] >> 4);
-        sprintf(Buffer, "%s%d%d:", Buffer, Number[4] & 0x0f, Number[4] >> 4);
-        sprintf(Buffer, "%s%d%d",  Buffer, Number[5] & 0x0f, Number[5] >> 4);
+       sprintf(Buffer, "%s%d%d-", Buffer, Number[0] & 0x0f, Number[0] >> 4);
+       sprintf(Buffer, "%s%d%d-", Buffer, Number[1] & 0x0f, Number[1] >> 4);
+       sprintf(Buffer, "%s%d%d ", Buffer, Number[2] & 0x0f, Number[2] >> 4);
+       sprintf(Buffer, "%s%d%d:", Buffer, Number[3] & 0x0f, Number[3] >> 4);
+       sprintf(Buffer, "%s%d%d:", Buffer, Number[4] & 0x0f, Number[4] >> 4);
+       sprintf(Buffer, "%s%d%d",  Buffer, Number[5] & 0x0f, Number[5] >> 4);
        if (Number[6] & 0x08) 
                sprintf(Buffer, "%s-", Buffer);
        else
                sprintf(Buffer, "%s+", Buffer);
        sprintf(Buffer, "%s%02d00", Buffer, (10 * (Number[6] & 0x07) + (Number[6] >> 4)) / 4);
 
-        return Buffer;
+       return Buffer;
 }
 
 SMS_DateTime *UnpackDateTime(u8 *Number, SMS_DateTime *dt)
 {
-        dt->Year     =  10 * (Number[0] & 0x0f) + (Number[0] >> 4);
+       dt->Year     =  10 * (Number[0] & 0x0f) + (Number[0] >> 4);
        if (dt->Year < 70) dt->Year += 2000;
        else dt->Year += 1900;
-        dt->Month    =  10 * (Number[1] & 0x0f) + (Number[1] >> 4);
-        dt->Day      =  10 * (Number[2] & 0x0f) + (Number[2] >> 4);
-        dt->Hour     =  10 * (Number[3] & 0x0f) + (Number[3] >> 4);
-        dt->Minute   =  10 * (Number[4] & 0x0f) + (Number[4] >> 4);
-        dt->Second   =  10 * (Number[5] & 0x0f) + (Number[5] >> 4);
-        dt->Timezone = (10 * (Number[6] & 0x07) + (Number[6] >> 4)) / 4;
-        if (Number[6] & 0x08) dt->Timezone = -dt->Timezone;
+       dt->Month    =  10 * (Number[1] & 0x0f) + (Number[1] >> 4);
+       dt->Day      =  10 * (Number[2] & 0x0f) + (Number[2] >> 4);
+       dt->Hour     =  10 * (Number[3] & 0x0f) + (Number[3] >> 4);
+       dt->Minute   =  10 * (Number[4] & 0x0f) + (Number[4] >> 4);
+       dt->Second   =  10 * (Number[5] & 0x0f) + (Number[5] >> 4);
+       dt->Timezone = (10 * (Number[6] & 0x07) + (Number[6] >> 4)) / 4;
+       if (Number[6] & 0x08) dt->Timezone = -dt->Timezone;
 
        return dt;
 }
@@ -675,7 +687,7 @@ static GSM_Error DecodeUDH(char *message, GSM_SMSMessage *SMS)
 static GSM_Error DecodeSMSHeader(unsigned char *message, GSM_SMSMessage *SMS)
 {
        /* Short Message Type */
-        switch (SMS->Type = message[2]) {
+       switch (SMS->Type = message[2]) {
        case SMS_Deliver:
                dprintf("Mobile Terminated message:\n");
                break;
@@ -697,20 +709,20 @@ static GSM_Error DecodeSMSHeader(unsigned char *message, GSM_SMSMessage *SMS)
        dprintf("\tLocation: %d\n", SMS->Number);
 
        /* Short Message Center */
-        strcpy(SMS->MessageCenter.Number, GetBCDNumber(message + 3));
-        dprintf("\tSMS center number: %s\n", SMS->MessageCenter.Number);
-        SMS->ReplyViaSameSMSC = false;
-        if (SMS->RemoteNumber.number[0] == 0 && (message[6] & 0x80)) {
+       strcpy(SMS->MessageCenter.Number, GetBCDNumber(message + 3));
+       dprintf("\tSMS center number: %s\n", SMS->MessageCenter.Number);
+       SMS->ReplyViaSameSMSC = false;
+       if (SMS->RemoteNumber.number[0] == 0 && (message[6] & 0x80)) {
                SMS->ReplyViaSameSMSC = true;
        }
 
-        /* Remote number */
-        message[15+DataOffset[SMS->Type]] = ((message[15+DataOffset[SMS->Type]])+1)/2+1;
-        dprintf("\tRemote number (recipient or sender): %s\n", GetBCDNumber(message + 15 + DataOffset[SMS->Type]));
-        strcpy(SMS->RemoteNumber.number, GetBCDNumber(message + 15 + DataOffset[SMS->Type]));
+       /* Remote number */
+       message[15+DataOffset[SMS->Type]] = ((message[15+DataOffset[SMS->Type]])+1)/2+1;
+       dprintf("\tRemote number (recipient or sender): %s\n", GetBCDNumber(message + 15 + DataOffset[SMS->Type]));
+       strcpy(SMS->RemoteNumber.number, GetBCDNumber(message + 15 + DataOffset[SMS->Type]));
 
        UnpackDateTime(message + 27 + DataOffset[SMS->Type], &(SMS->Time));
-        dprintf("\tDate: %s\n", PrintDateTime(message + 27 + DataOffset[SMS->Type]));
+       dprintf("\tDate: %s\n", PrintDateTime(message + 27 + DataOffset[SMS->Type]));
 
        /* Message length */
        SMS->Length = message[14+DataOffset[SMS->Type]];
@@ -722,7 +734,7 @@ static GSM_Error DecodeSMSHeader(unsigned char *message, GSM_SMSMessage *SMS)
                SMS->DCS.Type = 0;
 
        /* User Data Header */
-        if (message[15] & 0x40) { /* UDH header available */
+       if (message[15] & 0x40) { /* UDH header available */
                dprintf("UDH found\n");
                DecodeUDH(message + 34 + DataOffset[SMS->Type], SMS);
        } else {                    /* No UDH */
@@ -771,12 +783,12 @@ GSM_Error DecodePDUSMS(unsigned char *message, GSM_SMSMessage *SMS, int MessageL
                SMS->MessageText[SMS->Length] = 0;
                break;
        }
-       
+
        return GE_NONE;
 }
 
 /* This function does simple SMS decoding - no PDU coding */
 GSM_Error DecodeTextSMS(unsigned char *message, GSM_SMSMessage *SMS)
 {
-        return GE_NONE;
+       return GE_NONE;
 }
index 5f98794..934f03c 100644 (file)
   The various routines are called FBUS_(whatever).
 
   $Log$
-  Revision 1.1.1.1  2001/11/25 21:59:10  short
-  :pserver:cvs@pserver.samba.org:/cvsroot - gnokii - Sun Nov 25 22:56 CET 2001
+  Revision 1.1.1.1.12.1  2001/11/27 23:34:48  short
+  Update: orig2001_11_27_05_17 -> orig2001_11_27_22_58
+
+  Revision 1.1.1.1.8.1  2001/11/27 23:06:09  short
+  Update: orig2001_11_27_05_17 -> orig2001_11_27_22_58
+
+  Revision 1.1.1.1.2.1  2001/11/27 22:48:37  short
+  Update: orig2001_11_27_05_17 -> orig2001_11_27_22_58
+
+  Revision 1.1.1.2  2001/11/27 22:01:16  short
+  :pserver:cvs@pserver.samba.org:/cvsroot - gnokii - Tue Nov 27 22:58 CET 2001
+
+  Revision 1.3  2001/11/27 12:19:01  pkot
+  Cleanup, indentation, ANSI complaint preprocesor symbols (Jan Kratochvil, me)
 
   Revision 1.2  2001/11/09 14:25:04  pkot
   DEBUG cleanups
 #include "links/utils.h"
 
 #ifndef WIN32
-  #include "device.h"
+#  include "device.h"
 #else
-  #include "win32/winserial.h"
-  #define device_write(a, b) WriteCommBlock(a, b)
-  #define device_read(a, b) ReadCommBlock(a, b)
-  #define sleep(x) Sleep((x) * 1000)
-  #define usleep(x) Sleep(((x) < 1000) ? 1 : ((x) / 1000))
+#  include "win32/winserial.h"
+#  define device_write(a, b) WriteCommBlock(a, b)
+#  define device_read(a, b) ReadCommBlock(a, b)
+#  define sleep(x) Sleep((x) * 1000)
+#  define usleep(x) Sleep(((x) < 1000) ? 1 : ((x) / 1000))
 #endif
 
 #define __links_fbus_3110_c
index 49c1332..6146dc4 100644 (file)
   The various routines are called FBUS_(whatever).
 
   $Log$
-  Revision 1.1.1.1  2001/11/25 21:59:10  short
-  :pserver:cvs@pserver.samba.org:/cvsroot - gnokii - Sun Nov 25 22:56 CET 2001
+  Revision 1.1.1.1.12.1  2001/11/27 23:34:48  short
+  Update: orig2001_11_27_05_17 -> orig2001_11_27_22_58
+
+  Revision 1.1.1.1.8.1  2001/11/27 23:06:09  short
+  Update: orig2001_11_27_05_17 -> orig2001_11_27_22_58
+
+  Revision 1.1.1.1.2.1  2001/11/27 22:48:37  short
+  Update: orig2001_11_27_05_17 -> orig2001_11_27_22_58
+
+  Revision 1.1.1.2  2001/11/27 22:01:16  short
+  :pserver:cvs@pserver.samba.org:/cvsroot - gnokii - Tue Nov 27 22:58 CET 2001
+
+  Revision 1.14  2001/11/27 12:19:01  pkot
+  Cleanup, indentation, ANSI complaint preprocesor symbols (Jan Kratochvil, me)
 
   Revision 1.13  2001/11/17 20:14:15  pkot
   Nasty bug with counting message length. Workaround applied. Needs fixing.
 #include "links/utils.h"
 
 #ifndef WIN32
-  #include "device.h"
+#  include "device.h"
 #else
-  #include "win32/winserial.h"
-  #define device_write(a, b) WriteCommBlock(a, b)
-  #define device_read(a, b) ReadCommBlock(a, b)
-  #define sleep(x) Sleep((x) * 1000)
-  #define usleep(x) Sleep(((x) < 1000) ? 1 : ((x) / 1000))
+#  include "win32/winserial.h"
+#  define device_write(a, b) WriteCommBlock(a, b)
+#  define device_read(a, b) ReadCommBlock(a, b)
+#  define sleep(x) Sleep((x) * 1000)
+#  define usleep(x) Sleep(((x) < 1000) ? 1 : ((x) / 1000))
 #endif
 
 #define __links_fbus_c
index c798bbf..1dd52a5 100644 (file)
   See README for more details on supported mobile phones.
 
   $Log$
-  Revision 1.1.1.1  2001/11/25 21:59:13  short
-  :pserver:cvs@pserver.samba.org:/cvsroot - gnokii - Sun Nov 25 22:56 CET 2001
+  Revision 1.1.1.1.12.1  2001/11/27 23:34:48  short
+  Update: orig2001_11_27_05_17 -> orig2001_11_27_22_58
+
+  Revision 1.1.1.1.8.1  2001/11/27 23:06:09  short
+  Update: orig2001_11_27_05_17 -> orig2001_11_27_22_58
+
+  Revision 1.1.1.1.2.1  2001/11/27 22:48:37  short
+  Update: orig2001_11_27_05_17 -> orig2001_11_27_22_58
+
+  Revision 1.1.1.2  2001/11/27 22:01:20  short
+  :pserver:cvs@pserver.samba.org:/cvsroot - gnokii - Tue Nov 27 22:58 CET 2001
+
+  Revision 1.7  2001/11/27 12:19:01  pkot
+  Cleanup, indentation, ANSI complaint preprocesor symbols (Jan Kratochvil, me)
 
   Revision 1.6  2001/11/20 16:22:22  pkot
   First attempt to read Picture Messages. They should appear when you enable DEBUG. Nokia seems to break own standards. :/ (Markus Plail)
 #include "phones/nokia.h"
 
 #ifndef WIN32
-  #include <unistd.h>
+#  include <unistd.h>
 #else
-  #define snprintf _snprintf
-  #define usleep(x) Sleep(((x) < 1000) ? 1 : ((x) / 1000))
+#  define snprintf _snprintf
+#  define usleep(x) Sleep(((x) < 1000) ? 1 : ((x) / 1000))
 #endif
 
 /* Some globals */
index 67fc0f1..66c2bb0 100644 (file)
   The various routines are called P7110_(whatever).
 
   $Log$
-  Revision 1.1.1.1  2001/11/25 21:59:13  short
-  :pserver:cvs@pserver.samba.org:/cvsroot - gnokii - Sun Nov 25 22:56 CET 2001
+  Revision 1.1.1.1.12.1  2001/11/27 23:34:48  short
+  Update: orig2001_11_27_05_17 -> orig2001_11_27_22_58
+
+  Revision 1.1.1.1.8.1  2001/11/27 23:06:09  short
+  Update: orig2001_11_27_05_17 -> orig2001_11_27_22_58
+
+  Revision 1.1.1.1.2.1  2001/11/27 22:48:37  short
+  Update: orig2001_11_27_05_17 -> orig2001_11_27_22_58
+
+  Revision 1.1.1.2  2001/11/27 22:01:19  short
+  :pserver:cvs@pserver.samba.org:/cvsroot - gnokii - Tue Nov 27 22:58 CET 2001
+
+  Revision 1.28  2001/11/27 12:25:01  pkot
+  Cleanup
 
   Revision 1.27  2001/11/22 17:56:53  pkot
   smslib update. sms sending
@@ -904,14 +916,11 @@ static GSM_Error P7110_GetSMSFolderStatus(GSM_Data *data, GSM_Statemachine *stat
 static GSM_Error P7110_SendSMS(GSM_Data *data, GSM_Statemachine *state)
 {
        unsigned char req[256] = {FBUS_FRAME_HEADER, 0x01, 0x02, 0x00};
-       unsigned char smsc_req[] = {FBUS_FRAME_HEADER, 0x33, 0x64, 0x00};
        int length, i;
 
        if (data->SMSMessage->MessageCenter.No) {
                data->MessageCenter = &data->SMSMessage->MessageCenter;
                P7110_GetSMSCenter(data, state);
-//             SM_SendMessage(state, 6, 0x02, smsc_req);
-//             SM_Block(state, data, 0x02);
        }
 
        length = EncodePDUSMS(data->SMSMessage, req + 6);
@@ -928,7 +937,7 @@ static GSM_Error P7110_SendSMS(GSM_Data *data, GSM_Statemachine *state)
 static GSM_Error P7110_IncomingSMS(int messagetype, unsigned char *message, int length, GSM_Data *data)
 {
        GSM_Error       e = GE_NONE;
-       int             digits, bytes, i;
+       int             digits, bytes;
 
        if (!data) return GE_INTERNALERROR;
 
index 64a8934..e13a0ae 100644 (file)
   really powerful and useful :-)
 
   $Log$
-  Revision 1.1.1.1  2001/11/25 21:59:18  short
-  :pserver:cvs@pserver.samba.org:/cvsroot - gnokii - Sun Nov 25 22:56 CET 2001
+  Revision 1.1.1.1.12.1  2001/11/27 23:34:48  short
+  Update: orig2001_11_27_05_17 -> orig2001_11_27_22_58
+
+  Revision 1.1.1.1.8.1  2001/11/27 23:06:09  short
+  Update: orig2001_11_27_05_17 -> orig2001_11_27_22_58
+
+  Revision 1.1.1.1.2.1  2001/11/27 22:48:37  short
+  Update: orig2001_11_27_05_17 -> orig2001_11_27_22_58
+
+  Revision 1.1.1.2  2001/11/27 22:01:25  short
+  :pserver:cvs@pserver.samba.org:/cvsroot - gnokii - Tue Nov 27 22:58 CET 2001
+
+  Revision 1.152  2001/11/27 12:23:11  pkot
+  Specifying SMSC number in --sendsms works again
 
   Revision 1.151  2001/11/22 17:56:53  pkot
   smslib update. sms sending
@@ -843,6 +855,8 @@ int sendsms(int argc, char *argv[])
                case '1': /* SMSC number */
                        SMS.MessageCenter.No = 0;
                        strcpy(SMS.MessageCenter.Number, optarg);
+                       if (SMS.MessageCenter.Number[0] == '+') SMS.MessageCenter.Type = SMS_International;
+                       else SMS.MessageCenter.Type = SMS_Unknown;
                        break;
                case '2': /* SMSC number index in phone memory */
                        SMS.MessageCenter.No = atoi(optarg);
index 90d5771..7b220fb 100644 (file)
   Header file for RLP protocol.
 
   $Log$
-  Revision 1.1.1.1  2001/11/25 21:59:21  short
-  :pserver:cvs@pserver.samba.org:/cvsroot - gnokii - Sun Nov 25 22:56 CET 2001
+  Revision 1.1.1.1.12.1  2001/11/27 23:34:48  short
+  Update: orig2001_11_27_05_17 -> orig2001_11_27_22_58
+
+  Revision 1.1.1.1.8.1  2001/11/27 23:06:09  short
+  Update: orig2001_11_27_05_17 -> orig2001_11_27_22_58
+
+  Revision 1.1.1.1.2.1  2001/11/27 22:48:37  short
+  Update: orig2001_11_27_05_17 -> orig2001_11_27_22_58
+
+  Revision 1.1.1.2  2001/11/27 22:01:28  short
+  :pserver:cvs@pserver.samba.org:/cvsroot - gnokii - Tue Nov 27 22:58 CET 2001
+
+  Revision 1.3  2001/11/27 12:19:01  pkot
+  Cleanup, indentation, ANSI complaint preprocesor symbols (Jan Kratochvil, me)
 
   Revision 1.2  2001/06/10 11:29:49  machek
   It is very bad idea to name enum "Data", because it is then impossible
 
   Revision 1.1  2001/02/21 19:57:11  chris
   More fiddling with the directory layout
-
-
 */
 
 #ifndef __data_rlp_common_h
 #define __data_rlp_common_h
 
 #ifndef __misc_h
-  #include "misc.h"
+#  include "misc.h"
 #endif
 
 /* Global variables */
 /* Data types */
 
 /* Typedef for frame type - they are the same for RLP version 0, 1 and 2. */
-
 typedef enum {
-  RLPFT_X, /* Unknown. */
-  RLPFT_U, /* Unnumbered frame. */
-  RLPFT_S, /* Supervisory frame. */
-  RLPFT_IS /* Information plus Supervisory (I+S) frame. */
+       RLPFT_X, /* Unknown. */
+       RLPFT_U, /* Unnumbered frame. */
+       RLPFT_S, /* Supervisory frame. */
+       RLPFT_IS /* Information plus Supervisory (I+S) frame. */
 } RLP_FrameType;
 
 /* Define the various Unnumbered frame types. Numbering is bit reversed
    relative to ETSI GSM 04.22 for easy parsing. */
-
 typedef enum {
-  RLPU_SABM  = 0x07, /* Set Asynchronous Balanced Mode. */
-  RLPU_UA    = 0x0c, /* Unnumbered Acknowledge. */
-  RLPU_DISC  = 0x08, /* Disconnect. */
-  RLPU_DM    = 0x03, /* Disconnected Mode. */
-  RLPU_NULL  = 0x0f, /* Null information. */
-  RLPU_UI    = 0x00, /* Unnumbered Information. */
-  RLPU_XID   = 0x17, /* Exchange Identification. */
-  RLPU_TEST  = 0x1c, /* Test. */
-  RLPU_REMAP = 0x11  /* Remap. */
+       RLPU_SABM  = 0x07, /* Set Asynchronous Balanced Mode. */
+       RLPU_UA    = 0x0c, /* Unnumbered Acknowledge. */
+       RLPU_DISC  = 0x08, /* Disconnect. */
+       RLPU_DM    = 0x03, /* Disconnected Mode. */
+       RLPU_NULL  = 0x0f, /* Null information. */
+       RLPU_UI    = 0x00, /* Unnumbered Information. */
+       RLPU_XID   = 0x17, /* Exchange Identification. */
+       RLPU_TEST  = 0x1c, /* Test. */
+       RLPU_REMAP = 0x11  /* Remap. */
 } RLP_UFrameType;
 
 /* Define supervisory frame field. */
-
 typedef enum {
-  RLPS_RR   = 0x00, /* Receive Ready. */
-  RLPS_REJ  = 0x02, /* Reject. */
-  RLPS_RNR  = 0x01, /* Receive Not Ready. */
-  RLPS_SREJ = 0x03  /* Selective Reject. */
+       RLPS_RR   = 0x00, /* Receive Ready. */
+       RLPS_REJ  = 0x02, /* Reject. */
+       RLPS_RNR  = 0x01, /* Receive Not Ready. */
+       RLPS_SREJ = 0x03  /* Selective Reject. */
 } RLP_SFrameField;
 
 /* Used for CurrentFrameType. */
-
 typedef enum {
-  RLPFT_U_SABM = 0x00,
-  RLPFT_U_UA,
-  RLPFT_U_DISC,
-  RLPFT_U_DM,
-  RLPFT_U_NULL,
-  RLPFT_U_UI,
-  RLPFT_U_XID,
-  RLPFT_U_TEST,
-  RLPFT_U_REMAP,
-  RLPFT_S_RR,
-  RLPFT_S_REJ,
-  RLPFT_S_RNR,
-  RLPFT_S_SREJ,
-  RLPFT_SI_RR,
-  RLPFT_SI_REJ,
-  RLPFT_SI_RNR,
-  RLPFT_SI_SREJ,
-  RLPFT_BAD
+       RLPFT_U_SABM = 0x00,
+       RLPFT_U_UA,
+       RLPFT_U_DISC,
+       RLPFT_U_DM,
+       RLPFT_U_NULL,
+       RLPFT_U_UI,
+       RLPFT_U_XID,
+       RLPFT_U_TEST,
+       RLPFT_U_REMAP,
+       RLPFT_S_RR,
+       RLPFT_S_REJ,
+       RLPFT_S_RNR,
+       RLPFT_S_SREJ,
+       RLPFT_SI_RR,
+       RLPFT_SI_REJ,
+       RLPFT_SI_RNR,
+       RLPFT_SI_SREJ,
+       RLPFT_BAD
 } RLP_FrameTypes;
 
 /* Frame definition for TCH/F9.6 frame. */
-
 typedef struct {
-  u8 Header[2];
-  u8 Data[25];    
-  u8 FCS[3];
+       u8 Header[2];
+       u8 Data[25];    
+       u8 FCS[3];
 } RLP_F96Frame;   
 
 /* Header data "split up" for TCH/F9.6 frame. */
-
 typedef struct {
-  u8            Ns;   /* Send sequence number. */
-  u8            Nr;   /* Receive sequence number. */
-  u8            M;    /* Unumbered frame type. */
-  u8            S;    /* Status. */
-  bool          PF;   /* Poll/Final. */
-  bool          CR;   /* Command/Response. */
-  RLP_FrameType Type; /* Frame type. */
+       u8            Ns;   /* Send sequence number. */
+       u8            Nr;   /* Receive sequence number. */
+       u8            M;    /* Unumbered frame type. */
+       u8            S;    /* Status. */
+       bool          PF;   /* Poll/Final. */
+       bool          CR;   /* Command/Response. */
+       RLP_FrameType Type; /* Frame type. */
 } RLP_F96Header;
 
 
 /* RLP User requests */
-
 typedef struct {
-  bool Conn_Req;
-  bool Attach_Req;
-  bool Conn_Req_Neg;
-  bool Reset_Resp;
-  bool Disc_Req;
+       bool Conn_Req;
+       bool Attach_Req;
+       bool Conn_Req_Neg;
+       bool Reset_Resp;
+       bool Disc_Req;
 } RLP_UserRequestStore;
 
 typedef enum {
-  Conn_Req,
-  Attach_Req,
-  Conn_Req_Neg,
-  Reset_Resp,
-  Disc_Req
+       Conn_Req,
+       Attach_Req,
+       Conn_Req_Neg,
+       Reset_Resp,
+       Disc_Req
 } RLP_UserRequests;
 
 typedef enum {
-  Conn_Ind,
-  Conn_Conf,
-  Disc_Ind,
-  Reset_Ind,
-  Data,                /* FIXME: This should really be called RLP_Data, otherwise it hogs name "Data"! */
-  StatusChange,
-  GetData
+       Conn_Ind,
+       Conn_Conf,
+       Disc_Ind,
+       Reset_Ind,
+       Data,           /* FIXME: This should really be called RLP_Data, otherwise it hogs name "Data"! */
+       StatusChange,
+       GetData
 } RLP_UserInds;
 
 /* RLP (main) states. See GSM specification 04.22 Annex A, Section A.1.1. */
-
 typedef enum {
-  RLP_S0, /* ADM and Detached */
-  RLP_S1, /* ADM and Attached */
-  RLP_S2, /* Pending Connect Request */
-  RLP_S3, /* Pending Connect Indication */
-  RLP_S4, /* ABM and Connection Established */
-  RLP_S5, /* Disconnect Initiated */
-  RLP_S6, /* Pending Reset Request */
-  RLP_S7, /* Pending Reset Indication */
-  RLP_S8  /* Error */
+       RLP_S0, /* ADM and Detached */
+       RLP_S1, /* ADM and Attached */
+       RLP_S2, /* Pending Connect Request */
+       RLP_S3, /* Pending Connect Indication */
+       RLP_S4, /* ABM and Connection Established */
+       RLP_S5, /* Disconnect Initiated */
+       RLP_S6, /* Pending Reset Request */
+       RLP_S7, /* Pending Reset Indication */
+       RLP_S8  /* Error */
 } RLP_State;
 
 /* RLP specification defines several states in which variables can be. */
-
 typedef enum {
-  _idle=0,
-  _send,
-  _wait,
-  _rcvd,
-  _ackn,
-  _rej,
-  _srej
+       _idle=0,
+       _send,
+       _wait,
+       _rcvd,
+       _ackn,
+       _rej,
+       _srej
 } RLP_StateVariable;
 
-
 /* RLP Data */
-
 typedef struct { 
-  u8 Data[25];
-  RLP_StateVariable State;
+       u8 Data[25];
+       RLP_StateVariable State;
 } RLP_Data;
 
-
-
 /* Prototypes for functions. */
-
 void RLP_DisplayF96Frame(RLP_F96Frame *frame);
 void RLP_DecodeF96Header(RLP_F96Frame *frame, RLP_F96Header *header);
 void RLP_DisplayXID(u8 *frame);
index 4c62651..cfcd687 100644 (file)
   Header file for CRC24 (aka FCS) implementation in RLP.
 
   $Log$
-  Revision 1.1.1.1  2001/11/25 21:59:21  short
-  :pserver:cvs@pserver.samba.org:/cvsroot - gnokii - Sun Nov 25 22:56 CET 2001
+  Revision 1.1.1.1.12.1  2001/11/27 23:34:48  short
+  Update: orig2001_11_27_05_17 -> orig2001_11_27_22_58
+
+  Revision 1.1.1.1.8.1  2001/11/27 23:06:09  short
+  Update: orig2001_11_27_05_17 -> orig2001_11_27_22_58
+
+  Revision 1.1.1.1.2.1  2001/11/27 22:48:37  short
+  Update: orig2001_11_27_05_17 -> orig2001_11_27_22_58
+
+  Revision 1.1.1.2  2001/11/27 22:01:28  short
+  :pserver:cvs@pserver.samba.org:/cvsroot - gnokii - Tue Nov 27 22:58 CET 2001
+
+  Revision 1.2  2001/11/27 12:19:01  pkot
+  Cleanup, indentation, ANSI complaint preprocesor symbols (Jan Kratochvil, me)
 
   Revision 1.1  2001/02/21 19:57:11  chris
   More fiddling with the directory layout
@@ -28,7 +40,7 @@
 #define __data_rlp_crc24_h
 
 #ifndef __misc_h
-  #include    "misc.h"
+#  include    "misc.h"
 #endif
 
 /* Prototypes for functions */
index 3d16a3f..263fc76 100644 (file)
  * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA  02111-1307  USA
  *
  * $Log$
- * Revision 1.1.1.1  2001/11/25 21:59:21  short
- * :pserver:cvs@pserver.samba.org:/cvsroot - gnokii - Sun Nov 25 22:56 CET 2001
+ * Revision 1.1.1.1.12.1  2001/11/27 23:34:48  short
+ * Update: orig2001_11_27_05_17 -> orig2001_11_27_22_58
+ *
+ * Revision 1.1.1.1.8.1  2001/11/27 23:06:09  short
+ * Update: orig2001_11_27_05_17 -> orig2001_11_27_22_58
+ *
+ * Revision 1.1.1.1.2.1  2001/11/27 22:48:37  short
+ * Update: orig2001_11_27_05_17 -> orig2001_11_27_22_58
+ *
+ * Revision 1.1.1.2  2001/11/27 22:01:28  short
+ * :pserver:cvs@pserver.samba.org:/cvsroot - gnokii - Tue Nov 27 22:58 CET 2001
+ *
+ * Revision 1.2  2001/11/27 12:19:01  pkot
+ * Cleanup, indentation, ANSI complaint preprocesor symbols (Jan Kratochvil, me)
  *
  * Revision 1.1  2001/02/21 19:57:11  chris
  * More fiddling with the directory layout
 #define __devices_tekram_h
 
 #ifdef WIN32
-  #include <stddef.h>
+#  include <stddef.h>
   /* FIXME: this should be solved in config.h in 0.4.0 */
-  #define __const const
-  typedef void * __ptr_t;
+#  define __const const
+       typedef void * __ptr_t;
 #else
-  #include <unistd.h>
+#  include <unistd.h>
 #endif /* WIN32 */
 
 #include "misc.h"
 
-
 #define TEKRAM_B115200 0x00
 #define TEKRAM_B57600  0x01
 #define TEKRAM_B38400  0x02
@@ -58,7 +69,6 @@
 
 #define TEKRAM_PW      0x10 /* Pulse select bit */
 
-
 int tekram_open(__const char *__file);
 void tekram_close(int __fd);
 
@@ -71,7 +81,3 @@ size_t tekram_write(int __fd, __const __ptr_t __buf, size_t __n);
 int tekram_select(int fd, struct timeval *timeout);
 
 #endif  /* __devices_tekram_h */
-
-
-
-
index 58ff7e1..221ab7c 100644 (file)
   Released under the terms of the GNU GPL, see file COPYING for more details.
 
   $Log$
-  Revision 1.1.1.1.12.1  2001/11/25 23:31:57  short
-  WARNING! dependency on: lace_cfgreader (branchpoint), lace_utils
-
-  * new gnokiirc/global settings:
-    * connect_script/disconnect_script - needed for BIP but can be general
-      * entries in such sections passed as %ENV - ...
-      * provided chat script ("connect-et" now) w/o bugs of "ppp-6210-modem"
-    * serial_baudrate               - used when not overriden by phone
-    * handshake = software/hardware - used when not overriden by phone
-    * require_dcd - kills Gnokii when modem drops connection - needed for BIP
-    * serial_write_usleep - waits between each character sent - for Siemens M20
-  * All open device fds are now closed and DTR/RTS-cleared on exit
-    * SIGINT abort not properly handled - clashing with pthreads
-  * Fixed hang-ons by fcntl(FASYNC) forgotting to specify also FNONBLOCK
-
-  Revision 1.1.1.1  2001/11/25 21:59:21  short
-  :pserver:cvs@pserver.samba.org:/cvsroot - gnokii - Sun Nov 25 22:56 CET 2001
+  Revision 1.1.1.1.12.2  2001/11/27 23:34:48  short
+  Update: orig2001_11_27_05_17 -> orig2001_11_27_22_58
+
+  Revision 1.1.1.1.8.1  2001/11/27 23:06:09  short
+  Update: orig2001_11_27_05_17 -> orig2001_11_27_22_58
+
+  Revision 1.1.1.1.2.1  2001/11/27 22:48:37  short
+  Update: orig2001_11_27_05_17 -> orig2001_11_27_22_58
+
+  Revision 1.1.1.2  2001/11/27 22:01:28  short
+  :pserver:cvs@pserver.samba.org:/cvsroot - gnokii - Tue Nov 27 22:58 CET 2001
+
+  Revision 1.3  2001/11/27 12:19:01  pkot
+  Cleanup, indentation, ANSI complaint preprocesor symbols (Jan Kratochvil, me)
 
   Revision 1.2  2001/08/20 23:27:37  pkot
   Add hardware shakehand to the link layer (Manfred Jonsson)
   Revision 1.1  2001/02/21 19:57:12  chris
   More fiddling with the directory layout
 
-
 */
 
 #ifndef __devices_unixserial_h
 #define __devices_unixserial_h
 
 #ifdef WIN32
-  #include <stddef.h>
+#  include <stddef.h>
   /* FIXME: this should be solved in config.h in 0.4.0 */
-  #define __const const
-  typedef void * __ptr_t;
+#  define __const const
+       typedef void * __ptr_t;
 #else
-  #include <unistd.h>
+#  include <unistd.h>
 #endif /* WIN32 */
 
 #include "misc.h"
@@ -67,7 +63,3 @@ size_t serial_write(int __fd, __const __ptr_t __buf, size_t __n);
 int serial_select(int fd, struct timeval *timeout);
 
 #endif  /* __devices_unixserial_h */
-
-
-
-
index 84a828a..ed239e0 100644 (file)
   the handset interface.  See gsm-api.c for more details.
 
   $Log$
-  Revision 1.1.1.1  2001/11/25 21:59:19  short
-  :pserver:cvs@pserver.samba.org:/cvsroot - gnokii - Sun Nov 25 22:56 CET 2001
+  Revision 1.1.1.1.12.1  2001/11/27 23:34:48  short
+  Update: orig2001_11_27_05_17 -> orig2001_11_27_22_58
+
+  Revision 1.1.1.1.8.1  2001/11/27 23:06:09  short
+  Update: orig2001_11_27_05_17 -> orig2001_11_27_22_58
+
+  Revision 1.1.1.1.2.1  2001/11/27 22:48:37  short
+  Update: orig2001_11_27_05_17 -> orig2001_11_27_22_58
+
+  Revision 1.1.1.2  2001/11/27 22:01:26  short
+  :pserver:cvs@pserver.samba.org:/cvsroot - gnokii - Tue Nov 27 22:58 CET 2001
+
+  Revision 1.15  2001/11/27 12:19:01  pkot
+  Cleanup, indentation, ANSI complaint preprocesor symbols (Jan Kratochvil, me)
 
   Revision 1.14  2001/06/28 00:28:45  pkot
   Small docs updates (Pawel Kot)
    sense so we include it here if required. */
 
 #ifndef __gsm_common_h
-  #include "gsm-common.h"
+#  include "gsm-common.h"
 #endif
 
 /* Ditto rlp_common.h... */
 #ifndef __data_rlp_common_h
-  #include "data/rlp-common.h"
+#  include "data/rlp-common.h"
 #endif
 
 #include "gsm-statemachine.h"
index 3ff3ba2..5dbedaf 100644 (file)
   Include file for SMS library.
 
   $Log$
-  Revision 1.1.1.1  2001/11/25 21:59:21  short
-  :pserver:cvs@pserver.samba.org:/cvsroot - gnokii - Sun Nov 25 22:56 CET 2001
+  Revision 1.1.1.1.12.1  2001/11/27 23:34:48  short
+  Update: orig2001_11_27_05_17 -> orig2001_11_27_22_58
+
+  Revision 1.1.1.1.8.1  2001/11/27 23:06:09  short
+  Update: orig2001_11_27_05_17 -> orig2001_11_27_22_58
+
+  Revision 1.1.1.1.2.1  2001/11/27 22:48:37  short
+  Update: orig2001_11_27_05_17 -> orig2001_11_27_22_58
+
+  Revision 1.1.1.2  2001/11/27 22:01:27  short
+  :pserver:cvs@pserver.samba.org:/cvsroot - gnokii - Tue Nov 27 22:58 CET 2001
+
+  Revision 1.7  2001/11/27 12:19:01  pkot
+  Cleanup, indentation, ANSI complaint preprocesor symbols (Jan Kratochvil, me)
 
   Revision 1.6  2001/11/22 17:56:53  pkot
   smslib update. sms sending
@@ -201,12 +213,12 @@ typedef struct {
 /* Validity of SMS Messages. */
 
 typedef enum {
-        SMS_V1H   = 0x0b,
-        SMS_V6H   = 0x47,
-        SMS_V24H  = 0xa7,
-        SMS_V72H  = 0xa9,
-        SMS_V1W   = 0xad,
-        SMS_VMax  = 0xff
+       SMS_V1H   = 0x0b,
+       SMS_V6H   = 0x47,
+       SMS_V24H  = 0xa7,
+       SMS_V72H  = 0xa9,
+       SMS_V1W   = 0xad,
+       SMS_VMax  = 0xff
 } SMS_ValidityPeriod;
 
 typedef struct {
@@ -306,7 +318,7 @@ typedef enum {
        GMT_F19 = 0xB9,
        GMT_F20 = 0xC1 /* 20th CUSTOM FOLDER in 6210/7110 */
 } SMS_MemoryType;
-        
+
 /* Define datatype for SMS messages, describes precisely GSM Spec 03.40 */
 typedef struct {
        /* Specification fields */
@@ -336,7 +348,7 @@ typedef struct {
        SMS_DateTime Time;                             /* Discharge Time (9.2.3.13) */
 
        /* Other fields */
-        SMS_MemoryType MemoryType;                     /* memoryType (for 6210/7110: folder indicator */
+       SMS_MemoryType MemoryType;                     /* memoryType (for 6210/7110: folder indicator */
        SMS_MessageStatus Status;                      /* Status of the message: sent/read or unsent/unread */
 
 //     SMS_CommandType Command;                       /* Command Type - 8 bits (9.2.3.19); FIXME: use it!!!! */