<html lang='en'>
<head>
<meta content='text/html; charset=utf-8' http-equiv='Content-Type'>
<title>
GitLab
</title>
</meta>
</head>
<style>
  img {
    max-width: 100%;
    height: auto;
  }
  p.details {
    font-style:italic;
    color:#777
  }
  .footer p {
    font-size:small;
    color:#777
  }
  pre.commit-message {
    white-space: pre-wrap;
  }
  .file-stats a {
    text-decoration: none;
  }
  .file-stats .new-file {
    color: #090;
  }
  .file-stats .deleted-file {
    color: #B00;
  }
</style>
<body>
<div class='content'>
<h3>Andrew Price pushed to branch master at <a href="https://projects.sucs.org/arthur/mw">Justin Mitchell / mw</a></h3>
<h4>
Commits:
</h4>
<ul>
<li>
<strong><a href="https://projects.sucs.org/arthur/mw/commit/2b6a2c76e52ab6a7e6aa1c9f42e677b31b74f696">2b6a2c76</a></strong>
<div>
<span>by Andrew Price</span>
<i>at 2015-11-14T15:31:53Z</i>
</div>
<pre class='commit-message'>Use SEEK_* in lseek(2) calls

Change scripted with coccinelle:

@rule0@
expression A,B;
@@
- lseek(A, B, 0);
+ lseek(A, B, SEEK_SET);
@rule1@
expression A,B;
@@
- lseek(A, B, 1);
+ lseek(A, B, SEEK_CUR);
@rule2@
expression A,B;
@@
- lseek(A, B, 2);
+ lseek(A, B, SEEK_END);</pre>
</li>
</ul>
<h4>7 changed files:</h4>
<ul>
<li class='file-stats'>
<a href='#diff-0'>
src/client/add.c
</a>
</li>
<li class='file-stats'>
<a href='#diff-1'>
src/client/edit.c
</a>
</li>
<li class='file-stats'>
<a href='#diff-2'>
src/client/mod.c
</a>
</li>
<li class='file-stats'>
<a href='#diff-3'>
src/client/new.c
</a>
</li>
<li class='file-stats'>
<a href='#diff-4'>
src/client/newmain.c
</a>
</li>
<li class='file-stats'>
<a href='#diff-5'>
src/client/read.c
</a>
</li>
<li class='file-stats'>
<a href='#diff-6'>
src/folders.c
</a>
</li>
</ul>
<h4>Changes:</h4>
<li id='diff-0'>
<a href='https://projects.sucs.org/arthur/mw/commit/2b6a2c76e52ab6a7e6aa1c9f42e677b31b74f696#diff-0'>
<strong>
src/client/add.c
</strong>
</a>
<hr>
<pre class="highlight"><code><span style="color: #000000;background-color: #ffdddd">--- a/src/client/add.c
</span><span style="color: #000000;background-color: #ddffdd">+++ b/src/client/add.c
</span><span style="color: #aaaaaa">@@ -168,7 +168,7 @@ int add_msg(int folnum, struct user *user, int replyto)
</span>                   free(new);
                        return(-1);
                }else
<span style="color: #000000;background-color: #ffdddd">-                        lseek(headfile,posn,0);
</span><span style="color: #000000;background-color: #ddffdd">+                   lseek(headfile, posn, SEEK_SET);
</span>           while (get_data(headfile,&inreplyto) && inreplyto.Ref<replyto);
                if (inreplyto.Ref!=replyto)
                {
<span style="color: #aaaaaa">@@ -372,7 +372,7 @@ int add_msg(int folnum, struct user *user, int replyto)
</span>                           return(0);
                        }
                        size=lseek(tfile,0,2);
<span style="color: #000000;background-color: #ffdddd">-                        lseek(tfile,0,0);
</span><span style="color: #000000;background-color: #ddffdd">+                   lseek(tfile, 0, SEEK_SET);
</span>                   buff=(char *)realloc(buff,size);
                        read(tfile,buff,size);
                        new->size=size;
<span style="color: #aaaaaa">@@ -398,9 +398,9 @@ int add_msg(int folnum, struct user *user, int replyto)
</span>   Lock_File(data);
 
        new->datafield=lseek(data,0l,2);
<span style="color: #000000;background-color: #ffdddd">-        lseek(folderfile,folnum*sizeof(struct folder),0);
</span><span style="color: #000000;background-color: #ddffdd">+   lseek(folderfile, folnum * sizeof(struct folder), SEEK_SET);
</span>   read(folderfile,fol,sizeof(*fol));
<span style="color: #000000;background-color: #ffdddd">-        lseek(folderfile,-1*sizeof(struct folder),1);
</span><span style="color: #000000;background-color: #ddffdd">+   lseek(folderfile, -1 * sizeof(struct folder), SEEK_CUR);
</span>   if (!is_moderated(fol,user))
        {
                new->Ref=fol->last+1;
<span style="color: #aaaaaa">@@ -408,7 +408,7 @@ int add_msg(int folnum, struct user *user, int replyto)
</span>           if (fol->first==0) fol->first=1;
                if (replyto>0)
                {
<span style="color: #000000;background-color: #ffdddd">-                        lseek(i,replyposn,0);
</span><span style="color: #000000;background-color: #ddffdd">+                   lseek(i, replyposn, SEEK_SET);
</span>                   write(i,&inreplyto,sizeof(inreplyto));
                }
        }else
<span style="color: #aaaaaa">@@ -421,7 +421,7 @@ int add_msg(int folnum, struct user *user, int replyto)
</span> 
        if (td>0){
                printf(_("Warning: Index error, skipping back %ld bytes.\r\n"),td);
<span style="color: #000000;background-color: #ffdddd">-                lseek(i,-td,1);
</span><span style="color: #000000;background-color: #ddffdd">+           lseek(i, -td, SEEK_CUR);
</span>   }
        if ((write(i,new,sizeof(*new)))<sizeof(*new))
        {
</code></pre>

<br>
</li>
<li id='diff-1'>
<a href='https://projects.sucs.org/arthur/mw/commit/2b6a2c76e52ab6a7e6aa1c9f42e677b31b74f696#diff-1'>
<strong>
src/client/edit.c
</strong>
</a>
<hr>
<pre class="highlight"><code><span style="color: #000000;background-color: #ffdddd">--- a/src/client/edit.c
</span><span style="color: #000000;background-color: #ddffdd">+++ b/src/client/edit.c
</span><span style="color: #aaaaaa">@@ -610,7 +610,7 @@ static void users_lastread(int folnum)
</span>   Lock_File(ufile);
        while (read(ufile,&usr,sizeof(usr))>0)
        {
<span style="color: #000000;background-color: #ffdddd">-                lseek(ufile,-1*sizeof(usr),1);
</span><span style="color: #000000;background-color: #ddffdd">+           lseek(ufile, -1 * sizeof(usr), SEEK_CUR);
</span>           usr.lastread[folnum]=0;
                usr.folders[0]|=(1<<folnum);
                write(ufile,&usr,sizeof(usr));
<span style="color: #aaaaaa">@@ -763,7 +763,7 @@ void edit_folder(const char *args, const char *name)
</span> 
        afile=openfolderfile(O_RDWR);
        Lock_File(afile);
<span style="color: #000000;background-color: #ffdddd">-        lseek(afile,folnum*sizeof(struct folder),0);
</span><span style="color: #000000;background-color: #ddffdd">+   lseek(afile, folnum * sizeof(struct folder), SEEK_SET);
</span>   write(afile,&fold,sizeof(struct folder));
        Unlock_File(afile);
        close(afile);
<span style="color: #aaaaaa">@@ -793,7 +793,7 @@ void mesg_edit(const char *args, struct folder *folder, int msgno, struct user *
</span>           return;
        }
        buff=(char *)malloc(head.size);
<span style="color: #000000;background-color: #ffdddd">-        lseek(text,head.datafield,0);
</span><span style="color: #000000;background-color: #ddffdd">+   lseek(text, head.datafield, SEEK_SET);
</span>   read(text,buff,head.size);
 
        if (!u_god(usr) && !u_mod(usr) && strcasecmp(head.from, usr->record.name))
<span style="color: #aaaaaa">@@ -866,7 +866,7 @@ void mesg_edit(const char *args, struct folder *folder, int msgno, struct user *
</span>                   return;
                }
                size=lseek(tfile,0,2);
<span style="color: #000000;background-color: #ffdddd">-                lseek(tfile,0,0);
</span><span style="color: #000000;background-color: #ddffdd">+           lseek(tfile, 0, SEEK_SET);
</span>           buff=(char *)realloc(buff,size);
                read(tfile,buff,size);
                head.size=size;
<span style="color: #aaaaaa">@@ -933,7 +933,7 @@ void mesg_edit(const char *args, struct folder *folder, int msgno, struct user *
</span>   else
                printf(_("What do you want to do ?\n"));
        Lock_File(fd);
<span style="color: #000000;background-color: #ffdddd">-        lseek(fd,-1*sizeof(head),1);
</span><span style="color: #000000;background-color: #ddffdd">+   lseek(fd, -1 * sizeof(head), SEEK_CUR);
</span>   write(fd,&head,sizeof(head));
        Unlock_File(fd);
        close(fd);
</code></pre>

<br>
</li>
<li id='diff-2'>
<a href='https://projects.sucs.org/arthur/mw/commit/2b6a2c76e52ab6a7e6aa1c9f42e677b31b74f696#diff-2'>
<strong>
src/client/mod.c
</strong>
</a>
<hr>
<pre class="highlight"><code><span style="color: #000000;background-color: #ffdddd">--- a/src/client/mod.c
</span><span style="color: #000000;background-color: #ddffdd">+++ b/src/client/mod.c
</span><span style="color: #aaaaaa">@@ -114,7 +114,7 @@ void moderate(void)
</span>           {
                        int foo;
                        text=(char *)malloc(head.size);
<span style="color: #000000;background-color: #ffdddd">-                        lseek(tmptext,head.datafield,0);
</span><span style="color: #000000;background-color: #ddffdd">+                   lseek(tmptext, head.datafield, SEEK_SET);
</span>                   if ((foo=read(tmptext,text,head.size))<head.size)
                        {
                                printf(_("only %d of %d bytes read.\n"),foo,head.size);
<span style="color: #aaaaaa">@@ -127,7 +127,8 @@ void moderate(void)
</span>                   if (stringcmp(answer,_("approve"),1))
                        {
                                Lock_File(f_file);
<span style="color: #000000;background-color: #ffdddd">-                                lseek(f_file,-1*sizeof(struct folder),1);
</span><span style="color: #000000;background-color: #ddffdd">+                           lseek(f_file, -1 * sizeof(struct folder),
+                                     SEEK_CUR);
</span>                           fold.last++;
                                if (fold.first<=0) fold.first=1;
                                write(f_file,&fold,sizeof(fold));
</code></pre>

<br>
</li>
<li id='diff-3'>
<a href='https://projects.sucs.org/arthur/mw/commit/2b6a2c76e52ab6a7e6aa1c9f42e677b31b74f696#diff-3'>
<strong>
src/client/new.c
</strong>
</a>
<hr>
<pre class="highlight"><code><span style="color: #000000;background-color: #ffdddd">--- a/src/client/new.c
</span><span style="color: #000000;background-color: #ddffdd">+++ b/src/client/new.c
</span><span style="color: #aaaaaa">@@ -100,10 +100,10 @@ static int read_new(struct user *user, struct folder *data, int folnum)
</span>   }
        /* try jumping to expected location */
        posn = (urec->lastread[folnum] - data->first + 1) * sizeof(struct Header);
<span style="color: #000000;background-color: #ffdddd">-        lseek(indexfile, posn, 0);
</span><span style="color: #000000;background-color: #ddffdd">+   lseek(indexfile, posn, SEEK_SET);
</span>   /* read the article, if failed, or overshot then rewind to start */
        if (!get_data(indexfile, &head) || head.Ref > urec->lastread[folnum]) {
<span style="color: #000000;background-color: #ffdddd">-                lseek(indexfile,0,0);
</span><span style="color: #000000;background-color: #ddffdd">+           lseek(indexfile, 0, SEEK_SET);
</span>           get_data(indexfile,&head);
        }
 
<span style="color: #aaaaaa">@@ -151,7 +151,7 @@ static int read_new(struct user *user, struct folder *data, int folnum)
</span>                           long foo;
                                foo=lseek(indexfile,0,1);
                                add_msg(folnum, user, head.Ref);
<span style="color: #000000;background-color: #ffdddd">-                                lseek(indexfile,foo,0);
</span><span style="color: #000000;background-color: #ddffdd">+                           lseek(indexfile, foo, SEEK_SET);
</span>                           get_folder_number(data,folnum);
                        }else
                        if (stringcmp(tmp,"unsubscribe",5))
</code></pre>

<br>
</li>
<li id='diff-4'>
<a href='https://projects.sucs.org/arthur/mw/commit/2b6a2c76e52ab6a7e6aa1c9f42e677b31b74f696#diff-4'>
<strong>
src/client/newmain.c
</strong>
</a>
<hr>
<pre class="highlight"><code><span style="color: #000000;background-color: #ffdddd">--- a/src/client/newmain.c
</span><span style="color: #000000;background-color: #ddffdd">+++ b/src/client/newmain.c
</span><span style="color: #aaaaaa">@@ -721,7 +721,7 @@ void c_tidyup(CommandList *cm, int argc, const char **argv, char *args)
</span>           {
                        first=idx.Ref<first?idx.Ref:first;
                        textbuff=(char *)malloc(idx.size+1);
<span style="color: #000000;background-color: #ffdddd">-                        lseek(textin,idx.datafield,0);
</span><span style="color: #000000;background-color: #ddffdd">+                   lseek(textin, idx.datafield, SEEK_SET);
</span>                   read(textin,textbuff,idx.size);
                        idx.datafield=lseek(textout,0,1);
                        write(textout,textbuff,idx.size);
</code></pre>

<br>
</li>
<li id='diff-5'>
<a href='https://projects.sucs.org/arthur/mw/commit/2b6a2c76e52ab6a7e6aa1c9f42e677b31b74f696#diff-5'>
<strong>
src/client/read.c
</strong>
</a>
<hr>
<pre class="highlight"><code><span style="color: #000000;background-color: #ffdddd">--- a/src/client/read.c
</span><span style="color: #000000;background-color: #ddffdd">+++ b/src/client/read.c
</span><span style="color: #aaaaaa">@@ -69,7 +69,7 @@ void display_article(struct Header *tmp, int datafile)
</span>   if (tmp->status&(1<<2))
                fprintf(output,"Message has a reply.\n");
        fprintf(output,"\n");
<span style="color: #000000;background-color: #ffdddd">-        lseek(datafile,tmp->datafield,0);
</span><span style="color: #000000;background-color: #ddffdd">+   lseek(datafile, tmp->datafield, SEEK_SET);
</span>   if (read(datafile,buff,tmp->size)<tmp->size)
        {
                printf("Failed to read entire data entry");
<span style="color: #aaaaaa">@@ -132,9 +132,9 @@ int read_msg(int folnum, int msgnum, struct user *user)
</span>   tmppos=lseek(headfile,0,2);
        posn=(msgnum - data.last - 1)*sizeof(struct Header);
        if (posn < -tmppos)
<span style="color: #000000;background-color: #ffdddd">-                lseek(headfile, 0, 0);
</span><span style="color: #000000;background-color: #ddffdd">+           lseek(headfile, 0, SEEK_SET);
</span>   else
<span style="color: #000000;background-color: #ffdddd">-                lseek(headfile, posn, 1);
</span><span style="color: #000000;background-color: #ddffdd">+           lseek(headfile, posn, SEEK_CUR);
</span>   while (get_data(headfile,&head) && head.Ref<msgnum);
        if (head.Ref==msgnum)
        {
<span style="color: #aaaaaa">@@ -288,9 +288,9 @@ int get_mesg_header(struct folder *data, int msgnum, struct Header *head)
</span>   /* locate to file data */
        posn=(msgnum - data->last - 1)*sizeof(struct Header);
        if (posn < -tmppos)
<span style="color: #000000;background-color: #ffdddd">-                lseek(headfile, 0, 0);
</span><span style="color: #000000;background-color: #ddffdd">+           lseek(headfile, 0, SEEK_SET);
</span>   else
<span style="color: #000000;background-color: #ffdddd">-                lseek(headfile, posn, 1);
</span><span style="color: #000000;background-color: #ddffdd">+           lseek(headfile, posn, SEEK_CUR);
</span> 
        /* read it */
        while (get_data(headfile, head) && head->Ref < msgnum);
</code></pre>

<br>
</li>
<li id='diff-6'>
<a href='https://projects.sucs.org/arthur/mw/commit/2b6a2c76e52ab6a7e6aa1c9f42e677b31b74f696#diff-6'>
<strong>
src/folders.c
</strong>
</a>
<hr>
<pre class="highlight"><code><span style="color: #000000;background-color: #ffdddd">--- a/src/folders.c
</span><span style="color: #000000;background-color: #ddffdd">+++ b/src/folders.c
</span><span style="color: #aaaaaa">@@ -108,7 +108,7 @@ int get_folder_number(struct folder *fol, int num)
</span>   if (nofolders())
                {printf("There are no folders !\n");return 0;}
        if ((file=openfolderfile(O_RDONLY)) < 0) return 0;
<span style="color: #000000;background-color: #ffdddd">-        lseek(file,sizeof(*fol)*num,0);
</span><span style="color: #000000;background-color: #ddffdd">+   lseek(file, sizeof(*fol) * num, SEEK_SET);
</span>   if (read(file,fol,sizeof(*fol))<0)
        {
                perror("get_folder_number");
</code></pre>

<br>
</li>

</div>
<div class='footer' style='margin-top: 10px;'>
<p>

<br>
<a href="https://projects.sucs.org/arthur/mw/commit/2b6a2c76e52ab6a7e6aa1c9f42e677b31b74f696">View it on GitLab</a>
<br>
You're receiving this email because of your account on <a href="https://projects.sucs.org/">projects.sucs.org</a>.
If you'd like to receive fewer emails, you can adjust your notification settings.
<script type="application/ld+json">{"@context":"http://schema.org","@type":"EmailMessage","action":{"@type":"ViewAction","name":"View Commit","url":"https://projects.sucs.org/arthur/mw/commit/2b6a2c76e52ab6a7e6aa1c9f42e677b31b74f696"}}</script>
</p>
</div>
</body>
</html>